/dapp-otc

An OTC Desk contract

Primary LanguageJavaScript

OTC Desk Contract

Building a Composable DeFi Contract

This repo contains the OTC Desk contract from the "Building a Composable DeFi Contract" Cosmos Code With Us episode.

Watch the replay of the workshop: Building a Composable DeFi Contract

Functionality

The OTC Desk contract is based on an idea by Haseeb Qureshi in "Unbundling Uniswap: The Future of On-Chain Market Making"

OTC Desk

In this OTC Desk Contract:

  • Trades are atomic and “trustless”
  • Creator keeps all profits
  • Can use any pricing mechanism
  • Can stop quoting when market is crazy
  • Can trade fungible and non-fungible digital assets
  • Uses another contract (the covered call option contract) as a reusable component

This contract runs on the Agoric Stack:

Agoric Stack

Run the Tests

Unlike the basic Encouragement Dapp, this dapp only includes the contract portion. It does not include the browser UI or API server. However, it does include tests for the contract and the deploy script to install the contract code on Zoe.

To run the tests:

yarn test

Install the Code on Zoe

To install the OTC Desk code on your local version of Zoe, run:

agoric install
agoric start --reset

and then in another terminal tab:

agoric deploy contract/deploy.js

You will see something like the following if successful:

Open CapTP connection to ws://127.0.0.1:8000/private/captp...o
agoric: deploy: running contract/deploy.js
- SUCCESS! contract code installed on Zoe
-- Contract Name: OTC Desk
-- Installation Board Id: 1456154132