andywan

Posted on Jan 18, 2022Read on Mirror.xyz

Tokemak

https://docs.tokemak.xyz/

What is Tokemak?

Tokemak is a novel protocol designed to generate deep, sustainable liquidity for DeFi and future tokenized applications that will arise throughout the growth and evolution of web3.

It can be thought of as a decentralized market making platform and a liquidity router that disaggregates traditional liquidity provision and market making for DeFi. Sitting a "layer above" decentralized exchanges, Tokemak allows for control over where the liquidity flows, and also offers an easier, cheaper way for providing and sourcing liquidity.

The Current State of Liquidity in DeFi

The current state of DeFi is comprised of fragmented, unpredictable, and expensively sourced liquidity. Builders of new projects bear massive costs pursuing liquidity solutions through incentivized "pool 2's," which can dry up when the incentives are exhausted. Providing 50/50 paired liquidity is expensive for an individual, and has the looming risk of impermanent loss. Traditional market making solutions are opaque for native DeFi builders, highly centralized, and expensive. Finally, reliance upon whales to provide liquidity results in a perpetual state of uncertainty.

Insufficient liquidity results in poor pricing and volatility. This negatively impacts projects/DAOs seeking deep liquidity for their tokens, exchanges looking to offer the best possible pricing, and the individual, hoping to avoid slippage due to the price impact of their trade. Additionally, protocols interacting with other projects' tokens require reliable liquidity.

High Level Protocol Functionality

Tokemak enables users to both provide liquidity and control where that liquidity goes.

Liquidity Providers deposit single-sided assets into individual Token Reactors and/or Genesis Pools (ETH, USDC), and earn yield in the form of TOKE, Tokemak's native protocol token.

Liquidity Directors stake TOKE into individual Token Reactors and vote how that liquidity gets paired from the Genesis Pools and to what exchange venue it gets directed. They too earn yield in the form of TOKE.

TOKE can be thought of as generalized or tokenized liquidity. TOKE holders are able to generate liquidity on demand for whatever tokens they want, on whatever exchange they want, by controlling and directing Tokemak's TVL.

Tokemak has several different mechanics and guardrails in place to mitigate IL risk to ensure that Liquidity Providers can always claim their underlying assets deposited, 1:1. These mechanics involve some risk to TOKE stakers, but only as a last resort.

The protocol captures fees from providing liquidity across DeFi. Over time, this will allow Tokemak to build a strong reserve of various assets in Tokemak's PCA (Protocol Controlled Assets). In the end, the PCA is controlled by TOKE holders through decentralized governance.

Tokemak allows for unique composability opportunities for new and existing token projects and DAOs, allowing for more strategic liquidity deployment, ownership, and control.

It offers opportunities for exchanges to reinforce their liquidity and for market makers to leverage the PCA to create deep liquidity for a specific project.

Eventually, Tokemak will allow for new projects to stand up their initial liquidity as determined by TOKE governance.

Key Terminology

Base and Quote Assets

In the example SUSHI/ETH, SUSHI is the base asset and ETH is the quote asset.

Cycles

Tokemak deploys liquidity on Cycles, which will be set to weekly upon live liquidity deployment. Assets deposited or TOKE staked mid-Cycle only become 'active' when a new Cycle begins. Assets requested to be withdrawn cannot be fully withdrawn until a new Cycle begins. TOKE rewards only begin for newly deposited assets or staked TOKE at the start of a new Cycle. See Cycles for more info.

Liquidity Directors

Liquidity Directors (or LDs) are users that stake their TOKE and allocate votes to a specific Token Reactor, in order to direct the inventory of a specific asset as liquidity to a preferred exchange. LDs can acquire TOKE through providing liquidity in the form of rewards, or traded on the open market.

LDs also earn % APR rewards in the form of TOKE for directing liquidity. This APR is a variable rate which is dependent upon a number of factors, discussed more in depth in the Reactor Balance & Rewards Logic section.

TOKE votes for liquidity direction is queued to be deployed on the next Cycle. LD TOKE reward emissions don't begin until the beginning of the following Cycle.

Liquidity Providers

