Platform: Code4rena
Start Date: 21/08/2023
Pot Size: $125,000 USDC
Total HM: 26
Participants: 189
Period: 16 days
Judge: GalloDaSballo
Total Solo HM: 3
Id: 278
League: ETH
Rank: 77/189
Findings: 2
Award: $109.80
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: juancito
Also found by: 0x3b, 0xmuxyz, 0xnev, ArmedGoose, Bauchibred, KrisApostolov, RED-LOTUS-REACH, Viktor_Cortess, ciphermarco, ginlee, ladboy233, mitko1111, nemveer
90.6302 USDC - $90.63
https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/reLP/ReLPContract.sol#L286-L295
The code sets 0 minimal amount of tokens when adding liquidity. AddLiquidity operation is subject to the same slippage issues as swaps. Due to this, the protocol may suffer losses each time ReLP is used, as when it adds liquidity, it will suffer slippage.
Below code snippet from reLP shows the vulnerable function call. It uses IUniswapV2Router interface. According to UniswapV2 Docs the minimum amounts should be set in places marked below, but they are not.
(, , uint256 lp) = IUniswapV2Router(addresses.ammRouter).addLiquidity( addresses.tokenA, addresses.tokenB, tokenAAmountOut, amountB / 2, 0, //@audit uint amountAMin, 0, //@audit uint amountBMin, address(this), block.timestamp + 10 );
Manual approach
Enforce slippage in the same way as it is done in other functions using the slippageTolerance
parameter like here.
MEV
#0 - c4-pre-sort
2023-09-07T12:53:16Z
bytes032 marked the issue as duplicate of #1259
#1 - c4-pre-sort
2023-09-11T07:51:21Z
bytes032 marked the issue as sufficient quality report
#2 - c4-pre-sort
2023-09-11T07:53:16Z
bytes032 marked the issue as duplicate of #1032
#3 - c4-judge
2023-10-15T19:21:17Z
GalloDaSballo marked the issue as satisfactory
🌟 Selected for report: juancito
Also found by: 0xDING99YA, 0xTiwa, 0xkazim, 0xnev, ABA, ArmedGoose, Aymen0909, Bauchibred, Evo, IceBear, KrisApostolov, MohammedRizwan, Nikki, QiuhaoLi, T1MOH, Toshii, WoolCentaur, Yanchuan, __141345__, asui, bart1e, carrotsmuggler, catellatech, chaduke, codegpt, deadrxsezzz, degensec, dethera, dirk_y, erebus, ether_sky, gjaldon, glcanvas, jasonxiale, josephdara, klau5, kodyvim, ladboy233, lsaudit, minhquanym, parsely, peakbolt, pep7siup, rvierdiiev, said, savi0ur, sces60107, tapir, ubermensch, volodya, zzebra83
19.1724 USDC - $19.17
[Low-01] Redundant code
Some of the code is not used throughout the project. Examples are:
in UniV2Liquidity.sol
:
slippageTolerance
is not user, therefore the function setting it is also not needed: setSlippageTolerance()in UniV3LiquidityAmo.sol
:
[Low-02] Key and predictable state variables are not initialized There are some key state variables that in order for the protocol to work properly, have to be initialized. For example, the roles that are critical for the protocol or key tokens that anyway will be used. They still can be updated later, but initializing it as the values are predictable (e.g. we already know what tokens will be used and what roles will be used) makes the protocol more error-prone, as during manual setup some steps might be accidentally omitted, leaving the protocol in incorrect state.
The occurences are:
decreaseAmount
and but never initialized, the same role is int PerpetualAtlanticVault.sol used in purchase
, settle
and payFunding
but never initializedRecommendation: Pre-initialize the known variables in constructor or in an initialization-like function.
[Low-03] RPC disclosure The unit tests contain a valid RPC URL which presumably may have some limitation and be related to a project maintained by the team. Once disclosed, it can be freely used by users throughout the internet or scrapped from github, and the team's limit for this RPC might be abused. Recommendation: After the contest, remove the URL and regenerate new one.
[Low-04] Missing whenNotPaused modifier In RdpxV2Bond there is no pause() check on mint, making the pause less effective. in contrary, it is implemented in decaying bonds on mint. However, the overall impact is negligible thus classified as low.
[Info-01] Bond mapping is not cleared after burn When a bond is burnt, in
#0 - c4-pre-sort
2023-09-10T11:55:06Z
bytes032 marked the issue as sufficient quality report
#1 - GalloDaSballo
2023-10-10T11:34:44Z
L-1 R
L-2 L
L-3 NC
L-4 L
NC-1 L
#2 - c4-judge
2023-10-20T10:21:53Z
GalloDaSballo marked the issue as grade-b