Extract ABI for Contract Verification

Hi,

Again I am having trouble verifying the contract on BscScan
Can someone help to extract the ABI code of this contract for contract verification purposes?

Regards
Jay

Sorry, I am not familiar with the BSC-Chain, maybe you should ask for help in their forum: Home | Binance Chain Forum

And they have a documentation about how to verify contracts, maybe you can have a look at it:

You should share your source code and compiler version.

1 Like

Hi @Skyge, Thanks for your support;

Here is my source code:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import “@openzeppelin/contracts/token/ERC20/ERC20.sol”;
import “@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol”;
import “@openzeppelin/contracts/token/ERC20/extensions/ERC20Snapshot.sol”;
import “@openzeppelin/contracts/access/Ownable.sol”;
import “@openzeppelin/contracts/security/Pausable.sol”;
import “@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol”;

contract Cashback is ERC20, ERC20Burnable, ERC20Snapshot, Ownable, Pausable, ERC20Permit {
constructor() ERC20(“Cashback”, “CBK”) ERC20Permit(“Cashback”) {
_mint(msg.sender, 1000000 * 10 ** decimals());
}

function snapshot() public onlyOwner {
    _snapshot();
}

function pause() public onlyOwner {
    _pause();
}

function unpause() public onlyOwner {
    _unpause();
}

function mint(address to, uint256 amount) public onlyOwner {
    _mint(to, amount);
}

function _beforeTokenTransfer(address from, address to, uint256 amount)
    internal
    whenNotPaused
    override(ERC20, ERC20Snapshot)
{
    super._beforeTokenTransfer(from, to, amount);
}

}

And the compiler version is: 0.8.1

I hope your help. Thank you.

So have you tried to follow the doc to verify your code?

I think if you want to have a deep in the solidity contract, you had better have a try by yourself.

And I have flattenned your contract, but it failed to verify, seems like the source code you shared is not the code you want to verify, I am not sure.

HI @Skyge, Yes I am still trying but not successful. I think there is some slightly different fi I deployed the contract using remix ide. Please let me know if so. Thanks.

I am still stuck here, I tried many ways but all the time error.

Hi @Skyge, any other way to verify the contract? It looks most of the time can not easily verify contracts inherited from openzeppelin. If there is some good solution for not tech guy will be perfect.

Sorry for responding so late, okay, let me have a try again.

Emmmm, I always use the plugin to verify the contract, and it looks like not very difficult.

I have tried again, but still can not verify.
So I use your code to deploy a new contract, and then try to verify it, It works well, so maybe this is something wrong with your source code:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Snapshot.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/security/Pausable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";

contract Cashback is ERC20, ERC20Burnable, ERC20Snapshot, Ownable, Pausable, ERC20Permit {
    constructor() ERC20("Cashback", "CBK") ERC20Permit("Cashback") {
        _mint(msg.sender, 1000000 * 10 ** decimals());
    }
    
    function snapshot() public onlyOwner {
        _snapshot();
    }
    
    function pause() public onlyOwner {
        _pause();
    }
    
    function unpause() public onlyOwner {
        _unpause();
    }
    
    function mint(address to, uint256 amount) public onlyOwner {
        _mint(to, amount);
    }
    
    function _beforeTokenTransfer(address from, address to, uint256 amount)
        internal
        whenNotPaused
        override(ERC20, ERC20Snapshot)
    {
        super._beforeTokenTransfer(from, to, amount);
    }
}

Hi @Skyge, I exactly copied from https://wizard.openzeppelin.com/
Is there any wrong code format?

I am not sure, you can see, I just use your code to deploy and verify, it works well.