coin

作者: 链羽 | 来源:发表于2020-08-16 00:36 被阅读0次

    pragma solidity >=0.5.0 <0.7.0;

    contract Coin {

        address public minter;

        mapping (address =>uint) public balances;

        event Sent(address from, address to, uint amount);

        constructor() public{

            minter =msg.sender;

        }

        function mint(address receiver,uint amount) public {

            require(msg.sender == minter);

            require(amount<1e60);

            balances[receiver]+=amount;

            emit Sent(msg.sender, receiver, amount);

        }

        function send(address receiver, uint amount) public {

            require(amount <=balances[msg.sender],"Insufficient balance.");

            balances[msg.sender] -=amount;

            balances[receiver]+=amount;

            emit Sent(msg.sender, receiver, amount);

        }

    }

    相关文章

      网友评论

          本文标题:coin

          本文链接:https://www.haomeiwen.com/subject/ezwzdktx.html