Spaces:
Sleeping
Sleeping
File size: 747 Bytes
31ea9b2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title Payouts
/// @notice Ignores low-level call return values.
contract Payouts {
mapping(address => uint256) public credits;
function credit(address who) external payable {
credits[who] += msg.value;
}
// VULNERABLE: the return value of call is discarded; a failed transfer is
// treated as success and the credit is still cleared.
function payout(address payable who) external {
uint256 amount = credits[who];
credits[who] = 0;
who.call{value: amount}("");
}
// VULNERABLE: send() returns a bool that is ignored.
function refund(address payable who, uint256 amount) external {
who.send(amount);
}
}
|