Commit e2a293c6 authored by tom goriunov's avatar tom goriunov Committed by GitHub

Add ability to re-verify partially verified contracts from UI (#1178)

Fixes #1155
parent db6c1650
...@@ -86,6 +86,8 @@ const ContractCode = ({ addressHash, noSocket }: Props) => { ...@@ -86,6 +86,8 @@ const ContractCode = ({ addressHash, noSocket }: Props) => {
return <DataFetchAlert/>; return <DataFetchAlert/>;
} }
const canBeVerified = !data?.is_self_destructed && (!data?.is_verified || data.is_partially_verified);
const verificationButton = isPlaceholderData ? <Skeleton w="130px" h={ 8 } mr={ 3 } ml="auto" borderRadius="base"/> : ( const verificationButton = isPlaceholderData ? <Skeleton w="130px" h={ 8 } mr={ 3 } ml="auto" borderRadius="base"/> : (
<Button <Button
size="sm" size="sm"
...@@ -253,7 +255,7 @@ const ContractCode = ({ addressHash, noSocket }: Props) => { ...@@ -253,7 +255,7 @@ const ContractCode = ({ addressHash, noSocket }: Props) => {
<RawDataSnippet <RawDataSnippet
data={ data.creation_bytecode } data={ data.creation_bytecode }
title="Contract creation code" title="Contract creation code"
rightSlot={ data.is_verified || data.is_self_destructed ? null : verificationButton } rightSlot={ canBeVerified ? verificationButton : null }
beforeSlot={ data.is_self_destructed ? ( beforeSlot={ data.is_self_destructed ? (
<Alert status="info" whiteSpace="pre-wrap" mb={ 3 }> <Alert status="info" whiteSpace="pre-wrap" mb={ 3 }>
Contracts that self destruct in their constructors have no contract code published and cannot be verified. Contracts that self destruct in their constructors have no contract code published and cannot be verified.
...@@ -268,7 +270,7 @@ const ContractCode = ({ addressHash, noSocket }: Props) => { ...@@ -268,7 +270,7 @@ const ContractCode = ({ addressHash, noSocket }: Props) => {
<RawDataSnippet <RawDataSnippet
data={ data.deployed_bytecode } data={ data.deployed_bytecode }
title="Deployed ByteCode" title="Deployed ByteCode"
rightSlot={ !data?.creation_bytecode && !(data.is_verified || data.is_self_destructed) ? verificationButton : null } rightSlot={ !data?.creation_bytecode && canBeVerified ? verificationButton : null }
textareaMaxHeight="200px" textareaMaxHeight="200px"
isLoading={ isPlaceholderData } isLoading={ isPlaceholderData }
/> />
......
...@@ -51,7 +51,7 @@ const ContractVerification = () => { ...@@ -51,7 +51,7 @@ const ContractVerification = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [ ]); }, [ ]);
const isVerifiedContract = contractQuery.data?.is_verified; const isVerifiedContract = contractQuery.data?.is_verified && !contractQuery.data.is_partially_verified;
React.useEffect(() => { React.useEffect(() => {
if (isVerifiedContract) { if (isVerifiedContract) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment