Platform: Code4rena
Start Date: 14/09/2022
Pot Size: $50,000 USDC
Total HM: 25
Participants: 110
Period: 5 days
Judge: hickuphh3
Total Solo HM: 9
Id: 162
League: ETH
Rank: 12/110
Findings: 3
Award: $995.77
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: carrotsmuggler
Also found by: 0x52, 0xDecorativePineapple, 0xPanas, Bahurum, Jeiwan, Lambda, PwnPatrol, R2, Respx, auditor0517, durianSausage, hyh, ladboy233, pauliax, scaraven, teawaterwire, zzzitron
36.6124 USDC - $36.61
Judge has assessed an item in Issue #502 as High risk. The relevant finding follows:
#0 - HickupHH3
2022-11-05T02:18:55Z
- pegOracle assumes the oracle feeds provided have 8 decimals. While this is true as of now for chainlink USD feeds this could change in the future for new feeds and could lead to incorrect calculations in PegOracle.sol#L67-L82. Also powers of 10 are used as literals in calculations. Consider normalizing to decimals provided:
dup #195, but partial credit because failure to elaborate on "incorrect calculations".
388.9011 USDC - $388.90
Judge has assessed an item in Issue #502 as High risk. The relevant finding follows:
#0 - HickupHH3
2022-11-05T02:21:18Z
Vault does not respect the ERC4626 standard as claimed. In Vault, the withdraw function allows to withdraw an amount of underlying that is different from parameter assets. As a counsequence, previewWithdraw does not actually work as expected as wall as the convert functions. Also there is confusion in that function around whether the sender withdraws assets or shares since at the end we find asset.transfer(receiver, entitledShares). This issue could cause intergation problems since the Valut is presented as a standard ERC4626 while it is not (for example one could expect to have a withdrawal as given by previewWithdraw while this is not the case)
dup #47, but partial credit because of failure to point out the more major flaws of the incompatibilities.
🌟 Selected for report: Respx
Also found by: 0x1f8b, 0xDecorativePineapple, 0xNazgul, 0xPanas, 0xSmartContract, 0xc0ffEE, 0xmuxyz, Aymen0909, Bahurum, Bnke0x0, CodingNameKiki, Deivitto, Jeiwan, Lambda, Picodes, PwnPatrol, R2, RaymondFam, Rolezn, Ruhum, Saintcode_, SooYa, Tointer, V_B, ajtra, ak1, async, auditor0517, brgltd, c3phas, carrotsmuggler, cccz, csanuragjain, datapunk, djxploit, durianSausage, eierina, erictee, gogo, imare, joestakey, jonatascm, kv, ladboy233, leosathya, lukris02, oyc_109, pashov, pauliax, rbserver, robee, rokinot, rvierdiiev, scaraven, simon135, unforgiven, wagmi, zzzitron
570.2631 USDC - $570.26
pegOracle
assumes the oracle feeds provided have 8 decimals.While this is true as of now for chainlink USD feeds this could change in the future for new feeds and could lead to incorrect calculations in PegOracle.sol#L67-L82
. Also powers of 10 are used as literals in calculations. Consider normalizing to decimals provided:
https://github.com/code-423n4/2022-09-y2k-finance/blob/2175c044af98509261e4147edeb48e1036773771/src/oracles/PegOracle.sol#L67-L82
if (price1 > price2) { - nowPrice = (price2 * 10000) / price1; + nowPrice = (price2 * 10**decimals) / price1; } else { - nowPrice = (price1 * 10000) / price2; + nowPrice = (price1 * 10**decimals) / price2; } - int256 decimals10 = int256(10**(18 - priceFeed1.decimals())); - nowPrice = nowPrice * decimals10; return ( roundID1, - nowPrice / 1000000, + nowPrice, startedAt1, timeStamp1, answeredInRound1 );
Vault
does not respect the ERC4626 standard as claimed.In Vault
, the withdraw
function allows to withdraw an amount of underlying that is different from parameter assets
. As a counsequence, previewWithdraw
does not actually work as expected as wall as the convert
functions. Also there is confusion in that function around whether the sender withdraws assets or shares since at the end we find asset.transfer(receiver, entitledShares)
. This issue could cause intergation problems since the Valut is presented as a standard ERC4626 while it is not (for example one could expect to have a withdrawal as given by previewWithdraw
while this is not the case)
See Vault.sol#L248. A view function is generally not expected to revert.
Custom errors and revert strings are both used and sometimes a revert string is used when a custom error exists for that (seeVault.sol#L165). Consider using using only custom errors or at least use a custom error when it already exists.
SemiFulngibleVault.sol
the functions withdraw
and deposit
are overridden by their implementation in Valut.sol
. Consider just leaving them as non implemented in SemiFulngibleVault.sol
.WETH9
can never return false
but instead reverts on failure.controller
is address(0)
then the previous check would revert. Consider moving the if(controller == address(0))
before the if(IController(controller).getVaultFactory() != address(this))
check.Some public and external functions have incomplete Natspec Comments (missing parameters):
Some parameters are missing: strikePrice
at VaultFactory.sol#L47 and withdrawalFee
at VaultFactory.sol#L67
Some comments are inaccurate:
In Vault.sol#L167 assets
should be used instead of shares
. This is not an issue here since the vault has a constant 1:1 ratio.
mulWadDown
instead of mulDivDown
and 1 Ether as denominatorIn Vault.sol#L387-L412 consider simplyfing the code by using amount.divWadDown(idFinalTVL[id]).mulWadDown(idClaimTVL[id])
instead of amount.divWadDown(idFinalTVL[id]).mulDivDown(idClaimTVL[id],1 ether)
#0 - HickupHH3
2022-11-07T00:52:06Z
Aside from the upgraded issues, I'm giving this a high satisfactory rating because the findings's descriptions are specific to the codebase.