Automated Market Making of Yield Token Pool

Abstract

ALEX aims to provide a fixed rate borrowing and lending service with pre-determined maturity in the world of decentralised finance (DeFi). We include forward contracts in our trading pool, with Automated Market Making (AMM) engine in association with generalised mean. While we formalise the trading practise swapping forward contracts with underlying asset, we incorporate the latest innovation in the industry - concentrated liquidity. Consequently, liquidity provider of ALEX can save decent amount of capital by making markets on a selected range of interest rate.

Introduction

ALEX stands for Automated Liquidity EXchange. It is a hybrid of automated market making and on-chain loanable fund built on Stacks blockchain network. While lenders and borrowers can minimise uncertainty by securing the loan with fixed rate and tenor, liquidity providers are able to take advantage of our capital efficiency mechanism by imposing cap and floor on the interest rate. This allows liquidity to be offered on parts of the curve that contains majority of trading activities and leads to efficient capital management.

On ALEX, lending and borrowing activities are facilitated by a forward contract based token โ€œayTokenโ€. It is similar to an OTC bilateral forward contract in the conventional financial market, which specifies underlying asset โ€œTokenโ€ and expiry date. This paper assumes ayToken is minted and ready to be exchanged. Lenders purchase ayToken at a discount to the spot Token price when the contract is initiated and reclaim underlying asset upon expiration when forward price converges to spot price. Borrowers sell ayToken in return for Token on day one and return Token upon expiration. Implied interest rate depends on how much discount that the forward price is to the spot price at the time of transaction, which is executed on AMM.

Last but not least, ALEX hopes to bridge the gap between Defi and conventional finance by applying an AMM protocol derived from one of the basic instruments in fixed income market - zero coupon bond firstly proposed by Yield Space. This empowers ALEX to learn from the fiat world and offer more decentralised financial products in the future.

This paper focuses on technical aspects of AMM and is the first of a series of ALEX papers unveiling all exciting features and applications of ALEX development.

AMM and Invariant Function

ALEX AMM is built on three beliefs: (i) it is mathematically neat and reflect economic demand and supply; (ii) it is a type of mean, like other AMMs; and (iii) it is derived and can be interpreted in terms of yield and is somehow related to conventional finance, where research has been conducted for decades.

We will firstly review some desirable features of AMM that ALEX hopes to exhibit.

Properties of AMM

ALEX AMM

After extensive research, we consider it possible for ALEX AMM to be connected to generalised mean defined as

In the rest of the paper, to be consistent with Yield Space, we employ notations below

ALEX's implied interest rate is compound. Not only does the compound rate allow us to derive mathematical formulas throughout the paper, we can also conduct further research and offer more products by referring to vast amount of literatures and applications in conventional finance, which is largely built on Black-Scholes model with compound rate employed as the discounting factor.

Trading Formulae

Out-Given-In

In-Given-Out

In-Given-Price / Yield

Transaction Cost on Notional and Yield

In the previous sections, fee is in proportion to the notional amount. This is consistent with AMM such as Uniswap. However, it could be hard to interpret in the yield space, as market participants tend to think of borrowing or lending activity in terms of rate.

Concentrated Liquidity

The idea is inspired by concentrated liquidity in Uniswap v3.

Pool with interest rate floored at zero

Initialisation

Trading

Balance of Token and ayToken, including both actual and virtual, still satisfy the invariant function. However, once the actual ayToken is depleted and only Token is left in the pool, trading would be ceased until more ayToken is deposited.

Minting and Burning

Solution to the above equations is

Example

Suppose Rachel then sells 50 ayToken to the pool on the same day. On IFC, this means ayToken amount of 150 (50 actual and 100 virtual) and the amount of 60.10 Token remaining on IFC.

Range-bound Pool

\begin{split} &x_{a}+x_{v}&=\left[\frac{L}{1+e^{(1-t)r_{c}}}\right]^{\frac{1}{1-t}}\\ &y_{a}+y_{v}&=\left[\frac{L}{1+e^{-(1-t)r_{c}}}\right]^{\frac{1}{1-t}} \end{split}

See Appendix 3 for a detailed derivation of virtual, as well as actual token reserve.

Example

We aim to show here how virtual token is able to assist liquidity providers to efficiently manage capital.

According to the figure, when current implied interest rate is 10%, without capital efficiency, liquidity provider is required to deposit 95.06 Token and 105.06 ayToken. This is in comparison with 18.39 Token and 5.06 ayToken after imposing cap and floor. In this example, the capital saving is at least 77%.

Appendix 1: Generalised Mean when d=2

Theorem

Proof

The last inequality holds because each component is positive.

Theorem

Proof

Therefore

Corollary

When d = 2,

Appendix 2: Liquidity Mapping to Uniswap v3

As Uniswap v3 is able to simulate liquidity curve of any AMM, we are interested in exploring the connection between ALEX's AMM and that of Uniswap's. Interesting questions include: what is the shape of the liquidity distribution? Which point(s) has the highest liquidity? We acknowledge that the section is more of a theoretical study for now.

Therefore

Appendix 3: Derivation of Actual and Virtual Token Reserve

As there are four unknown variables with four equations, solutions can be expressed as below

Solution to above is

Last updated