CustomToken.sol

 avatar
bruteCoder
plain_text
10 days ago
635 B
5
Indexable
Never
metCrafter_CU
contract CustomToken {

    // public variables here
    string public tokenName = "CUSTO";
    string public tokenAbbrv = "CTO";
    uint public totalToken = 0 ;

    // mapping variable here

    mapping (address => uint) public wallets;

    // mint function
    function mint ( address _address, uint _val) public {
       totalToken += _val;
       wallets[_address] += _val;
    }

    // burn function
    function burn ( address _address, uint _val) public {
       if(wallets[_address] >= _val){
       totalToken -= _val;
       wallets[_address] -= _val;
       }else revert("User don't have enough token to burn");
    }

}
Leave a Comment