Skip to main content
A Flow passes two kinds of value between calls. Resources are token balances. Handles are typed scalar values such as a uint256, an address or a bool. Op calls connect to them through ports, which the manifest declares with a kind and a mode.

Resources

A resource is a token balance: an ERC-20 ({ kind: "erc20", token, chainId }) or the native asset ({ kind: "native", chainId }). The execution proxy holds it while the transaction runs. A resource comes from one of three places:
  • A flow input. Its runtime value in run.inputs says how the amount is funded or measured. See Wire runtime values.
  • An op output. Most LI.FI ops (lifi.swap, lifi.zap, lifi.bridge) produce a resource on their amountOut port.
  • core.asResource. It turns a typed handle, such as the share amount a vault’s deposit() returns, into a tracked resource. See the Op Catalog.

Linear consumption

At most one call may consume a given resource. Two consuming bindings of the same resource fail with a linearity_error, so the proxy never spends the same balance twice. A resource nothing consumes is legal: it becomes a terminal resource. A copy-mode binding reads a resource without consuming it. core.approve, for example, approves a spender for a resource while leaving the balance for a later consuming binding. The manifest’s port metadata says which bindings consume, and the SDK’s typed handles follow it.

Terminal resources and their owner

A resource that no op consumes is a terminal resource: the receipt token of a vault deposit, a core.split output left unbound, or a resource input no node spends. Each terminal has an owner, the address that holds it after the flow. The compile response reports it as outputs[key].owner:
  • A recipient. core.transfer sends transferred to its recipient, and lifi.zap sends amountOut to recipient when you bind one. The recipient owns that output. The address must be known at compile time.
  • The epilogue’s destination. A terminal still on the proxy after the last call goes to a named forward’s to or to the remainder address (run.sweepTo), if the flow has a flow epilogue.
  • The execution proxy. Without either, the terminal stays on the per-signer proxy, where a later flow can spend it.
Two binding rules follow:
  • Binding a later op to an output already delivered to a recipient fails with a linearity_error, because the proxy no longer holds it.
  • A quoted op that needs an exact input amount cannot bind another quoted op’s previewed output; that fails with a validation_error. Quoted ops that accept a floor are not affected, so the common lifi.swap → lifi.zap chain is valid.

Future resources

Most outputs exist when the transaction ends. Some land later, on another chain, or after LI.FI’s settlement service runs a destination flow. Their output ports declare availability: "future": A future output is never on the proxy, so the epilogue never moves it and no op in the same Flow can consume it. The one exception: bind a future output, such as a bridge’s amountOut, to a continuation.settle node, and the source op delivers into the settle node’s escrow. See Funding the escrow. In the compile response, a future terminal reports delivery: { when: "future", etaSeconds?, provider?, trackingId? }. etaSeconds is the provider’s published estimate. provider names the delivering system; for lifi.bridge it is the tool key you pass as bridge to LI.FI’s /v1/status. trackingId is that system’s id for the delivery, when it has one at compile time.

Handles

A handle is a typed scalar: a flow input, an op’s output port, or a context value (builder.context.sender, builder.context.executionAddress). Handles are non-linear: many calls may read the same handle. A uint256 deadline can feed every op that needs it. See References for how handles become refs.

Ports

Ops declare typed input and output ports in the manifest. Every port has a name and these properties:
  • Kind. resource (an input that takes a token balance), handle (a typed scalar, input or output), or resource_output (an output that produces a token balance).
  • Mode. linear (the binding consumes the value) or copy (the binding only reads it).
  • accepts. On resource inputs: erc20, native or any.
  • optional. The input may be left unbound, like lifi.zap’s recipient.
Resource output ports can also declare:
  • availability. now (the default) or future; see Future resources.
  • providesMinimum. The op enforces its own minimum on this output; see below.
  • omitIfZero. The output is reported only when it is non-zero, for example lifi.swap’s unspentIn (input the swap did not spend) or core.splitAt’s tail.
  • deliveryAddressInput. Names the input port whose address receives this output, for example recipient on core.transfer.transferred and lifi.zap.amountOut.
  • countFrom. Makes the port an output family; see Output families.
A binding whose handle does not match a port’s kind or mode is rejected at compile time. If you bind a raw ref with the wrong type parameter, the validator rejects the flow the same way.

Output families

An output family is one port that expands into numbered instances, one per entry in the config key that countFrom names. core.partition declares parts with countFrom: "bps", so config: { bps: [5000, 3000, 2000] } produces parts.0, parts.1 and parts.2. Reference an instance as <nodeId>.parts.<i>, for example p.parts.1. Each instance gets its own outputs entry in the compile response.

providesMinimum

An output port with providesMinimum: true already carries a minimum-out check from its op. lifi.swap.amountOut is the canonical example: the swap’s slippage config sets minOut in the router calldata. Others include lifi.bridge.amountOut, lifiIntents.order.amountOut, continuation.settle.output, aave.borrow.borrowed, aave.claimRewards.claimed, and the Morpho Blue borrow, withdraw and withdrawCollateral outputs. No guard can attach to these ports. The op’s own floor is reported as outputs[key].amount.minimum instead. See Where guards can attach.

See also