Links

Cover Reassurance

When launching a new cover, you can include a reassurance fund. Liquidity from the reassurance fund lowers cover fees and offsets liquidity providers' losses during cover incidents, enhancing the confidence of the liquidity providers. When a cover incident is finalized, the reassurance tokens are reimbursed as support to the liquidity providers.
Based on available liquidity, the reassurance contract will capitalize up to 25% of the suffered loss to the liquidity pool.

Add Reassurance

import { ChainId, reassurance, registry } from '@neptunemutual/sdk'
import { info } from './info.js'
import { getProvider } from './provider.js'
import { parseUnits, unitsAsToken } from '../../bn.js'
const increase = async () => {
const { key, coverName, reassuranceToken } = info
const { symbol } = reassuranceToken
const provider = getProvider()
// getting token address from registry Stablecoin
const tokenAddress = await (await registry.Stablecoin.getInstance(ChainId.Mumbai, provider)).address
// getting token from IERC20 instance
const token = await registry.IERC20.getInstance(tokenAddress, provider)
// getting symbol from the token
const symbol = await token.symbol()
// getting token decimals
const decimals = await token.decimals()
const amount = parseUnits(100, decimals)
let response = await reassurance.get(ChainId.Mumbai, key, provider)
console.info('[%s Reassurance] Before: %s', coverName, unitsAsToken(response.result, decimals, symbol))
response = await reassurance.approve(ChainId.Mumbai, { amount }, provider)
// Wait for the transaction to get included in a block
await response.result.wait()
response = await reassurance.add(ChainId.Mumbai, key, amount, provider)
// Wait for the transaction to get included in a block
await response.result.wait()
console.info(response)
// Wait for the transaction to get included in a block
await response.result.wait()
response = await reassurance.get(ChainId.Mumbai, key, provider)
console.info('[%s Reassurance] After: %s', coverName, unitsAsToken(response.result, decimals, symbol))
}
increase()
/*****************************************************************************
[info] [Compound Finance Cover Reassurance] Before: 50,000.00 COMP
[info] {
status: 'Success',
result: {
nonce: 1,
gasPrice: BigNumber { _hex: '0x06fc23ac00', _isBigNumber: true },
gasLimit: BigNumber { _hex: '0x01fe55', _isBigNumber: true },
to: '0xC551E926F7B251cc6579BE111C65079f25e50e53',
value: BigNumber { _hex: '0x00', _isBigNumber: true },
data: '0x9295182570726f746f3a636f6e7472616374733a636f7665723a6366633a303100000002000000000000000000000000076f91c0a411197e6fce476f37c6385cceacd26d00000000000000000000000000000000000000000000152d02c7e14af6800000',
chainId: 80001,
v: 160037,
r: '0xb648e7979b067ae87af2789e64bcc16bfd3d13c9d2bd6fb4bae9d6c1f75b7f17',
s: '0x15956535e8d34fb17cfa36cdcfd5d58a5d3f57956d57de2dc519bc8abc7c52aa',
from: '0x076F91C0A411197e6Fce476F37c6385CCeacd26D',
hash: '0xc2d7e8ff50b2463f2a2b044baadff3cedfd7caa1369eacd31ec864fbe5651d41',
type: null,
wait: [Function (anonymous)]
}
}
[info] [Compound Finance Cover Reassurance] After: 150,000.00 COMP
*****************************************************************************/

Get Reassurance

import { ChainId, reassurance } from '@neptunemutual/sdk'
import { info } from './info.js'
import { getProvider } from '../../provider.js'
import { unitsAsToken } from '../../bn.js'
const get = async () => {
const { key, coverName, reassuranceToken } = info
const provider = getProvider()
// getting token address from registry Stablecoin
const tokenAddress = await (await registry.Stablecoin.getInstance(ChainId.Mumbai, provider)).address
// getting token from IERC20 instance
const token = await registry.IERC20.getInstance(tokenAddress, provider)
// getting symbol from the token
const symbol = await token.symbol()
// getting token decimals
const decimals = await token.decimals()
const response = await reassurance.get(ChainId.Mumbai, key, provider)
console.info('[%s Reassurance] %s', coverName, unitsAsToken(response.result, decimals, symbol))
}
get()
/*****************************************************************************
[info] [Compound Finance Cover Reassurance] 150,000.00 NPM
*****************************************************************************/