0
function issue(uint amount) public onlyOwner {

    //_totalSupply + amount must be greater than the _totalSupply value
    require(_totalSupply + amount > _totalSupply);

    //balance of owner + the amount must me greater than the owner's balance
    require(balances[owner] + amount > balances[owner]);

    balances[owner] += amount; // balances[owner]= amount+balances[amount]
    _totalSupply += amount; //_totalSupply = _totalSupply+amount
    emit Issue(amount); // when new token issues it will be emitted
}


function redeem(uint amount) public onlyOwner {

//to perform redeem successfully _totalSupplyis greater than or equal to the amount
    require(_totalSupply >= amount);

    // also require owner's balance greater than or equal to the amount
    require(balances[owner] >= amount);

    //_totalSupply = _totalSupply - amount;
    _totalSupply -= amount;

    //balances[owner] = balance[owner]-amount;
    balances[owner] -= amount;
   emit Redeem(amount);
}

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.