Purchase a Policy

The protocol automatically determines the premium or policy fees by taking numerous aspects such as policy term/cover duration, adverse selection, sum insured, utilization ratio, total pool balance, reassurance pool, etc into account.

The policy fee is determined by the supply and demand in the cover market. A pool with a low utilization ratio charges much less than one with a high utilization ratio. A pool with a high utilization ratio costs higher fees, which makes it more enticing and lucrative for liquidity providers to contribute more cash, lowering the price gradually.

Equation:

The policy fee denoted PF is given by the equation

where the value of x is always between constants F and Cc is the cover commitment amount, t is the total balance of the pool, CD is the policy duration desired, CA is the desired cover amount, IP is incident support pool amount for the cover pool, IR is incident support pool capitalization ratio.

For simplicity, this equation can also be written as:

PF = (CD/100) + (CA+c) / (t + (IP + IR)) 

Check the following page to calculate cover fees:

Get Fees#

import { ChainId, policy, registry, utils } from '@neptunemutual/sdk'
import { info } from '../configs/info.js'
import { getProvider } from '../provider.js'
import { weiAsPercent, parseUnits, unitsAsDollars, formatPercent, toFraction } from '../bn.js'

const get = async () => {
  try {
    const { key: coverKey } = info
    const productKey = utils.keyUtil.toBytes32('')
    const provider = getProvider()

    const dai = await registry.Stablecoin.getInstance(ChainId.Mumbai, provider)
    const daiDecimals = await dai.decimals()

    const args = {
      duration: 2,
      amount: parseUnits(500, daiDecimals)
    }

    console.info('Getting %s cover for %d months', unitsAsDollars(args.amount, daiDecimals), args.duration)
    console.info('--------------------------------------')

    const response = await policy.getCoverFee(ChainId.Mumbai, coverKey, productKey, args, provider)
    const {
      fee,
      utilizationRatio,
      totalAvailableLiquidity,
      rate
    } = response.result

    console.info('Rate: %s', formatPercent(toFraction(rate.toString())))
    console.info('Fee: %s', unitsAsDollars(fee, daiDecimals))
    console.info('--------------------------------------')
    console.info('Utilization Ratio: %s', weiAsPercent(utilizationRatio))
    console.info('Total Available Liquidity: %s', unitsAsDollars(totalAvailableLiquidity, daiDecimals))
    // console.info('Cover Ratio: %s', weiAsPercent(coverRatio))
  } catch (error) {
    console.error(error)
    console.info('Try adding more liquidity --> `3.\\ add-liquidity.js`')
  }
}

get()

/*****************************************************************************
[info] Getting US$500.00 cover for 1 months
[info] --------------------------------------
[info] Rate: 8.00%
[info] Fee: US$3.07
[info] --------------------------------------
[info] Utilization Ratio: 0.00%
[info] Total Available Liquidity: US$4,076,840.42
*****************************************************************************/

Result Type

Property Type Description
fee number The amount required in stablecoin 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 NPM Provision + Weighted Amount in Reassurance Pool
floor number The base policy floor rate
ceiling number The base policy ceiling
rate number The annualized percentage required to purchase this policy for the specified amount

Purchase Policy#

import { ChainId, policy, registry, utils } from '@neptunemutual/sdk'
import { info } from '../configs/info.js'
import { getProvider } from '../provider.js'
import { parseUnits } from '../bn.js'

const purcahse = async () => {
  try {
    const { key } = info
    const provider = getProvider()

    const dai = await registry.Stablecoin.getInstance(ChainId.Mumbai, provider)
    const daiDecimals = await dai.decimals()

    const args = {
      duration: 2,
      amount: parseUnits(200, daiDecimals), // <-- Amount to Cover (In DAI)
      referralCode: utils.keyUtil.toBytes32(''),
      onBehalfOf: provider.address
    }

    // First approve the Policy contract to spend your DAI or BUSD
    let response = await policy.approve(ChainId.Mumbai, { }, provider)
    await response.result.wait()

    response = await policy.purchaseCover(ChainId.Mumbai, key, utils.keyUtil.toBytes32(''), args, provider)
    await response.result.wait()
    console.info(response)
  } catch (error) {
    console.error(error)
  }
}

purcahse()

/*****************************************************************************
[info] {
  status: 'Success',
  result: {
    type: 2,
    chainId: 80001,
    nonce: 16,
    maxPriorityFeePerGas: BigNumber { _hex: '0x0fa4b452d0', _isBigNumber: true },
    maxFeePerGas: BigNumber { _hex: '0x0fa4b452d0', _isBigNumber: true },
    gasPrice: null,
    gasLimit: BigNumber { _hex: '0x09c943', _isBigNumber: true },
    to: '0x23099F06e9ABbeE01597F422CDBb9c232D581626',
    value: BigNumber { _hex: '0x00', _isBigNumber: true },
    data: '0x82bdf3bd0000000000000000000000002dac3776b9f4243df6445515ebe6f6cd003b3681616e696d617465642d6272616e6473000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000bebc2000000000000000000000000000000000000000000000000000000000000000000',
    accessList: [],
    hash: '0x0402cec1b8fce955bca22c83e1fea5d2c74d711f1ea7fb111c35cce9082e2692',
    v: 0,
    r: '0x81f18c2a43f4f509d4ef3aeebc3f28143910292b53ecced7625256a86b746b87',
    s: '0x04d826825bf61048523b22289c1795eb92353414ed9c8a35acd820740d172b17',
    from: '0x2DAc3776B9f4243DF6445515eBE6F6Cd003B3681',
    confirmations: 0,
    wait: [Function (anonymous)]
  }
}
*****************************************************************************/