Project made during the 2024 SUI hackaton organized by the BSA Team: Arthur Y., Clément S., c, Cyril, Ryan S. and Stan S.
When you want to perform an OTC trade, there is always a counterparty risk.
What happen if one of the party does not fulfill its obligations ?
As a result, OTC trade uses most often central counterparty clearing house or collateral to guarantee the transaction.
These requirements increases the cost of transaction for OTC buyers and sellers.
A blockchain-based application improves the OTC derivatives market by removing the need to trust counterparties.
Smart contracts automate settlements, ensuring timely execution and reducing settlement risk.
This application is focused on OTC for derivate product.
The solution implements the following American options:
- Call
A call option gives the buyer the right (not the obligation) to buy an asset represented by a coin at a set price on or before a set date.
- Put
A put option gives you the right, but not the obligation, to sell an asset represented by a coin at a specific price (known as the strike price) by a specific time
- Design the SUI native token
Coin<SUI>
clock
Sui has built-in support for a clock. The clock is a special object that can be used to get the current time. It is a shared object, and can be accessed by anyone.
Clock has a reserved address 0x6
. While being a shared object, it can't be accessed mutably, and a transaction attempting to do so will fail.
clock: &Clock,
assert!(!time_expired(contract.begin_date, contract.end_date, clock));
Reference: Sui examples - clock
split
A split is required to create a token object with the amount to transfer.
For example, to create a SUI token worth .6 SUI, you have to split the token worth 1 SUI into two token objects worth .6 SUI and .4 SUI.
contract.underlying.split(value);
Doc: SUI - SUI balance transfer
pay::split_and_transfer
This function will perform a split and a transfer.
pay::split_and_transfer(coin, contract.price, contract.seller, ctx);
Doc: docs.sui.io - sui-framework/pay
coin::from_balance
Wrap a balance into a Coin to make it transferable.
coin::from_balance(balance, ctx)
Reference: Sui doc
- volckeralliance.org - Clearinghouses for Over-the-Counter Derivatives
- YouTube - Understanding OTC Derivatives: A Beginner's Guide
- YouTube - Derivatives Trading Explained
Made with the help of:
- github.com/bsaepfl - SUIxBSA-Hackathon-Template-2024
- github.com/Krut007 - Tricount
- github.com/0xresil - Escrow-Move
- MystenLabs/sui - escrow/sources
Many cool project have been build during this hackaton by other team. Here their repository: