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?
[link] [comments]
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