Our partners: Yield Protocol

Mitch | Contango
Contango
Published in
4 min readDec 21, 2022

We’ve told you plenty of times already: we price expirables via fixed-rate markets.

Our current live beta relies upon Yield Protocol, which offers borrowing and lending at a fixed-rate on both Arbitrum and Ethereum.

We’ve been working closely with the Yield team over the past year. Thanks Allan, Alberto and everyone else who was involved in working out this genius integration.

The integration

The key of our integration with Yield lies in the flashswap mechanism that Contango uses when opening a position. Let’s see how that works.

Yield offers fixed rates to borrowers and lenders through a zero-coupon bond-like instrument (called fyToken). At Contango we call them zcTokens, as in zero-coupon bond Tokens. At a high level:

  • Lending at a fixed rate is equivalent to buying a zero-coupon bond.
  • Borrowing at a fixed rate is equivalent to selling a zero-coupon bond.

However, borrowing on Yield, just like anywhere in DeFi, requires overcollateralization, i.e. you need to deposit more than the amount you can borrow, to ensure solvency and protect lenders.

So how does Contango achieve leverage for trading?

Let’s dig into this real transaction, where a trader goes long 0.2 ETH on the ETHUSDC contract:

1) Contango first gets ETH from a flashswap on Uniswap. Notice this is slightly less than 0.2 ETH, because it will be lent on Yield and at maturity it will amount to 0.2 ETH (see the following step). The first address is the Uniswap pool. The second address is Yield’s fyETH/ETH pool contract (which is the same as the first address in the second line).

Analysis of a transaction batch on Contango (1)

2) On the fyETH/ETH pool, Contango lends at a fixed-rate, by swapping the initial ETH for 0.2 fyETH (at expiry, thanks to interest being accrued, 0.2 fyETH will be swapped back for 0.2 ETH). The second address is the Join (the contract that stores assets posted as collateral).

Analysis of a transaction batch on Contango (2)

3) Contango transfers 100 USDC posted by the trader as collateral to Uniswap, to repay part of the flashswap. The first address is the trader’s wallet, and the second is Uniswap.

Analysis of a transaction batch on Contango (3)

4) The 0.2 fyETH from step 2 are posted as collateral on Yield to mint fyUSDC (which explains why the origin address is a “Null Address”). Minting fyUSDC and selling them for USDC is equivalent to borrowing USDC at a fixed rate. The second address is the fyUSDC pool on Yield.

Analysis of a transaction batch on Contango (4)

5) The fyUSDC from the previous step are swapped for USDC and transferred to Uniswap to honor the flashswap (which is the original Uniwap pool address from the first step).

Analysis of a transaction batch on Contango (5)

6) Notice how an NFT representing the position is minted (from “Null Address”) and transferred to the trader’s wallet.

Analysis of a transaction batch on Contango (6)

All the steps above are batched into one single atomic transaction.

It cannot get more DeFi than this.

That’s it.

That’s how Contango achieves up to 3.5x leverage for ETH pairs, given the 140% collateralization ratio on Yield. For stable vs stable pairs the leverage goes up to 11x, because the collateralization ratio is lowered to 110%.

Still got questions? Ask them on our Discord.

About Yield

Yield is an Ethereum protocol to bring fixed-term, fixed-rate lending and interest-rate markets to decentralized finance.

Website | Twitter | Discord

About Contango

Contango is the first DeFi market offering expirables: contracts to buy or sell assets at a set price and date in the future. Contango achieves that without order books or liquidity pools. When a trader opens a position, the protocol borrows on the fixed-rate market, swaps on the spot market, then lends back on the fixed-rate market. Contango offers physical delivery and a minimal price impact for larger trades. Join us at contango.xyz.

Website | Twitter | Discord | Docs | Blog

--

--