Use call instead of transfer in case receiver fallback exceeds 2300 gas

This commit is contained in:
Richard Ramos 2022-08-09 13:23:03 -04:00
parent d8c3d4e62f
commit dc7778a24f
1 changed files with 2 additions and 1 deletions

View File

@ -85,7 +85,8 @@ contract RLN {
members[_pubkeyIndex] = 0;
// refund deposit
receiver.transfer(MEMBERSHIP_DEPOSIT);
(bool sent, _) = receiver.call{value: MEMBERSHIP_DEPOSIT}("");
require(sent, "transfer failed");
emit MemberWithdrawn(pubkey, _pubkeyIndex);
}