Skip to main content
Rollback to Revision 1
Source Link
hroussille
  • 7.9k
  • 2
  • 7
  • 29

abstract contract Token {

    mapping(address => uint256) AccountsBalances; // Token accounts 
    string public constant TokenName = "NewToken";
    string public constant TokenSymbol = "ALPH";
    uint public  MaxTokens = 1000000000;
    uint256 public constant decimals = 18;

    function transfer(address _to,uint256 _amount) virtual payable public  returns (bool);
    function transferFrom(address _from , address _to ,uint _amount) virtual payable public returns (bool);
    function AllowToSpend( address _spender , uint256 _allowanceAmount) virtual public returns (bool);
    function CheckMyAllowance(address _walletAddress) virtual public view returns (uint256);
    function BalanceOfWallet(address _walletAddress) virtual public view returns (uint256);
    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event ApprovalToSpend(address indexed _owner, address indexed _spender, uint256 _value);
}


contract StandardToken is Token{

    
    mapping (address => mapping (address => uint256)) Allowed;// Allowance count


    function transfer(address _to, uint256 _amount) override payable public returns (bool){
        if(AccountsBalances[msg.sender] >= _amount && _amount > 0 && msg.sender != _to)
        {
            AccountsBalances[msg.sender] -= _amount;
            AccountsBalances[_to] += _amount;
            emit Transfer(msg.sender, _to, _amount);
            return true;
        } else return false;
    }


    function transferFrom(address _TransferFrom , address _TransferTo , uint256 _amount)override payable public returns (bool)
    {
        if(CheckMyAllowance(_TransferFrom) >= _amount && AccountsBalances[_TransferFrom] >= _amount && _amount > 0)
        {
            AccountsBalances[_TransferFrom] -= _amount;
            Allowed[_TransferFrom][msg.sender] -= _amount;
            AccountsBalances[_TransferTo] += _amount;
            emit Transfer(_TransferFrom,_TransferTo,_amount);
            return true;
        }else return false;
    }

    function AllowToSpend(address _spender,uint256 _allowanceAmount) override public returns (bool)
    {
        Allowed[msg.sender][_spender] = _allowanceAmount;
        emit ApprovalToSpend(msg.sender,_spender,_allowanceAmount);
        return true;
    }

    function CheckMyAllowance(address _walletAddress) override public view returns (uint256)
    {
        return Allowed[_walletAddress][msg.sender];
    }


    function BalanceOfWallet(address _walletAddress)override public view returns (uint256)
    {
        require(CheckMyAllowance(_walletAddress) > 0, "You have no allowance on this account and cannot see balance");
        return AccountsBalances[_walletAddress];
    }
}
pragma solidity ^0.8.0;

contract Token {

    mapping(address => uint256) AccountsBalances; // Token accounts 
    string public constant TokenName = "NewToken";
    string public constant TokenSymbol = "ALPH";
    uint public  MaxTokens = 1000000000;
    uint256 public constant decimals = 18;

    function transfer(address _to,uint256 _amount) virtual payable public  returns (bool);
    function transferFrom(address _from , address _to ,uint _amount) virtual payable public returns (bool);
    function AllowToSpend( address _spender , uint256 _allowanceAmount) virtual public returns (bool);
    function CheckMyAllowance(address _walletAddress) virtual public view returns (uint256);
    function BalanceOfWallet(address _walletAddress) virtual public view returns (uint256);
    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event ApprovalToSpend(address indexed _owner, address indexed _spender, uint256 _value);
}


contract StandardToken is Token{

    
    mapping (address => mapping (address => uint256)) Allowed;// Allowance count


    function transfer(address _to, uint256 _amount)override payable public returns (bool){
        if(AccountsBalances[msg.sender] >= _amount && _amount > 0 && msg.sender != _to)
        {
            AccountsBalances[msg.sender] -= _amount;
            AccountsBalances[_to] += _amount;
            Transfer(msg.sender, _to, _amount);
        } else return false;
    }


    function transferFrom(address _TransferFrom , address _TransferTo , uint256 _amount)override payable public returns (bool)
    {
        if(CheckMyAllowance(_TransferFrom) >= _amount && AccountsBalances[_TransferFrom] >= _amount && _amount > 0)
        {
            AccountsBalances[_TransferFrom] -= _amount;
            Allowed[_TransferFrom][msg.sender] -= _amount;
            AccountsBalances[_TransferTo] += _amount;
            Transfer(_TransferFrom,_TransferTo,_amount);
        }else return false;
    }

    function AllowToSpend(address _spender,uint256 _allowanceAmount) override public returns (bool)
    {
        Allowed[msg.sender][_spender] = _allowanceAmount;
        ApprovalToSpend(msg.sender,_spender,_allowanceAmount);
        return true;
    }

    function CheckMyAllowance(address _walletAddress) override public view returns (uint256)
    {
        return Allowed[_walletAddress][msg.sender];
    }


    function BalanceOfWallet(address _walletAddress)override public view returns (uint256)
    {
        require(CheckMyAllowance(_walletAddress) > 0, "You have no allowance on this account and cannot see balance");
        return AccountsBalances[_walletAddress];
    }
}

