SkyPierIO / smartContracts

Apache License 2.0
0 stars 0 forks source link

Snip for Payment Distro #2

Open mrtingalingling opened 2 months ago

mrtingalingling commented 2 months ago
    // Sends an amount of existing tokens from any caller to an address.
    function transfer(address receiver, uint amount) public {
        // The sender must have enough tokens to send
        require(amount <= balances[msg.sender], "Insufficient balance.");
        // Adjusts token balances of the two addresses
        balances[msg.sender] -= amount;
        balances[receiver] += amount;
        // Emits the event defined earlier
        emit Transfer(msg.sender, receiver, amount);
    }
mrtingalingling commented 2 months ago

https://docs.openzeppelin.com/contracts/2.x/api/math#SafeMath