> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# actions: Action types

> Action types: the declaration and description of each of the 63 exports of @eco-incorp/sauce/actions.

`@eco-incorp/sauce/actions` reads JSON action programs (`{ version, chainId?, actions }`), validates them against the JSON Schema exported as `@eco-incorp/sauce/actions/action-program.schema.json`, and compiles them for a chain. A token field takes a registry symbol and a contract field a namespace reference, beside an address.

```typescript theme={null}
import { parseProgram, compileProgram } from "@eco-incorp/sauce/actions";
```

Generated from the type declarations of `@eco-incorp/sauce`.

### `TokenSymbol`

*Type* · `@eco-incorp/sauce/actions`

A registry token symbol - `"USDC"`, `"WETH"` - in the spelling a Sauce program uses. It is the
program global of that name, so it resolves on the chain the program is compiled for, and
compiling for a chain that does not register it fails, naming the chain and the symbol.

```typescript theme={null}
export type TokenSymbol = string;
```

### `Token`

*Type* · `@eco-incorp/sauce/actions`

A token: a registry symbol, or an address.

```typescript theme={null}
export type Token = Address | TokenSymbol;
```

### `TokenOrNative`

*Type* · `@eco-incorp/sauce/actions`

A token, or `"native"`: the venue's marker for the chain's native currency (the zero address).

```typescript theme={null}
export type TokenOrNative = Token | "native";
```

### `ContractName`

*Type* · `@eco-incorp/sauce/actions`

A protocol contract by namespace - `"UniswapV3.Factory"`, `"BalancerV2.Vault"` - in the spelling
a Sauce program uses. Like a symbol, it resolves on the chain the program is compiled for.

```typescript theme={null}
export type ContractName = `${string}.${string}`;
```

### `Contract`

*Type* · `@eco-incorp/sauce/actions`

A protocol contract: a namespace reference, or an address.

```typescript theme={null}
export type Contract = Address | ContractName;
```

### `TokenContract`

*Type* · `@eco-incorp/sauce/actions`

A contract that is also a token (WETH, wstETH, rETH): a symbol, a namespace reference or an address.

```typescript theme={null}
export type TokenContract = Token | ContractName;
```

### `Recipient`

*Type* · `@eco-incorp/sauce/actions`

An address, or `"pot"` for the executing Pot.

```typescript theme={null}
export type Recipient = Address | "pot";
```

### `RemoteRecipient`

*Type* · `@eco-incorp/sauce/actions`

A recipient on another chain: an address, or a 32-byte account for a non-EVM chain (Solana).

```typescript theme={null}
export type RemoteRecipient = `0x${string}`;
```

### `UniswapV2SwapAction`

*Type* · `@eco-incorp/sauce/actions`

One Uniswap V2 pair, or a fork's (`@sauce/router`'s `uniswapV2`): priced from its reserves, paid
by a push, swapped directly. The direction is the pair's sort order. The pair is `pool`, or the
one `factory.getPair(tokenIn, tokenOut)` names, read on chain.

```typescript theme={null}
export type UniswapV2SwapAction = Spends & {
    type: "uniswapV2Swap";
    tokenIn: Token;
    tokenOut: Token;
    feePpm?: number;
    amountOutMin: string;
    recipient: Recipient;
} & ({
    pool: Contract;
    factory?: never;
} | {
    factory: Contract;
    pool?: never;
});
```

### `UniswapV3SwapAction`

*Type* · `@eco-incorp/sauce/actions`

One Uniswap V3 pool, or a fork's, through the Pot's Router (`@sauce/router`'s `uniswapV3`). The
pool is `pool`, or the one `factory.getPool(tokenIn, tokenOut, fee)` names - `tickSpacing` in
place of `fee` for Aerodrome Slipstream - read on chain.

```typescript theme={null}
export type UniswapV3SwapAction = Spends & {
    type: "uniswapV3Swap";
    tokenIn: Token;
    tokenOut: Token;
    sqrtPriceLimitX96?: string;
    amountOutMin: string;
    recipient: Recipient;
} & ({
    pool: Contract;
    factory?: never;
    fee?: never;
    tickSpacing?: never;
} | {
    factory: Contract;
    fee: number;
    pool?: never;
    tickSpacing?: never;
} | {
    factory: Contract;
    tickSpacing: number;
    pool?: never;
    fee?: never;
});
```

### `UniswapV4SwapAction`

*Interface* · `@eco-incorp/sauce/actions`

One Uniswap V4 pool, through the Pot's Router (`@sauce/router`'s `uniswapV4`). A V4 pool has no
address: it is its key, `tokenIn` and `tokenOut` in sort order with `fee`, `tickSpacing` and
`hooks`. `"native"` is the native currency, which V4 keys as the zero address.

