Staking Machanism Explained

All staker need to know when staking tokens in InsurAce.io

Stake

Pools

Pools are fundamental elements in the InsurAce.io mutual insurance model. They are built as liquidity reservoirs. InsurAce.io Protocol provides coverage capability backed by substantial capital gathered in the pools.

The DeFi market is dynamic, and tremendous DeFi tokens are available in the market. InsurAce.io builds token pools based on the below considerations following market development:

  • Popularity

  • Liquidity

  • Price Volatility

Currently, InsurAce.io provides the following staking pools:

InsurAce.io may introduce new capital pools based on market development.

LPTokens

LPTokens are tokens used to prove the stake of the corresponding principal token (ETH/DAI…) in InsurAce.io pools. The lifecycle of LPTokens is

  • LPTokens are minted and attach to the staker's wallet when the staker starts staking.

  • Once the staker withdraws the principal tokens (ETH/DAI…) from the respective capital pool, its corresponding LPTokens are burned by InsurAce.io.

  • LPTokens, as of now, is non-transferable, non-exchangeable, does not consider an asset to be staked in another platform.

  • Do not burn the LPTokens to avoid loss in the principal token in the pool.

The end-user does not need to interact with LPTokens directly.

Capital Pool Factor

LPTokens are minted are based on capital pool's factor μμ

μt=LPTokentPrincipaltμ_t = \frac {LPToken_t} {Principal_t}

where

  • tt is the principal token of the pool

  • Principalt{Principal_t}is the remaining principal token in the pool

  • LPTokentLPToken_tis the remaining LPToken in the pool

In other words, μtμ_tis the amount of LPTokentLPToken_tyou will get when you stake 1 Token tt.

LPToken Minting

The formula for LPTokens minting is

ΔLPTokent=μt×Staket\Delta{LPToken}_t = μ_t \times{Stake_t}

where

  • tt is the principal token of the pool

  • StaketStake_tis the amount of principal token end-user staked in

  • ΔLPTokent\Delta{LPToken}_t is the Amount of LPTokens tt to be minted

Example

Take ETH capital for example. A staker is staking 10 ETH into our capital pool. The ETH pool's factor μETHμ_{ETH}is 1 at that moment. The amount of LPTokenETHLPToken_{ETH}he will get is

ΔLPTokenETH=μETH×StakeETH=1×10=10\Delta{LPToken}_{ETH} = μ_{ETH} \times Stake_{ETH} = 1 \times 10 = 10

Rewards

Staking is considered one of the key elements to building up the InsurAce.io. INSUR, as the governance token, will be rewarded to all the stakers, based on the below formula:

INSUR Distribution Formula for staking

Rewards are calculated based on the below formula

Rewards=t=0T(X×Y×N×KZ×J)Rewards = \displaystyle\sum_{t=0}^T ( \frac {X \times Y \times N \times K} {Z \times J})

where

  • X = INSUR Released Per Block

  • Y = Token Pool Weightage

  • Z = Total Pools Weightage

  • K = Amount of LPTokentLPToken_t staker holding

  • J = Total Supply of LPTokentLPToken_t

  • N = Number of Blocks between events

  • T = Sequence of Stake or Withdraw Happened

To better understand the above formula, here comes a straightforward example. Assuming we have:

  • Two Token Pools, one is ETH, the other one is DAI

  • Weightage for each pool is 50:50

  • Per block, we release 2 INSUR token

  • UserA stake in 1 ETH in block 1

  • UserB stake in 1 ETH in block 10

Some calculations:

  1. For ETH pool, per block INSUR released will be (2 * 50)/(50 + 50) = 1 INSUR

  2. From block 1 to block 10, only UserA here, so the reward for him is (10 - 1)*1*1/1 = 9.

  3. Block 10 onwards, since UserB also joins the party, these two will share the INSUR per block.

    1. UserA, reward per block is 1*1/(1+1) = 0.5

    2. UserB, reward per block is 1*1/(1+1) = 0.5

The more blocks a staker experienced or, the more staker staked in, the more INSUR token the staker will be rewarded.

APY Calculation

Step 1: Calculate the reward per block of a mining pool

where

  • R = The reward per block of the mining pool (in INSUR)

  • RallR_{all}= The total reward for all mining pools (in INSUR), obtained from the rewardPerBlock function in StakersPool contract.

  • W = The weight of the mining pool, obtained from the poolWeightPT function in StakersPool contract.

  • WallW_{all}= The sum of the weights of all mining pools, obtained from the totalPoolWeight function in StakersPool contract.

Step 2: Calculate the APY of a mining pool

where

  • A = The APY of the mining pool

  • N = The number of blocks mined in a year. For the Ethereum blockchain, this is set to the number of seconds in a year / average block time = 365 x 24 x 60 x 60 / 15 = 2102400.

  • R = The reward per block of the mining pool (in INSUR), obtained from step 1.

  • PINSURP_{INSUR} = The price of INSUR (in USDC), can be obtained from any price provider.

  • V = The total value locked in a mining pool, obtained from the stakedAmountPT function in StakersPool contract.

  • P = The price of the token of the mining pool (in USDC), can be obtained from any price provider.

Example

Before we can calculate the APY of the INSUR mining pool, we need to know the staking data (by querying the blockchain) and the prices of the tokens.

The StakersPool contract (address: 0x136D841d4beCe3Fc0E4dEbb94356D8b6B4b93209) has functions that provide the staking data we need.

  • function rewardPerBlock() view returns (uint256) : We can getRallR_{all}by calling this function.

  • function totalPoolWeight() view returns (uint256) : We can getWallW_{all}by calling this function.

  • function poolWeightPT(address token) view returns (uint256) : We can get W by calling this function with the “token” parameter set to the INSUR token address (0x544c42fBB96B39B21DF61cf322b5EDC285EE7429).

  • function stakedAmountPT(address token) view returns (uint256) : We can get V by calling this function with the “token” parameter set to the INSUR token address (0x544c42fBB96B39B21DF61cf322b5EDC285EE7429).

We can get the prices of the tokens by checking any price providers, e.g. 1inch, CoinGecko etc. In particular, we are interested in

  • PINSURP_{INSUR} – The price of INSUR in USDC

  • P – The price of the token of the mining pool in USDC (in this example, this happens to be the same as PINSURP_{INSUR} )

After getting all the data, we can calculate the APY of the INSUR mining pool as follows.

Reference

  • Tokens

The mining pools on the Ethereum network are as follows:

ETH Mining Pool

  • ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE

  • Liquidity Provider Token: 0xdF8BEc949367b677B7C951219ED66035dDc73d3f

WETH Mining Pool

  • WETH: 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

  • Liquidity Provider Token: 0xEE516E05cecFEe5fE72930f3B38B87594434fD00

DAI Mining Pool

  • DAI: 0x6b175474e89094c44da98b954eedeac495271d0f

  • Liquidity Provider Token: 0x5157e052Ae30381E38874A9b3452Aabc9F145182

USDC Mining Pool

  • USDC: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48

  • Liquidity Provider Token: 0x3d9317a27f3d83f0821deeeb0befdb68d4c9cd47

USDT Mining Pool

  • USDT: 0xdac17f958d2ee523a2206206994597c13d831ec7

  • Liquidity Provider Token: 0x8ce730BBAF5Ed1B9E8cF2d857f474bDcDeb22275

INSUR Mining Pool

  • INSUR: 0x544c42fBB96B39B21DF61cf322b5EDC285EE7429

  • Liquidity Provider Token: 0x7e68521a2814a84868Da716b9f436b53e6764C1D

mUSD Mining Pool

  • mUSD: 0xe2f2a5c287993345a840db3b0845fbc70f5935a5

  • Liquidity Provider Token: 0xd9AAE8F651F323cBB39E328B8FDa741D11A231E0

The mining pools on the BSC network are as follows:

BNB Mining Pool

  • BNB: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE

  • Liquidity Provider Token: 0x563D10af7395DB31f9b0030b39fc4E3eF2598fEe

BUSD Mining Pool

  • BUSD: 0x55d398326f99059fF775485246999027B3197955

  • Liquidity Provider Token: 0xDbbB520B40C7B7C6498dbD532AEE5e28c62b3611

USDC Mining Pool

  • USDC: 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d

  • Liquidity Provider Token: 0xF2CE369B6E2B96952741AF463DdDd7061f565946

USDT Mining Pool

  • USDT: 0x55d398326f99059fF775485246999027B3197955

  • Liquidity Provider Token: 0x22182Ee443E109472Fa3fF95311e4532FF5880F9

ETH Mining Pool

  • ETH: 0x2170Ed0880ac9A755fd29B2688956BD959F933F8

  • Liquidity Provider Token: 0x5B9D6666398B86E2541b08B00468Ae6434F79441

INSUR Mining Pool

  • INSUR: 0x3192CCDdf1CDcE4Ff055EbC80f3F0231b86A7E30

  • Liquidity Provider Token: 0xA5Eb163588E25F6de18b9E164BA39DAa6086f52b

  • Contract

StakersPool

Address: 0x136D841d4beCe3Fc0E4dEbb94356D8b6B4b93209

Additional topic

Rounding Loss

The rounding loss may happen if dividing results in infinite decimal due to the precision limitation of smart contract. Though the round loss is negligible, we would like to elaborate on the calculation below so that you can understand.

Taking ETH Pool, for example, suppose when more people staking in and there is 9000 ETH in ETH Pool, and 10000 LPTokenETH minted, and the staker plan to stake in another 10 ETH, the minted LPTokenETH will be 11.111111111111111111.

ΔLPTokenETH=PrincipalETH×StakeETHLPTokenETH\Delta{LPToken}_{ETH} = \frac {Principal_{ETH} \times Stake_{ETH}} {LPToken_{ETH}}
=10×100009000=11.1111111111111111= \frac {10 \times 10000} {9000} = 11.1111111111111111

Following the above formula, the ETH value the staker can claim back will be (ignore withdrawal fee and etcetera):

ΔUnstakeETH=ΔLPTokenETH×PrincipalETHLPTokenETH\Delta{Unstake}_{ETH} = \frac {\Delta{LPToken_{ETH}} \times Principal_{ETH}} {LPToken_{ETH}}
=11.111111111111111111900010000=9.99999999999999999= \frac {11.111111111111111111 * 9000} {10000} = 9.99999999999999999

The rounding loss is 1/10171/10^{17} ETH which can be negligible.

Events impacting Capital Pool Factor

The capital pool factor is 1 at the start of any capital pool. It will stay constant unless events been triggered which changes the ratio between principal token and LPToken:

Claiming is one of the events which will change the ratio. Staking pools share the portion of claim payouts. Besides the rights to take rewards from InsurAce.io, the staker bear obligations for claim payouts. When the community approves a claim payout, a portion of the staking pool will be forked out, based on weightage, to compensate for the claim owner's loss. As a result, less principal you will be received upon unstaking, and more LPToken you will with the same amount of principal token staked.