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 providesUSDC, pot, Address and Uint256, so this program needs no imports.
pay.sauce.ts
maindefines the inputs: the recipient and the amount to pay.USDCresolves to the token address for the chain you compile for.pot.USDCreads the Pot’s USDC balance when the program executes.requirestops this program if the balance is too low.USDC.transfertransfers tokens from the Pot and checks the token’s response.
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.
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.
