Skip to content

feat: loop widget backend API (#6608)#6685

Draft
aariya50 wants to merge 1 commit intodevelopfrom
feature/loop-widget-6608
Draft

feat: loop widget backend API (#6608)#6685
aariya50 wants to merge 1 commit intodevelopfrom
feature/loop-widget-6608

Conversation

@aariya50
Copy link
Copy Markdown
Contributor

@aariya50 aariya50 commented Apr 6, 2026

Summary

  • Backend-only looping orchestration for yield-leveraged strategies (deposit -> borrow/mint -> swap -> repeat)
  • Three endpoints: GET /loop/bootstrap, POST /loop/execute, GET /loop/history
  • Lending loop and CDP loop adapters with full swap integration
  • Bootstrap includes carry model economics with swap impact adjustment

Closes #6608

@aariya50 aariya50 force-pushed the feature/loop-widget-6608 branch from d2f5f68 to f981e10 Compare April 6, 2026 20:14
@aariya50
Copy link
Copy Markdown
Contributor Author

aariya50 commented Apr 6, 2026

Loop Widget POC — Testnet Results

Yield-Bearing Assets

Token Yield Lending CDP USDST Pool Loopable?
wstETH 4.09% yes yes yes (46k) yes
rETH 1.37% yes yes no pool vs USDST no
sUSDS 9.52% no no yes no — not collateral
syrupUSDC 5.15% no no yes no — not collateral

Only wstETH is loopable on testnet. rETH has no direct USDST swap pool. sUSDS and syrupUSDC are not configured as lending/CDP collateral.

Economics (ref $1k position, balanced risk)

Route Net Carry Swap Impact/Leg Adjusted Carry
wstETH CDP (q=0.50, M=2x) +5.58% 1.99% +1.60%
wstETH Lending (q=0.55, M=2.2x) +2.24% 1.99% -0.75%

Formula: net = M*y - (M-1)*r - 2*(M-1)*fee, impact: g*dx/(x+g*dx).

Tx Fee Note

5 contract calls per iteration = 0.05 USDST. Covered by vouchers if available. 2-loop = 0.10 USDST.

wstETH CDP Loop x2 (positive carry)

Expected Actual
Flow deposit → mint → swap → repeat 6/6 txs
Collateral (from 1.0 wstETH) ~1.6x 1.613 wstETH ($4,259)
Debt ~$2,600 2,610 USDST
CR >155% 163%
Adjusted carry +1.60% ~+1.95% (better than estimate — actual impact < modeled)

wstETH Lending Loop x2 (negative carry)

Expected Actual
Flow supply → borrow → swap → repeat 6/6 txs
Adjusted carry -0.75% Confirmed negative (5% borrow > 4.09% yield at leverage)

Backend-only orchestration for yield-leveraged looping.
Three endpoints: bootstrap, execute, history.
Full loop cycle: deposit -> borrow/mint -> swap -> repeat.

Made-with: Cursor
@aariya50 aariya50 force-pushed the feature/loop-widget-6608 branch from f981e10 to 586e1ff Compare April 6, 2026 22:12
@aariya50 aariya50 mentioned this pull request Apr 6, 2026
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.

loop widget

1 participant