Introducing the Automated Price Reserve (APR)

Anton Buenavista
Kyber Network
Published in
6 min readJan 23, 2019

--

UPDATE: Read about Kyber APR’s advantages over other models, including how it is more capital-efficient and provides lower slippage market making.

In order to further grow our network of reserves, we developed a new reserve type — the Automated Price Reserve (APR), mainly targeting entities such as token teams with larger token holdings, but without the need to commit extensive technical resources to maintain the reserve. In this post, we will explain the process of creating an APR, its specifications, the motivations behind it, and the current state of our liquidity network.

How the APR Works

The Automated Price Reserve relies on Kyber’s pre-defined algorithm set in the smart contract to automatically provide conversion rates for a token. It changes the price of the token based on the trades performed and the ETH/token inventory.

It starts with an initial supply of Ether and tokens and an initial price set at deployment which does not change until a trade occurs. Depending on the change in price with respect to the price of ETH and on market conditions (for example if users mostly BUY or users mostly SELL), the ETH or token inventory needs to be replenished in the reserve.

The figure below shows an example of how the price of the token changes as trades occur and based on the initial ETH and token inventory deposited in the reserve.

Figure 1: The price function, with relevant parameters, indicates the change in price with respect to the change in inventory as trades occur

Process for Creating an Automated Price Reserve

Creating an APR is a simple 3-step process. First, the following smart contracts need to be deployed on the blockchain: KyberReserve.sol and LiquidityConversionRates.sol. Second, the reserve manager deposits the initial ETH and token inventory into the reserve contract. Lastly, the reserve manager invokes the function setLiquidityParams() in the LiquidityConversionRates contract to set the liquidity parameters. After which, the reserve will be able to market make until its own inventory is depleted. Invoking setLiquidityParams() should be done once at the deployment of the reserve, and subsequently whenever inventory in the reserve is replenished.

The reserve manager needs to only decide on the initial liquidity parameters of the APR. Specifically, the following information needs to be considered:

  1. Liquidity Rate
  2. Initial Ether Amount
  3. Initial Token Amount
  4. Initial Token Price
  5. Minimum and Maximum Supported Price Factor
  6. Maximum Buy and Maximum Sell Amount in a Trade
  7. Fee Percentage

These information will be used to calculate the parameters needed to pass into the setLiquidityParams() function.

Parameter Description

The parameters are as follows:

function setLiquidityParams(uint _rInFp, uint _pMinInFp, uint _numFpBits, uint _maxCapBuyInWei, uint _maxCapSellInWei, uint _feeInBps, uint _maxTokenToEthRateInPrecision, uint _minTokenToEthRateInPrecision)

There are several things to take note of in the list of parameters. First, notice that some parameters will have the InFp suffix. InFp refers to formula precision. While this is configurable, 2⁴⁰ is the recommended value.

r is liquidity the rate in which the price should move each time the ETH/token inventory changes in 1 ETH worth of quantity. For an r of 0.01, the price will move 1%. r is calculated taking into account the amount of initial ETH and tokens deposited into the contract, and the desired minimum/maximum price factor ratio. A smaller r also means more ETH and token inventory is needed to facilitate the liquidity.

For the minimum/maximum price factor ratio, it is recommended to start with a ratio of 0.5:2.0. This indicates that the inventory will suffice for up to 100% increase or 50% decrease in token price with respect to ETH.

Below is an example table for a token with a price of 0.00004258 ETH:

Setup Guide

For a more detailed guide on deploying and testing an Automated Price Reserve, visit our documentation page. If you have any feedback or questions, you can find us in the Kyber Developer telegram group.

The Motivation for APR

The first reserve type, the Fed Price Reserve, provided the means to bootstrap liquidity in the network. Entities that would like to provide liquidity to the ecosystem with their token holdings are able to do so while being able to manage the reserve entirely on-chain. However, the flexibility of managing a Fed Price Reserve came with a relatively steep learning curve and development costs that arose from having to build, run, and maintain an off-chain server and/or scripts to feed prices on-chain.

Unlike the Fed Price Reserve, the APR was created with ease of maintenance as the top consideration. As such, the APR is capable of calculating the conversion rates entirely on-chain in the smart contract. This means that the reserve managers no longer need to incur the development costs described above.

However, this comes with the trade-off of not having as much control over the pricing algorithm because the reserve manager relies on the pre-defined algorithm in the smart contract. Another trade-off of the APR is higher financial costs upfront due to the initial inventory of ETH and tokens needed to perform automated market making. Moreover, it is important to note that one APR can only support one type of token. If another token needs to be supported, another APR needs to be deployed.

The APR was also designed to help discover the price of a newly created token that was previously not available in any centralized or decentralized exchange. Through the interaction of buyers and sellers, an estimated market price is discovered based on the market’s sentiment at a point in time.

Key APR benefits

  • Kyber APR is highly suited for token teams that want to list their tokens and individuals who want to utilise their large token holdings.
  • For the same price range and inventory, Kyber’s APR can provide a lot more liquidity, better slippage, and has the ability to serve more volume than other platforms e.g. uniswap.
  • APR allows Reserve managers to: a) Provide liquidity for over 100 integrated platforms b) Market make for profit on each trade c) Save funds and resources by efficiently utilizing token inventory

Growing the Shared Liquidity Pool

Moving forward, the Automated Price Reserve will be one of the available choices that new liquidity providers can use to provide liquidity to the ecosystem. They can choose the classic Fed Price Reserve for more flexibility and control, or use the APR for ease of manageability and to incur less costs.

BigBom was the first project to utilize the APR. Since then, we’ve continued to operationalize and support the rollout of the APR to several other projects such as Midas Protocol, Distributed Credit Chain, Dether, and The Abyss, with more to come in the near future. We have a total of 16 reserves in the network to date.

Through continuous collaboration with new potential liquidity providers, we are aiming to further grow the shared liquidity pool in the ecosystem. More liquidity results to more seamless swaps taking place across different interfaces, therefore increasing adoption for decentralized applications. We are very excited to see new liquidity providers use the APR to help grow liquidity in the network.

Read about the APR’s advantages over other models and the APR documentation.

About Kyber Network

Kyber’s on-chain liquidity protocol allows decentralized token swaps to be integrated into any application, enabling value exchange to be performed seamlessly between all parties in the ecosystem. Using this protocol, developers can build innovative payment flows and applications, including instant token swap services, ERC20 payments, and financial DApps — helping to build a world where any token is usable anywhere.

Kyber is the most used and integrated decentralized finance (DeFi) protocol in the world, with over US$1Billion worth of transactions facilitated since its inception. Kyber supports over 80 different tokens, and powers over 100 integrated projects including popular wallets MEW, Trust, Enjin, Argent, and the HTC Exodus smartphone, as well as DeFi platforms Nuo, DeFiSaver, InstaDApp, Set Protocol, Melon, and many others.

Discord | Website | Blog | Twitter | Reddit | Facebook | Developer Portal | Kyber Tracker | KyberWidget Generator | APR documentation

--

--