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:
- Parties call E(zoe).offer(invitation, proposal, assets). Zoe escrows the assets.
- Zoe relays the proposal to the contract identified in the invitation.
- The contract handles proposals using its custom business logic.
- The contract instructs Zoe to reallocate assets among the parties.
- The contract completes (aka exits) the offers.
- 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:
- an Automated Market Maker (AMM) implementation
- a covered call option contract
- an OTC Desk market maker contract
- contracts for minting fungible and non-fungible tokens
Beta Features
These contracts may depend on features from our Beta release that are not available in mainnet.