Cover Provision
The governance portal enables DAO members to provision NPM tokens as Liquidity Pool Support for any given cover. We believe this will foster community participation and will also incentivize liquidity providers. The NPM provision acts as a defense mechanism during cover incidents. Along with the NPM provisions, the liquidity providers also have Cover Assurance Support for a rainy day.

Increase Provision

1
/**
2
* This feature is only accessible to Neptune Mutual Governance Contract
3
* or administrator
4
*/
5
6
import { ChainId, provision } from '@neptunemutual/sdk'
7
import { info } from './info.js'
8
import { getProvider } from './provider.js'
9
import { ether, weiAsNep } from './bn.js'
10
11
const increase = async () => {
12
const { key, coverName } = info
13
const provider = getProvider()
14
const amount = ether(25_000)
15
16
let response = await provision.get(ChainId.Mumbai, key, provider)
17
console.info('[%s Provision] Before: %s', coverName, weiAsNep(response.result))
18
19
await provision.approve(ChainId.Mumbai, { amount }, provider)
20
response = await provision.increase(ChainId.Mumbai, key, amount, provider)
21
22
console.info(response)
23
24
await response.result.wait()
25
26
response = await provision.get(ChainId.Mumbai, key, provider)
27
console.info('[%s Provision] After: %s', coverName, weiAsNep(response.result))
28
}
29
30
increase()
31
32
/*****************************************************************************
33
[info] [Compound Finance Cover Provision] Before: 0.00 NPM
34
[info] {
35
status: 'Success',
36
result: {
37
nonce: 1,
38
gasPrice: BigNumber { _hex: '0x06fc23ac00', _isBigNumber: true },
39
gasLimit: BigNumber { _hex: '0x026b49', _isBigNumber: true },
40
to: '0xD52F2321D0713071843546b503E8137Ed4Bb3795',
41
value: BigNumber { _hex: '0x00', _isBigNumber: true },
42
data: '0xb7d3571e70726f746f3a636f6e7472616374733a636f7665723a6366633a30310000000200000000000000000000000000000000000000000000054b40b1f852bda00000',
43
chainId: 80001,
44
v: 160037,
45
r: '0x42004ddaf03e90acdfae56b0d689fa4be6f40838cde52dd3ba9123d079f80c3f',
46
s: '0x401f146aa19d3b456ed307bea062f7a0a7bedc4c97a9408d33a2ce2bc324c643',
47
from: '0xA3dEE71417e31C0A09F33690cA55052018041a94',
48
hash: '0xb131465bbbc54bbad85b2e0fc76782b00de01e856aca8461113cd1fe937f5183',
49
type: null,
50
wait: [Function (anonymous)]
51
}
52
}
53
[info] [Compound Finance Cover Provision] After: 25,000.00 NPM
54
*****************************************************************************/
Copied!

Get Provision

1
import { ChainId, provision } from '@neptunemutual/sdk'
2
import { info } from './info.js'
3
import { weiAsNep } from './bn.js'
4
5
const get = async () => {
6
const { key, coverName } = info
7
const response = await provision.get(ChainId.Mumbai, key)
8
9
console.info('[%s Provision] %s', coverName, weiAsNep(response.result))
10
}
11
12
get()
13
14
/*****************************************************************************
15
[info] [Compound Finance Cover Provision] 25,000.00 NPM
16
*****************************************************************************/
Copied!

Decrease Provision

1
/**
2
* This feature is only accessible to Neptune Mutual Governance Contract
3
* or administrator
4
*/
5
6
import { ChainId, provision } from '@neptunemutual/sdk'
7
import { info } from './info.js'
8
import { getProvider } from './provider.js'
9
import { ether, weiAsNep } from './bn.js'
10
11
const decrease = async () => {
12
const { key, coverName } = info
13
const provider = getProvider()
14
const amount = ether(200)
15
16
let response = await provision.get(ChainId.Mumbai, key)
17
console.info('[%s Provision] Before: %s', coverName, weiAsNep(response.result))
18
19
response = await provision.decrease(ChainId.Mumbai, key, amount, provider)
20
console.info(response)
21
22
// Wait for the transaction to get included in a block
23
await response.result.wait()
24
25
response = await provision.get(ChainId.Mumbai, key)
26
console.info('[%s Provision] After: %s', coverName, weiAsNep(response.result))
27
}
28
29
decrease()
30
31
/*****************************************************************************
32
[info] [Compound Finance Cover Provision] Before: 25,000.00 NPM
33
[info] {
34
status: 'Success',
35
result: {
36
nonce: 1,
37
gasPrice: BigNumber { _hex: '0x06fc23ac00', _isBigNumber: true },
38
gasLimit: BigNumber { _hex: '0x020729', _isBigNumber: true },
39
to: '0xD52F2321D0713071843546b503E8137Ed4Bb3795',
40
value: BigNumber { _hex: '0x00', _isBigNumber: true },
41
data: '0x735b702870726f746f3a636f6e7472616374733a636f7665723a6366633a3031000000020000000000000000000000000000000000000000000000056bc75e2d63100000',
42
chainId: 80001,
43
v: 160038,
44
r: '0x0fec5d669550f8d17ccdc91f0ea007acf8676c4694e3ee5e12f2182d7d486f89',
45
s: '0x0c1d628090f07fd916427caa871d5a96ced32f06577ccf65c25f2a7c7c487442',
46
from: '0xA3dEE71417e31C0A09F33690cA55052018041a94',
47
hash: '0xe5cf70fa61656b602f15c074551ae08b0dcad20adadaf2700a565439efd40832',
48
type: null,
49
wait: [Function (anonymous)]
50
}
51
}
52
[info] [Compound Finance Cover Provision] After: 24,800.00 NPM
53
*****************************************************************************/
Copied!
Last modified 2mo ago