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;
}Discussion 0
Join free to post in the discussion.
Related questions
- Private variables are public dataBlockchain Developer
- Verifying a contract on EtherscanBlockchain Developer
- Sharing a seed phraseBlockchain Developer
- Why use OpenZeppelinBlockchain Developer
- The checks-effects-interactions orderBlockchain Developer
- What nonReentrant doesBlockchain Developer
- What front-running isBlockchain Developer
- Anyone can mintBlockchain Developer