Skip to content

Zoe Overview

The Zoe service and smart contract API support credibly trading assets with reduced risk.

  • Zoe is Safer for Users: Zoe guarantees that when you make an offer, you get either what you said you wanted or a full refund of the assets you put in, even if the contract is buggy or malicious.

  • Zoe is Safer for Developers: For a given offer, if you make a mistake with the amount of assets you take or give, Zoe guarantees that your users will either get what they say they wanted or get a refund.

High Level Trading Flow

Trading with a contract using Zoe typically goes through these steps:

offer safety flow with contracts, zoe, and parties

  1. Parties call E(zoe).offer(invitation, proposal, assets). Zoe escrows the assets.
  2. Zoe relays the proposal to the contract identified in the invitation.
  3. The contract handles proposals using its custom business logic.
  4. The contract instructs Zoe to reallocate assets among the parties.
  5. The contract completes (aka exits) the offers.
  6. Zoe pays out assets to the parties.

Note that in this flow, assets are not sent to the contract; only information about them. For more on this distinction, see The Settlers of Blockchain Jun 2021.

Watch: Offer Safety: Partitioning Risk in Smart Contracts (20 min. Sep 2019)

Building and Using Contracts

Live Coding and Example Contracts

Watch: How To Build a Composable DeFi Contract (1:47 Dec 2020)

Agoric has written a number of example contracts that you can use, including:

Beta Features

These contracts may depend on features from our Beta release that are not available in mainnet.