Skip to main content
Sauce lets you combine several onchain actions into one transaction. For example, you can compare two swap quotes, exchange tokens on the pool with the higher quote, and deposit the result into a lending protocol. You write the actions and the conditions they must satisfy in a Sauce program. A program runs on one chain. If a failure is not handled by the program, the transaction reverts: its transfers and other state changes are undone. This is transaction-level atomicity. It does not undo earlier transactions or guarantee that a later transaction on another chain succeeds.

When to use Sauce

Use Sauce when an action depends on a balance, a price, or the result of an earlier action in the same transaction. Common examples include:
  • Payments: distribute tokens to several recipients or swap tokens before paying an invoice.
  • Swaps: compare pools, enforce a minimum output, or try a second pool when the first attempt fails.
  • Lending: swap into a token, supply it to a protocol, and check the resulting position.

The main concepts

You write a program in SauceScript, a language based on a subset of TypeScript. SauceScript compiles to instructions for Sauce’s engine; you do not run it with Node.js or deploy a new contract for each program. Start with the program and the Pot. The runtime reference explains the contract details, and the glossary defines the terms used throughout the docs.

A first program

This example pays USDC from the Pot to a recipient. It first checks that the Pot holds enough USDC. SauceScript provides USDC, pot, Address and Uint256, so this program needs no imports.
pay.sauce.ts
  • main defines the inputs: the recipient and the amount to pay.
  • USDC resolves to the token address for the chain you compile for.
  • pot.USDC reads the Pot’s USDC balance when the program executes.
  • require stops this program if the balance is too low.
  • USDC.transfer transfers tokens from the Pot and checks the token’s response.
Token amounts use integers in the token’s smallest unit. USDC has 6 decimals, so 5000000 means 5 USDC. Uint256 is an unsigned 256-bit integer; its arithmetic checks for overflow and underflow. To install the tools and run a simulation, follow the Sauce SDK quickstart. The payment recipe adds recipient checks and verifies the amount received.

How a program runs

1

Compile for a chain

The compiler checks the program and resolves names such as USDC to addresses for the selected chain. It produces bytecode and the information needed to encode main’s arguments.
2

Build the transaction

The SDK combines the program, its arguments and the transaction settings. On EVM chains, the transaction calls the Pot’s cook(engine, program) function. Its value covers the Kitchen fee and any native coin the program needs.
3

Simulate the result

Simulation runs the transaction against chain state without signing or sending it. You can inspect transfers, the return value, estimated gas and any failure. State can change before you send the transaction.
4

Authorize and send

The owner sends the transaction or, on supported EVM Pots, signs an authorization for another account to submit. The Pot executes the program. On EVM chains, calls made by the program come from the Pot.
On Solana, the Kitchen and Pot use Solana’s account model, and the cook is an instruction signed by the owner. Protocol calls and account setup differ between targets; see EVM and Solana.

Chain support and execution boundaries

The CLI can build and send transactions for Ethereum, Base, Arc and Solana, and for the testnets Arc Testnet, Base Sepolia, Ethereum Sepolia, Solana Devnet and Solana Testnet. The registry also includes preview chains with more limited support. A registry entry or successful compile does not establish that the required contracts are deployed. Check the chain reference and deployment reference for your target. A program can call a bridge contract, but the destination-chain transaction happens separately. Within a cook, an unhandled failure undoes that transaction’s state changes. Earlier approvals, earlier transfers and network fees are outside that rollback. See security considerations before sending a program with real funds.

Next steps

Run your first simulation

Install the tools, compile a program and inspect its result.

Learn SauceScript by example

Build from payments to quotes, swaps and lending in five annotated examples.

Choose a recipe

Find a complete program for a payment, swap, lending action or portfolio check.

Look up a term

Find definitions for Sauce, EVM and Solana terminology.