Contango uses the concept of flash swaps to make the protocol capital efficient. Let's say a trader wants to buy 1 ETH with 100 DAI. Without using flash swaps the trader would need to first give DAI before receiving ETH. With flash swaps the trader could get 1 ETH first as long as the 100 DAI are given back in the same block. If that's not the case the transaction is reversed. This allows the trader, or a protocol such as Contango, to perform some actions between receiving the 1 ETH, at the start of the transaction, and giving 100 DAI at the end of the transaction.
Let's start by taking the example in the position opening section, where a trader buys 1 futures at
. The protocol owes a debt
. Let's say the borrowing requires a minimum collaterization ratio (CR) of 140% margin, i.e. the equivalent of
. The trader has only posted
as margin, i.e.
, there is clearly not enough money to do the borrowing with over-collaterisation.
Using flash swaps on the spot market, e.g. on Uniswap, the protocol is now able to meet the collaterisation ratio requirement by:
first getting the
to be lent
by buying its zero-coupon version
using this zero-coupon as margin to borrow the required fund. The collaterisation ratio for borrowing would be
which is above the required 140%.
Swap the borrowed
use the borrowed
plus margin to pay for the initial
Flashswap steps to open a long position
Contango closes a position by reverting the above steps. In the long example in the position closing section, the protocol follows these steps: