Good morning.
I've tried to deploy and then verify multiple smart contracts with Truffle and Remix combined (I'm a bit newbie about publishing ad verifying).
I've deployed the contract with Remix and then verified and published using the plugin "truffle-verify-plugin" version 0.6.3, but I've got a weird error when I've tried to publish and verify this smart contract:
Code to reproduce
// contracts/GameItem.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract GameItem is ERC721URIStorage {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
constructor() ERC721("GameItem", "ITM") {}
function awardItem(address player, string memory tokenURI)
public
returns (uint256)
{
uint256 newItemId = _tokenIds.current();
_mint(player, newItemId);
_setTokenURI(newItemId, tokenURI);
_tokenIds.increment();
return newItemId;
}
}
Result of the verification with the plugin:
npx truffle run verify GameItem@0xBe4399464008a98DF93c3f19c98781C842Bb6617 --network moonbase
Verifying contracts on moonscan
Verifying GameItem@0xBe4399464008a98DF93c3f19c98781C842Bb6617
Fail - Unable to verify
Failed to verify 1 contract(s): GameItem@0xBe4399464008a98DF93c3f19c98781C842Bb6617
Verifying contracts on sourcify
Verifying GameItem@0xBe4399464008a98DF93c3f19c98781C842Bb6617
Fail - Unable to verify: The deployed and recompiled bytecode don't match.
Failed to verify 1 contract(s): GameItem@0xBe4399464008a98DF93c3f19c98781C842Bb6617
Environment
My specs for this attempt are:
Truffle v5.8.1 (core: 5.8.1)
Solidity v0.5.16 (solc-js)
Node v18.15.0
Remix online version
I've compiled the contract with 0.8.9 compiler on both Remix and Truffle but there was a different result in the compilation and so I wasn't able to verify the contract with Truffle.
I've tried the same approach with contracts provided by the OZ wizard and there are no problems.
What can be the failing reason?
Thanks for your availability!