AGENT SKILL

defi-bridge

Moving value between chains with defi_trade.bridge: what it can move, the two-phase guard, in_flight is not failure, and proving arrival by a measured destination balance.

License 许可
MIT
最近更新
2026-11-14
Stars
★ 12
Forks
2

01 前言 Front Matter

name
defi-bridge
license
MIT
metadata
{ "polyrob-when": "Moving funds between chains (bridge)", "polyrob-version": "4", "polyrob-priority": "2", "polyrob-triggers": "{\"tool_ids\":[\"defi_trade\"]}" }
description
Moving value between chains with defi_trade.bridge: what it can move, the two-phase guard, in_flight is not failure, and proving arrival by a measured destination balance.

03 SKILL.md 正文

Bridge — moving value between chains

defi_trade.bridge is the ONE cross-chain move. It takes no max_spend_usd: the amount you bridge is the declaration, and the caps apply to it.

Moving value between chains — the bridge

Your money is rarely on the chain that holds the opportunity. defi_trade.bridge moves it there.

What it does. Sends the origin chain's NATIVE asset (SOL / ETH), or its PINNED USDC (token_in="usdc"), through Relay. Every direction works: solana → EVM, EVM → EVM (Base → Ethereum, for example), and EVM → solana (native SOL or usdc; the arrival is measured in lamports / the SPL balance). solana → solana is not a bridge: use solana_swap / solana_transfer.

The destination asset may be native OR a token pinned in the chain registry — weth / usdc where that chain has one:

defi_trade.bridge(from_chain="base", to_chain="ethereum", amount=0.036)
defi_trade.bridge(from_chain="base", to_chain="ethereum", amount=0.036,
                  token_out="weth")
    # dry_run defaults TRUE — quotes, asserts and simulates, broadcasts nothing
defi_trade.bridge(from_chain="ethereum", to_chain="solana", amount=0.1,
                  token_out="usdc")             # ETH in, USDC on Solana
defi_trade.bridge(from_chain="base", to_chain="solana", amount=50,
                  token_in="usdc", token_out="usdc")   # USDC to USDC

An arbitrary token address is refused, and that is not a bug to work around: every address in the registry was verified on-chain, a supplied one was not. The ORIGIN is native or the chain's pinned usdc (amount is then in dollars). On an EVM chain a usdc origin first approves EXACTLY the amount to the pinned Relay depository, then deposits; a refused deposit revokes that approval. Any other origin token is refused. A chain whose registry row pins no USDC can only send its native asset.

⚠️ Prefer native where native routes. On a chain where ETH is gas AND the asset that routes straight into a position with no allowance, token_out="weth" costs you more slippage and buys you nothing unless WETH is wanted for its own sake.

Caps, not taps — the bridge is the exception. The general lane rule for the money verbs is in trade-execution ("The lane and the caps"). The bridge differs from it:

  • under the autonomous ceiling you run it and report — no tap, whatever DEFI_TIERED_SPEND_LANE says;
  • above it, the durable owner queue decides — one tap, and it is the verb's own ask (it names the recipient, the USD value, the arrival floor and the relay id);
  • the owner's own /bridge … go is the owner's act: the ceiling and the pause do not hold it (the caps do);
  • a delegated sub-agent/leaf still never bridges. Report back and let the parent run it. That is not a size question.

Read the dry run's lane: line for the verb you are about to use; do not carry one verb's lane over to another. The caps bind the bridge too, and the one that bites on a big move is the rolling 24h cap, not the per-transaction one. If a bridge refuses on the daily cap, say the NUMBER — how much headroom is left and when the window rolls — rather than "refused by PolicyGate".

The owner reaches the same rail from chat with /bridge <from> <to> <amount> [from usdc] [as <asset>] (the quote is an action card; Confirm executes it). When the owner asks you to move value between chains, that is the answer — do not say it cannot be done, and do not ask for a tool grant. To put a specific bridge to the owner, call propose_action(command="/bridge <from> <to> <amount>", why=…): the owner gets a card with one Confirm tap. Without propose_action, follow the command-line rule in trade-execution.

⚠️ The one rule that costs real money if you get it wrong. A bridge that has not arrived by the deadline comes back as in_flight — that is neither success nor failure.

  • NEVER re-send an in_flight bridge. A re-sent bridge pays twice. The funds are in transit; the deadline expiring is a statement about the clock, not about the money.
  • NEVER report in_flight as failed — that is what invites the re-send, from you or from the owner.
  • NEVER report it as arrived either. That is a lie about money.
  • It is recorded durably and escalated to the owner. Your job is to say plainly: sent, not yet confirmed arrived, here is the id. Then stop.
  • A watcher re-checks it and settles it when the destination balance actually moves, so an in_flight row is no longer the end of the story. The owner gets that resolution automatically — you do not need to poll it, and you must not re-send while waiting.

An UNREADABLE destination balance is unknown, never zero — a dead RPC returning 0 looks exactly like funds that never arrived, and only one of those is an incident. Arrival is proven by MEASURING the destination balance, so "the quote said it would arrive" is not arrival. INTO Solana the proof is stricter: the wallet also trades there, so only the delivering transaction's own balance change for this wallet counts — a swap fill during the wait never passes as the bridge.

When to bridge at all. Rarely. Gas and slippage make it a real cost, so it is not a move you make to chase one ticket — bridge when the imbalance is structural, i.e. your buying power sits on a chain you are not hunting on. "I am allowed to" is not "I should".

If a tool is missing

Follow harness-manual; do the read steps you can, and never work around a missing verb with a raw call, a browser dapp or another agent.

Related

stable-cash, trade-execution.

04 同仓库更多 Skills