Skip to content

feat: Add max slippage guard rails for strategy rebalance operations#673

Open
thebabalola wants to merge 1 commit into
Junirezz:mainfrom
thebabalola:issue-561
Open

feat: Add max slippage guard rails for strategy rebalance operations#673
thebabalola wants to merge 1 commit into
Junirezz:mainfrom
thebabalola:issue-561

Conversation

@thebabalola
Copy link
Copy Markdown

Description

This PR resolves #561 by introducing max slippage guard rails and failure-safe behavior for strategy rebalance operations.

Changes Made:

  • Added a new rebalance function to the YieldVault contract (vault/src/lib.rs). This allows an atomic divest-and-invest flow between two distinct strategies.
  • Enforced min_divest_value to check against oracle manipulation or unexpected token deductions when withdrawing from the from_strategy.
  • Enforced min_invest_value to verify that the target to_strategy accrues at least the expected equivalent valuation during a deposit.
  • Included robust failure-safe boundaries: Since the rebalance steps are fully atomic, any slippage threshold breach (either during withdrawal or deposit) instantly reverts the entire transaction.
  • Extended the VaultError enum with SlippageExceeded = 15.

This implementation mitigates the risk of value leakage when transitioning capital between connected yield strategies.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@thebabalola Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Contracts: Add max slippage guard rails for strategy rebalance operations

1 participant