Skip to content

Conversation

vanitymnm
Copy link

@vanitymnm vanitymnm commented Apr 22, 2025

Builds on #195

We want to support withdraws for users that only have borrows, no deposits, but are deposited in a reserve with bad oracles.
In such case, we skip liveness checks.
However, while calculating max outflow the math depended on a value that was set upon refresh. That caused the max outflow to be zero and blocked withdrawals.

This change is safe to introduce as the rate limiter is a client only limiter.
It can be avoided by instead using withdraw + redeem because in those cases account_for_rate_limiter is false.

…osits, but are deposited in a reserve with bad oracles.

In such case, we skip liveness checks.
However, while calculating max outflow the math depended on a value that was set upon refresh.
That caused the max outflow to be zero and blocked withdrawals.
@vanitymnm vanitymnm requested a review from nope-finance April 22, 2025 07:39
@vanitymnm vanitymnm self-assigned this Apr 22, 2025
@vanitymnm vanitymnm changed the base branch from mainnet to upcoming May 2, 2025 06:48
max_outflow_usd,
// min here bc this function can overflow if max_outflow_usd is u64::MAX
// the actual value doesn't matter too much as long as its sensible
obligation.deposited_value.try_mul(2)?,
Copy link
Author

Choose a reason for hiding this comment

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

or use a static value here that doesn't overflow

@nope-finance nope-finance merged commit c3b159d into upcoming May 16, 2025
6 checks passed
@nope-finance nope-finance deleted the fix/refreshless-withdraw-if-no-borrow branch May 16, 2025 09:33
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.

2 participants