1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
use cumulus_pallet_xcm::Origin;
use frame_support::{
parameter_types,
sp_runtime::{traits::AccountIdConversion, Perbill, Permill},
sp_std::prelude::*,
traits::{Contains, LockIdentifier},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, WEIGHT_PER_SECOND},
DispatchClass, Weight,
},
PalletId,
};
use frame_system::limits::{BlockLength, BlockWeights};
use orml_traits::{arithmetic::Zero, parameter_type_with_key};
use primitives::{
fee::{FeeRate, RedemptionFeeRange},
AccountId, AssetId, Balance, BlockNumber,
};
use xcm::v1::MultiLocation;
pub use currency::*;
pub mod currency {
use frame_support::weights::constants::{ExtrinsicBaseWeight, WEIGHT_PER_SECOND};
use primitives::Balance;
pub const DECIMALS: u8 = 0u8;
pub const UNITS: Balance = 1;
pub const DOLLARS: Balance = UNITS;
pub const CENTS: Balance = DOLLARS / 100;
pub const MILLICENTS: Balance = CENTS / 1_000;
pub fn basic_per_second() -> u128 {
let base_weight = Balance::from(ExtrinsicBaseWeight::get());
let base_tx_per_second = (WEIGHT_PER_SECOND as u128) / base_weight;
base_tx_per_second * CENTS
}
pub fn ksm_per_second() -> u128 {
basic_per_second() / 50
}
pub fn dot_per_second() -> u128 {
basic_per_second() / 50
}
}
pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);
pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
pub const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND / 2;
pub const MILLISECS_PER_BLOCK: u64 = 6000;
pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
pub const HOURS: BlockNumber = MINUTES * 60;
pub const DAYS: BlockNumber = HOURS * 24;
pub const WEEKS: BlockNumber = DAYS * 7;
pub const UNIT: Balance = 1_000_000_000_000;
pub const MILLIUNIT: Balance = 1_000_000_000;
pub const MICROUNIT: Balance = 1_000_000;
pub const KUSAMA_EPOCH_DURATION_IN_SLOTS: BlockNumber = 1 * HOURS;
pub const POLKADOT_EPOCH_DURATION_IN_SLOTS: BlockNumber = 4 * HOURS;
pub const KUSAMA_BONDING_DURATION_IN_BLOCKS: BlockNumber = 28 * 6 * KUSAMA_EPOCH_DURATION_IN_SLOTS;
pub const POLKADOT_BONDING_DURATION_IN_BLOCKS: BlockNumber = 28 * 6 * POLKADOT_EPOCH_DURATION_IN_SLOTS;
parameter_types! {
pub const BaseWithdrawalFee: FeeRate = FeeRate{ numerator: 0, denominator: 1_000,};
pub const BaseXcmWeight: Weight = 100_000_000;
pub const BlockHashCount: BlockNumber = 250;
pub const MaxActiveDeposits: u32 = 5;
pub const Days: BlockNumber = DAYS;
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(33);
pub const ExistentialDeposit: Balance = 500;
pub const FeedPalletId: PalletId = PalletId(*b"linkfeed");
pub const FeedLimit: u16 = 10;
pub const IndexTokenLockIdentifier: LockIdentifier = *b"pintlock";
pub const Offset: BlockNumber = 0;
pub const OracleLimit: u32 = 10;
pub const PalletIndexStringLimit: u32 = 50;
pub const Period: u32 = 6 * HOURS;
pub const PINTAssetId: AssetId = 1;
pub PintTreasuryAccount: AccountId = TreasuryPalletId::get().into_account();
pub const PotId: PalletId = PalletId(*b"PotStake");
pub const RedemptionFee: RedemptionFeeRange<BlockNumber> = RedemptionFeeRange {
range: [(DAYS * 7, FeeRate { numerator: 1, denominator: 10 }), (DAYS * 30, FeeRate{ numerator: 3, denominator: 100 })],
default_fee: FeeRate { numerator: 1, denominator: 100 }
};
pub const RelayChainAssetId: AssetId = 42;
pub RelayChainOrigin: Origin = cumulus_pallet_xcm::Origin::Relay;
pub const RelayLocation: MultiLocation = MultiLocation::parent();
pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;
pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;
pub RuntimeBlockLength: BlockLength =
BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
.base_block(BlockExecutionWeight::get())
.for_class(DispatchClass::all(), |weights| {
weights.base_extrinsic = ExtrinsicBaseWeight::get();
})
.for_class(DispatchClass::Normal, |weights| {
weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
})
.for_class(DispatchClass::Operational, |weights| {
weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
weights.reserved = Some(
MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
);
})
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
.build_or_panic();
pub const SS58Prefix: u8 = 0;
pub const StringLimit: u32 = 15;
pub const TransactionByteFee: Balance = 1 ;
pub const OperationalFeeMultiplier: u8 = 5;
pub const LockupPeriod: BlockNumber = DAYS;
pub const MaxCandidates: u32 = 200;
pub const MaxDecimals: u8 = 18;
pub const MaxInvulnerables: u32 = 50;
pub const MaxLocks: u32 = 50;
pub const MinCandidates: u32 = 1;
pub const MinCouncilMembers: usize = 4;
pub const MinCouncilVotes: usize = 4;
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
pub const MinimumRedemption: u32 = 0;
pub const AssetUnbondingSlashingSpans: u32 = 5;
pub const MinimumStatemintTransferAmount: Balance = 1;
pub const MinimumReserve: Balance = 100;
pub const UncleGenerations: u32 = 0;
pub BasicPerSecond: (xcm::v1::AssetId, u128) = (xcm::v1::AssetId::Concrete(MultiLocation::here()), basic_per_second());
pub const UnitWeightCost: Weight = 200_000_000;
pub const MaxInstructions: u32 = 100;
pub const WithdrawalPeriod: BlockNumber = 10;
pub const TreasuryPalletId: PalletId = PalletId(*b"Treasury");
pub const ProposalBond: Permill = Permill::from_percent(3);
pub const ProposalBondMinimum: Balance = 5 * DOLLARS;
pub const SpendPeriod: BlockNumber = 7 * DAYS;
pub const Burn: Permill = Permill::from_percent(0);
pub const MaxApprovals: u32 = 100;
}
pub fn get_all_pallet_accounts() -> Vec<AccountId> {
vec![TreasuryPalletId::get().into_account()]
}
pub struct DustRemovalWhitelist;
impl Contains<AccountId> for DustRemovalWhitelist {
fn contains(a: &AccountId) -> bool {
get_all_pallet_accounts().contains(a)
}
}
parameter_type_with_key! {
pub ExistentialDeposits: |_asset_id: AssetId| -> Balance {
Zero::zero()
};
}
parameter_type_with_key! {
pub MinimumRemoteReserveBalance: |_asset_id: AssetId| -> Balance {
ExistentialDeposit::get()
};
}
parameter_type_with_key! {
pub MinimumBondExtra: |_asset_id: AssetId| -> Balance {
Balance::MAX
};
}
parameter_type_with_key! {
pub CanEncodeAsset: |_asset_id: AssetId| -> bool {
true
};
}