Update global pause effects for withdrawals#161
Conversation
jordanschalm
left a comment
There was a problem hiding this comment.
Looks good. Just one request to update docs for isPausedOrWarmup before merging.
cadence/contracts/FlowALPv1.cdc
Outdated
| 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" |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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
cadence/tests/pool_pause_test.cdc
Outdated
There was a problem hiding this comment.
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)
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
drawDownSinkwhen the position's health is above its target health.