Liquidity Providers (or LPs) are participants that deposit (single asset stake) assets into a specific Token Reactor, in order to contribute to the inventory that will then be paired and deployed as liquidity.

LPs earn % APR rewards in the form of TOKE. This APR is a variable rate which is dependent upon a number of factors, discussed more in depth in the Reactor Balance & Rewards Logic section.

LPs assets are then queued to be deployed on the next Cycle. LP TOKE reward emissions don't begin until the beginning of the following Cycle.

Pair Reactors

Pair Reactors are pooled deposits (by LPs) of ETH and other stablecoins that can then be paired with assets from Token Reactors (see below). LDs can stake TOKE to the Pair Reactors, to balance and determine the depth of pooled Pair Reactor assets needed for optimal liquidity deployment, while also acting as Pair Reactor collateralization.

PCA (Protocol Controlled Assets)

The PCA, or Protocol Controlled Assets, is in reference to: Tokemak's treasury, the assets within the protocol that are utilized for liquidity deployment, asset reserves utilized for IL mitigation, and trading fees accrued from providing liquidity.

Pricers

For any non-AMM exchange (order book or RFQ venue) where a third party participant is required to provide real time pricing, Tokemak sources Pricers (otherwise known as traditional market makers) in order to set the bid/offer prices. More information will be announced soon regarding this Pricer network.

Token Reactors

A Token Reactor is simply another name for a specific asset's Tokemak reactor. Tokemak is the name for the protocol at-large, and an individual "Tokemak" is known as a Token Reactor.

LPs deposit their assets into Token Reactors, and LDs allocate their staked TOKE to specific Token Reactors in order to direct liquidity of that asset, earning specified Token Reactor APR.

Cycles

Tokemak operates on epochs known as Cycles.

  • If you deposit assets as an LP or stake TOKE as an LD mid-Cycle, you’ll begin to earn TOKE at the start of the next Cycle.
  • When liquidity deployment begins, your assets deposited will not be deployed as liquidity until the start of the next Cycle.
  • When you want to withdraw, you must first “request” to withdraw, and assets will only then be able to be fully withdrawn at the start of the next Cycle.
  • TOKE rewards are only claimable weekly.

Tokemak is currently in its pre-liquidity deployment phase (Cycle Zero). Cycle deposits and withdrawals are currently set to 24 hours, however, TOKE rewards are still only claimable weekly, around 1:00-2:00 PM UTC on Fridays.

When liquidity deployment goes live, Cycle deposits and withdrawals will also be set to weekly.

The Cycle functionality, designed for network stability and health, is defined as follows:

Liquidity Providers

An LP can deposit their assets into a given Token Reactor or Genesis Pool at any given time. TOKE reward emissions for LP's will not begin until the assets are then deployed and locked for the duration of the next Cycle. These rewards will not be claimable until the end of the following Cycle.

Once an LPs assets are deployed, a request function can be called for the withdrawal of specified assets, however they will not be claimable until the beginning of the next Cycle. Once your assets are removed from deployment at the end of a Cycle, they will be staged for the user to either claim or redeploy.

Liquidity Directors

An LD may stake TOKE into a Token Reactor at any time leading up to a new Cycle. An LD may then choose where to direct liquidity, however, the TOKE will not be actively directing liquidity until the rollover into the new Cycle. When the new Cycle begins, the LDs will start earning TOKE rewards and their chosen liquidity direction will be effectuated.

Once an LDs TOKE is staked and the new Cycle begins, the chosen exchange where the liquidity has been directed may not be redirected until the start of the new cycle. The LD may choose to redirect this liquidity, but it won't be enacted until the Cycle rolls over. Similarly to the LP, the LD may submit a request to pull their TOKE from the system, however it will not be claimable until the end of the current Cycle. When the Cycle ends, the TOKE will be staged and can then be claimed. TOKE rewards are claimable at the end of a given Cycle, and can then be added to your current TOKE stake to compound liquidity directional power.

Pricers:

More info on the Pricer network and their integration into Cycles to be announced soon.

Cycles in the UI:

You can always see what Cycle Tokemak is currently in clearly in the upper left hand of the dashboard:

tAssets (tABC)

