ghost-portal/packages/apps-config/src/api/params/inflation.ts
Wei Tang 05d12f2048
Add Neatcoin inflation parameters to apps-config (#5638)
* Add NEATCOIN_GENESIS to apps-config

* Add Neatcoin inflation parameters

* Fix linting issue
2021-06-20 07:01:08 +02:00

35 lines
1004 B
TypeScript

// Copyright 2017-2021 @polkadot/app-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiPromise } from '@polkadot/api';
import { KUSAMA_GENESIS, NEATCOIN_GENESIS, POLKADOT_GENESIS } from '../constants';
interface InflationParams {
auctionAdjust: number;
auctionMax: number;
falloff: number;
maxInflation: number;
minInflation: number;
stakeTarget: number;
}
const DEFAULT_PARAMS: InflationParams = {
auctionAdjust: 0,
auctionMax: 0,
falloff: 0.05,
maxInflation: 0.1,
minInflation: 0.025,
stakeTarget: 0.5
};
const KNOWN_PARAMS: Record<string, InflationParams> = {
[KUSAMA_GENESIS]: { ...DEFAULT_PARAMS, auctionAdjust: (0.3 / 60), auctionMax: 60, stakeTarget: 0.75 },
[NEATCOIN_GENESIS]: { ...DEFAULT_PARAMS, stakeTarget: 0.75 },
[POLKADOT_GENESIS]: { ...DEFAULT_PARAMS, stakeTarget: 0.75 }
};
export function getInflationParams (api: ApiPromise): InflationParams {
return KNOWN_PARAMS[api.genesisHash.toHex()] || DEFAULT_PARAMS;
}