Deep Dive : Timeswap
First fully decentralized AMM based money market protocol
In the last 2 years we witnessed Decentralized Finance (DeFi) powered by the blockchain technology coming into the mainstream and solving real-world problems. Its’ power to create an open, free and fair financial system for anyone with an internet connection really shakes up the foundation of opaque, tightly controlled world of Traditional Finance. Today we are going look into the intricacies of a DeFi Protocol on Ethereum blockchain; Timeswap, a fixed income lending-borrowing protocol which aims to solve some the core problems of the current DeFi ecosystem.
Current Stage of DeFi Ecosystem
DeFi is an umbrella term for financial services on public blockchains, primarily Ethereum. Basically its can take care of all the services a bank provides — earn interest, borrow, lend, buy insurance, trade derivatives, trade assets, and so much more — but it’s faster, efficient , global and without any central third-party authority. Now, If you are new to DeFi, this article is one of the best in class .
DeFi have seen meteoric rise since summer of 2020 aka DeFi Summer. DeFi protocols have now amassed over $100 billion in capital, a staggering growth considering there was less than $1 billion locked in DeFi protocols less than 40 months ago. DeFi Protocols such as Aave, Uniswap, Maker, InstaDApp, Compound, Yearn, Sushiswap, Curve Finance are becoming household name with an ever-increasing user base, revenue and total value locked (TVL).
Although this protocols have established product-market fit for DeFi ecosystem, there is still some challenges to overcome to onboard the next Billion users in its ecosystem.
Scalability has been a significant challenge for DeFi within Ethereum with obscene transaction fees, i.e - gas costs preventing retail users from utilizing these protocols. Some solutions like Polygon, Optimism, Starkware, Arbitrum are already trying find a reasonable solution to this.
Security related incidents hackers and external third party actors, i.e-Oracles have already drained millions of dollars from the ecosystem due to manipulation of external third party actors ,i.e - Oracles. Every lending and borrowing protocol is only as strong as their weakest link i.e the price oracles that feed the liquidation engines.
Capital Inefficiency is another major challenge as in most of the current money market protocols significant portion of the capital is underutilised at best and unutilised at worst. Uniswap v3 looks like a step in that right direction.
Complexity in the current ecosystem have becoming a strict hindrance for the non-crypto native people. Protocols need to have more fluid UI/UX experience to onboard new people quickly. Multiple protocols are also not fully de-centralised, requiring a complex process of token based voting for providing simple services, i.e - creating a money pool.
Topic in discussion today, TimeSwap envisions to tackle some of this above mentioned core problems and aims to solve those by creating a protocol in this new era of DeFi 2.0
What is Timeswap
‘Timeswap is the world’s first fully decentralized AMM-based money market protocol which is self-sufficient, non-custodial, gas efficient and works without the need of oracles.’
Sounds dizzy, let’s break down some of these terms.
ANM-based money market protocol : ANM stands for Automated Marker Maker, it’s a mechanism for price discovery via an algorithm. Timeswap introduces a unique 3 variable ANM model. Money market protocol is nothing but a system to lend and borrow. Since we are in the DeFi world, those transaction will be in the form of any ERC-20 tokens, i.e- tokens that are on the Ethereum network.
gas efficient : Gas is the fee charged by Ethereum for each transaction.
works without the need of oracles : Oracles are third-party services that current DeFi protocols rely on for real-time external data like the price of assets. Automated model of Timeswap allows it getting rid of these actors.
So to sum it all up, Timeswap enables anyone to create an open market, i.e- liquidity pool from where they can lend or borrow ERC-20 type tokens based on AMM based pre-determined interest rate and collateral for a fixed time period.
Understanding 3 variable AMM
Uniswap, launched in 2018 is the first decentralized platform to successfully utilised an automated market maker (AMM). Inspired by Uniswap’s 2 variable equation, Timeswap introduces a unique 3 variable constant product equation-
X*Y*Z = K
X = Principal Pool is a virtual pool consists of all the assets deposited by the lenders.
Y = Interest Rate Pool which determines the interest rate per second of the pool, where Ratio Y/X is the maximum interest rate of the pool.
Z = Collateral Factor Pool determines the collateral needs to be posted by the borrower, where Z/X is the minimum Collateralized Debt Position(CDP) of the pool.
K = Invariance Constant Product.
As a constant product equation, when any variable in the equation changes, the other two variables rebalance to maintain the constant product. Just like when a transaction occur value of X (Principal Pool) changes , so the interest rate and minimum collateral requirements dynamically change to keep the K value constant. This enables real-time market price discovery of interest rate & collateral factors.
Additionally, there are two other pools :
Collateral Locked Pool and is equal to the amount of ERC20 collateral tokens locked in the pool by borrowers
Asset Pool and is equal to the amount of ERC20 asset tokens locked in the pool. It is the sum of assets lent by lenders & the debt paid by the borrowers
Salient Features of Timeswap
Permissionless fixed maturity lending & borrowing
Timeswap allows anyone to do fixed maturity lending & borrowing of any ERC20 token with any other ERC20 token as collateral. Fixed maturity loans allows projects/ organisations for better cash flow planning due to its less volatile nature.
Oracle Free System
Current DeFi protocols rely heavily on Oracles as they bring off-chain data into on-chain, i.e- pass external data to smart contracts on block. But recent event suggests oracle are prone to manipulation by bad actors as seen in the price manipulation attack on protocols like Harvest Finance, Compound Finance where multi- million dollar positions exploited. Timeswap pools are self-sufficient & have their own native interest rate and collateral factor discovery mechanism through 3 variable AMM model, removing the need of Price Oracles.
Flexible Risk Profiles
Timeswap offers flexibility for lenders and borrowers to decide their risk profile through flexible interest rates & collateral factors. Increasing interest rate results in lower collateral factor and vic versa. This also transcends to greater capital efficiency.
Permissionless Debt Financing
Timeswap enables projects to borrow debt with their native tokens as collateral. It’s a great way for funding new project without selling those tokens.
There are four tokens native to Timeswap pools, 3 ERC-20 token; Bond, Insurance, and Liquidity token and 1 ERC-721 token, standard format of NFT - Collateralized Debt token. Each of ERC-20 token contracts have an underlying ERC-20 token with a fixed maturity date. These token serve as a receipt for every transaction occurring on the protocol.
Bond Token (BT) : Issued to lenders as a receipt for depositing assets into the Principal Pool. Tokens amount essentially account for the principal plus interest owed after maturity to the lenders. After maturity of the pool, BT can be redeemed for the exact amount of underlying asset in the Asset pool (as long as there is a sufficient amount of the underlying asset present in the pool)
Insurance Token (IT) : Issued to lenders incase of no redeemable asset available for Bond Token (BT). Insurance tokens holder gets the claim to the collateral defaulted by the borrower after maturity, equivalent to the shortfall not covered by Bond Token redemption.
Collateralized Debt Token (CDT) : Issued to borrowers who deposit collateral and borrow assets from the pool. CDT is a redeemable ERC-721 token. The borrower has to pay back the debt before maturity to withdraw the collateral locked. If the borrower fails to pay the debt, the collateral is forfeited and distributed to the lenders. One cool thing about CDT is that it can be viewed on Opensea.
Liquidity Token (LT): Issued to liquidity providers of the pool who add both assets & collateral. LT gives the token holders a proportional claim to existing liquidity i.e. assets in the Principal pool and collateral locked in the Collateral Pool after the claims of lenders are realized.
How Timeswap Works
3 variable equation of AMM we gone through in previous section dictates the rule of lending and borrowing in Timeswap.
Lenders get interest for lending their token for a fixed time frame. They also get insurance as a proportional coverage of the pool’s paired token in case of default. Before lending, they have make the trade off between interest rate and insurance based upon their risk appetite.
Lending Transaction : (X+x)×(Y−y)×(Z−z)=K. Lenders add assets to the Principal pool which increases X. To maintain the constant product, Y and Z will decrease which in turn reduces interest rates & CDP/insurance coverage for the next lender.
They use this to borrow token with fixed interest rate and fixed time period. They have to put over and above a minimum collateral decided by the AMM equation. To withdraw the collateral they have to pay the debt before the maturity date. Borrowers make an informed choice to either pay the debt or let go of the collateral near maturity time based on which token has higher value. Every borrowers decision determines the liquidity of the pool and maintains the protocols self -sufficient, oracle less ecosystem.
Borrowing transaction: (X−x)×(Y+y)×(Z+z)=K. Borrowers withdraw assets from the Principal Pool, reducing X . To maintain the constant product Y & Z will increase thereby pushing up the interest rate and CDP.
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. Assets from principal pool, interest rate and CDP increased proportionally to maintain the same ratio, such that x=rX, y=rY, z=rZ, keeping the value of K constant.
If AMM based interest rate or collateral amount of Timeswap pools doesn’t reflect actual market values, using of arbitrage is a useful and test-tested approach to normalize the market. This method has been used extensively on Uniswap.
Arbitrage is the simultaneous purchase and sale of the same asset in different markets in order to profit from tiny differences in the asset’s listed price.
In Timeswap, arbitrage can be of various types, either exchanging with external DeFi protocols like Aave, Notional Finance, Compound etc or within two internal timeswap pools. Although it’s a market inefficiency, practice of these method will keep the exchange rates at Timeswap as close as possible to market price.
We have gone through the theoretical working of Timeswap, now it’s to get your boots on the ground. Now timeswap application is currently available only on web, not on IOS or Android. One thing to keep in mind is that the application is still in testing mode so lot’s of changes in the UI/UX experience might comes as feedbacks from the current phase of testing keeps pouring in.
So, if we click on the homepage of the application, we’ll be greeted with the market page with all the token pairs, (first one for lending, second for collateral) currently available and number of pools present on those token pairs. For now it supports MetaMask as a wallet, but I believe more and more wallet support are in pipeline.
Clicking on an individual token pair will list the all the various pools available for that pair, alongside information for that pool with an option to lend or borrow.
Lending on Timeswap App
We need to click the ‘Lend’ button on a particular pool of our choosing which opens up this pop-up.
Lender isn’t capable of claiming any token until maturity time.
Estimated APR (Annual Percentage Rate) and the collateral factor is pre-determined by the algorithm. Also this gives the user a clear-picture about how much he is going to receive as interest.
After you click on Lend, you’ll be able to see your position on the ‘Dashboard’ section. After maturity you’ll be able to claim your tokens from the ‘Dashboard’ section as well.
Borrowing on Timeswap App
Pop-up for borrowing tokens is pretty much same as lending.
When you are in a borrowed position, you can repay your debt any-time before maturity.
If you are a borrow, you’ll receive a Collateralized Debt Token (CDT) as a NFT on Opensea.
Risk Profile Selection
You might have noticed by now the ‘Customize Risk’ button on Lend or Borrow pop-up box. By activating the button the UI lets you customize your risk for each transaction.
A lower APR will reflect a lower risk tolerance and a higher APR vice versa. This risk taking calculation is reflected in the insurance/collateral that will be demanded. So, basically higher APR means less insurance and lower APR means higher insurance.
Slippage Control Mechanism
Since Timeswap is fully on-chain, there could be slippage. To avoid any unwanted deduction, Timeswap provide ‘Slippage tolerance’ settings to set the maximum limit on slippage. You can also select longest time you want to wait for a transaction to execute on the blockchain after you clicked execute.
Governance on Timeswap
Timeswap is planning to launch a governance token called Time. Creators of the protocol acknowledged these reasons for this step.
- Collection of Fee : Timeswap charges mainly two kind of fee. Transaction fee which provides incentives for liquidity providers to provide liquidity, the contract charges transaction fees to lenders and borrowers and Protocol fee which financially reward the protocol creator for building and re-building in the future as well.
- Strategic Partnership : Timeswap needs to be in partnership with other protocols and solutions for continue to grow. Many decision regarding growing the product line, marketing, supporting other projects, also needs to be taken.
- DAO treasury management :The Timeswap team plans to create a Timeswap Decentralized Autonomous Organization (Timeswap DAO) to receive the protocol fee and handle the management of the individuals working with Timeswap in a decentralized and censorship-resistant way.
I think creating a DAO is the right step for the protocol at this time as community based decision needs to drive the future of Timeswap. These also keeps the protocol fully decentralized in nature and will echo their founders motto of “automated in the center, humans at the edges”.
What’s next for Timeswap
In the present DeFi ecosystem, user’s have almost little to no choice in terms of fixed time financial instrument with custom risk management. Although it’s too early to predict , but Timeswap has a lot of potentials to grow into a mammoth scale. Now in terms of what’s next, I think lot of it depends on the general reception of public once it’s released in its a full fledged form. But assuming it’ll be successful, Timeswap can be used as a base class to build other product.
- Since Collateralized Debt Token (CDT) can be sold to other user, multiple secondary market product, such as options can be built on top of Timeswap.
- Possibility of using traditional assets such as house or land or art as a collateralized loan need to be analysed and could lead to an exciting path.
Timeswap has a vibrant community of over 28k + members on its discord server. Resources posted in the discord server are super helpful. Here is a glimpse -
It has recently announced its Gamified testnet on discord which recorded huge success of 27k + total transaction in the first week of alpha phase testing. For more details join their discord and read testnet guide here.
Timeswap is backed by top crypto venture capital funds. They completed their seed round funding led by Multicoin Capital with participation from Mechanism Capital and Defiance Capital. Follow the entire team of Timeswap here.
Timeswap’s fully-decentralised, self-sufficient, oracle less, AMM based protocol really goes in the direction of solving some of the core-problem of current DeFi world. But we need to remember that it’s still in a very nascent stage. I don’t know how this particular protocol will play out in the next couple of years, but I think we can all agree that we need more of these type of protocols to onboard billion users into the DeFi world.