-
Notifications
You must be signed in to change notification settings - Fork 67
/
constants.ts
24 lines (22 loc) · 1007 Bytes
/
constants.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { PalletProposalsEngineProposalParameters } from '@polkadot/types/lookup'
import BN from 'bn.js'
export interface ProposalConstants {
votingPeriod: number
gracePeriod: number
approvalQuorumPercentage: number
approvalThresholdPercentage: number
slashingQuorumPercentage: number
slashingThresholdPercentage: number
requiredStake: BN
constitutionality: number
}
export const asProposalConstants = (params: PalletProposalsEngineProposalParameters): ProposalConstants => ({
votingPeriod: params.votingPeriod.toNumber(),
gracePeriod: params.gracePeriod.toNumber(),
approvalQuorumPercentage: params.approvalQuorumPercentage.toNumber(),
approvalThresholdPercentage: params.approvalThresholdPercentage.toNumber(),
slashingQuorumPercentage: params.slashingQuorumPercentage.toNumber(),
slashingThresholdPercentage: params.slashingThresholdPercentage.toNumber(),
requiredStake: new BN(params.requiredStake.toString()),
constitutionality: params.constitutionality.toNumber(),
})