> ## 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.

# deposit: Deposit source emission

> Deposit source emission: 8 exports of the deposit module of @eco-incorp/sauce, including depositCallStatement, depositImportLines, depositSource, swapThenDepositSource, DEPOSIT_BASE_DIRS, COMPOSED_BASE_DIRS.

The `deposit` namespace emits deposit programs from protocol templates listed under `DepositKey`. Compile with `baseDirs: [...deposit.DEPOSIT_BASE_DIRS]`, or `COMPOSED_BASE_DIRS` for a swap-then-deposit program.

```typescript theme={null}
import { deposit } from "@eco-incorp/sauce";
```

This page covers `sdk/dist/deposit/source.d.ts`.

<Note>
  Generated from the type declarations shipped in `@eco-incorp/sauce` 0.99.4. Each entry shows the package authors' JSDoc and declaration for this SDK version. For runtime compatibility and deployed addresses, see [architecture and deployments](/programmable-transactions/sauce/architecture-and-deployments).
</Note>

### `deposit.depositCallStatement`

*Function* · `sdk/dist/deposit/source.d.ts`

One deposit's full statement block (any `"balance"` binding line, the approve line if
applicable, then the protocol call) for `spec` - for splicing into a larger, hand-written
program. `varSuffix` disambiguates EVERY local this block binds - the `depositAmtN` balance read
and a template's own selector const - when several deposits share one program (`depositSource`
passes the spec's own index).

```typescript theme={null}
export declare function depositCallStatement(spec: DepositSourceSpec, varSuffix?: string): string;
```

### `deposit.depositImportLines`

*Function* · `sdk/dist/deposit/source.d.ts`

The import lines a `depositSource(specs)` program needs: each resolved template's own
`imports`, plus `IERC20` iff any spec needs an approval or an ERC20 balance/delta read. De-duped by
exact line, in first-seen order (`IERC20` first, matching `swap`'s own ordering convention).

```typescript theme={null}
export declare function depositImportLines(specs: DepositSourceSpec | readonly DepositSourceSpec[]): readonly string[];
```

### `deposit.depositSource`

*Function* · `sdk/dist/deposit/source.d.ts`

A complete, compilable `function main() { ... }` program: one deposit statement block per spec,
in the given order, inside ONE function. See `sdk/src/deposit/index.ts` for the compile →
`routes.buildSauceEvmCall` seam (identical to `swap`'s).

```typescript theme={null}
export declare function depositSource(spec: DepositSourceSpec | readonly DepositSourceSpec[], opts?: DepositSourceOptions): string;
```

### `deposit.swapThenDepositSource`

*Function* · `sdk/dist/deposit/source.d.ts`

The E4.1/E4.2 composition seam: **one cook = one program** (`V12Pot.cook` takes exactly one) - a
swap-then-deposit is ONE `main()` with the swap statements followed by the deposit statements, not
two cooks. Mirrors the `swapAndSupply` recipe's own shape:
`outToken.approve(aavePool, swapDelta); IAavePool.at(aavePool).supply(tokenOut, swapDelta,
beneficiary, 0);`.

A deposit spec with `amount: "delta"` is bracketed around the WHOLE swap block: a balance
snapshot (`IERC20.balanceOf`/`ctx.selfBalance()`, per the template's funding kind) is taken before
the swap statements and again after, and the deposit uses `post - pre` - the exact
`swapAndSupply` idiom ("never sweep pre-existing tokenOut dust", since a cook may run in a shared
runtime context). `amount: "balance"`/a concrete literal are unaffected and just run after the
swap block, per `depositCallStatement`'s own rules.

Import lines are unioned (not concatenated) - `swapImportLines` ∪ `depositImportLines`, de-duped
by exact line, so a program needing `IERC20` from both sides emits it exactly once (the compiler
throws `Conflicting ABIs registered` for two DIFFERENT ABIs bound to the same local name, but is
idempotent for the identical import line repeated).

```typescript theme={null}
export declare function swapThenDepositSource(swaps: SwapSourceSpec | readonly SwapSourceSpec[], deposits: DepositSourceSpec | readonly DepositSourceSpec[], opts?: SwapThenDepositOptions): string;
```

### `deposit.DEPOSIT_BASE_DIRS`

*Variable* · `sdk/dist/deposit/source.d.ts`

`baseDirs` for compiling a `depositSource`/`depositCallStatement` program. Two entries, because
(unlike `swap`, whose only import is the engine-vendored `ISauceRouter`) a deposit template's
import resolves against the SDK's PROTOCOL registry, which lives in `sdk/src/protocols`, not
`sdk/dist/artifacts`:

1. `join(__dirname, "..")` - the dist root, resolving `./artifacts/IERC20.json` (same artifact
   `swap`'s `"balance"` path already uses).
2. `join(__dirname, "..", "..", "src")` - the SHIPPED `sdk/src` tree (the root `package.json`
   `files` list ships `sdk/src/protocols` verbatim - see `sdk/src/deposit/index.ts`'s packaging
   note), resolving `./protocols/<slug>/<X>ABI.json`.

In dev (this package's own `src/`), `__dirname` is `sdk/src/deposit`, so both entries land on
`sdk/src`, which already has both trees.

```typescript theme={null}
DEPOSIT_BASE_DIRS: readonly string[]
```

### `deposit.COMPOSED_BASE_DIRS`

*Variable* · `sdk/dist/deposit/source.d.ts`

`SWAP_BASE_DIRS` ∪ `DEPOSIT_BASE_DIRS`, de-duped - the `baseDirs` a `swapThenDepositSource`
program needs.

```typescript theme={null}
COMPOSED_BASE_DIRS: readonly string[]
```

### `deposit.DepositSourceOptions`

*Interface* · `sdk/dist/deposit/source.d.ts`

```typescript theme={null}
export interface DepositSourceOptions {
    functionName?: string;
    imports?: readonly string[];
}
```

### `deposit.SwapThenDepositOptions`

*Interface* · `sdk/dist/deposit/source.d.ts`

```typescript theme={null}
export interface SwapThenDepositOptions {
    functionName?: string;
    imports?: readonly string[];
}
```