tAssets are tABC tokens that a Liquidity Provider receives when they deposit tokens into a Token Reactor. These tABC tokens represent your underlying claim to the assets you deposited into the token reactor, available to be redeemed 1:1 at any time (pending Cycle withdraw period).

tAssets are transferable, however, whichever wallet holds the tABC tokens can claim the underlying deposited assets, as well as begins accruing the rewards for those deposited assets at the time of receipt.

Analogous to AAVE's "a" tokens, these assets are 1:1 representative of your stake and is subsequently burned when claiming the underlying asset.

Example: if you deposit 750 SUSHI into the SUSHI token reactor, you will receive 750 tSUSHI. In order to claim your underlying asset, you must call the withdraw function, wait for the current Cycle to end, and have your 750 tSUSHI in your wallet when they become claimable. This will in effect burn the tSUSHI tokens in order to receive the underlying asset (750 SUSHI).

Navigating Tokemak (UX)

Note: Tokemak's full dApp/UI is currently being finalized. This section will be updated frequently, so check back for updates.

Current UI Navigation (Tokemak Cycle Zero)

After "Entering the Tokemak" dApp, you'll notice a Connect Wallet button in the top right, where you'll connect your Metamask or preferred browser or hardware wallet:

Once your wallet is connected, you'll notice a number of informational items and options:

In the top left, you'll see the current and next Cycle. There is also a link to current Rewards.

In the center, you'll notice the total (non-TOKE) TVL as well as the TOKE TVL. TOKE and non-TOKE TVL are separated to clearly indicate in the future how much TVL there is from LPs vs. LDs.

Above that, there's a button to access your Dashboard to see your assets at a glance.

Below all of this, you'll find the current Cycle Zero pools and their respecting APR's: ETH, USDC (Genesis Pools), TOKE single asset staking, and the Sushi and Uni LP pools. The Deposit button will trigger a modal with two options: Deposit or Withdraw:

Depositing is pretty straight forward, but withdrawing assets requires a two-step process. You must first "REQUEST WITHDRAWAL," which will trigger a request to withdraw the indicated amount of assets from the system. They will not be fully available to withdraw until a Cycle ends. When a Cycle concludes and rolls over into the next, your assets will then be fully withdrawable and will require a second transaction to withdraw them to your wallet.

When you access the Dashboard, you'll find your total balance in USD as well as assets locked in the system (on the left side, highlighted in green).

You'll also see any potential or claimable "Rewards."

Underneath "Withdrawals," you'll find any assets that are currently available to be withdrawn. Remember, you must first "Request" to withdraw assets and they'll only become fully withdrawable at the end of the current Cycle. Once they're able to be withdrawn, they'll appear in this column and will no longer be earning TOKE rewards.

Upcoming UI Updates

As we conclude Cycle Zero, there will be some updates to the UI. See above for a WIP version. Similar to C.o.R.E. voting, staking TOKE into Tokemak will grant you votes that can be allocated to specific Token Reactors (FXS Reactor pictured above) in order to direct assets in a Token Reactor as liquidity to exchanges. On the left side of the FXS Token Reactor, there will be a Deposit/Manage button that will trigger a modal similar to the one seen previously in the Cycle Zero version of the dApp.

General Overview

General Introduction

As a reminder, Tokemak orchestrates the provisioning of liquidity across DeFi by coordinating actions across Liquidity Providers (LPs) and Liquidity Directors (LDs). LPs provide assets via single sided staking into the system, and the LDs direct that liquidity to AMMs/exchanges via staking and voting with their TOKE.

LPs play a central role in the operation of Tokemak and are held sacred. The mechanics have been designed to, in combination with the deployment guardrails, mitigate potential impermanent loss (IL) for LPs while keeping the protocol in a safe operational state.

The mechanics are set up in such a way that the LPs are protected from impermanent loss (IL), which is accomplished through a surplus/deficit management, reserve and TOKE staked as collateral.

The goals of the protocol are to provide sustainable liquidity across DeFi while increasing the Protocol Controlled Assets (PCA) and protecting LPs from impermanent loss.

Basic Mechanics of a Tokemak Liquidity Deployment

The below illustration depicts the mechanics of a Tokemak deploying liquidity to an outside trading venue (while we will be focusing on automated market makers as these represent the main concern in regards to IL, the same general mechanics apply when liquidity is deployed to order book exchanges)

LDs direct the assets from LPs into Uniswap

  1. LPs provide one-sided liquidity to Genesis Pools (the Tokemak ETH and stable

    coin pools) and the individual token reactors (assets)

  2. 2.Liquidity Directors (LDs) stake TOKE to the token reactor(s) and direct the liquidity to their chosen trading venue

  3. 3.The system determines the amount to be deployed according to the quantity of the asset held in the reserve (and the TOKE staked to the specific reactor), see section “Deployment Logic”

  4. 4.Finally, the system draws appropriate quantities of both assets from the Genesis Pools and the asset side of the reactor and deploys them as directed by the LDs

System Reserve and Operational Surplus

Operational Surplus

One of the main sources of value that is utilized to maintain or increase the PCA is the operational surplus, the surplus in asset quantities resulting from the change of their ratio occurring in AMM pools (same mechanism that results in the asset deficit).

These operational surpluses from which the system draws have to be looked at from both the reactor and system level, as the system tries to rebalance and optimize on both levels.

System Reserve

The system reserve represents the primary source of assets to be paid out to make LDs whole. As a result of the two collateralization events the system will have surplus of both ETH / stable coins and the initially supported assets in its PCA. These will be utilized in internal swaps (with e.g. assets from the operational surplus) if a loss occurs.

First the reserve is used to make LPs whole, followed by using TOKE staked to that reactor. As an ultimate backstop, ETH or stables can be drawn from the reserve, in case an internal swap for the asset in deficit is not possible. This scenario should not occur unless incorrect guardrails are put in place for the deployment, or a relative price change larger than mitigated by the guardrails occurs.

Impermanent Loss

Individual LPs usually view impermanent loss as the difference in total value of the assets deployed after shifting of the ratio of the pool assets due to a change in their exchange rate (“sell the winner, buy the loser” – very similar to a constant mix strategy in portfolio management) compared to simply holding both assets.

Tokemak views impermanent loss from the perspective of the negative change in quantity of one of the assets deployed to a AMM trading venue. In other words, Tokemak tries to ensure that LPs can withdraw the same quantity of assets they initially deposited into the system. This approach combined with other specifics of the system allows for rebalancing of assets that should only result in a net loss on the system level in extreme market conditions.

Deployment Logic

  1. General The quantities of assets deployed to outside venues are dictated by the following guardrail factors. More detailed information on the guardrails can be found in the "Guardrails & Impermanent Loss Mitigation" section. Assets in reserve (eg ABC) Do not deploy more than 3x the qty available in the reserve ("Reserve Multiple") LP provided base asset available to pair (eg ETH) If not enough provided by LPs the available base assets are pro rata distributed across reactors. TOKE staked to the reactor Ideally, enough TOKE should be staked to the reactor to result in TOKE staked + ABC reserve = LP ABC, or in other words two thirds of the value of deployed LP assets should be staked by LDs. Note that these are starting parameters and we will be able to significantly relax these as more data becomes available. The below detailed logic is set up in such way that if followed in order will result in the correct deployed amount.
  2. Deployment Logic & Equations
  3. Based on assets in reserve In a first step, the assets provided by the LPs (AssetLP) are passed through the first guardrail. The assets available in reserve multiplied by the reserve multiple (3) determine the maximum amount of LP assets deployable (LPAsset_Deployable1). This guardrail is applied to both the LP provided assets and the Genesis pool. This guardrail is calculated based on Qty.

  1. Based on ETH available to pair In a second step, the system compares the amount of available ETH in the Genesis pool (after applying the reserve guardrail) to the LP provided assets in order to determine if all assets can be paired up with ETH. Should not enough ETH be available in the Genesis pool, the system will proceed by equally distributing the ETH across the reactors. This guardrail is calculated based on notional value.

  1. Based on TOKE staked to the reactor The last step is to assure a minimum amount of TOKE is staked to the reactor by the LDs. While more TOKE can be staked to a reactor the value of ABC deployed is not to surpass 1.5x the value of the TOKE staked to the reactor. This is calculated based on notional value.