Foundry Verify
Currently, when verifying contracts on Kaiascan using Foundry, only flattened contract files
are supported.
Ensure that your contract is flattened before proceeding with the verification process.
To flatten the contract, run the following command (replace with your actual contract file):
forge flatten src/Counter.sol > Flattened.sol
After flattening the contract, to verify using Foundry, run the following command:
Mainnet
forge verify-contract --verifier-url https://mainnet-api.kaiascan.io/forge-verify-flatten \
--chain-id 8217 --compiler-version `{COMPILER_VERSION}` \
{CONTRACT_ADDRESS} Flattened.sol:{CONTRACT_NAME} --retries 1
Kairos
forge verify-contract --verifier-url https://kairos-api.kaiascan.io/forge-verify-flatten \
--chain-id 1001 --compiler-version {COMPILER_VERSION} \
{CONTRACT_ADDRESS} Flattened.sol:{CONTRACT_NAME} --retries 1
Option Descriptions
{COMPILER_VERSION}
: The Solidity compiler version (e.g.,0.8.28
).{CONTRACT_ADDRESS}
: The address of the contract to verify.{CONTRACT_NAME}
: The name of the contract to verify (e.g.,Counter
).[--retries N]
(Optional): Number of retry attempts if verification fails (default:5
, but1
is recommended).