```typescript theme={null}
export interface UniswapV4SwapAction extends Spends {
    type: "uniswapV4Swap";
    poolManager: Contract;
    tokenIn: TokenOrNative;
    tokenOut: TokenOrNative;
    fee: number;
    tickSpacing: number;
    hooks?: Contract;
    sqrtPriceLimitX96?: string;
    amountOutMin: string;
    recipient: Recipient;
}
```

### `CurveSwapAction`

*Interface* · `@eco-incorp/sauce/actions`

A Curve pool's 4-argument `exchange` (`@sauce/router`'s `curve`), approved for exactly the input;
the output is the `tokenOut` balance delta.

```typescript theme={null}
export interface CurveSwapAction extends Spends {
    type: "curveSwap";
    pool: Contract;
    tokenIn: Token;
    tokenOut: Token;
    i: number;
    j: number;
    indexType: "int128" | "uint256";
    amountOutMin: string;
    recipient: Recipient;
}
```

### `BalancerV2SwapAction`

*Interface* · `@eco-incorp/sauce/actions`

One Balancer V2 pool, through its Vault (`@sauce/router`'s `balancerV2`), approved for exactly the
input.

```typescript theme={null}
export interface BalancerV2SwapAction extends Spends {
    type: "balancerV2Swap";
    vault: Contract;
    poolId: Hex;
    tokenIn: Token;
    tokenOut: Token;
    amountOutMin: string;
    recipient: Recipient;
}
```

### `DodoV2SwapAction`

*Interface* · `@eco-incorp/sauce/actions`

A DODO V2 pool - DVM, DPP or DSP - paid by a push (`@sauce/router`'s `dodoV2`). `tokenIn` and
`tokenOut` must be the pool's base and quote tokens, in either order.

```typescript theme={null}
export interface DodoV2SwapAction extends Spends {
    type: "dodoV2Swap";
    pool: Contract;
    tokenIn: Token;
    tokenOut: Token;
    baseToken: Token;
    quoteToken: Token;
    amountOutMin: string;
    recipient: Recipient;
}
```

### `TraderJoeLBSwapAction`

*Type* · `@eco-incorp/sauce/actions`

A Trader Joe Liquidity Book pair, paid by a push (`@sauce/router`'s `traderJoeLB`). The pair is
`pool`, or the one `factory.getLBPairInformation(tokenIn, tokenOut, binStep)` names, read on
chain. `tokenIn` and `tokenOut` must be its X and Y tokens, in either order; leave `tokenX` and
`tokenY` out to read them from the pair.

```typescript theme={null}
export type TraderJoeLBSwapAction = Spends & {
    type: "traderJoeLBSwap";
    tokenIn: Token;
    tokenOut: Token;
    amountOutMin: string;
    recipient: Recipient;
} & ({
    pool: Contract;
    factory?: never;
    binStep?: never;
} | {
    factory: Contract;
    binStep: number;
    pool?: never;
}) & ({
    tokenX: Token;
    tokenY: Token;
} | {
    tokenX?: never;
    tokenY?: never;
});
```

### `WoofiSwapAction`

*Interface* · `@eco-incorp/sauce/actions`

WOOFi's WooPPV2 itself, paid by a push (`@sauce/router`'s `woofi`).

```typescript theme={null}
export interface WoofiSwapAction extends Spends {
    type: "woofiSwap";
    pool: Contract;
    tokenIn: Token;
    tokenOut: Token;
    amountOutMin: string;
    recipient: Recipient;
}
```

### `MaverickV2SwapAction`

*Interface* · `@eco-incorp/sauce/actions`

One Maverick V2 pool, through the Pot's Router (`@sauce/router`'s `maverickV2`).

```typescript theme={null}
export interface MaverickV2SwapAction extends Spends {
    type: "maverickV2Swap";
    pool: Contract;
    tokenIn: Token;
    tokenOut: Token;
    amountOutMin: string;
    recipient: Recipient;
}
```

### `CurveRouterNGSwapAction`

*Interface* · `@eco-incorp/sauce/actions`

A Curve RouterNG route of up to five hops.

```typescript theme={null}
export interface CurveRouterNGSwapAction extends Spends {
    type: "curveRouterNGSwap";
    router: Contract;
    route: TokenContract[];
    swapParams: [
        number,
        number,
        number,
        number,
        number
    ][];
    pools: Contract[];
    amountOutMin: string;
    recipient: Recipient;
}
```

### `BalancerV2BatchStep`

*Interface* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export interface BalancerV2BatchStep {
    poolId: Hex;
    assetInIndex: number;
    assetOutIndex: number;
    amount: string;
}
```

### `BalancerV2BatchSwapAction`

*Interface* · `@eco-incorp/sauce/actions`

A Balancer V2 batch across pools; the output is the last step's asset delta.

```typescript theme={null}
export interface BalancerV2BatchSwapAction extends Explicit {
    type: "balancerV2BatchSwap";
    vault: Contract;
    steps: BalancerV2BatchStep[];
    assets: TokenOrNative[];
    amountOutMin: string;
    recipient: Recipient;
    deadline: number;
}
```

### `BalancerV3SwapAction`

*Interface* · `@eco-incorp/sauce/actions`

One Balancer V3 pool. The router pulls through Permit2 (`permit2Approve` it first), except a WETH
input under `wethIsEth`, which the Pot pays as native ETH.

```typescript theme={null}
export interface BalancerV3SwapAction extends Spends {
    type: "balancerV3Swap";
    router: Contract;
    pool: Contract;
    tokenIn: Token;
    tokenOut: Token;
    amountOutMin: string;
    deadline: number;
    wethIsEth: boolean;
}
```

### `AmbientSwapAction`

*Interface* · `@eco-incorp/sauce/actions`

An Ambient (CrocSwap) pool; the output is the received token's balance delta.

```typescript theme={null}
export interface AmbientSwapAction extends Spends {
    type: "ambientSwap";
    dex: Contract;
    base: TokenOrNative;
    quote: Token;
    poolIdx: number;
    isBuy: boolean;
    inBaseQty: boolean;
    tip: number;
    limitPrice: string;
    amountOutMin: string;
    reserveFlags: number;
}
```

### `DodoV1SwapAction`

*Interface* · `@eco-incorp/sauce/actions`

Legacy DODO V1 (Classical) pairs, through the DODO proxy; approvals go to DODOApprove.

```typescript theme={null}
export interface DodoV1SwapAction extends Spends {
    type: "dodoV1Swap";
    proxy: Contract;
    tokenIn: Token;
    tokenOut: Token;
    pairs: Contract[];
    directions: number;
    amountOutMin: string;
    deadline: number;
}
```

### `CarbonTradeAction`

*Interface* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export interface CarbonTradeAction {
    strategyId: string;
    amount: string;
}
```

### `CarbonSwapAction`

*Interface* · `@eco-incorp/sauce/actions`

Carbon strategies, by source amount; the controller pays the Pot.

```typescript theme={null}
export interface CarbonSwapAction extends Explicit {
    type: "carbonSwap";
    controller: Contract;
    sourceToken: Token;
    targetToken: Token;
    tradeActions: CarbonTradeAction[];
    amountOutMin: string;
    deadline: number;
}
```

### `FraxswapSwapAction`

*Interface* · `@eco-incorp/sauce/actions`

A Fraxswap path; the output is the last token's balance delta.

```typescript theme={null}
export interface FraxswapSwapAction extends Spends {
    type: "fraxswapSwap";
    router: Contract;
    path: Token[];
    amountOutMin: string;
    recipient: Recipient;
    deadline: number;
}
```

### `FluidDexT1SwapAction`

*Interface* · `@eco-incorp/sauce/actions`

A Fluid DEX T1 pool, selling its ERC-20 side.

```typescript theme={null}
export interface FluidDexT1SwapAction extends Spends {
    type: "fluidDexT1Swap";
    pool: Contract;
    swap0to1: boolean;
    amountOutMin: string;
    recipient: Recipient;
}
```

### `RouterSwapAction`

*Type* · `@eco-incorp/sauce/actions`

A swap that `@sauce/router` implements: one pool, at one of its venues.

```typescript theme={null}
export type RouterSwapAction = UniswapV2SwapAction | UniswapV3SwapAction | UniswapV4SwapAction | CurveSwapAction | BalancerV2SwapAction | DodoV2SwapAction | TraderJoeLBSwapAction | WoofiSwapAction | MaverickV2SwapAction;
```

### `SwapAction`

*Type* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export type SwapAction = RouterSwapAction | CurveRouterNGSwapAction | BalancerV2BatchSwapAction | BalancerV3SwapAction | AmbientSwapAction | DodoV1SwapAction | CarbonSwapAction | FraxswapSwapAction | FluidDexT1SwapAction;
```

### `AcrossBridgeAction`

*Interface* · `@eco-incorp/sauce/actions`

Across: deposit for the destination chain's token, less the relayer fee.

```typescript theme={null}
export interface AcrossBridgeAction extends Spends {
    type: "acrossBridge";
    spokePool: Contract;
    token: Token;
    outputToken?: Address;
    destChainId: number;
    recipient: Address;
    relayerFee: string;
    quoteTimestamp: number;
    fillDeadline: number;
    exclusivityDeadline: number;
    message: Hex;
}
```

### `StargateBridgeAction`

*Interface* · `@eco-incorp/sauce/actions`

Stargate V2: send from a StargatePool, paying the LayerZero fee it quotes on-chain.

```typescript theme={null}
export interface StargateBridgeAction extends Spends {
    type: "stargateBridge";
    pool: Contract;
    dstEid: number;
    recipient: RemoteRecipient;
    amountOutMin: string;
}
```

### `CCTPBridgeAction`

*Interface* · `@eco-incorp/sauce/actions`

Circle CCTP V2: burn USDC for minting on the destination.

```typescript theme={null}
export interface CCTPBridgeAction extends Spends {
    type: "cctpBridge";
    tokenMessenger: Contract;
    token: Token;
    destinationDomain: number;
    recipient: RemoteRecipient;
    maxFee?: string;
    minFinalityThreshold?: number;
}
```

### `HyperlaneBridgeAction`

*Interface* · `@eco-incorp/sauce/actions`

A Hyperlane warp route: `transferRemote`, paying the interchain gas it quotes on-chain.

```typescript theme={null}
export interface HyperlaneBridgeAction extends Spends {
    type: "hyperlaneBridge";
    router: Contract;
    destinationDomain: number;
    recipient: RemoteRecipient;
}
```

### `BridgeAction`

*Type* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export type BridgeAction = AcrossBridgeAction | StargateBridgeAction | CCTPBridgeAction | HyperlaneBridgeAction;
```

### `WrapETHAction`

*Interface* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export interface WrapETHAction extends Spends {
    type: "wrapETH";
    weth: TokenContract;
}
```

### `UnwrapETHAction`

*Interface* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export interface UnwrapETHAction extends Spends {
    type: "unwrapETH";
    weth: TokenContract;
}
```

### `WrapStETHAction`

*Interface* · `@eco-incorp/sauce/actions`

stETH to wstETH; wstETH pulls the stETH, so approve it first.

```typescript theme={null}
export interface WrapStETHAction extends Spends {
    type: "wrapStETH";
    wstETH: TokenContract;
}
```

### `UnwrapStETHAction`

*Interface* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export interface UnwrapStETHAction extends Spends {
    type: "unwrapStETH";
    wstETH: TokenContract;
}
```

### `LidoStakeAction`

*Interface* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export interface LidoStakeAction extends Spends {
    type: "lidoStake";
    stETH: TokenContract;
    referral?: Address;
}
```

### `LidoUnstakeAction`

*Interface* · `@eco-incorp/sauce/actions`

Requests a withdrawal of stETH; the queue pulls it, so approve it first.

```typescript theme={null}
export interface LidoUnstakeAction extends Spends {
    type: "lidoUnstake";
    withdrawalQueue: Contract;
    owner: Recipient;
}
```

### `RocketPoolStakeAction`

*Interface* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export interface RocketPoolStakeAction extends Spends {
    type: "rocketPoolStake";
    depositPool: Contract;
    rETH: TokenContract;
}
```

### `RocketPoolUnstakeAction`

*Interface* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export interface RocketPoolUnstakeAction extends Spends {
    type: "rocketPoolUnstake";
    rETH: TokenContract;
}
```

### `EtherFiStakeAction`

*Interface* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export interface EtherFiStakeAction extends Spends {
    type: "etherFiStake";
    liquidityPool: Contract;
    eETH: TokenContract;
}
```

### `WrapAction`

*Type* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export type WrapAction = WrapETHAction | UnwrapETHAction | WrapStETHAction | UnwrapStETHAction;
```

### `StakeAction`

*Type* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export type StakeAction = LidoStakeAction | LidoUnstakeAction | RocketPoolStakeAction | RocketPoolUnstakeAction | EtherFiStakeAction;
```

### `AaveV3SupplyAction`

*Interface* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export interface AaveV3SupplyAction extends Spends {
    type: "aaveV3Supply";
    pool: Contract;
    token: Token;
    onBehalfOf: Recipient;
    referralCode?: number;
}
```

### `AaveV3WithdrawAction`

*Interface* · `@eco-incorp/sauce/actions`

Withdraws from Aave V3; the output is the amount withdrawn.

```typescript theme={null}
export interface AaveV3WithdrawAction extends Spends {
    type: "aaveV3Withdraw";
    pool: Contract;
    token: Token;
    recipient: Recipient;
}
```

### `AaveV3BorrowAction`

*Interface* · `@eco-incorp/sauce/actions`

Borrows at the variable rate, the only rate Aave V3 offers.

```typescript theme={null}
export interface AaveV3BorrowAction extends Spends {
    type: "aaveV3Borrow";
    pool: Contract;
    token: Token;
    onBehalfOf: Recipient;
    referralCode?: number;
}
```

### `AaveV3RepayAction`

*Interface* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export interface AaveV3RepayAction extends Spends {
    type: "aaveV3Repay";
    pool: Contract;
    token: Token;
    onBehalfOf: Recipient;
}
```

### `CompoundV3SupplyAction`

*Interface* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export interface CompoundV3SupplyAction extends Spends {
    type: "compoundV3Supply";
    comet: Contract;
    token: Token;
}
```

### `CompoundV3WithdrawAction`

*Interface* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export interface CompoundV3WithdrawAction extends Spends {
    type: "compoundV3Withdraw";
    comet: Contract;
    token: Token;
}
```

### `LendingAction`

*Type* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export type LendingAction = AaveV3SupplyAction | AaveV3WithdrawAction | AaveV3BorrowAction | AaveV3RepayAction | CompoundV3SupplyAction | CompoundV3WithdrawAction;
```

### `TransferAction`

*Interface* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export interface TransferAction extends Spends {
    type: "transfer";
    token: Token;
    recipient: Recipient;
}
```

### `ApproveAction`

*Interface* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export interface ApproveAction extends Spends {
    type: "approve";
    token: Token;
    spender: Contract;
}
```

### `Permit2ApproveAction`

*Interface* · `@eco-incorp/sauce/actions`

A Permit2 allowance, for spenders that pull through Permit2 (Balancer V3's router, Uniswap's
Universal Router). The token must also be ERC-20-approved to Permit2 itself.

```typescript theme={null}
export interface Permit2ApproveAction extends Spends {
    type: "permit2Approve";
    permit2: Contract;
    token: Token;
    spender: Contract;
    expiration: number;
}
```

### `TokenAction`

*Type* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export type TokenAction = TransferAction | ApproveAction | Permit2ApproveAction;
```

### `BalanceOfAction`

*Interface* · `@eco-incorp/sauce/actions`

The Pot's balance of `token` when the program reaches this action.

```typescript theme={null}
export interface BalanceOfAction extends Explicit {
    type: "balanceOf";
    token: Token;
}
```

### `NativeBalanceAction`

*Interface* · `@eco-incorp/sauce/actions`

The Pot's native balance when the program reaches this action.

```typescript theme={null}
export interface NativeBalanceAction extends Explicit {
    type: "nativeBalance";
}
```

### `ArgumentAction`

*Interface* · `@eco-incorp/sauce/actions`

A runtime argument of the compiled program: `main(<name>: Uint256)`. Standalone programs only.

```typescript theme={null}
export interface ArgumentAction extends Explicit {
    type: "argument";
    name: string;
}
```

### `SourceAction`

*Type* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export type SourceAction = BalanceOfAction | NativeBalanceAction | ArgumentAction;
```

### `Action`

*Type* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export type Action = SwapAction | BridgeAction | WrapAction | StakeAction | LendingAction | TokenAction | SourceAction;
```

### `ActionType`

*Type* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export type ActionType = Action["type"];
```

### `ActionProgram`

*Interface* · `@eco-incorp/sauce/actions`

An action program: its actions in order, and optionally the one chain it is written for.

```typescript theme={null}
export interface ActionProgram {
    version: 1;
    chainId?: number;
    actions: Action[];
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.