Skip to content

feat(shield-swap): support flexible atomic rebalances - #89

Open
iamalwaysuncomfortable wants to merge 1 commit into
masterfrom
feat/flexible-rebalance
Open

iamalwaysuncomfortable wants to merge 1 commit into
masterfrom
feat/flexible-rebalance

Conversation

@iamalwaysuncomfortable

Copy link
Copy Markdown
Member

The Python rebalance tools currently turn every funding budget into an exact quote, so they cannot use the flexible recovery and execution-time liquidity sizing added by amm-v3 #110. This adds the corresponding behavior from Veil #220, preserving existing exact calls.

  • Add exact-amount, exact-liquidity, and amount-driven planners and execution helpers. Sync and async planners share the existing pure math; liquidity execution remains on the sync client.
  • Accept token caps/minimums and fixed funding/refunds. Amount-driven plans retain a zero contract target and report estimated_liquidity separately. Flexible surplus remains collectible on the successor.
  • Submit prebuilt plans verbatim, reject conflicting overrides, and validate u128 values, token bounds, funding/refund conflicts, and exact accounting before preparing a transaction.
  • Expose the modes through agent/MCP tools with precise decimal-string amounts, and update the README and generated agent guides.

Validation:

  • Full offline Shield Swap suite: 572 passed, 8 skipped, 95 deselected.
  • Generated-context freshness and size checks, sync/async surface checks, and git diff --check passed.
  • Pyright 1.1.414 reports the same 15 existing diagnostics on the unchanged base and this branch, with no new diagnostics.
  • Independent review found no actionable issues. A final regression test also verifies that agent tools reject fractional/boolean amounts rather than silently converting them.

Reference heads: Veil 3d5ef1d65e1f1efa818cd2d7e7dab5bda5a3da17; amm-v3 6676393c723ba5d3caad688dde20731c8896128c.

No funded/live transactions were run. Flexible calls require a compatible contract deployment; deployment compatibility has not been verified live. Contract/ABI and shared liquidity arithmetic are unchanged.

This branch has not been deployed

No deployments
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.

1 participant