Skip to content

Update global pause effects for withdrawals#161

Merged
vishalchangrani merged 4 commits intomainfrom
tim/126-update-global-pause
Feb 13, 2026
Merged

Update global pause effects for withdrawals#161
vishalchangrani merged 4 commits intomainfrom
tim/126-update-global-pause

Conversation

@tim-barry
Copy link
Collaborator

@tim-barry tim-barry commented Feb 12, 2026

Refinement of work on issue #126.

Description

Applies the warmup period to withdrawals as well as liquidations (previously just liquidations).
Note this also applies to rebalancing: during the warmup period, rebalancing can run, but will not push tokens to the drawDownSink when the position's health is above its target health.

@tim-barry tim-barry marked this pull request as ready for review February 13, 2026 00:36
@tim-barry tim-barry requested a review from a team as a code owner February 13, 2026 00:36
Copy link
Member

@jordanschalm jordanschalm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just one request to update docs for isPausedOrWarmup before merging.

access(EPosition) fun withdraw(pid: UInt64, amount: UFix64, type: Type): @{FungibleToken.Vault} {
pre {
!self.isPaused(): "Withdrawal, deposits, and liquidations are paused by governance"
!self.isPausedOrWarmup(): "Withdrawal, deposits, and liquidations are paused by governance"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the documentation for this function (isPausedOrWarmup) to note that withdrawals are also disabled, and explain the reasoning behind the warmup period? (Provide an opportunity for users to deposit to unhealthy positions before liquidations start, and also disallow withdrawing while liquidations are disabled, because liquidations can be needed to satisfy withdrawal requests.)

Test.expect(openRes2, Test.beSucceeded())

// Wait for the warmup period to end
Test.moveTime(by: Fix64(300.0))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

I think the most ideal way to get this number is actually from the unpause event. If that's not easy to do in the testing setup currently, can at least reference where this number comes from, i.e. here in the defaults

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: since we have the initialDepositAmount vars, i typically like to do withdraws in fractions of that, just so if anyone changes that var in the future they don't have to really adjust the tests. So just initialDepositAmount/2.0 here (and below in the success portion of the test)

Copy link
Member

@Kay-Zee Kay-Zee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vishalchangrani vishalchangrani merged commit c5a48f3 into main Feb 13, 2026
1 check passed
@vishalchangrani vishalchangrani deleted the tim/126-update-global-pause branch February 13, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants