Platform: Code4rena
Start Date: 28/11/2022
Pot Size: $192,500 USDC
Total HM: 33
Participants: 106
Period: 11 days
Judge: LSDan
Total Solo HM: 15
Id: 186
League: ETH
Rank: 79/106
Findings: 1
Award: $103.92
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: IllIllI
Also found by: 0x4non, 0x52, 0xAgro, 0xNazgul, 0xSmartContract, 0xackermann, 9svR6w, Awesome, Aymen0909, B2, BRONZEDISC, Bnke0x0, Deekshith99, Deivitto, Diana, Dravee, HE1M, Jeiwan, Kaiziron, KingNFT, Lambda, Mukund, PaludoX0, RaymondFam, Rolezn, Sathish9098, Secureverse, SmartSek, __141345__, ahmedov, ayeslick, brgltd, cccz, ch0bu, chrisdior4, cryptonue, cryptostellar5, csanuragjain, datapunk, delfin454000, erictee, gz627, gzeon, helios, i_got_hacked, ignacio, imare, jadezti, jayphbee, joestakey, kankodu, ksk2345, ladboy233, martin, nadin, nicobevi, oyc_109, pashov, pavankv, pedr02b2, pzeus, rbserver, ronnyx2017, rvierdiiev, shark, unforgiven, xiaoming90, yjrwkk
103.9175 USDC - $103.92
safeIncreaseAllowance
AND safeDecreaseAllowance
INSTEAD OF safeApprove
OR approve
Number of Instances Identified: 3
safeApprove()
has been deprecated in favour of safeIncreaseAllowance()
and safeDecreaseAllowance()
approve()
might fail because some tokens (eg. USDT) don’t work when changing the allowance from an existing non-zero allowance valueUpdate instances of approve()
and safeApprove()
to safeIncreaseAllowance()
.
555: IERC20(token).safeApprove(operator, type(uint256).max);
45: _apeCoin.approve(address(_apeCoinStaking), type(uint256).max); 46: _apeCoin.approve(address(POOL), type(uint256).max);
Number of Instances Identified: 1
While it doesn’t save any gas because the compiler knows that developers often make this mistake, it’s still best to use the right tool for the task at hand. There is a difference between constant
variables and immutable
variables, and they should each be used in their appropriate contexts. constants
should be used for literal values written into the code, and immutable
variables should be used for expressions, or values calculated in, or passed into the constructor.
70: bytes32 public constant UPDATER_ROLE = keccak256("UPDATER_ROLE");
Number of Instances Identified: 1
See this link for a description of this storage variable. While some contracts may not currently be sub-classed, adding the variable now protects against forgetting to add it in the future.
19-23: contract WPunkGateway is ReentrancyGuard, IWPunkGateway, IERC721Receiver, OwnableUpgradeable
Number of Instances Identified: 2
Removing unused named returns variables can reduce gas usage (MSTOREs/MLOADs) and improve code clarity. To save gas and improve code quality: consider using only one of those.
240: returns (uint256 price) 256: returns (uint256 timestamp)
Number of Instances Identified: 10
Uniswap should be written in place of uinswap
53: returns (UinswapV3PositionData memory) 77: UinswapV3PositionData 101: UinswapV3PositionData memory positionData = getOnchainPositionData 114: UinswapV3PositionData memory positionData 132: UinswapV3PositionData memory positionData = getOnchainPositionData 145: UinswapV3PositionData memory positionData 157: UinswapV3PositionData memory positionData = getOnchainPositionData 221: function _getOracleData(UinswapV3PositionData memory positionData) 282: function _getPendingFeeAmounts(UinswapV3PositionData memory positionData)
start should be written in place of tsatr
34: @notice Function to tsatr auction
Number of Instances Identified: 3
238: // TODO using bit shifting for the 2^96
59: // TODO: take minPercentageToAsk into account
442: // TODO: support PToken
All the inscope contracts are using solidity version 0.8.10, should be upgraded to the latest version - 0.8.17
pragma solidity 0.8.10
#0 - c4-judge
2023-01-25T16:50:12Z
dmvt marked the issue as grade-b