abstract contract Token {

    mapping(address => uint256) AccountsBalances; // Token accounts 
    string public constant TokenName = "NewToken";
    string public constant TokenSymbol = "ALPH";
    uint public  MaxTokens = 1000000000;
    uint256 public constant decimals = 18;

    function transfer(address _to,uint256 _amount) virtual payable public  returns (bool);
    function transferFrom(address _from , address _to ,uint _amount) virtual payable public returns (bool);
    function AllowToSpend( address _spender , uint256 _allowanceAmount) virtual public returns (bool);
    function CheckMyAllowance(address _walletAddress) virtual public view returns (uint256);
    function BalanceOfWallet(address _walletAddress) virtual public view returns (uint256);
    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event ApprovalToSpend(address indexed _owner, address indexed _spender, uint256 _value);
}


contract StandardToken is Token{

    
    mapping (address => mapping (address => uint256)) Allowed;// Allowance count


    function transfer(address _to, uint256 _amount) override payable public returns (bool){
        if(AccountsBalances[msg.sender] >= _amount && _amount > 0 && msg.sender != _to)
        {
            AccountsBalances[msg.sender] -= _amount;
            AccountsBalances[_to] += _amount;
            emit Transfer(msg.sender, _to, _amount);
            return true;
        } else return false;
    }


    function transferFrom(address _TransferFrom , address _TransferTo , uint256 _amount)override payable public returns (bool)
    {
        if(CheckMyAllowance(_TransferFrom) >= _amount && AccountsBalances[_TransferFrom] >= _amount && _amount > 0)
        {
            AccountsBalances[_TransferFrom] -= _amount;
            Allowed[_TransferFrom][msg.sender] -= _amount;
            AccountsBalances[_TransferTo] += _amount;
            emit Transfer(_TransferFrom,_TransferTo,_amount);
            return true;
        }else return false;
    }

    function AllowToSpend(address _spender,uint256 _allowanceAmount) override public returns (bool)
    {
        Allowed[msg.sender][_spender] = _allowanceAmount;
        emit ApprovalToSpend(msg.sender,_spender,_allowanceAmount);
        return true;
    }

    function CheckMyAllowance(address _walletAddress) override public view returns (uint256)
    {
        return Allowed[_walletAddress][msg.sender];
    }


    function BalanceOfWallet(address _walletAddress)override public view returns (uint256)
    {
        require(CheckMyAllowance(_walletAddress) > 0, "You have no allowance on this account and cannot see balance");
        return AccountsBalances[_walletAddress];
    }
}
pragma solidity ^0.8.0;

contract Token {

    mapping(address => uint256) AccountsBalances; // Token accounts 
    string public constant TokenName = "NewToken";
    string public constant TokenSymbol = "ALPH";
    uint public  MaxTokens = 1000000000;
    uint256 public constant decimals = 18;

    function transfer(address _to,uint256 _amount) virtual payable public  returns (bool);
    function transferFrom(address _from , address _to ,uint _amount) virtual payable public returns (bool);
    function AllowToSpend( address _spender , uint256 _allowanceAmount) virtual public returns (bool);
    function CheckMyAllowance(address _walletAddress) virtual public view returns (uint256);
    function BalanceOfWallet(address _walletAddress) virtual public view returns (uint256);
    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event ApprovalToSpend(address indexed _owner, address indexed _spender, uint256 _value);
}


