Strategies

Each AMM will have a corresponding strategy contract. The interface IStrategy exposes a few functions.

invest

Given two assets, the invest method will buy as much LP tokens as possible at the current ratio between the assets on the AMM. However, it is very likely the two tranches will not be balanced at that ratio (which is unknown when Liquidity Providers are depositing funds). Therefore, there will likely be some excess uninvested funds for one tranche.

redeem

This function is more complicated because it also contains the logic for paying off the tranches according to the hurdle rate. The first step is to remove the LP tokens from the AMM and determine how much of each asset has been received. In addition, for Sushiswap the protocol will also redeem any incentives earned for providing liquidity. There are several possible outcomes:

  • If the Senior Tranche now exceeds the amount expected after the

    hurdle rate, then any excess senior assets are given to the Junior Tranche

  • If the Senior Tranche is below the expected amount, then we convert

    some or all of the Junior Tranche tokens to compensate the Senior Tranche holders

In the worst case, the returns are so low that the Junior Tranche is wiped out and the Senior Tranche still suffers a loss. Crypto is not for the faint of heart!

withdrawExcess

Transfer any unused deposits back to the investor.

UniswapStrategy

This strategy is the simplest because Uniswap doesn't offer liquidity incentives. For invest it simply calls addLiquidity. To redeem it calls removeLiquidity. However, some additional bookkeeping is involved to handle mid-duration deposits and removal of LP tokens.

SushiStrategyLP

This strategy is mostly the same as UniswapStrategy since Sushi forked their code. However, Sushi added features for additional incentives, e.g. Sushi and xSushi. This strategy has an additional method harvest to occasionally convert earned Sushi into a balance of senior and junior assets to reinvest into LP tokens. Of course, those LP tokens are placed into Masterchef, which earns Sushi, that is again harvested to reinvest into LP tokens. The cycle continues.

Last updated