Tarot Deep Dive: Part One

We explore the core protocol mechanics which power leveraged yield farming.

Tarot
4 min readJun 23, 2021

The seer, curious about the mechanisms which drive this world, uncovers hidden truths at its core.

Tarot is a decentralized lending protocol for liquidity provider (LPs) to leverage their LP tokens for enhanced yield farming and staking rewards.

In this post, we’ll discuss the core mechanics of the Tarot Protocol. This includes lending pools, collateralization and liquidation mechanics, and the factory contracts that create new permissionless markets.

Core Contracts

The core contracts of the Tarot Protocol consist of the Factory and Deployers for lending pools’ constituent parts, Borrowables and Collateral. Anyone can create a new lending pool via the Factory in a permissionless manner. All lending pools are isolated. If a borrower is liquidated in one lending pool, other lending pools are not affected. Users may choose to borrow or lend in any lending pool.

In practice, the lending pools for highly liquid and stable token pairs, and token pairs with attractive yields, will be the most popular. A particular token may be borrowable in multiple lending pools, at different rates for each pool.

Lending Pools

Each lending pool is associated with a token pair. A lending pool consists of three (3) parts:

  • Borrowable0 — An interest-bearing contract for the first token (token0) in the token pair
  • Borrowable1 — An interest-bearing contract for the second token (token1) in the token pair
  • Collateral — A collateral contract for the LP token of the token pair

Lenders can deposit either token (token0 or token1) into its associated Borrowable contract for that token. In exchange, they receive an interest-bearing token, bTAROT, representing the underlying token with accrued interest. Later, they can exchange their interest-bearing token for the original token, with accrued interest, provided there is sufficient liquidity in the Borrowable for that token.

Borrowers can deposit the LP token for the token pair as collateral into the Collateral contract. With this collateral, a borrower can create a loan, which requires a certain amount of the underlying tokens, provided there is sufficient liquidity in both Borrowables to create the loan.

To enable leveraged yield farming, the Tarot Protocol uses tokens from Borrowable0 and Borrowable1 to add liquidity to the DEX for the token pair, adds the resulting LP tokens to the Collateral for the token pair, and sends the borrower cTAROT tokens, which represent the borrower’s initial collateral and borrowed LP tokens.

If, at any time, the collateral value for a borrower’s loan is less than the minimum collateral required, the loan can be liquidated. Anyone can liquidate a loan in a liquidatable state in a permissionless manner. The liquidator repays the loan and receives, in exchange, the value of the borrowed LP tokens multiplied by the liquidation incentive. This ensures the stability of the protocol.

Flash Borrowing

The Tarot Protocol optimistically sends the tokens when a borrower requires a loan, or when a liquidator attempts to liquidate a loan, in an atomic transaction.

As an example, consider the following transaction to create a 5X leveraged yield farming position:

  1. A borrower deposits 100 LP tokens as Collateral.
  2. Tarot optimistically sends both tokens in the token pair to the borrower in a loan. The loan is equivalent in value to 400 LP tokens.
  3. Tarot executes a callback contract to add these tokens as liquidity to the DEX for the token pair, and receives 400 LP tokens, which are deposited as Collateral. Now, all 500 LP tokens are deposited as collateral in the Tarot Protocol to back the loan.
  4. After the callback completes, Tarot checks that either the loan is repaid or there is sufficient collateral to back the loan. If the loan is not repaid and there is insufficient collateral for the loan, the entire transaction reverts.

At the end of this transaction, the borrower has a 5X leveraged yield farming position in LP tokens.

Future deep dives will cover the pricing of LP tokens, flash liquidation mechanics, and a powerful new DeFi construct: the leveraged yield farming vault.

Stay tuned for more details:

--

--

Tarot

Tarot is a multi-chain decentralized lending protocol.