Users are incentivized to not withdraw immediately after the market is closed. #121
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
M-01
primary issue
Highest quality submission among a set of duplicates
🤖_primary
AI based primary recommendation
🤖_14_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
selected for report
This submission will be included/highlighted in the audit report
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-08-wildcat/blob/main/src/market/WildcatMarketBase.sol#L665
Vulnerability details
Impact
Users are incentivized to not withdraw immediately after market is closed.
Proof of Concept
Within a withdraw batch, all users within said batch are paid equally - at the same rate, despite what exactly was the rate when each individual one created their withdraw.
While this usually is not a problem as it is a way to reward users who queue the withdrawal and start the expiry cooldown, it creates a problematic situation when the market is closed with an outstanding expiry batch.
The problem is that up until the expiry timestamp comes, all new withdraw requests are added to this old batch where the rate of the previous requests drags the overall withdraw rate down.
Consider the following scenario:
1.12
and the batch is currently filled at1.06
~1.06
rate or wait 6 months to be able to withdraw their funds at1.12
rate.This creates a very unpleasant situation as the users have an incentive to hold their funds within the contract, despite not providing any value.
Looked from slightly different POV, these early withdraw requesters force everyone else to lock their funds for additional 6 months, for the APY they should've usually received for just holding up until now.
Tools Used
Manual review
Recommended Mitigation Steps
After closing a market and filling the current expiry, delete it from
pendingWithdrawalExpiry
. Introduce aclosedExpiry
variable so you later make sure a future expiry is not made at that same timestamp to avoid collision.Assessed type
Context
The text was updated successfully, but these errors were encountered: