The contract verification failed because the deployed bytecode doesn't match the current source code. This happened because:
- Contract was deployed at
0x060d87018EE78c2968959cA2C8a189c12953Cc9Aon Base Sepolia - After deployment, we added the
distributePrizes()function to the contract - Verification attempt tried to verify the new code against the old deployment
If you want to verify the currently deployed contract, you need to use the original contract code (without distributePrizes()).
- Temporarily remove or comment out the
distributePrizes()function - Verify the contract:
forge verify-contract \ 0x060d87018EE78c2968959cA2C8a189c12953Cc9A \ contracts/TriviaBattle.sol:TriviaBattle \ --chain-id 84532 \ --num-of-optimizations 200 \ --constructor-args $(cast abi-encode "constructor(address,address,address,address,uint256,uint256,uint256)" 0x036CbD53842c5426634e7929541eC2318f3dCF7e 0xE4aB69C077896252FAFBD49EFD26B5D171A32410 0xf57E8952e2EC5F82376ff8Abf65f01c2401ee294 0xf57E8952e2EC5F82376ff8Abf65f01c2401ee294 604800 1000000 80) \ --watch - Restore the
distributePrizes()function after verification
Deploy a new version of the contract that includes distributePrizes():
-
Deploy the updated contract:
forge script script/DeployTriviaBattle.s.sol:DeployTriviaBattle \ --rpc-url base_sepolia \ --broadcast \ --verify
-
Update your configs with the new contract address:
chainlink-cre-workflows/weekly-prize-distribution/config.staging.jsonlib/blockchain/contracts.ts(if applicable)
If verification isn't critical right now, you can:
- Continue using the deployed contract
- Deploy the updated version later when ready
- The contract is functional even without verification (just not viewable on Basescan)
The deployed contract at 0x060d87018EE78c2968959cA2C8a189c12953Cc9A was compiled from the source code before we added distributePrizes(). When we try to verify it with the new code that includes distributePrizes(), the bytecode doesn't match.
- For immediate use: The deployed contract works fine, just doesn't have
distributePrizes()yet - For Chainlink CRE: You'll need to redeploy with
distributePrizes()function - For verification: Use Option 1 to verify the current deployment, or Option 2 to deploy and verify the new version
The distributePrizes() function is needed for Chainlink CRE automation. If you want to use automated weekly prize distribution, you'll need to redeploy the contract with this function included.