contract StandardToken is Token{

    
    mapping (address => mapping (address => uint256)) Allowed;// Allowance count


    function transfer(address _to, uint256 _amount)override payable public returns (bool){
        if(AccountsBalances[msg.sender] >= _amount && _amount > 0 && msg.sender != _to)
        {
            AccountsBalances[msg.sender] -= _amount;
            AccountsBalances[_to] += _amount;
            Transfer(msg.sender, _to, _amount);
        } else return false;
    }


    function transferFrom(address _TransferFrom , address _TransferTo , uint256 _amount)override payable public returns (bool)
    {
        if(CheckMyAllowance(_TransferFrom) >= _amount && AccountsBalances[_TransferFrom] >= _amount && _amount > 0)
        {
            AccountsBalances[_TransferFrom] -= _amount;
            Allowed[_TransferFrom][msg.sender] -= _amount;
            AccountsBalances[_TransferTo] += _amount;
            Transfer(_TransferFrom,_TransferTo,_amount);
        }else return false;
    }

    function AllowToSpend(address _spender,uint256 _allowanceAmount) override public returns (bool)
    {
        Allowed[msg.sender][_spender] = _allowanceAmount;
        ApprovalToSpend(msg.sender,_spender,_allowanceAmount);
        return true;
    }

    function CheckMyAllowance(address _walletAddress) override public view returns (uint256)
    {
        return Allowed[_walletAddress][msg.sender];
    }


    function BalanceOfWallet(address _walletAddress)override public view returns (uint256)
    {
        require(CheckMyAllowance(_walletAddress) > 0, "You have no allowance on this account and cannot see balance");
        return AccountsBalances[_walletAddress];
    }
}
Paste incomplete code correction.
Source Link
hroussille
  • 7.9k
  • 2
  • 7
  • 29
pragma solidity ^0.8.0;

contract Token {

    mapping(address => uint256) AccountsBalances; // Token accounts 
    string public constant TokenName = "NewToken";
    string public constant TokenSymbol = "ALPH";
    uint public  MaxTokens = 1000000000;
    uint256 public constant decimals = 18;

    function transfer(address _to,uint256 _amount) virtual payable public  returns (bool);
    function transferFrom(address _from , address _to ,uint _amount) virtual payable public returns (bool);
    function AllowToSpend( address _spender , uint256 _allowanceAmount) virtual public returns (bool);
    function CheckMyAllowance(address _walletAddress) virtual public view returns (uint256);
    function BalanceOfWallet(address _walletAddress) virtual public view returns (uint256);
    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event ApprovalToSpend(address indexed _owner, address indexed _spender, uint256 _value);
}


contract StandardToken is Token{

    
    mapping (address => mapping (address => uint256)) Allowed;// Allowance count


    function transfer(address _to, uint256 _amount)override payable public returns (bool){
        if(AccountsBalances[msg.sender] >= _amount && _amount > 0 && msg.sender != _to)
        {
            AccountsBalances[msg.sender] -= _amount;
            AccountsBalances[_to] += _amount;
            Transfer(msg.sender, _to, _amount);
        } else return false;
    }


    function transferFrom(address _TransferFrom , address _TransferTo , uint256 _amount)override payable public returns (bool)
    {
        if(CheckMyAllowance(_TransferFrom) >= _amount && AccountsBalances[_TransferFrom] >= _amount && _amount > 0)
        {
            AccountsBalances[_TransferFrom] -= _amount;
            Allowed[_TransferFrom][msg.sender] -= _amount;
            AccountsBalances[_TransferTo] += _amount;
            Transfer(_TransferFrom,_TransferTo,_amount);
        }else return false;
    }

    function AllowToSpend(address _spender,uint256 _allowanceAmount) override public returns (bool)
    {
        Allowed[msg.sender][_spender] = _allowanceAmount;
        ApprovalToSpend(msg.sender,_spender,_allowanceAmount);
        return true;
    }

    function CheckMyAllowance(address _walletAddress) override public view returns (uint256)
    {
        return Allowed[_walletAddress][msg.sender];
    }


    function BalanceOfWallet(address _walletAddress)override public view returns (uint256)
    {
        require(CheckMyAllowance(_walletAddress) > 0, "You have no allowance on this account and cannot see balance");
        return AccountsBalances[_walletAddress];
    }
}

abstract contract Token {

    mapping(address => uint256) AccountsBalances; // Token accounts 
    string public constant TokenName = "NewToken";
    string public constant TokenSymbol = "ALPH";
    uint public  MaxTokens = 1000000000;
    uint256 public constant decimals = 18;

    function transfer(address _to,uint256 _amount) virtual payable public  returns (bool);
    function transferFrom(address _from , address _to ,uint _amount) virtual payable public returns (bool);
    function AllowToSpend( address _spender , uint256 _allowanceAmount) virtual public returns (bool);
    function CheckMyAllowance(address _walletAddress) virtual public view returns (uint256);
    function BalanceOfWallet(address _walletAddress) virtual public view returns (uint256);
    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event ApprovalToSpend(address indexed _owner, address indexed _spender, uint256 _value);
}


