call() should be used instead of transfer() as with EIP-1884, gas cost for SLOAD operation changed which broke many existing contracts
The transfer() and send() functions forward a fixed amount of 2300 gas. Historically, it has often been recommended to use these functions for value transfers to guard against reentrancy attacks. However, the gas cost of EVM instructions may change significantly during hard forks which may break already deployed contract systems that make fixed assumptions about gas costs. For example. EIP 1884 broke several existing smart contracts due to a cost increase of the SLOAD instruction.
2023-07-beedle/blob/main/src/Lender.sol: setPool(): Line 152 , Line 159
2023-07-beedle/blob/main/src/Lender.sol: removeFromPool(): Line 203
2023-07-beedle/blob/main/src/Lender.sol: borrow(): Line 267, Line 269
2023-07-beedle/blob/main/src/Lender.sol: repay(): Line 329
2023-07-beedle/blob/main/src/Lender.sol: giveLoan(): Line 403
2023-07-beedle/blob/main/src/Lender.sol: buyLoan(): Line 505
2023-07-beedle/blob/main/src/Lender.sol: seizeLoan(): Line 563, Line 564
2023-07-beedle/blob/main/src/Lender.sol: refinance(): Line 651, Line 653, Line 656, Line 670
The use of the deprecated transfer() function for an address will inevitably make the transaction fail when:
The claimer smart contract does not implement a payable function.
The claimer smart contract does implement a payable fallback which uses more than 2300 gas unit.
The claimer smart contract implements a payable fallback function that needs less than 2300 gas units but is called through proxy, raising the call's gas usage above 2300.
Additionally, using higher than 2300 gas might be mandatory for some multisig wallets.
VSCodium, Manual audit
Use the low-level function call() instead of transfer(), but be sure to respect the CEI pattern and/or add re-entrancy guards (popular choice is the one from OpenZeppelin), as several hacks have already happened in the past due to this recommendation not being fully understood.
More info on here.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.