Skip to content

Model-B contract → mainnet (0x8b2412e9…) + README#1

Merged
rifkyeasy merged 5 commits into
mainfrom
dev
Jul 13, 2026
Merged

Model-B contract → mainnet (0x8b2412e9…) + README#1
rifkyeasy merged 5 commits into
mainfrom
dev

Conversation

@rifkyeasy

@rifkyeasy rifkyeasy commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Ships the reworked model-B contract to Sui mainnet and documents it.

  • New mainnet package: 0x8b2412e9a5d931cafa533d29daf8c91edacda28d6a689cbdecacf2a092380e14 (fresh publish — the breaking rework can't be an on-chain upgrade).
  • Deprecated: 0x1925bced… (unchecked vault_spend); old-vault funds stay owner-recoverable via owner_withdraw.

Contents

  • vault.move / policy.move: no unchecked exit — three bounded exits (vault_transfer, vault_borrow/vault_settle hot-potato, vault_spend_capped), rolling-window blast-radius bound, owner-gated multi-asset vaults.
  • Tests: 44 pass.
  • Published.toml: new mainnet record. README.md: rewritten for model-B.

publish tx 9NwFHsn1w2K6jBUKC1UjXf5uupTd6w2Rkx38cmR3nZCJ

…only record

Closes the on-chain enforcement holes from the security review:

- No unchecked exit (A#1): remove public vault_spend (agent could draw a raw
  coin and transfer to self, bypassing the recipient allowlist). Spends now go
  through either vault_transfer (recipient-enforced) or vault_borrow -> a
  FlashSpend hot-potato (no abilities) that MUST be settled via vault_settle,
  depositing the resulting asset back into a same-policy vault. Funds can't be
  pocketed; the recipient allowlist is now meaningful (no raw path around it).
- Real blast-radius bound (A#3, A#5): rolling per-window spend budget
  (window_ms/window_budget) so one PTB can't loop spends up to the lifetime
  budget; the window resets when elapsed.
- Honest accounting (A#6): record_action is now audit-only (&AgentPolicy, no
  budget charge) so a bare log entry can't exhaust the budget.
- Multi-asset ready (for Wormhole deposits): vault_settle<U> lets the returned
  asset differ from what was borrowed; Vault<T> stays generic.

40 Move tests pass (incl. hot-potato settle, foreign-settle rejection, and
rolling-window burst/reset). Build clean. NOTE: mainnet redeploy + off-chain
tx-builder rewrite are the follow-up; a professional audit remains a hard gate
before real funds.
…aults + docs

Make the contract stable/complete so downstream stacks consume it without further
churn:
- open<T> is now owner-cap-gated (was unauthenticated): only the policy owner can
  add ADDITIONAL asset vaults (Vault<USDC> alongside Vault<SUI> for bridged
  deposits). new<T> is key-only so no external code can share a vault around this.
- Module docs rewritten to describe the final design: generic multi-asset Vault<T>,
  the two authorized exits (vault_transfer + vault_borrow/settle hot-potato), and
  the rolling-window + lifetime budget model.
42 Move tests pass; build clean.
…n DeFi outputs

Model B completion. Native staking (→ StakedSui) and lending supply (→ an
account position) return NON-coin outputs, so they can't use vault_borrow/settle
(which requires a Coin to return). vault_spend_capped hands the agent a raw coin
for these, but:
  - requires a NAMED protocol (aborts on the no-protocol sentinel) → stays gated
    by the protocol allowlist; it can't be used as a generic drain;
  - is the ONLY path with standing exposure, deliberately bounded by the rolling
    per-window budget (a compromised agent can misdirect at most one window's
    worth). Sends still use vault_transfer (recipient-checked), swaps use
    vault_borrow/settle (funds return — zero standing exposure).
44 Move tests pass; build clean. Contract now covers sends, swaps, staking,
lending + bridged multi-asset deposits — no further contract change needed.
Fresh mainnet publish of the reworked non-custodial contract (the rework is
breaking, so it can't be an on-chain upgrade of the old 0x1925… package). Record
the new published-at/original-id/upgrade-cap in Published.toml, and rewrite the
README for model-B: the three bounded spend exits (vault_transfer /
vault_borrow+settle / vault_spend_capped), the rolling-window blast-radius bound,
and the deprecation of the old unchecked-vault_spend package.

publish tx: 9NwFHsn1w2K6jBUKC1UjXf5uupTd6w2Rkx38cmR3nZCJ
@rifkyeasy rifkyeasy merged commit 8f4133e into main Jul 13, 2026
1 check passed
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