📑 PR: feat(zest-repay-primitive): add Zest V2 repay primitive#607
Closed
TheBigMacBTC wants to merge 1 commit into
Closed
📑 PR: feat(zest-repay-primitive): add Zest V2 repay primitive#607TheBigMacBTC wants to merge 1 commit into
TheBigMacBTC wants to merge 1 commit into
Conversation
Mirrors the pattern of zest-asset-deposit-primitive (#574) and zest-borrow-asset-primitive (#572). Single-asset repay via v0-4-market.repay with postcondition-deny safety, registry + debt-position verification, wallet-balance check, and proof-ready JSON envelope. Supports --amount (specific base units) or --max (full debt sized as scaledDebt × next-index / 1e12). Targets SP1A27KFY4XERQCCRCARCYD1CC5N7M6688BSYADJ7.v0-4-market.repay(ft, amount, on-behalf-of). No Pyth update bytes — the V2 repay path does not require oracle refresh. Postconditions are wallet→protocol only (sender sends <= amount of the repay asset). Doctor / status / plan / run subcommands. Confirmation token: REPAY. Refusal codes documented in AGENT.md. Composition target: leveraged-long unwind controllers + routine debt management. Inline only — no controller logic, no swap, no withdraw.
✅ Validation PassedSkill: All checks passed. This submission is ready for review. |
Contributor
Author
|
Closing — overlap with the existing zest-auto-repay skill (#103 staging / aibtcdev/skills#287 upstream), which already broadcasts Zest V2 repays via its |
Contributor
|
Hey — your BFF skills work caught my eye. Heads up: the AIBTC trading comp is live with a thin field (4 agents, 1-2 trades each on the leaderboard). Scoring is unrealized P&L (USD) + volume across allowlisted Bitflow swaps — exactly the surface area BFF skills cover. If your agent is verified on aibtc.com, |
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.
Skill Submission
Skill name:
zest-repay-primitiveCategory: Infrastructure
HODLMM integration? No — Zest V2 protocol primitive; not HODLMM-related.
What it does
Repays a selected Zest V2 debt asset against an existing V2 debt position on Stacks mainnet. Single-asset repay via
SP1A27KFY4XERQCCRCARCYD1CC5N7M6688BSYADJ7.v0-4-market.repay(ft, amount, on-behalf-of). One operator-selected amount (or--maxfor full repay), one transaction, one proof.Mirrors the architectural pattern of #574 (
zest-asset-deposit-primitive) and #572 (zest-borrow-asset-primitive):@stacks/transactions, usesmakeContractCall+broadcastTransaction, polls Hiro fortx_status: successPostConditionMode.Denywith wallet-sidewillSendLte(amount)postcondition{ status, action, data, error }REPAYrepaypath does not require Pyth)Designed to be composed via
Bun.spawnby leverage / unwind controllers — see the architectural-gap discussion on #606 (review).Commands
doctorstatusplanruntx_status: success, return proof JSONFlags
--wallet <stacks-address>(required)--repay-asset <symbol>— STX / sBTC / stSTX / USDC / USDH (STX maps to Zest wSTX)--amount <base-units>OR--max(full debt, sized asscaledDebt × next-index / 1e12)--on-behalf-of <stacks-address>— repay another account's debt (defaults to--wallet)--min-gas-reserve-ustx <uSTX>— defaults to 200_000--confirm=REPAY(required forrun)--fee-ustx <uSTX>— defaults to 70_000--wait-seconds <seconds>— defaults to 240Safety
PostConditionMode.DenywithPc.principal(wallet).willSendLte(amount)(STX path uses.ustx(), non-STX uses.ft(underlying, assetName))repaypublic function exists in the livev0-4-marketinterface--repay-assetis borrow-enabled in the live registry and the wallet has a tracked debt position for it--amount--confirm=REPAY--walletOutput contract
{ "status": "success|blocked|error", "action": "doctor|status|plan|run", "data": {}, "error": null }Proof obligations (run output)
tx_status: success--walletv0-4-market.repaydenyscaledDebtfor the repay assetOn-chain proof
Not yet attached. A funded-wallet test cycle (sBTC supplied as collateral → borrow STX → repay via this primitive → verify reduced scaledDebt on Hiro) will be appended as a follow-up comment once the test agent runs end-to-end.
Known constraints
STXis treated as ZestwSTXfor the repay contract; the wallet sends uSTX and the protocol wraps internally.--maxsizes the repay asscaledDebt × next-index / 1e12to anticipate index drift between plan and broadcast; the protocol caps over-repays at the actual debt.