contract StandardToken is Token{

    
    mapping (address => mapping (address => uint256)) Allowed;// Allowance count


    function transfer(address _to, uint256 _amount) override payable public returns (bool){
        if(AccountsBalances[msg.sender] >= _amount && _amount > 0 && msg.sender != _to)
        {
            AccountsBalances[msg.sender] -= _amount;
            AccountsBalances[_to] += _amount;
            emit Transfer(msg.sender, _to, _amount);
            return true;
        } else return false;
    }


    function transferFrom(address _TransferFrom , address _TransferTo , uint256 _amount)override payable public returns (bool)
    {
        if(CheckMyAllowance(_TransferFrom) >= _amount && AccountsBalances[_TransferFrom] >= _amount && _amount > 0)
        {
            AccountsBalances[_TransferFrom] -= _amount;
            Allowed[_TransferFrom][msg.sender] -= _amount;
            AccountsBalances[_TransferTo] += _amount;
            emit Transfer(_TransferFrom,_TransferTo,_amount);
            return true;
        }else return false;
    }

    function AllowToSpend(address _spender,uint256 _allowanceAmount) override public returns (bool)
    {
        Allowed[msg.sender][_spender] = _allowanceAmount;
        emit ApprovalToSpend(msg.sender,_spender,_allowanceAmount);
        return true;
    }

    function CheckMyAllowance(address _walletAddress) override public view returns (uint256)
    {
        return Allowed[_walletAddress][msg.sender];
    }


    function BalanceOfWallet(address _walletAddress)override public view returns (uint256)
    {
        require(CheckMyAllowance(_walletAddress) > 0, "You have no allowance on this account and cannot see balance");
        return AccountsBalances[_walletAddress];
    }
}
pragma solidity ^0.8.0;

contract Token {

    mapping(address => uint256) AccountsBalances; // Token accounts 
    string public constant TokenName = "NewToken";
    string public constant TokenSymbol = "ALPH";
    uint public  MaxTokens = 1000000000;
    uint256 public constant decimals = 18;

    function transfer(address _to,uint256 _amount) virtual payable public  returns (bool);
    function transferFrom(address _from , address _to ,uint _amount) virtual payable public returns (bool);
    function AllowToSpend( address _spender , uint256 _allowanceAmount) virtual public returns (bool);
    function CheckMyAllowance(address _walletAddress) virtual public view returns (uint256);
    function BalanceOfWallet(address _walletAddress) virtual public view returns (uint256);
    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event ApprovalToSpend(address indexed _owner, address indexed _spender, uint256 _value);
}


contract StandardToken is Token{

    
    mapping (address => mapping (address => uint256)) Allowed;// Allowance count


    function transfer(address _to, uint256 _amount)override payable public returns (bool){
        if(AccountsBalances[msg.sender] >= _amount && _amount > 0 && msg.sender != _to)
        {
            AccountsBalances[msg.sender] -= _amount;
            AccountsBalances[_to] += _amount;
            Transfer(msg.sender, _to, _amount);
        } else return false;
    }


    function transferFrom(address _TransferFrom , address _TransferTo , uint256 _amount)override payable public returns (bool)
    {
        if(CheckMyAllowance(_TransferFrom) >= _amount && AccountsBalances[_TransferFrom] >= _amount && _amount > 0)
        {
            AccountsBalances[_TransferFrom] -= _amount;
            Allowed[_TransferFrom][msg.sender] -= _amount;
            AccountsBalances[_TransferTo] += _amount;
            Transfer(_TransferFrom,_TransferTo,_amount);
        }else return false;
    }

    function AllowToSpend(address _spender,uint256 _allowanceAmount) override public returns (bool)
    {
        Allowed[msg.sender][_spender] = _allowanceAmount;
        ApprovalToSpend(msg.sender,_spender,_allowanceAmount);
        return true;
    }

    function CheckMyAllowance(address _walletAddress) override public view returns (uint256)
    {
        return Allowed[_walletAddress][msg.sender];
    }


    function BalanceOfWallet(address _walletAddress)override public view returns (uint256)
    {
        require(CheckMyAllowance(_walletAddress) > 0, "You have no allowance on this account and cannot see balance");
        return AccountsBalances[_walletAddress];
    }
}

abstract contract Token {

    mapping(address => uint256) AccountsBalances; // Token accounts 
    string public constant TokenName = "NewToken";
    string public constant TokenSymbol = "ALPH";
    uint public  MaxTokens = 1000000000;
    uint256 public constant decimals = 18;

    function transfer(address _to,uint256 _amount) virtual payable public  returns (bool);
    function transferFrom(address _from , address _to ,uint _amount) virtual payable public returns (bool);
    function AllowToSpend( address _spender , uint256 _allowanceAmount) virtual public returns (bool);
    function CheckMyAllowance(address _walletAddress) virtual public view returns (uint256);
    function BalanceOfWallet(address _walletAddress) virtual public view returns (uint256);
    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event ApprovalToSpend(address indexed _owner, address indexed _spender, uint256 _value);
}


