error! unable to generate contract bytecode and abi
I have read these forum posts
forge config --json (Environment)
using Foundry.
solc: 0.8.20
optimizer: true
optimizer_runs: 200
evm_version: shanghai/cancun/paris
other
GitHub code
xuegao-web3/src/NewNftManager.sol at solidity_mint_erc721_json_url · WarriorFromLongAgo/xuegao-web3 (github.com)
setps 1
forge script script/DeployNewNftManager.s.sol:DeployNewNftManager --rpc-url $env:RPC_URL --private-key $env:PRIVATE_KEY --broadcast -vvvv --ffi
== Logs ==
deploy nftManagerImpl: 0xe05064035E85cEE91f054Fc36f5008C3ccCC1341
deploy proxyNftManager: 0x3b9cBcf6865a8F66C1461213F901b3ef085f6A2E
step 2
flatten solidity
forge flatten src/NewNftManager.sol > FlattenedNewNftManager.sol
step 3
forge verify-contract 0x123586E8d0d0ac1aE435AF188CC3eEAF2e248687 NewNftManager:src/NewNftManager.sol:NewNftManager --chain 137 --watch --verifier-url https://api.polygonscan.com/api --constructor-args $(cast abi-encode "constructor(address)" 0xD79053a14BC465d9C1434d4A4fAbdeA7b6a2A94b) --compiler-version v0.8.20+commit.a1b79de6 --etherscan-api-key $env:POLYGONSCAN_API_KEY
Start verifying contract `0x123586E8d0d0ac1aE435AF188CC3eEAF2e248687` deployed on polygon
Submitting verification for [src/NewNftManager.sol:NewNftManager] 0x123586E8d0d0ac1aE435AF188CC3eEAF2e248687.
Submitted contract for verification:
Response: `OK`
GUID: `a7gjecwpezgmksqvpkk2pk66wst7xcd4e2ypr41w5qmrhqg21y`
URL: https://polygonscan.com/address/0x123586e8d0d0ac1ae435af188cc3eeaf2e248687
Contract verification status:
Response: `NOTOK`
Details: `Pending in queue`
Contract verification status:
Response: `NOTOK`
Details: `Fail - Unable to verify. Compiled contract deployment bytecode does NOT match the transaction deployment bytecode.`
Error:
Checking verification result failed
Context:
- Contract failed to verify.
steps 4
forge verify-contract 0xe05064035E85cEE91f054Fc36f5008C3ccCC1341 D:/git_project_20240909/solidity_erc721/solidity_mint_erc721/FlattenedNewNftManager.sol:NewNftManager --chain 137 --watch --verifier-url https://api.polygonscan.com/api --constructor-args $(cast abi-encode "constructor(address)" 0xD79053a14BC465d9C1434d4A4fAbdeA7b6a2A94b) --compiler-version v0.8.20+commit.a1b79de6 --etherscan-api-key $env:POLYGONSCAN_API_KEY
Start verifying contract `0xe05064035E85cEE91f054Fc36f5008C3ccCC1341` deployed on polygon
Error:
Failed to get standard json input
Context:
- cannot resolve file at "D:/git_project_20240909/solidity_erc721/solidity_mint_erc721/FlattenedNewNftManager.sol"
step 5 polygon scan verify & publish contract source code
nftimpl: 0xe05064035E85cEE91f054Fc36f5008C3ccCC1341
select solidity single file
select v0.8.20
select unlicense
step 6 polygon scan verify & publish contract source code
step 7 I faild
Contract Address 0xe05064035e85cee91f054fc36f5008c3cccc1341 | PolygonScan
Skyge
2
Contract has been verified.
Here is my command:
forge verify-contract \
--watch \
--etherscan-api-key "xxx" \
--rpc-url "https://polygon-mainnet.g.alchemy.com/v2/xxx" \
0xe05064035E85cEE91f054Fc36f5008C3ccCC1341 \
src/NewNftManager.sol:NewNftManager
The output result:
Start verifying contract `0xe05064035E85cEE91f054Fc36f5008C3ccCC1341` deployed on polygon
Submitting verification for [src/NewNftManager.sol:NewNftManager] 0xe05064035E85cEE91f054Fc36f5008C3ccCC1341.
Submitted contract for verification:
Response: `OK`
GUID: `xxxx`
URL: https://polygonscan.com/address/0xe05064035e85cee91f054fc36f5008c3cccc1341
Contract verification status:
Response: `NOTOK`
Details: `Pending in queue`
Contract verification status:
Response: `OK`
Details: `Pass - Verified`
Contract successfully verified
1 Like
omg, Thanks, I was Surprised, I failed to verify in Windows.
1 Like
New operations, new knowledge
forge verify-contract --watch --etherscan-api-key "$env:API_KEY" --rpc-url "$env:RPC_URL" 0x3512EEb9eB7977000bEbbe8C17Aa8859f4E5DbF6 src/contracts/core/token/NftManagerV3.sol:NftManagerV3
Start verifying contract `0x3512EEb9eB7977000bEbbe8C17Aa8859f4E5DbF6` deployed on polygon
Submitting verification for [src/contracts/core/token/NftManagerV3.sol:NftManagerV3] 0x3512EEb9eB7977000bEbbe8C17Aa8859f4E5DbF6.
Submitted contract for verification:
Response: `OK`
GUID: `iwugyfhzgtdubrzfethrfep5txazsbzevcwz7rcdijdzxd8aak`
URL: https://polygonscan.com/address/0x3512eeb9eb7977000bebbe8c17aa8859f4e5dbf6
Contract verification status:
Response: `NOTOK`
Details: `Pending in queue`
Contract verification status:
Response: `OK`
Details: `Pass - Verified`
Contract successfully verified
1 Like