# Zoe Pre-Built Contracts

Zoe Alpha Release v0.8.1. Last updated 2020-9-15.

While Zoe provides the means to build custom smart contracts, there is a good chance you will want to use one that follows a commonly-used structure. Therefore, we currently provide several pre-built contracts that can be imported and run on Zoe:

# Oracles

# DeFi Contracts

These contracts create various sorts of financial instruments.

  • Loan Contract - a basic collateralized loan contract.
  • Funded Call Spread - Creates a pair of fully collateralized call spread options. They are ERTP assets and can be used as such in other contracts. There are two variants of this contract, which affect the way invitations are created. This version is fully funded by the creator, who receives a matching pair of call spread options, which can be traded or sold separately.
  • Priced Call Spread - Creates a pair of fully collateralized call spread options. They are ERTP assets and can be used as such in other contracts. There are two variants of this contract, which affect the way invitations are created. In this version, the creator requests a pair of invitations, each of which enables the holder to obtain one of the positions by providing a started portion of the collateral. This version would be useful for a market maker who finds pairs of people with matching interests.
  • Covered Call - Creates a call option, which is the right to buy an underlying asset.
  • OTC Desk - A contract for giving quotes that can be exercised. The quotes are guaranteed to be exercisable because they are actually options with the underlying assets escrowed.

# Uniswap-like Constant Product AMMs

  • Autoswap - An automated market maker (implementating Uniswap v1) that can always trade between the two currencies in its liquidity pool.
  • Multipool Autoswap - An automated market maker implementing Uniswap v1. It has multiple liquidity pools and can trade between any pair of funded currencies.

# Generic Sales/Trading Contracts

These contracts involve trading or selling ERTP digital assets.

  • Sell Items - A generic sales contract, mostly used for selling NFTs for money.
  • Atomic Swap - A basic trade of digital assets between two parties.
  • Barter Exchange - An exchange with an order book that allows all kinds of goods to be offered for explicit barter swaps.
  • Second-price Auction - An auction in which the highest bidder wins and pays the second-highest bid. This version doesn't conceal the bids (an essential aspect of second price auctions), therefore, it should not be used in production.
  • Simple Exchange - A basic exchange with an order book for one asset, priced in a second asset.

# Governance

  • Escrow To Vote - A coin voting contract in which votes are weighted by the escrowed governance tokens.

# Minting

# Misc

  • Use Obj Example - An example of how you might associate the ability to take an action with ownership of a particular digital asset. In this case, you can color a pixel if you own the NFT for the pixel.

# Trivial Examples

  • Automatic Refund - A trivial contract that gives the user back what they put in.

If you want to build your own smart contract, start with the Zoe API