contract StandardToken is Token{

    
    mapping (address => mapping (address => uint256)) Allowed;// Allowance count


    function transfer(address _to, uint256 _amount) override payable public returns (bool){
        if(AccountsBalances[msg.sender] >= _amount && _amount > 0 && msg.sender != _to)
        {
            AccountsBalances[msg.sender] -= _amount;
            AccountsBalances[_to] += _amount;
            emit Transfer(msg.sender, _to, _amount);
            return true;
        } else return false;
    }


    function transferFrom(address _TransferFrom , address _TransferTo , uint256 _amount)override payable public returns (bool)
    {
        if(CheckMyAllowance(_TransferFrom) >= _amount && AccountsBalances[_TransferFrom] >= _amount && _amount > 0)
        {
            AccountsBalances[_TransferFrom] -= _amount;
            Allowed[_TransferFrom][msg.sender] -= _amount;
            AccountsBalances[_TransferTo] += _amount;
            emit Transfer(_TransferFrom,_TransferTo,_amount);
            return true;
        }else return false;
    }

    function AllowToSpend(address _spender,uint256 _allowanceAmount) override public returns (bool)
    {
        Allowed[msg.sender][_spender] = _allowanceAmount;
        emit ApprovalToSpend(msg.sender,_spender,_allowanceAmount);
        return true;
    }

    function CheckMyAllowance(address _walletAddress) override public view returns (uint256)
    {
        return Allowed[_walletAddress][msg.sender];
    }


    function BalanceOfWallet(address _walletAddress)override public view returns (uint256)
    {
        require(CheckMyAllowance(_walletAddress) > 0, "You have no allowance on this account and cannot see balance");
        return AccountsBalances[_walletAddress];
    }
}
Source Link

Contract should be marked as abstract ( Missing implementation)

Hello i am getting error on line 4 TypeError: Contract "Token" should be marked as abstract. I know there was a lot threads made about this before but none of them seems to give me solution .

pragma solidity ^0.8.0;

contract Token {

    mapping(address => uint256) AccountsBalances; // Token accounts 
    string public constant TokenName = "NewToken";
    string public constant TokenSymbol = "ALPH";
    uint public  MaxTokens = 1000000000;
    uint256 public constant decimals = 18;

    function transfer(address _to,uint256 _amount) virtual payable public  returns (bool);
    function transferFrom(address _from , address _to ,uint _amount) virtual payable public returns (bool);
    function AllowToSpend( address _spender , uint256 _allowanceAmount) virtual public returns (bool);
    function CheckMyAllowance(address _walletAddress) virtual public view returns (uint256);
    function BalanceOfWallet(address _walletAddress) virtual public view returns (uint256);
    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event ApprovalToSpend(address indexed _owner, address indexed _spender, uint256 _value);
}


contract StandardToken is Token{

    
    mapping (address => mapping (address => uint256)) Allowed;// Allowance count


    function transfer(address _to, uint256 _amount)override payable public returns (bool){
        if(AccountsBalances[msg.sender] >= _amount && _amount > 0 && msg.sender != _to)
        {
            AccountsBalances[msg.sender] -= _amount;
            AccountsBalances[_to] += _amount;
            Transfer(msg.sender, _to, _amount);
        } else return false;
    }


    function transferFrom(address _TransferFrom , address _TransferTo , uint256 _amount)override payable public returns (bool)
    {
        if(CheckMyAllowance(_TransferFrom) >= _amount && AccountsBalances[_TransferFrom] >= _amount && _amount > 0)
        {
            AccountsBalances[_TransferFrom] -= _amount;
            Allowed[_TransferFrom][msg.sender] -= _amount;
            AccountsBalances[_TransferTo] += _amount;
            Transfer(_TransferFrom,_TransferTo,_amount);
        }else return false;
    }

    function AllowToSpend(address _spender,uint256 _allowanceAmount) override public returns (bool)
    {
        Allowed[msg.sender][_spender] = _allowanceAmount;
        ApprovalToSpend(msg.sender,_spender,_allowanceAmount);
        return true;
    }

    function CheckMyAllowance(address _walletAddress) override public view returns (uint256)
    {
        return Allowed[_walletAddress][msg.sender];
    }


    function BalanceOfWallet(address _walletAddress)override public view returns (uint256)
    {
        require(CheckMyAllowance(_walletAddress) > 0, "You have no allowance on this account and cannot see balance");
        return AccountsBalances[_walletAddress];
    }
}

I was reading other posts about this issue but none of them seems to help me find solution for this .