Closed sherlock-admin2 closed 1 month ago
hmm not sure about this, seems like this is more of a trading strategy than a vulnerability to me. The cooldown period would negate the entire intent behind the protocol(hedge against depegging risks). invalid for now
KupiaSec
High
When the price of
PA
declines, users can profit by executingdepositPsm + redeemRaWithDs
Summary
When the price of
PA
drops significantly, users can profit by following these steps:RA
forCT + DS
.DS + PA
forRA
(using the generatedDS
from step 1).CT
(generated in step 1) forRA
in the Uniswap V2 pool.Vulnerability Detail
Let's consider the following scenario:
ds.exchangeRate() = 1.17
, so1 CT + 1 DS = 1.17 RA
.psmBaseRedemptionFeePercentage = 3%
(is used to deduct fees when exchangingDS + PA
forRA
).1 CT = 1.07 RA
in the Uniswap V2 pool.PA
has significantly dropped, so1 PA = 1 RA
.Under these assumptions:
117 RA
for100 * (CT + DS)
by calling thePsm.depositPsm()
function.100 * (DS + PA)
for117 RA
by calling thePsm.redeemRaWithDs()
function. However, due to the fee mechanism, Alice receives(117 * 0.97 = 113.49) RA
.100 CT
for107 RA
in the Uniswap V2 pool.As a result, Alice makes a profit of
-117 RA - 100 PA + 113.49 RA + 107 RA = 3.49 RA
.This issue arises because users can immediately use the generated
DS
from step 1 to exchangeDS + PA
forRA
. It would be more effective to implement a cooldown period from the generation timestamp before allowing the use ofDS
.Impact
Users can gain unfair profits.
Code Snippet
https://github.com/sherlock-audit/2024-08-cork-protocol/tree/main/Depeg-swap/contracts/core/Psm.sol#L90-L101
https://github.com/sherlock-audit/2024-08-cork-protocol/tree/main/Depeg-swap/contracts/core/Psm.sol#L123-L140
Tool used
Manual Review
Recommendation
It would be more effective to implement a cooldown period from the generation timestamp before allowing the use of
DS
.