Cannot verify contract deployed via Remix

Hi @Lifexcel,

I verified the contract: https://etherscan.io/address/0x0a6EBca8c0Ae2C540d30BEC35BFA00CEAa7f7B3F#code

I used the following method with the Hardhat Etherscan plugin: Verify smart contract inheriting from OpenZeppelin Contracts

The contract bytecode ends with 511, which means it was compiled with Solidity 0.5.17

5110032

I converted the imports to npm imports and added an MIT License Identifier (though realized I made a typo in Identifier)

// SPDX-License-Identifer: MIT

pragma solidity ^0.5.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Mintable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Pausable.sol";

contract Cashback is ERC20, ERC20Detailed, ERC20Mintable, ERC20Burnable, ERC20Pausable  {

    constructor () public ERC20Detailed("Cashback", "CBK", 18) {
        _mint(msg.sender, 1000000 * (10 ** uint256(decimals())));
    }
}

I imported OpenZeppelin Contracts 2.5.0

npm install @openzeppelin/contracts@2.5.0

I could then use Hardhat Etherscan plugin to run verify:

$ npx hardhat verify --network mainnet 0x0a6EBca8c0Ae2C540d30BEC35BFA00CEAa7f7B3F
Downloading compiler 0.5.17
Compiling 13 files with 0.5.17
Compilation finished successfully
Successfully submitted source code for contract
contracts/Cashback.sol:Cashback at 0x0a6EBca8c0Ae2C540d30BEC35BFA00CEAa7f7B3F
for verification on etherscan. Waiting for verification result...
Successfully verified contract on etherscan
1 Like