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

# Orchestrate

> Attach any onchain action to a single swap.

Orchestrate is a swap with an instruction attached. The funds and a payload travel together, and your contract on the destination chain reads that payload and acts on it the moment the funds land.

Entering a protocol from another chain normally takes four separate user actions: move funds across, swap into the right asset, switch apps, deposit. Orchestrate collapses all four into the one signature the user already gives to swap.

## How it works

Request a quote that supports payloads, then pass the bytes to the swap call. Mayan forwards them verbatim; decoding them is your destination logic's job.

```typescript theme={null}
const quotes = await fetchQuote(
  {
    amountIn64: "100000000",
    fromChain: "arbitrum",
    fromToken: USDC_ARBITRUM,
    toChain: "base",
    toToken: USDC_BASE,
    slippageBps: "auto",
  },
  { payload: "true" },   // only routes that carry payloads
);

const customPayload = Buffer.from("hello-world");

const tx = await swapFromEvm(
  quotes[0],
  fromAddress,
  destAddr,
  null,        // referrer
  signer,
  undefined,   // permit
  undefined,   // overrides
  customPayload,
);
```

What you can attach:

* **Deposit.** Funds arrive and go straight into a protocol or vault.
* **Stake.** Assets are staked on arrival, so users start earning without a second step.
* **Mint, join or participate.** The transfer triggers it as the funds land.
* **Your own logic.** Encoded contract calls, IDs, session data, or routing information your app needs.

## Requirements

Orchestrate is the one part of Mayan that is not a drop-in:

* Destination logic that can receive the funds and decode your payload.
* A route that carries payloads. Not every route does, which is why the quote request has to ask for one.
* Small payloads. Each chain and route has its own message-size limit.

See [Zaps](/integration/custom-payload) for the payload format and per-chain behavior.

## Where it fits

* A vault turns a multi-step entry into one click.
* A yield app puts deposits to work the moment they land.
* A trading app funds a position and opens it in the same action.

## Next steps

<CardGroup cols={2}>
  <Card title="Zaps" icon="bolt" href="/integration/custom-payload">
    Payload format, and which routes carry one.
  </Card>

  <Card title="Executing Swaps" icon="paper-plane" href="/build/sdk/executing-swaps">
    Passing the payload argument on EVM, Solana and Sui.
  </Card>
</CardGroup>
