@@ -6,7 +6,7 @@ contract CrowdFundBad {
66
77 function refundDos () public {
88 for (uint i; i < refundAddresses.length ; i++ ) {
9- require (refundAddresses[i].send (refundAmount[refundAddresses[i]]));
9+ require (refundAddresses[i].transfer (refundAmount[refundAddresses[i]]));
1010 }
1111 }
1212}
@@ -18,14 +18,13 @@ contract CrowdFundPull {
1818 function withdraw () external {
1919 uint refund = refundAmount[msg .sender ];
2020 refundAmount[msg .sender ] = 0 ;
21- msg .sender .send (refund);
21+ msg .sender .transfer (refund);
2222 }
2323}
2424
2525
26- //This is safe against the list length being the source of block gas limit issues
27- //but is not safe in the scenario where the payee takes up a lot of gas, or is that
28- // not possible because send has a fixed gas limit?
26+ //This is safe against the list length causing out of gas issues
27+ //but is not safe against the payee causing the execution to revert
2928contract CrowdFundSafe {
3029 address [] private refundAddresses;
3130 mapping (address => uint ) public refundAmount;
@@ -34,7 +33,7 @@ contract CrowdFundSafe {
3433 function refundSafe () public {
3534 uint256 i = nextIdx;
3635 while (i < refundAddresses.length && msg .gas > 200000 ) {
37- refundAddresses[i].send (refundAmount[i]);
36+ refundAddresses[i].transfer (refundAmount[i]);
3837 i++ ;
3938 }
4039 nextIdx = i;
0 commit comments