Mode Docs
  • Introduction
    • 🟡Introducing Mode
    • ✅AI Agent Dev Roadmap
  • AI AGENTS
    • Mode AI Terminal
    • 🤷What are AI Agents?
    • đŸ—ī¸Building your first agent
    • Tutorials
      • Quickstart
    • đŸ› ī¸AI Tooling
      • AI Audits
      • AI APIs
      • Frameworks
  • Tools
    • đŸ–Ĩī¸RPC
    • đŸĒļMultisig wallets
    • 🔁Bridge
    • 🚰Testnet Faucets
    • đŸ•ĩī¸Block Explorers
    • đŸ—‚ī¸Data Indexers
    • đŸ§™â€â™‚ī¸Oracles
    • â›“ī¸Interoperability
    • â‰ī¸Randomness
    • 🌎General Tooling
  • Tutorials
    • Interacting with Smart Contracts using ethers.js
    • Deploying a Smart Contract
      • Using Hardhat
      • Using Thirdweb
      • Using Foundry
      • Using Remix
    • Verifying your smart contract
      • Using Hardhat
      • Using Foundry
  • User Guides
    • â„šī¸Network Details
    • đŸĻŠAdd Mode
    • 🏡Contract Addresses
      • Tokens
      • L1/L2 Mainnet Contracts
      • Testnet Contracts
    • 🌉Bridge
      • âžĄī¸Bridge to Mode
      • âŦ…ī¸Bridge from Mode
      • đŸ—ī¸Bridging to Testnet
    • 📤Move to/from CEX
  • $MODE
    • 🟡MODE Tokenonomics
    • 1ī¸âƒŖSeason 1 (ended)
    • 2ī¸âƒŖSeason 2 (ended)
    • 3ī¸âƒŖGovernance Season 3 (ended)
      • Governance Contract Addresses
    • 4ī¸âƒŖMode Governance Season 4
    • 5ī¸âƒŖSeason 5
  • Other Docs
    • 🔓General Security
      • 🔓Mode L2 Security Model
      • â›‘ī¸Optimism Bug Bounty
      • Security Upgrades
        • 01/08/2024 Bridge Upgrade Fund Rescue
        • 06/08/2024 Mode Mainnet Key Handover
      • 🔐Audits
    • 🔗Official Links
    • 🤘Branding Guidelines
    • âŒ¨ī¸Node Operators
Powered by GitBook
On this page
  • Introduction
  • Getting Ready
  • Step 1: Prepare Your Contract for Verification
  • Step 2: Verifying Your Contract
  • Step 3: Confirm Your Contract's Verification
  • Conclusion

Was this helpful?

Edit on GitHub
  1. Tutorials
  2. Verifying your smart contract

Using Foundry

How to verify smart contract on Mode using foundry

Introduction

Foundry is the Rust-built toolbox designed to streamline your smart contract development process. It's your comprehensive toolkit for not just creating and testing, but also for the crucial step of verifying your smart contracts. Verification ensures your code's transparency and trustworthiness on the blockchain. This guide focuses on verifying any smart contract on the Mode network's mainnet and testnet using Foundry.

Getting Ready

Before we dive in, make sure you've got a few things in place:

  • Deployed your smart contract to the Mode network. This guide assumes you've completed the deployment process but if you haven' t please check Deploying a Smart Contract

  • Installed Rust and Foundry, as Foundry leverages Rust for its operations.

Got everything? Great! Let's get started.

Step 1: Prepare Your Contract for Verification

Ensure your smart contract, such as an ERC20 token, is ready and deployed. Keep the contract's address at hand, as you'll need it for the verification command.

Step 2: Verifying Your Contract

Verification is a straightforward process with Foundry. Depending on where your contract is deployed, you'll use either the mainnet or testnet command.

For Testnet Verification

If your contract is on the Mode testnet, use the following command, replacing CONTRACT_ADDRESS with your contract's actual address:

forge verify-contract CONTRACT_ADDRESS src/MyERC20.sol:MyERC20 --verifier blockscout --verifier-url https://sepolia.explorer.mode.network/api\?

For Mainnet Verification

For contracts deployed on the Mode mainnet, the command adjusts slightly to point to the mainnet explorer:

forge verify-contract CONTRACT_ADDRESS src/MyERC20.sol:MyERC20 --verifier blockscout --verifier-url https://explorer.mode.network/api\?

Remember to replace CONTRACT_ADDRESS with your contract's address and src/MyERC20.sol:MyERC20 with the correct path to your contract.

Step 3: Confirm Your Contract's Verification

After executing the relevant command:

  • Enter your contract's address in the search bar.

  • You should find your contract listed and verified, it should have the green checkmark just like the image below.

Conclusion

And that's it! You've just verified your ERC20 token on the Mode network using Foundry. Not too bad, right? Foundry makes these tasks less of a headache, so you can focus on the fun part: building your project.

PreviousUsing HardhatNextNetwork Details

Last updated 1 year ago

Was this helpful?

Visit the Mode explorer ( or , as applicable).

mainnet
testnet