call() should be used instead of transfer() on an address payable
Impact
The use of the deprecated transfer() function for an address will inevitably make the transaction fail when:
1.The claimer smart contract does not implement a payable function.
2.The claimer smart contract does implement a payable fallback which uses more than 2300 gas unit.
3.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.
Lines of code
https://github.com/code-423n4/2022-07-golom/blob/7bbb55fca61e6bae29e57133c1e45806cbb17aa4/contracts/core/GolomTrader.sol#L154
Vulnerability details
call()
should be used instead oftransfer()
on an address payableImpact
The use of the deprecated
transfer()
function for an address will inevitably make the transaction fail when:1.The claimer smart contract does not implement a payable function. 2.The claimer smart contract does implement a payable fallback which uses more than 2300 gas unit. 3.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.
Proof of Concept
Recommended Mitigation Steps
I recommend using
call()
instead oftransfer()
.