{{ message }}
Repository navigation
Add DeFi skill index and Blend v2 lending/backstop playbook - #55
Open
aristidesstaffieri wants to merge 6 commits into
Open
aristidesstaffieri wants to merge 6 commits into
aristidesstaffieri wants to merge 6 commits into
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a DeFi skill package with the Blend lending playbook, closing the Blend portion of the Agentic Wallet CLI epic (stellar/stellar-cli#2625, #2628). Composes the wallet skill for keys/signing/submission. - skills/defi/SKILL.md: DeFi index/router; draws the wallet-primitives vs protocol-logic boundary and resolves the wallet skill's ../defi/ link - skills/defi/blend/SKILL.md: architecture, mainnet/testnet contract refs (3 registry-authoritative addresses; the rest derived on-chain via RPC), routing, and dependency/[VERIFY] notes - skills/defi/blend/lending.md: the Pool `submit` model + RequestType table, supply/borrow/repay/withdraw examples, pool discovery, reading state - skills/defi/blend/backstop.md: deposit/Q4W/withdraw/claim and an RPC-only "rank backstops by APR" script Wire the site: new "DeFi" filter category, a SKILL_CARD_SOURCES entry, and the styles.scss filter whitelist so the card renders. All dynamic-data scripts use RPC only (no indexer). Written from Blend's contract architecture; signatures, RequestType numbering, the Q4W timelock, and the emission split are flagged [VERIFY] against blend-contracts source. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Target the skill exclusively at the Blend v2 deployment and correct
everything that live testing against the deployed contracts surfaced:
- Replace mainnet contract references with the v2 pool factory,
backstop, and emitter addresses; document the v2 testnet deployment
and warn about the coexisting v1 deployment
- Match all signatures, getters, arg names, and struct shapes to the
deployed v2 ABI (pool_data, user_balance, get_positions, backstop
claim with min_lp_tokens_out and auto-compounding, 17-day Q4W)
- Add emissions coverage: reserve_token_id layout, accrued-emissions
getters, claim preview via simulation, and a projected-earnings
section for supply interest and BLND emissions with correct scaling
- Add tested recipes for pricing BLND via the Comet LP, pricing
reserve assets via the pool oracle, and minting backstop LP tokens
with a single-sided Comet join
- Require --source on read commands (stellar-cli needs a source
account to simulate) and note trustline requirements for borrowing
- Extract rank-backstops.sh into scripts/ as an executable utility
and add tables of contents to both reference files
All commands exercised end-to-end on testnet: supply, borrow, repay
with refund, withdraw, batched submit, emissions reads, and the full
backstop deposit/queue/dequeue lifecycle.
Contributor
Addresses the agent stress-test feedback on #55: repay full-close recipe (dToken round-up, #10/#1205 failure modes, buffer-first), min_collateral semantics (#1224, c_factor-adjusted, oracle decimals), --send=no on all reads + archived-state RestoreFootprint caveat, reward_zone() as the pool-discovery method (factory events are past RPC retention), the borrow-rate curve with exact scales (ir_mod 7dp [0.1,10], status enum, q4w_pct 7dp, get_tokens order), BLND trustline prerequisite for claims (#13), getting assets from XLM (borrow or path payment; two testnet USDCs), tx-new-vs-invoke submit semantics, resource-fee and timeout remediation notes, testnet-first env blocks, and a verified public mainnet RPC endpoint list in the standards skill (the CLI's built-in mainnet alias has no RPC URL). rank-backstops.sh now derives the backstop per network and fails loudly instead of printing nothing off-mainnet; verified against testnet and mainnet.
Collaborator
Author
This was referenced Jul 20, 2026
This was referenced Aug 27, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds the first DeFi protocol playbook: a Blend v2 skill that maps every core Blend operation — supply, borrow, repay, withdraw, backstop deposit/Q4W, emissions, and projected earnings — to concrete
stellar contract invokecommands, plus a thindefiindex skill that routes protocol tasks and defines the division of labor with the wallet skill (protocol knowledge here; keys, signing, and submission there).Every documented command was exercised end-to-end on testnet against the deployed v2 contracts: the full lending lifecycle (including over-repay refunds and batched submits), the backstop deposit → queue → dequeue lifecycle with the 17-day timelock, emissions reads and claim previews via simulation, and the bundled APR-ranking script. Mainnet addresses are cross-checked against the blend-utils registry and the Blend docs deployment list. The legacy v1 deployment is explicitly out of scope.
What's in this PR
skills/defi/SKILL.md— new DeFi index skill; routes protocol tasks to per-protocol playbooksskills/defi/blend/SKILL.md— Blend v2 overview: architecture, v2 mainnet/testnet contract references, deriving all other addresses on-chainskills/defi/blend/lending.md— thesubmitmodel andRequestTypetable, supply/borrow/repay/withdraw, pool discovery, state reads, emissions check/claim, projected-earnings mathskills/defi/blend/backstop.md— LP-token minting, deposit, Q4W lifecycle, auto-compounding claim, backstop APR methodologyskills/defi/blend/scripts/rank-backstops.sh— executable scaffold that ranks reward-zone pools by approximate backstop APR, RPC onlysite/src/data/skills.ts,site/src/app/styles.scss— DeFi filter and skill card for skills.stellar.orgTest plan
expconfirmed), premature-withdraw rejection, dequeue, claim previewlastpricereads verified on testnetscripts/rank-backstops.shrun against the testnet backstop (both reward-zone pools ranked)blend-utilsmainnet.contracts.jsonand docs.blend.capitalCompanion PRs