skills/t2000-withdraw/SKILL.md
Withdraw from savings and receive USDC or USDsui. Use when asked to withdraw from savings, access deposited funds, pull money out of savings, reduce yield position, "close my position", or emergency withdraw. For sending to another address, use t2000-send.
npx skillsauth add mission69b/t2000-skills t2000-withdrawInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Withdraw USDC or USDsui from savings back to your checking balance.
t2000 withdraw <amount> [--asset USDC|USDsui]
t2000 withdraw all [--asset USDC|USDsui]
# Examples:
t2000 withdraw 25 # 25 USDC (default)
t2000 withdraw 25 --asset USDsui # 25 USDsui
t2000 withdraw all # full USDC savings position
t2000 withdraw all --asset USDsui # full USDsui savings position
--asset defaults to USDC when omitted.
✓ Withdrew $XX.XX <asset>
Tx: https://suiscan.xyz/mainnet/tx/0x...
If the wallet has outstanding debt, t2000 evaluates whether the withdrawal would push the health factor below 1.5:
| Scenario | Behavior |
|---|---|
| No debt | Withdrawal proceeds — no HF check. |
| Withdrawal keeps HF ≥ 1.5 | Withdrawal proceeds — note the new HF in the output. |
| Withdrawal would drop HF < 1.5 | Refused with WITHDRAW_WOULD_LIQUIDATE. Error data includes safeWithdrawAmount (the largest amount that keeps HF ≥ 1.5). |
When the user asks to "withdraw everything", "close my position", or "emergency withdraw":
Call health_check (engine) or t2000 balance --show-limits (CLI) to
see savings, debt, and current HF.
| Wallet state | Path |
|---|---|
| No debt | Single-write withdraw all for each asset held in savings. |
| Has debt, savings ≥ debt | Bundled repay + withdraw — emit repay_debt(all) and withdraw(remaining) as parallel tool_use blocks in the SAME assistant turn. Engine compiles into one Payment Intent: atomic repay-then-withdraw, one signature. |
| Has debt, savings < debt | Refuse — user can't fully close position without first acquiring more of the borrowed asset. Tell them how much more they'd need; do not auto-swap. |
For the "bundled repay + withdraw" case, emit BOTH tool_use blocks in the same assistant turn:
[ASSISTANT TURN — emit in parallel]
tool_use: repay_debt({ amount: <debt>, asset: <borrowed_asset> })
tool_use: withdraw({ amount: <remaining>, asset: <savings_asset> })
The engine's permission gate compiles these into ONE Payment Intent. Both legs succeed or both revert — no partial close. The user signs once.
Do NOT call them sequentially across turns — that loses atomicity and exposes the user to a window where debt is repaid but the withdraw fails, leaving the wallet in an awkward state.
Critical: repay_debt MUST use the SAME asset as the original borrow
(USDsui debt → USDsui repay, USDC debt → USDC repay — see t2000-repay).
If the user doesn't hold enough of the matching asset, abort with a clear
message; do not auto-swap.
WITHDRAW_WOULD_LIQUIDATE — withdrawal would push HF < 1.5. Use safeWithdrawAmount from error data, or repay debt first.NO_COLLATERAL — no savings position in the requested asset.INSUFFICIENT_BALANCE — requested amount exceeds savings balance.development
Swap tokens on Sui via Cetus Aggregator (20+ DEXs, best-route across SUI, USDC, USDsui, USDT, USDe, ETH, GOLD, NAVX, WAL, vSUI, and more). Use when asked to swap, trade, convert, exchange, or "turn X into Y". Do not use for sending — use the t2000-send skill for transfers.
tools
Set up a t2000 Agent Wallet end-to-end on the user's machine. Use when the user says "set up t2000", "install the wallet", "create my Agent Wallet", "connect t2000 to Claude / Cursor", or pastes a one-prompt install URL. Covers wallet creation, optional spending limits, and MCP wiring. Read this first when bootstrapping a new user; the other skills assume this has run.
development
Discover MPP services payable via `t2 pay`. Use when the user asks "what can I pay for?", "what AI models are available?", "show me the service catalog", "is there a weather API?", or any other discovery question. Pairs with the t2000-pay skill (discovery first, then pay).
data-ai
Rebalance the wallet to a target allocation by executing multiple swaps in one atomic Payment Intent. Use when asked to rebalance, adjust allocation, "shuffle my positions", or move from one set of holdings to another. Every leg prices against the same on-chain snapshot — no cross-leg slippage drift; user signs once.