How does it work?
Last updated
Last updated
Contango builds positions by automating looping strategies, through flash loans.
When a trader opens a long ETH/DAI position with DAI as margin, the protocol gets the remaining DAI from a flash loan, swaps all DAI for ETH on the spot market, and lends ETH on a money market, to borrow DAI and repay the flash loan.
When closing a position, Contango simply undoes the above steps.
Please note that currently Contango has integrated with variable-rate markets (which does not necessarily close the door to integrations with fixed-rate markets too).
Below is a detailed explanation how Contango builds long and short positions.
The following sub-section examines in detail a real transaction.
If a trader wants to long ETH with some DAI as margin, Contango will first obtain the remaining DAI with a flash loan, swap all DAI for ETH, lend that ETH on a variable rate market, and borrow DAI against it to reimburses the initial flash loan.
The diagram below recaps these steps and provides a numerical example when a trader longs 1 ETH with 200 DAI as margin, and spot ETH = 1000 DAI.
If a trader wants to long ETH with some ETH as margin, Contango will first obtain DAI with a flash loan, swap DAI for ETH, lend that ETH + the ETH posted as margin, and borrow DAI against it to reimburses the initial flash loan.
The diagram below recaps these steps and provides a numerical example when a trader longs 1 ETH with 0.2 ETH as margin, and spot ETH = 1000 DAI.
Short are built slightly different from the above flow.
Effectively, shorts are longs on the inverse contract with a +1 on the leverage. For instance, a 2x ETH/DAI short is like a 3x long on the inverse DAI/ETH contract. This is because you need the full notional exposure on the asset you're shorting for your PnL to be coherent.
A consequence of this is that you always have a liquidation price on Contango, even at 1x leverage.
If a trader wants to short ETH with some DAI as margin, Contango will first obtain the full ETH exposure with a flash loan, swap all ETH for DAI, lend that DAI on a variable rate market, and borrow ETH against it to reimburses the initial flash loan.
The diagram below recaps these steps and provides a numerical example when a trader shorts 1 ETH with 200 DAI as margin, and spot ETH = 1000 DAI.
If a trader wants to short ETH with some ETH as margin, Contango will first obtain the full ETH exposure with a flash loan, swap all ETH for DAI, lend that DAI on a variable rate market, and borrow ETH against it to reimburses the initial flash loan.
The diagram below recaps these steps and provides a numerical example when a trader shorts 1 ETH with 0.2 ETH as margin, and spot ETH = 1000 DAI.