Skip to content
RED SAGSkills
hard20 pts · first answer countssmart-contract-securitylogic-bugs

Transferring tokens to yourself

What happens when a user calls transfer(msg.sender, 100) with a balance of 100?

function transfer(address to, uint256 amt) external {
    uint256 fromBal = bal[msg.sender];
    uint256 toBal = bal[to];
    require(fromBal >= amt);
    bal[msg.sender] = fromBal - amt;
    bal[to] = toBal + amt;
}
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions