How it works

Timeswap pools work on a unique 3 variable AMM and as users interact with the pool through lending or borrowing transactions, the pool reserves change, thus shifting the interest rates & collateral required. Lending more assets into the asset pool decrease the interest rate & minimum collateral required whereas borrowing more assets from the pool increase the interest rate & minimum collateral required.
When interest rates or collateralization factors of Timeswap pools deviate from the market values, we expect arbitrageurs to normalize the markets through either a lending or a borrowing transaction, similar to Uniswap.

Lenders:

Lenders use the protocol to receive interest for lending their tokens in a fixed maturity setting. They also receive insurance in terms of the pool’s paired token, which gives proportional coverage to the unrealized assets from the bond tokens This explicitly gives each lender control over how much default risk he or she wants to take vs the interest rewards he or she will receive.
Lending transaction:
(X+x)×(Yy)×(Zz)=K(X+x)\times(Y-y)\times(Z-z)=K
As
xx
increases, the reserves of
YY
and
ZZ
have to decrease to maintain the constant product. As
yy
increases,
zz
has to decrease and vice versa.

Borrowers:

They use this protocol to borrow tokens with fixed interest values and a fixed maturity setting. They lock collateral stakes at whatever amount they are comfortable over and above a minimum collateral derived by the AMM. The collateral locked will never be liquidated in the life of the debt. Borrowers have to pay the debt before maturity time to withdraw their collateral stake, if not, their collateral will be distributed to lenders.
Near maturity time, when the value of the collateral is greater than the value of debt, we expect the borrower to pay the debt, but when the value of the collateral is less than the value of debt, we expect them to default. It is this rational behavior why the price feeds and oracles are not needed in the protocol. Liquidation happens automatically based on the decisions of each borrower.
Borrowing transaction:
(Xx)×(Y+y)×(Z+z)=K(X-x)\times(Y+y)\times(Z+z)=K
As
xx
decreases, the reserves of
YY
and
ZZ
have to increase to maintain the constant product. As
yy
increases,
zz
has to decrease and vice versa.

Liquidity Providers

Liquidity providers are the market makers of the pool. They add tokens into the pool and make both lending and borrowing transactions at the same time. They earn a spread between lenders and borrowers which is based on the number and size of transactions of the pools. They help add liquidity to facilitate transactions between lenders and borrowers.

Liquidity Addition transaction:

(X+x)×(Y+y)×(Z+z)=K(X+x)\times(Y+y)\times(Z+z)=K
The value of
xx
,
yy
and
zz
is calculated to maintain the same ratio between
XX
,
YY
and
ZZ
, such that
x=rX,y=rY,z=rZx=rX , y=rY , z=rZ