Skip to content

feat: model strategies as (collateral, debt) pairs#307

Draft
de-snake wants to merge 3 commits into
mainfrom
feat/strategies-collateral-debt-pairs
Draft

feat: model strategies as (collateral, debt) pairs#307
de-snake wants to merge 3 commits into
mainfrom
feat/strategies-collateral-debt-pairs

Conversation

@de-snake

Copy link
Copy Markdown
Collaborator

What

Reshapes src/strategies/index.ts so each entry is a single (collateral, debt) pair:

  • tokenOutAddress = collateral, new debt = borrowed underlying, creditManagers = the CMs servicing that pair.
  • Collaterals whose credit managers spanned two different debts are split into separate pairs, with id suffixed by the debt symbol (e.g. AUSDCT0-USDC / AUSDCT0-AUSD).
  • Single-debt strategies keep their existing id unchanged.

17 strategies → 23 pairs (6 splits): mEDGE (USDC/AUSD), Aura wstETH/tETH (WETH/wstETH), Convex ETH+/WETH (WETH/wstETH), Curve AZND/AUSD (USDC/AUSD), Curve AUSD/USDC/USDT0 (USDC/AUSD), Savings AUSD (USDC/AUSD).

Why

Preparation for the agentic approach — a strategy can be reasoned about as a discrete collateral/debt pair instead of one collateral umbrella-ing CMs across multiple debts.

Verification

Every debt was resolved on-chain via creditManager.underlying() across Mainnet, Monad (143), and Etherlink (42793). Checked: no credit manager dropped or added vs the previous list; all CMs within a pair share one debt; each declared debt matches the on-chain underlying; id unique per chain. yarn typecheck:ci, prettier, and generate-configs:ts (→ 23-entry strategies.json) all pass locally with the SDK change applied.

Dependency

Draft — depends on Gearbox-protocol/sdk#461 (adds the debt field). Needs that to release + an @gearbox-protocol/sdk version bump here before CI typecheck passes. Ready to un-draft once the SDK is published.

🤖 Generated with Claude Code

Each entry is now a single (collateral, debt) pair: tokenOutAddress is the
collateral, the new `debt` field is the borrowed underlying, and
creditManagers lists the CMs servicing that pair. Collaterals whose credit
managers spanned two different debts are split into separate pairs, with the
`id` suffixed by the debt symbol (e.g. AUSDCT0-USDC / AUSDCT0-AUSD). 17
strategies -> 23 pairs (6 splits).

Every debt was verified on-chain via creditManager.underlying(). Requires the
`debt` field added in Gearbox-protocol/sdk#461.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@de-snake

Copy link
Copy Markdown
Collaborator Author

The failing typecheck:ci is expected: all 23 errors are the same — the published @gearbox-protocol/sdk@14.5.2 doesn't carry the debt field yet, so each entry fails the type check. This is the documented dependency on Gearbox-protocol/sdk#461.

Unblock sequence:

  1. Merge + release sdk#461 (adds debt to StrategyConfigPayload).
  2. Bump @gearbox-protocol/sdk here to that version.
  3. typecheck:ci goes green → un-draft → merge.

Verified locally that the data is correct and typechecks cleanly once debt exists in the SDK type.

@de-snake de-snake force-pushed the feat/strategies-collateral-debt-pairs branch from 8fe9786 to f9f9148 Compare June 10, 2026 12:53
Suffix the remaining single-debt strategy ids with their debt symbol so all
ids uniformly reflect the (collateral, debt) pair (e.g. ETH+-WETH, sUSDe-USDC,
cbETH-WETH). Split strategies already carried the suffix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@de-snake de-snake force-pushed the feat/strategies-collateral-debt-pairs branch from f9f9148 to 0ba6552 Compare June 10, 2026 12:54
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