- The comment in Line 323 of
Staking.sol
is wrong, which can be confusing. In the case ofunstakeAllFromTokemak
, we have per definitionbalance == _amount
(as the balance of the pool is passed fromunstakeAllFromTokemak
). - The variable name in Line 112 of
LiquidityReserve.sol
still refers to the old project (FOX). - Hardcoding the COW contract addresses in Line 73 and Line 74 of
Staking.sol
goes against best practices. - In Line 88 of
Staking.sol
, the code from line 84 is duplicated, i.e. the yieldy token approval for the liquidity reserve is executed two times. - Duplicated code: In Line 144 and Line 372 of
Staking.sol
, the function_getTokemakBalance
could be used. amountToRequest
should be passed torequestWithdrawal
in Line 326 ofStaking.sol
, otherwise the wrong value is used whenbalance < _amount
.- In Line 372,
tokePoolContract
was already instantiated withITokePool
, there is no reason to callITokePool(tokePoolContract)
instead oftokePoolContract.balanceOf
- In Line 100 of
Yieldy.sol
, the new supply is passed as_previousCirculating
to_storeRebase
. In Line 121, this leads tototalStakedBefore
andtotalStakedAfter
always being equal (and a wrongrebasePercent
, which is also calculated with the_previousCirculating
. - The
creditAmount
calculation inYieldy.sol
is inconsistent. IntransferFrom
,creditsForTokenBalance
is called, whereas the calculation is done directly intransfer
,_mint
, and_burn
. Consider using one consistent method for that. - To have a consistent behavior with
rebase
, it should berequire(_totalSupply <= MAX_SUPPLY, ...);
in Line 257 ofYieldy.sol
, i.e._totalSupply == MAX_SUPPLY
should also be allowed.
URLs:
In the constructor of Staking.sol
, it is not enforced that the _firstEpochEndTime
is larger than the current block.timestamp
. If a low value is accidentally passed (or even 0), rebase
can be called multiple times in sucession, causing the epoch.number
to increase. Therefore, the coolDown & warmUp period can be circumvented in such a scenario, as epoch.number >= info.expiry
(in _isClaimAvailable
and _isClaimWithdrawAvailable
) will return true after rebase
caused several increases of epoch.number
.
Either require that _firstEpochEndTime
is larger than block.timestamp
or set the expiry of the first epoch to block.timestamp + _epochDuration
.
URLs:
- https://github.com/code-423n4/2022-06-yieldy/blob/34774d3f5e9275978621fd20af4fe466d195a88b/src/contracts/BatchRequests.sol#L37
- https://github.com/code-423n4/2022-06-yieldy/blob/34774d3f5e9275978621fd20af4fe466d195a88b/src/contracts/BatchRequests.sol#L93
When contracts[i]
is the 0 address (which happens after removeAddress
was called), IStaking(contracts[i]).canBatchTransactions()
will fail for this index, meaning that the whole function will always fail.
Check if the address is equal to 0.