badge-checkVerify & Publish Contract (Foundry)

This guide verifies and publishes a deployed contract on SATUCHAIN Testnet Explorer using Foundry. Explorer API: https://testnet.satuchain.com/apiarrow-up-right


Requirements

  • Contract already deployed on SATUCHAIN Testnet

  • Contract address

  • Exact compiler settings used at deployment (solc version, optimizer runs, viaIR, evmVersion)

  • Foundry installed (forge, cast)

SATUCHAIN Testnet:


1) Install Foundry (if needed)

curl -L https://foundry.paradigm.xyz | bash
foundryup

Verify:

forge --version
cast --version

2) Set Environment Variables

Linux/macOS:

Windows PowerShell:


3) Build (Must Match Deployment)

Important: Your foundry.toml must match the deployment build (optimizer, runs, evm_version, via_ir).


4) Verify Contract (No Constructor Args)

Replace:

  • <CONTRACT_ADDRESS> with your deployed address

  • src/Storage.sol:Storage with your file path and contract name


5) Verify Contract (With Constructor Args)

If your contract has constructor params, provide the encoded args:

To encode constructor args:

Use the output as <ENCODED_ARGS>.

Example:


6) Check Verification Status

<GUID> is returned by the forge verify-contract command.


7) Confirm on Explorer

Open: https://testnet.satuchain.com/address/arrow-up-right<CONTRACT_ADDRESS>

You should see the contract marked Verified, with Source Code and ABI available.


Troubleshooting

Bytecode mismatch

  • Wrong solc version, optimizer settings, runs, viaIR, or evmVersion compared to deployment.

Constructor args incorrect

  • Encode args using cast abi-encode and verify they match the original deployment.

Last updated