> For the complete documentation index, see [llms.txt](https://docs.peach.ag/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.peach.ag/documentation/arc/aggregator/smart-contract-functions.md).

# Smart Contract Functions

Key on-chain calls for swaps, token approvals and execution nonces.

Arc Aggregator executes same-chain ERC-20 swaps. No bridging function is exposed. Use the Execution Router proxy listed in [Contract Address](https://docs.peach.ag/documentation/arc/aggregator/contract-address).

### Execute a swap

**Execution Router: `executePlan`** · Selector: `0x02fcde22`

Executes an aggregator-signed plan and enforces its route, roles, signatures, deadline, nonce and minimum output.

```solidity
executePlan(
    ExecutionPlan plan,
    SwapParams params,
    bytes32[] logicalPoolIds,
    uint8[] amountModes,
    bytes payerSignature,
    bytes aggregatorSignature
)
```

<table><thead><tr><th width="199.80859375">Parameter</th><th>Purpose</th></tr></thead><tbody><tr><td><code>plan</code></td><td>Signed tokens, amounts, roles, hashes, fee terms, deadline and nonce.</td></tr><tr><td><code>params</code></td><td>Ordered swap steps and settlement values matching the plan.</td></tr><tr><td><code>logicalPoolIds</code></td><td>One non-zero logical pool identifier per step.</td></tr><tr><td><code>amountModes</code></td><td>Per-step mode: <code>0</code> uses the specified positive amount; <code>1</code> consumes the temporary input balance and requires <code>step.amountIn = 0</code>.</td></tr><tr><td><code>payerSignature</code></td><td><code>0x</code> for Direct Allowance; payer's Permit2 Witness signature for delegated swaps.</td></tr><tr><td><code>aggregatorSignature</code></td><td>Aggregator authorization for the execution plan.</td></tr></tbody></table>

Submit the prepared transaction's `to`, `data` and `value` unchanged. The SDK or [Swap API](https://docs.peach.ag/api-reference/arc-aggregator/swap) builds the calldata.

### Funding flows

* [Direct Swaps](https://docs.peach.ag/documentation/arc/aggregator/core-features/direct-allowance): `payer = executor = caller`. Approve the input token to the Execution Router.
* [Delegated Swaps](https://docs.peach.ag/documentation/arc/aggregator/core-features/delegated-execution-with-permit2-witness): `payer != executor`; executor sends the transaction. The payer approves Permit2 and signs the prepared authorization.

Arc uses `nativeMode = 0` and transaction `value = 0`. Token amounts use base units; deadlines use Unix seconds.

### Supporting functions

<table><thead><tr><th width="285.89453125">Function</th><th width="125.26171875">Selector</th><th>Purpose</th></tr></thead><tbody><tr><td><code>approve(address spender, uint256 amount)</code></td><td><code>0x095ea7b3</code></td><td>ERC-20: set the caller's allowance; <code>amount = 0</code> revokes it.</td></tr><tr><td><code>allowance(address owner, address spender)</code></td><td><code>0xdd62ed3e</code></td><td>ERC-20: read an owner's allowance for a spender.</td></tr><tr><td><code>invalidateExecutionNonces(uint256 word, uint256 mask)</code></td><td><code>0x52ab1a8b</code></td><td>Router: payer invalidates selected nonces to cancel pending plans.</td></tr><tr><td><code>isExecutionNonceUsed(address payer, uint256 nonce)</code></td><td><code>0xf253f061</code></td><td>Router: check whether a nonce was used or invalidated.</td></tr></tbody></table>

For one nonce: `word = nonce >> 8`, `mask = 1 << (nonce & 255)`. Router nonce invalidation does not revoke token allowances.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.peach.ag/documentation/arc/aggregator/smart-contract-functions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
