2
Tinku R 3 weeks ago

Please help me in solving this compilation error in solidity

Please help me in resolving this code

/home/ubuntu/token_sale/contracts/SandeepDappToken.sol:17:34: DeclarationError: Identifier not found or not unique.
        function  transfer(address _to, unit256  _value) public returns (bool success)
                                        ^—–^
Compilation failed. See below
code:
pragma solidity ^0.4.23;

contract SandeepDappToken{
           // constructor

           // set the v ariable
        uint256  public totalSupply;

        string public name = ‘Dapp’;

        mapping(address => uint256) public balanceOf;
        constructor(uint256 _initialSupply )  public {
                balanceOf[msg.sender] = _initialSupply;
                totalSupply = _initialSupply;
        }
        function  transfer(address _to, unit256  _value) public returns (bool success)
        {
                require(balanceOf[msg.sender] >= _value);

        }

}

  1. 2
    Marwan Galal 2 weeks ago
    Hey Tinku, in “function  transfer(address _to, unit256  _value) public returns (bool success)”, you misspelt uint256 as unit256 so it throws a declaration error. Also, I’m assuming this is incomplete code, but if its not, you should use any variables you pass into a function – in this case, you should use the variable “_to”. Hope this helps!
  2. 2
    Tinku R 4 days ago
    Thankyou