-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[H-03] PerpetualAtlanticVault.settle()
: If APP puts become OTM and price does not recover, it can cause option writers collateral to be locked forever
#625
Comments
bytes032 marked the issue as duplicate of #1012 |
bytes032 marked the issue as sufficient quality report |
GalloDaSballo changed the severity to QA (Quality Assurance) |
Hi @GalloDaSballo, I think this should be a duplicate of #1956, as it is also describing about the same root cause of not being able to forfeit OTM options |
This previously downgraded issue has been upgraded by GalloDaSballo |
GalloDaSballo marked the issue as not a duplicate |
GalloDaSballo marked the issue as duplicate of #1956 |
GalloDaSballo marked the issue as satisfactory |
Leaving #1956 as primary due to using the lingo of forfeiture |
Lines of code
https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/perp-vault/PerpetualAtlanticVault.sol#L333
Vulnerability details
Impact
In
PerpetualAtlanticVault.settle()
, users that have provided liquidity in vaultLP for APP options can redeem their rDPX and wETH collateral once options are settled. However, once price of rDPX increases above 75% of strike price (which is very likely), these APP options are never settled due to this check insettle()
:PerpetualAtlanticVault.sol#L333
Consider the following flow:
settle()
is called, some weth and rdpx will never be unlocked for liquidity providers to redeem their shares (This can happen for a sudden increase in rDPX price within a week and price remains high without decreasing), sincesettle()
will revertunlockLiquidity()
andaddRdpx()
while liquidity providers still retain shares. Here_rdpxCollateral
remains at 0, signifiying no rdpx collateral unlocked, and_activeCollateral
remains constant since it is not unlocked yet.deposit()
.settle()
will not revert. Consequently,_rdpxCollateral
and_activeCollateral
will be increased and decreased respectively._rdpxCollateral
underflows, assuming previously non-settled options still cannot be settled as prices remain high. They will also compete with other liquidity providers where previously minted shares that are stuck attempts to redeem their shares.Unless price of rDPX decrease till strike price is smaller again, previous APP options can never be settled leaving collateral to be potentially forever stuck for some liquidity providers, depending on who redeems their shares first whenever APP options are settled by treasury
Proof of Concept
underflow in
_rdpxCollateral
, user cannot redeem shares, of 1.89e18 wETH and 1e18 rDPX.Tools Used
Manual Analysis, Foundry
Recommendation
It is crucial to rewrite options for
optionIds
where it cannot be settled when the new premium is calculated based on current rDPX mark price to prevent price changes/stability from locking collateral provide to write APP.This can be done by exposing another admin function where associated
optionIds
from previous epoch not settled has its strike price rewrittened. This should be performed before calculating funding viacalculateFunding()
which is then followed bypayFunding()
.Assessed type
Context
The text was updated successfully, but these errors were encountered: