From 2a8e71e37a18e1d8b054af3b68a187558dfcb3d3 Mon Sep 17 00:00:00 2001 From: Manuel Wedler Date: Tue, 25 Feb 2025 09:05:32 +0100 Subject: [PATCH 1/2] Verification plugin: Disable verification when Etherscan is selected and no constructor arguments are provided --- .../src/app/components/ConstructorArguments.tsx | 12 ++++++++---- .../src/app/views/VerifyView.tsx | 7 ++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/apps/contract-verification/src/app/components/ConstructorArguments.tsx b/apps/contract-verification/src/app/components/ConstructorArguments.tsx index 46fa9822a7b..36aab2c6d2b 100644 --- a/apps/contract-verification/src/app/components/ConstructorArguments.tsx +++ b/apps/contract-verification/src/app/components/ConstructorArguments.tsx @@ -44,12 +44,16 @@ export const ConstructorArguments: React.FC = ({ abiE const constructorArgsInInitialState = useRef(true) useEffect(() => { + // Ensures that error is not reset when tabs are switched + if ((!abiEncodingError && !abiEncodedConstructorArgs) || !constructorArgsInInitialState.current) { + setAbiEncodingError(constructorArgs?.length === 0 ? '' : 'Some constructor arguments are missing') + } + if (constructorArgsInInitialState.current) { constructorArgsInInitialState.current = false return } setAbiEncodedConstructorArgs('') - setAbiEncodingError('') setConstructorArgsValues(Array(constructorArgs?.length ?? 0).fill('')) }, [constructorArgs]) @@ -60,7 +64,7 @@ export const ConstructorArguments: React.FC = ({ abiE // if any constructorArgsValue is falsey (empty etc.), don't encode yet if (changedConstructorArgsValues.some((value) => !value)) { setAbiEncodedConstructorArgs('') - setAbiEncodingError('') + setAbiEncodingError('Some constructor arguments are missing') return } @@ -112,7 +116,7 @@ export const ConstructorArguments: React.FC = ({ abiE
{' '}