Skip to content

Instantly share code, notes, and snippets.

@kadenzipfel
Created December 3, 2019 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kadenzipfel/2e26bb8d903172024f99611bc0b689bb to your computer and use it in GitHub Desktop.
Save kadenzipfel/2e26bb8d903172024f99611bc0b689bb to your computer and use it in GitHub Desktop.
address[] private refundAddresses;
mapping (address => uint) public refunds;
// bad
function refundAll() public {
for(uint x; x < refundAddresses.length; x++) { // arbitrary length iteration based on how many addresses participated
require(refundAddresses[x].send(refunds[refundAddresses[x]])) // doubly bad, now a single failure on send will hold up all funds
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment