Realio Network

Oct 22, 2020

7 min read

RIO Liquidity Mining Explained

Creating a balanced, sustainable liquidity rewards ecosystem

Through the launch of our (beta) LP token staking contract (Realio LP) we have officially kicked off the $RIO Uniswap Rewards Program, through which liquidity providers can earn rewards by staking RIO-ETH Uni LP Tokens through their MetaMask or WalletConnect enabled wallet.

Over the last few months, the rise of DEXes with automated market makers has brought a full-fledged paradigm shift to the DeFi landscape. For the first time in the history of crypto assets, DEXes have become a viable alternative to their centralized counterparts with volume on Uniswap surpassing that of Coinbase.

To participate, use the following links:

Realio LP Staking URL (Beta): https://defi-beta.realio.fund/ (100,000 RIO have been funded to this contract, now open to be mined by LPs)

Realio LP Staking Bonus Contract: To be released at completion of beta contract

ETH-RIO Uniswap v2 Pair Info: https://info.uniswap.org/pair/0x0b85B3000BEf3E26e01428D1b525A532eA7513b8

Github Repo for LP Staking Contract: https://github.com/realiotech/lp-staking

Upon the launch of the bonus contract, we will allocate up to 10 million $RIO as base rewards for liquidity providers of the RIO-ETH pair on Uniswap, which will be mined over the course of roughly the next year, at a rate of 5 $RIO per block (subject to change prior to contract release). In order to kickstart the program, there will be a bonus of an additional 10 million $RIO to be earned at a rate of 100 $RIO per block for each of the first 100,000 blocks (about two weeks). These bonus rewards will become harvest-able at a rate of 5 $RIO per block however (also subject to change) in order to avoid some of the supply/demand imbalances created by the reward structure of other DeFi projects.

Most liquidity provider “reward” tokens are given out across many pools, mainly to incentivize users to join the issuers platform (ie. sushi). Because of this, there is no connection created between new supply and the provision of liquidity for the reward token.

When the rewards go only to those providing liquidity for the reward token itself (as in the case of $RIO rewards), incentives are aligned like mining on a network. Its a “proof of liquidity” scenario where everyone earning block rewards takes the risk of impermanent loss that may be caused by the disposition of harvested rewards.

All RIO tokens awarded during the bonus period are time-locked and released at a rate equal to the base rewards, but only as long as LPs maintain their liquidity. Note that LPs can unstake their tokens at any time and keep all RIO they mined through the base rate, plus any bonus tokens they have released so far, but they will forgo all rights to claim bonus tokens that are still locked.

LPs who join for the bonus blocks will be able to harvest their % share of rewards at an overall rate of 10 RIO per block until such LP has exhausted its earned bonus allocation (earned at 100 per block). Thereafter, such LP will earn only the base reward.

When an LP who has earned bonus allocation (which is not yet harvest-able) withdraws from being an LP, the un-harvested (now unallocated) bonus will then increase the overall earned bonus allocation of all remaining LPs who qualified for the bonus, pro-rata based on such LPs % of the bonus pool.

With this release, we hope to create a liquidity mining program that both incentivizes the early provision and staying loyal to the RIO liquidity pool.

Besides providing liquidity to the RIO-ETH Uniswap pool, you can also use RIO tokens to earn regular staking rewards. If you want more info about staking on the Realio issuance network, check out our guide to RIO and RST staking. https://medium.com/@Realio_Network/a-guide-to-rst-rio-staking-on-the-realio-platform-62172f957f92

Contract Overview and Explanation

The Realio LP contract was sourced from the Masterchef contract, however we have made a few critical improvements. We have changed some features of the contract to include a bonus period with time released rewards that reward users for holding their stake in the contract, rather than incentivizing short term mining and selling of the reward tokens.

Stake LP tokens and earn RIO rewards

Users should be able to interact with the contract and stake (deposit) their LP tokens into a contract pool. As blocks progress, each user receives rewards based on when they originally staked their LP tokens.

Phases of the Contract

The smart contract has four phases; pre-bonus, bonus, bonus time release, post bonus reward end. These values are determined at contract creation time. Pre-bonus period begins at the contract start block and ends at bonus start. Bonus period begins at the contract’s bonus start block and ends at the bonus end block. Bonus time release period begins the first block after the bonus end block and continues until the RIO reward end block. The RIO reward end block is defined at contract creation time and is calculated by finding the total bonus RIO available to the stakers of the contract (number of bonus blocks multiplied by RIO bonus reward per block (static value of 100)) then dividing the total bonus RIO by bonus RIO harvest-able per block of 5 (static value of 5) to find the number of time release blocks needed to distribute all the bonus RIO.

Earning Bonus RIO rewards

Users that have staked LP tokens in the contract prior to or during the bonus period are eligible to receive bonus payouts. Bonus payouts are done at a rate of 5 RIO per block immediately after the bonus block has been reached. Bonus RIO is accumulated to the tune of 100 RIO per block while in the bonus period. After the bonus period has concluded the accumulated Bonus RIO is continuously distributed at a rate of 5 RIO per block until the calculated bonus payout end block is reached.

Rewards

The contract calculates rewards by determining the share of RIO earned per LP token in the pool. The share of RIO per LP Token is then multiplied by the user’s share of the LP tokens in the pool minus any rewardDebt the user has. Reward debt is an important value. Reward debt is the total RIO distributed by the contract up to the block when the user deposits, withdraws or harvests from the contract. Users will have 3 types of debt to track the 3 types of RIO they are eligible to earn.

Base Functionality of Contract

Contract may have many pools, however only RIO-ETH will be included during the bonus blocks. We may consider adding additional pairs in the future after market stability is achieved.

  • A pool has an LP token, map of users, accRioPerShare, accBonusRioPerShare, accUnlockBonusPerShare

Each pool has a set of users (stakers)

  • Each user (staker in a pool) has rewardDebt, bonusRewardDebt, bonusUnlockRewardDebt, stake block number (block in which the user originally staked their tokens)

Bonus Rewards

  • Reward 5 RIO per block for staking LP tokens in contract
  • After the reward period has completed release 5 RIO across all pools to users that staked before or during the bonus period.
  • If a user removes all their stake they lose all their bonus yet to be earned and that bonus is returned to the pool for distribution amongst other bonus stakers
  • If a user removes some but not all of their LP tokens their share of the bonus decreases based on the percentage of LP tokens removed from the pool
  • If a user increases the number of LP tokens in the pool they can increase their share of the bonus provided they had not removed their LP tokens entirely at any point in time.
  • Stakers should be able to quantify total bonus they have earned
  • Stakers should be able to determine what is bonus RIO for harvest vs RIO for pool share

Funding the contract

  • Anyone may call the contract fund method but it’s intent is to pass RIO into the contract that is not able to be touched by the owner

Add a Pool

  • Creating a LP staking pool requires the LP token contract address, and a weight to assign to the pool.

Set a Pool Weight

  • Mutate a pool to change its weight amongst other pools. The weight will determine how many of the 5 RIO per block goes to the pool for distribution amongst the stakers

Stake in a Pool

  • A user deposits LP tokens into a pool in the contract

Update a Pool

  • Forces a recalculation of rewards inside the pool

Harvest rewards from a Pool

  • Updates the pool
  • Transfers any pending rio rewards to the user’s wallet
  • Updates the user’s pool values

Withdraw from a Pool

  • Updates the pool
  • Transfers any pending rio rewards to the user’s wallet
  • Updates the user’s pool values
  • If a user withdraws all their LP tokens in the pool any bonus rewards earned get redistributed to the accumulated bonus rio.

View user’s pendingRio

  • A view to show how much RIO the user has earned and is harvestable at any point in time

View user’s pendingBonusRio

  • A view to show how much Bonus RIO the user has accumulated at any point in time

View user’s pendingUnlockBonusRio

  • A view to show how much Bonus RIO the user has earned and is harvestable only after the bonus round is complete

If you have any further questions, you can join our Telegram (t.me/realio_fund) and we would be happy to help. Also, do not forget to follow us on Twitter for more updates!