MultiversX Tracker is Live!

I can't verify contract code deployed on ZKsync with Foundry

Etherum Reddit

More / Etherum Reddit 6 Views

I have a contract that I deployed on ZKsync. It deployed successfully, but I can't verify the code so I can see it on zksync block explorer:

Look at this command

forge verify-contract \ --zksync \ --num-of-optimizations 200 \ --watch \ --constructor-args $(cast abi-encode "constructor(string)" "MY_CONSTRUCTOR_PARAMETER") \ --etherscan-api-key https://zksync2-mainnet-explorer.zksync.io/contract_verification \ --compiler-version v0.8.19 \ MY_CONTRACTS_DEPLOYED_ADDRESS \ src/MY_CONTRACT_NAME.sol:MY_CONTRACT_NAME 

This command results in an Invalid API Key error. Which is expected because I put https://zksync2-mainnet-explorer.zksync.io/contract_verification for --etherscan-api-key. The problem is that I can't see a way to login on https://explorer.zksync.io/ like I can on Etherscan, so I can't get an API key.

Before you tell me about https://explorer.zksync.io/contracts/verify?address=MY_CONTRACT_NAME, this doesn't work for me. I filled out the form exactly correct. I attached my flattened code which I made by running: forge flatten src/MY_CONTRACT_NAME.sol > MY_CONTRACT_NAMEFlattened.sol and filled out every other detail correctly including the constructor arguments which I got with cast abi-encode "constructor(string)" "MY_CONSTRUCTOR_PARAMETER", but it gives me a Deployed bytecode is not equal to generated one from given source error which makes no sense because I filled it out perfectly.

So can someone show me how to verify the deployed contract via Foundry?

submitted by /u/warpanomaly
[link] [comments]
Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments