⚙️How it works

Contango builds perps through looping, aka recursive borrowing and lending.

When a trader opens a position, the protocol borrows on a money market, swaps on the spot market, then lends back on the money market.

High level explanation of how Contango synthetizes a long perp position

To achieve leverage, the above steps are realized atomically by Contango via flash loans.

Quote currency as margin

If a traders 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.

Steps carried out to open a long ETH/DAI position, with DAI as margin

Base currency as margin

If a traders 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, with which it 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.

Steps carried out to open a long ETH/DAI position, with ETH as margin

Last updated