Purchase a Policy

The policy fee denoted PFP_F is given by the equation

PF=CA.31F+tc+NM+(AM.AW)ct+(CD.CA)+1C{P_F = C_A. { 3 \over {1\over F} + {{t - c + N_M + (A_M . A_W)} \over {{c \over t} + (C_D . C_A)}} + {1\over C}}}

where FFand CCare constants, cc is the cover commitment amount, tt is the total balance of the pool, CDC_D is the policy duration desired, CAC_A is the desired cover amount, NMN_M is NEP provision amount for the cover pool , AMA_M is assurance token amount for the cover pool, andAWA_W is the assurance token liquidity weight.

For simplicity, this equation can be broken down further to the following subtopics:

Utilization Ratio

The utilization ratio simply tells us how much liquidity in a given cover pool has already been used. It is denoted as the ratio between cover ommitment and total balance, given the pool has a positive balance.

u=ctu = {c \over t}

where cc is the cover commitment and tt is the total balance of the pool.

Available Liquidity

The available liquidity is always greater than or equal to the total balance of a cover pool. A cover pool may have additional liquidity available through Assurance Tokens and NEP Provision. The weight of assurance token is a constant.

l=tc+NM+(AM.AW)l = {t - c + N_M + (A_M . A_W)}

where tt is the total balance of the pool, cc is the cover commitment, NMN_M is NEP provision amount for the cover pool , AMA_M is assurance token amount for the cover pool, AWA_W is the assurance token liquidity weight.

Impact Ratio

The impact ratio signifies the effect of the desired cover amount and duration on the liquidity pool.

i=u+(CD.CA)li = {u + (C_D . C_A) \over l}

where uu is the current utilization ratio, CDC_D is the policy duration desired, CAC_A is the desired cover amount, and ll is the available liquidity.

Policy Fee

Finally, the policy fee (PFP_F) equation can be now derived from a simple harmonic mean of three values: namely floor, impact ratio, and ceiling, denoted as

PF=CA.31F+1i+1C{P_F = C_A. { 3 \over {1\over F} + {1 \over i} + {1\over C}}}

where FF and CC are constants, CAC_A is the desired cover amount, and i is the impact. Check the following sheet which contains this equation.

https://docs.google.com/spreadsheets/d/1RTSrFnE6sGNd71xcEhzT7Lagpt5EwELHZ75OF8GzA4o/edit?usp=sharing

Get Fees

import { ChainId, policy } from '@neptunemutual/sdk'
import { info } from './info.js'
import { getProvider } from './provider.js'
import { weiAsPercent, weiAsDollars, ether } from './bn.js'
const get = async () => {
const { key } = info
const provider = getProvider()
const args = {
duration: 2,
amount: ether(100_000)
}
console.info('Getting %s cover for %d months', weiAsDollars(args.amount), args.duration)
console.info('--------------------------------------')
const response = await policy.getCoverFee(ChainId.Mumbai, key, args, provider)
const {
fee,
utilizationRatio,
totalAvailableLiquidity,
coverRatio,
rate
} = response.result
console.info('Rate: %s', weiAsPercent(rate))
console.info('Fee: %s', weiAsDollars(fee, 'xYZ'))
console.info('--------------------------------------')
console.info('Utilization Ratio: %s', weiAsPercent(utilizationRatio))
console.info('Total Available Liquidity: %s', weiAsDollars(totalAvailableLiquidity))
console.info('Cover Ratio: %s', weiAsPercent(coverRatio))
}
get()
/*****************************************************************************
[info] Getting $100,000.00 cover for 2 months
[info] --------------------------------------
[info] Rate: 16.66%
[info] Fee: $2,776.78
[info] --------------------------------------
[info] Utilization Ratio: 0.00%
[info] Total Available Liquidity: $299,700.00
[info] Cover Ratio: 66.73%
*****************************************************************************/

Result Type

Property

Type

Description

fee

number

The amount required in DAI to purchase the policy for the specified amount.

utilizationRatio

number

Utilization Ratio = Total Commitment / Total Liquidity

totalAvailableLiquidity

number

Total Available Liquidity = Total Liquidity - Total Commitment + Amount in NEP Provision + Weighted Amount in Assurance Pool

coverRatio

number

Cover Ratio = Utilization Ratio + Cover Duration * (Amount to Cover / Total Liquidity)

floor

number

The base policy floor rate

ceiling

number

The base policy ceiling rate

rate

number

The annualized percentage required to purchase this policy for the specified amount

Purchase Policy

import { ChainId, policy } from '@neptunemutual/sdk'
import { info } from './info.js'
import { getProvider } from './provider.js'
import { ether } from './bn.js'
const purcahse = async () => {
const { key } = info
const provider = getProvider()
const args = {
duration: 2,
amount: ether(10_000) // <-- Amount to Cover (In DAI)
}
// First approve the Policy contract to spend your DAI, USDC, or BUSD
await policy.approve(ChainId.Mumbai, {}, provider)
const response = await policy.purchaseCover(ChainId.Mumbai, key, args, provider)
console.info(response)
}
purcahse()
/*****************************************************************************
[info] {
status: 'Success',
result: {
nonce: 1,
gasPrice: BigNumber { _hex: '0x06fc23ac00', _isBigNumber: true },
gasLimit: BigNumber { _hex: '0x2f788c', _isBigNumber: true },
to: '0x50443BED0C90987D3A3715f0A90e60503BB548dD',
value: BigNumber { _hex: '0x00', _isBigNumber: true },
data: '0x02bbd6e570726f746f3a636f6e7472616374733a636f7665723a6366633a303100000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000021e19e0c9bab2400000',
chainId: 80001,
v: 160038,
r: '0xc6539f52dfb2fc026bdef71082dccdcfd886fa6cef06c1d507ba18d1bbe6ed33',
s: '0x2b2ca2256d0a9513bc503e5f8496f54def3b2fb2ef9e2a988a0f21167a3c7cbe',
from: '0x076F91C0A411197e6Fce476F37c6385CCeacd26D',
hash: '0x1e6d351385c19d13e7e08fb372d23100d8000ef916909b18fabeb40252f9eb47',
type: null,
wait: [Function (anonymous)]
}
}
*****************************************************************************/