In traditional finance, an option enables the owner to buy or sell an underlying asset at a specified conversion rate before an expiration date. XOpts extends the native capabilities of Ethereum to track and execute PUT Options against BTC. Specifically, we enable sellers to lock DAI collateral in a contract to mint ERC-20 compatible option tokens that can be traded on Uniswap. Buyers can then insure an arbitrary amount of BTC relative to the contract's strike price and pay in an amount of DAI collateral as premium. Finally, options can be exercised once the buyer proves payment to the respective underwriters of that contract using BTC-Relay (a Bitcoin SPV client deployed as an Ethereum smart contract). Our solution does *not* use any kind of wrapped BTC construction (pTokens, wBTC, ...), but uses *native* Bitcoin transactions instead. Hence, the overhead for the buyer is minimal: anyone who owns BTC can join. Moreover, the buyer *maintains custody* over his BTC - no need to trust a central party (pTokens, wBTC) or committee (tBTC). **Basic protocol flow** - A seller (underwriter) creates a BTC put option with a strike price (the value of BTC the seller is willing to insure in Dai), an expiry time (the validity of the option), and a premium (the fee paid to the seller for buying an option in Dai). - A seller underwrites an option contract previously created by locking a number of Dai into the option contract. This creates a number of option tokens with the specific expiry, premium and strike price that are now available for buyers to obtain. During this process the seller also attaches his BTC address to the option tokens. For example, if the strike price is 10,000 Dai for a BTC and the seller locks 1,000 Dai, he would have generated 1,000 option tokens. - The buyer then goes ahead and buys a number of option tokens at a specific expiry, premium, and strike price. - During the expiry time, the buyer can exercise the option. To achieve this, he must send a number of BTC to the seller. Then, he proves that he sent the required number of BTC to the option smart contract. In return, the option tokens are burned and the buyer obtains underlying Dai provided by the seller. - After the expiry time, the seller can reclaim any unused collateral. - At any time a buyer can exchange his option tokens on Uniswap in a (Dai/Options) trading pair. **Components** - XOpts front-end: The front-end to allows buyers to buy Bitcoin put options in return for Dai. They can exercise the option from the UI as well. It also allows sellers to underwrite Bitcoin put options with Dai. They can also reclaim unused Dai from expired options. - XOpts smart contracts: A new ERC20Lockable that allows sellers to mint tokens that are then assigned to a buyer when obtaining the option. We also added an expiry functionality to the option. - XOpts framework: A number of scripts to generate options and testdata. - Uniswap integration: we are deploying a new pair via the Uniswap factory. We are using the uniswap-sdk and the uniswap-core contracts for that. - BTC-Relay extension: we integrated payment verification into a solidity BTC-Relay. - Relayer: We wrote a relayer that submits current BTC block header to the BTC-Relay.
How It's Made
- XOpts front-end: Built with react, ethers and JS. - XOpts smart contracts: Built with Solidity and OpenZeppelin utils. - XOpts framework: Built with buidler, ethers, money-legos, and TS. - XOpts Uniswap integration: Built with buidler, ethers, uniswap-core and uniswap-sdk. XOpts repo: https://gitlab.com/interlay/xflash - BTC-Relay extension: Solidity, Interlay Compressed Inclusion Proofs, and Summa Bitcoin SPV (see: https://gitlab.com/interlay/btc-relay-sol) - Relayer: Rust and rust-web3 - Ethereum network: based on Ropsten via ganache-cli fork options.