Closed sherlock-admin2 closed 9 months ago
1 comment(s) were left on this issue during the judging contest.
takarez commented:
invalid
This is as intended.
There are three layers of recursion:
There are additional smart contract risks for a staked USDC LP compared to a USDC LP (both the arcadia asset module as the staking contract).
A risk manager can always choose to set the risk factor for StakeStargateAM
to 100%, but he should always be able to lower it.
0x52
medium
riskFactor
is incorrectly double applied toStakeStargateAM
assetsSummary
When applying
riskFactor
inStateStargateAM
it is applied to the entire position, including the Stargate LP. Stargate LP is already a derived asset and therefore will already haveriskFactor
applied to it. The recursive nature of this pricing causes it to apply twice to the underlying asset.Vulnerability Detail
When querying the poolInfo of LPStakingTime we see that the LP token returned by
poolInfo(1)
isn't USDC directly but rather USDC LP.AbstractStakingAM.sol#L256-L272
We see in
abstractStakingAM
, that theriskFactor
is applied to the combined factors of both the LP and reward token.StargateAM.sol#L216-L222
We also see that in
StargateAM
that theriskFactor
is already applied. Through recursion:StargateStaking
>StargateAM
> USDC that theriskFactor
is now applied twice to the LP.Impact
StakedStargateAM
will undervalue tokens.Code Snippet
AbstractStakingAM.sol#L237-L273
Tool used
Manual Review
Recommendation
_calculateValueAndRiskFactors
should be overridden inStakeStargateAM
to only apply theriskFactor
tue the reward asset since the underlying LP already has it applied.