import { Flex } from '@chakra-ui/react'; import React from 'react'; import type { Address } from 'types/api/address'; import type { SmartContract } from 'types/api/contract'; import { Alert } from 'toolkit/chakra/alert'; import RawDataSnippet from 'ui/shared/RawDataSnippet'; import ContractDetailsDeployedByteCode from './ContractDetailsDeployedByteCode'; import ContractDetailsVerificationButton from './ContractDetailsVerificationButton'; interface Props { data: SmartContract; isLoading: boolean; addressData: Address; } const ContractDetailsByteCode = ({ data, isLoading, addressData }: Props) => { const canBeVerified = ![ 'selfdestructed', 'failed' ].includes(data.creation_status || '') && !data?.is_verified && addressData.proxy_type !== 'eip7702'; const creationStatusText = (() => { switch (data.creation_status) { case 'selfdestructed': return 'This contract self-destructed after deployment and there is no runtime bytecode. Below is the raw creation bytecode.'; case 'failed': return 'Contract creation failed and there is no runtime bytecode. Below is the raw creation bytecode.'; default: return null; } })(); return ( { data?.creation_bytecode && ( ) : null } beforeSlot={ creationStatusText ? ( { creationStatusText } ) : null } textareaMaxHeight="300px" isLoading={ isLoading } /> ) } { data?.deployed_bytecode && ( ) } ); }; export default React.memo(ContractDetailsByteCode);