1
 pragma solidity 0.7.4;

 contract MyToken {
    address public minter;

    mapping (address => uint) public balances;
    
    constructor(){
        minter = msg.sender;
    }
    
    function mint(address receiver, unit amount) public {
        require(msg.sender == minter);
        balances[receiver] += amount;
    }
}

oKAY this should be a simple piece of code that works that I watched from this video https://www.youtube.com/watch?v=1kMUPj5cP-0 as I'm learning how to deploy contracts (c# and c++ background) Its not making sense how this simple code isn't working. Please help me understand

I get the error "TestContract2.sol:12:37: DeclarationError: Identifier not found or not unique. function mint (address receiver, unit amount) public { ^--^ "

1 Answer 1

2

It's a bit cryptic, but there's a typo in your function parameters - unit -> uint:

Change:

function mint(address receiver, unit amount) public {

To:

function mint(address receiver, uint amount) public {
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.