Error on deploy: contract may be abstract, not implement an abstract parent’s methods completely or not invoke an inherited contract’s constructor correctly

Hello

I am trying to compile a contract and deploy it, but errors following me.

I will publish the contract here but without tokens’ names and symbol

pragma solidity ^0.5.0;

// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
//
// ----------------------------------------------------------------------------
contract ERC20Interface {
    function totalSupply() public view returns (uint);
    function balanceOf(address tokenOwner) public view returns (uint balance);
    function allowance(address tokenOwner, address spender) public view returns (uint remaining);
    function transfer(address to, uint tokens) public returns (bool success);
    function approve(address spender, uint tokens) public returns (bool success);
    function transferFrom(address from, address to, uint tokens) public returns (bool success);

    event Transfer(address indexed from, address indexed to, uint tokens);
    event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}

// ----------------------------------------------------------------------------
// Safe Math Library
// ----------------------------------------------------------------------------
contract SafeMath {
    function safeAdd(uint a, uint b) public pure returns (uint c) {
        c = a + b;
        require(c >= a);
    }
    function safeSub(uint a, uint b) public pure returns (uint c) {
        require(b <= a); c = a - b; } function safeMul(uint a, uint b) public pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function safeDiv(uint a, uint b) public pure returns (uint c) { require(b > 0);
        c = a / b;
    }
}


contract x is ERC20Interface, SafeMath {
    string public name;
    string public symbol;
    uint8 public decimals; // 18 decimals is the strongly suggested default, avoid changing it

    uint256 public _totalSupply;

    mapping(address => uint) balances;
    mapping(address => mapping(address => uint)) allowed;

    /**
     * Constrctor function
     *
     * Initializes contract with initial supply tokens to the creator of the contract
     */
    constructor() public {
        name = "x";
        symbol = "x";
        decimals = 18;
        _totalSupply = 100000000000000000000000000;

        balances[msg.sender] = _totalSupply;
        emit Transfer(address(0), msg.sender, _totalSupply);
    }

    function totalSupply() public view returns (uint) {
        return _totalSupply  - balances[address(0)];
    }

    function balanceOf(address tokenOwner) public view returns (uint balance) {
        return balances[tokenOwner];
    }

    function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
        return allowed[tokenOwner][spender];
    }

    function approve(address spender, uint tokens) public returns (bool success) {
        allowed[msg.sender][spender] = tokens;
        emit Approval(msg.sender, spender, tokens);
        return true;
    }

    function transfer(address to, uint tokens) public returns (bool success) {
        balances[msg.sender] = safeSub(balances[msg.sender], tokens);
        balances[to] = safeAdd(balances[to], tokens);
        emit Transfer(msg.sender, to, tokens);
        return true;
    }

    function transferFrom(address from, address to, uint tokens) public returns (bool success) {
        balances[from] = safeSub(balances[from], tokens);
        allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
        balances[to] = safeAdd(balances[to], tokens);
        emit Transfer(from, to, tokens);
        return true;
    }
}.

when I want to deploy it gave me this message

This contract may be abstract, not implement an abstract parent’s methods completely or not invoke an inherited contract’s constructor correctly.

what is wrong? do I need a new contract rather than the above one?
I need your help pls!

Regards

1 Like

I think you should try to deploy the contract x rather than ERC20Interface.

1 Like

done, its ok,

does there any way to move some eth from rinkeby to mainnet in metamask? or there is another way from websites or faucets to gain eth to move them to mainnet in metamask? coz if I want to deploy the contract it should be from mainnet in metamask. the blanace is 0!
is there any way?

1 Like

I do not think you can do this, you only can get eth on the mainnet by mining or buying,

1 Like

Hi @abdjo,

Welcome to the community :wave:

You may want to look at extending from OpenZeppelin Contracts. See: Deploy a simple ERC20 token in Remix


As an aside, please see: Format code in the forum

ok I will take a look, my main problem now how to submit eth to my main net eth in metamask.

regards

1 Like

Hloo bro , I m trying to clone the solidity multipile files smart contract from https://bscscan.com/address/0xb7dba4c673bedb174dc3ff7ec65d17c863d39b16#code
Here
But when I compile it shows an error


And when I click on deploy it shows the Error "contract may be abstract, not implement an abstract parent’s methods completely or not invoke an inherited contract’s constructor correctly"

CAN U HELP ME PLZZZ I WANT TO CREATE A TOKEN WITH ALL THIS FUNCTIONALITY IF IT DEPLOY I WILL CHANGE THE CODE THEN ...
Except this file all files is compiled without any error

Hi, although I am not sure why you want to use multi-file in the Remix, but I think it is ok if you want to do like so, just copy all contracts to the Remix, just like this(I do not copy all contracts, cause it has many contracts, but you need to copy all):
image

I really recommend to use tool to deploy contracts and verify them, such as Truffle or Hardhat

I copied all 16 files to the remix , and every file is compiled without any error but fatcake.sol
Has error which is the main file I'm deploying ,
And will u able to deploy fatcake.sol ?

I am not sure why you can not, I just copied all contract one by one, and when I tried to compile FATCAKE.sol, there was no errors

Yeah it's work ... I have one more question how I deploy mutipile solidity files for creation of token , or I have to deploy one by one all contracts ? Or there is any way that I make a single solidity files from these contracts?

Emmm, I do not think all the contracts need to be deployed, some are dependencies, for example:

interface IERC20 {}
library Context {}
library SafeMath {}
ERC20 is IERC20, Context {
    using SafeMath for uint256
}

Actually, in this case, you are only expected to deploy ERC20 contract.


Can u tell me why this error is coming when I m deploying .. can u able to deploy it ?

for my case. it has been resolved

regards

1 Like

I think you can select Enable Optimization under the COMPILER CONFIGURATION.

But still transaction is pending , will u able to deploy erc20 contract ?

Pending? Maybe you can increase the gas price.

I do not have a try.