// INSECURE | |
function transfer(address to, uint amount) external { | |
if (balances[msg.sender] >= amount) { | |
balances[to] += amount; | |
balances[msg.sender] -= amount; | |
} | |
} | |
function withdraw() external { | |
uint256 amount = balances[msg.sender]; | |
require(msg.sender.call.value(amount)()); | |
balances[msg.sender] = 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment