Skip to content

Add quotable_pairs_for_mode to hylo-quotes#41

Open
hylevi wants to merge 7 commits intomainfrom
feat/quotable-pairs-for-mode
Open

Add quotable_pairs_for_mode to hylo-quotes#41
hylevi wants to merge 7 commits intomainfrom
feat/quotable-pairs-for-mode

Conversation

@hylevi
Copy link
Contributor

@hylevi hylevi commented Feb 8, 2026

Expose quotable_pairs_for_mode(StabilityMode) — returns the list of quotable pairs allowed in a given stability mode. Intended for the public-api quotable-pairs endpoint. Simplifies verify-quotes which isn't resilient to mode changes right now & breaks CI.

Mode restrictions match the on-chain program:

  • MintStablecoin, SwapLeverToStable: Normal, Mode1
  • DepositToStabilityPool: Normal, Mode1, Mode2
  • MintLevercoin, RedeemLevercoin, SwapStableToLever, WithdrawAndRedeemFromStabilityPool: not Depeg
  • RedeemStablecoin, LstSwap, WithdrawFromStabilityPool: all modes

Note: WithdrawAndRedeemFromStabilityPool is blocked in Depeg at the SDK level, but the two underlying on-chain instructions (user_withdraw + redeem_stablecoin) have no mode check.

@hylevi hylevi marked this pull request as ready for review February 8, 2026 18:32
@hylevi hylevi requested a review from 0xPlish February 8, 2026 18:32
@0xPlish
Copy link
Contributor

0xPlish commented Feb 8, 2026

@hylevi re: this one is probably an overlooked bug as technically we do allow users to exit the pool and protocol in depeg mode to ensure liquidity in emergency

Note: WithdrawAndRedeemFromStabilityPool is blocked in Depeg at the SDK level, but the two underlying on-chain instructions (user_withdraw + redeem_stablecoin) have no mode check.

ProtocolState already holds stability_mode and xsol_pool — no reason
to make callers decompose those fields themselves. The free function
is replaced by ProtocolState::quotable_pairs(&self).
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