difftreelog
Merge pull request #577 from UniqueNetwork/fix/fee-multiplier-update
in: master
16 files changed
pallets/configuration/src/lib.rsdiffbeforeafterboth25};25};26use parity_scale_codec::{Decode, Encode, MaxEncodedLen};26use parity_scale_codec::{Decode, Encode, MaxEncodedLen};27use scale_info::TypeInfo;27use scale_info::TypeInfo;28use sp_arithmetic::traits::{BaseArithmetic, Unsigned};28use sp_arithmetic::{29 per_things::{Perbill, PerThing},30 traits::{BaseArithmetic, Unsigned},31};29use smallvec::smallvec;32use smallvec::smallvec;303331pub use pallet::*;34pub use pallet::*;32use sp_core::U256;35use sp_core::U256;33use sp_runtime::Perbill;343635#[pallet]37#[pallet]36mod pallet {38mod pallet {46 #[pallet::config]48 #[pallet::config]47 pub trait Config: frame_system::Config {49 pub trait Config: frame_system::Config {48 #[pallet::constant]50 #[pallet::constant]49 type DefaultWeightToFeeCoefficient: Get<u32>;51 type DefaultWeightToFeeCoefficient: Get<u64>;5051 #[pallet::constant]52 #[pallet::constant]52 type DefaultMinGasPrice: Get<u64>;53 type DefaultMinGasPrice: Get<u64>;666767 #[pallet::storage]68 #[pallet::storage]68 pub type WeightToFeeCoefficientOverride<T: Config> = StorageValue<69 pub type WeightToFeeCoefficientOverride<T: Config> = StorageValue<69 Value = u32,70 Value = u64,70 QueryKind = ValueQuery,71 QueryKind = ValueQuery,71 OnEmpty = T::DefaultWeightToFeeCoefficient,72 OnEmpty = T::DefaultWeightToFeeCoefficient,72 >;73 >;90 #[pallet::weight(T::DbWeight::get().writes(1))]91 #[pallet::weight(T::DbWeight::get().writes(1))]91 pub fn set_weight_to_fee_coefficient_override(92 pub fn set_weight_to_fee_coefficient_override(92 origin: OriginFor<T>,93 origin: OriginFor<T>,93 coeff: Option<u32>,94 coeff: Option<u64>,94 ) -> DispatchResult {95 ) -> DispatchResult {95 ensure_root(origin)?;96 ensure_root(origin)?;96 if let Some(coeff) = coeff {97 if let Some(coeff) = coeff {156impl<T, B> WeightToFeePolynomial for WeightToFee<T, B>157impl<T, B> WeightToFeePolynomial for WeightToFee<T, B>157where158where158 T: Config,159 T: Config,159 B: BaseArithmetic + From<u32> + Copy + Unsigned,160 B: BaseArithmetic + From<u32> + From<u64> + Copy + Unsigned,160{161{161 type Balance = B;162 type Balance = B;162163163 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {164 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {164 smallvec!(WeightToFeeCoefficient {165 smallvec!(WeightToFeeCoefficient {165 coeff_integer: <WeightToFeeCoefficientOverride<T>>::get().into(),166 coeff_integer: (<WeightToFeeCoefficientOverride<T>>::get() / Perbill::ACCURACY as u64)167 .into(),166 coeff_frac: Perbill::zero(),168 coeff_frac: Perbill::from_parts(169 (<WeightToFeeCoefficientOverride<T>>::get() % Perbill::ACCURACY as u64) as u32170 ),167 negative: false,171 negative: false,168 degree: 1,172 degree: 1,primitives/common/src/constants.rsdiffbeforeafterboth43pub const UNIQUE: Balance = 100 * CENTIUNIQUE;43pub const UNIQUE: Balance = 100 * CENTIUNIQUE;444445// Targeting 0.1 UNQ per transfer45// Targeting 0.1 UNQ per transfer46pub const WEIGHT_TO_FEE_COEFF: u32 = /*<weight2fee>*/175_199_920/*</weight2fee>*/;46pub const WEIGHT_TO_FEE_COEFF: u64 = /*<weight2fee>*/77_083_524_944_487_510/*</weight2fee>*/;474748// Targeting 0.15 UNQ per transfer via ETH48// Targeting 0.15 UNQ per transfer via ETH49pub const MIN_GAS_PRICE: u64 = /*<mingasprice>*/1_014_919_410_810/*</mingasprice>*/;49pub const MIN_GAS_PRICE: u64 = /*<mingasprice>*/1_014_919_313_914/*</mingasprice>*/;505051/// We assume that ~10% of the block weight is consumed by `on_initalize` handlers.51/// We assume that ~10% of the block weight is consumed by `on_initalize` handlers.52/// This is used to limit the maximal weight of a single extrinsic.52/// This is used to limit the maximal weight of a single extrinsic.60 .set_proof_size(MAX_POV_SIZE as u64);60 .set_proof_size(MAX_POV_SIZE as u64);616162parameter_types! {62parameter_types! {63 pub const TransactionByteFee: Balance = 501 * MICROUNIQUE;63 pub const TransactionByteFee: Balance = 501 * MICROUNIQUE / 2;64}64}6565runtime/common/config/pallets/mod.rsdiffbeforeafterboth104 pub const DayRelayBlocks: BlockNumber = RELAY_DAYS;104 pub const DayRelayBlocks: BlockNumber = RELAY_DAYS;105}105}106impl pallet_configuration::Config for Runtime {106impl pallet_configuration::Config for Runtime {107 type DefaultWeightToFeeCoefficient = ConstU32<{ up_common::constants::WEIGHT_TO_FEE_COEFF }>;107 type DefaultWeightToFeeCoefficient = ConstU64<{ up_common::constants::WEIGHT_TO_FEE_COEFF }>;108 type DefaultMinGasPrice = ConstU64<{ up_common::constants::MIN_GAS_PRICE }>;108 type DefaultMinGasPrice = ConstU64<{ up_common::constants::MIN_GAS_PRICE }>;109 type MaxXcmAllowedLocations = ConstU32<16>;109 type MaxXcmAllowedLocations = ConstU32<16>;110 type AppPromotionDailyRate = AppPromotionDailyRate;110 type AppPromotionDailyRate = AppPromotionDailyRate;runtime/common/config/substrate.rsdiffbeforeafterboth28 traits::{BlakeTwo256, AccountIdLookup},28 traits::{BlakeTwo256, AccountIdLookup},29 Perbill, Permill, Percent,29 Perbill, Permill, Percent,30};30};31use sp_arithmetic::traits::One;31use frame_system::{32use frame_system::{32 limits::{BlockLength, BlockWeights},33 limits::{BlockLength, BlockWeights},33 EnsureRoot,34 EnsureRoot,34};35};36use pallet_transaction_payment::{Multiplier, ConstFeeMultiplier};35use crate::{37use crate::{36 runtime_common::DealWithFees, Runtime, RuntimeEvent, RuntimeCall, RuntimeOrigin, PalletInfo,38 runtime_common::DealWithFees, Runtime, RuntimeEvent, RuntimeCall, RuntimeOrigin, PalletInfo,37 System, Balances, Treasury, SS58Prefix, Version,39 System, Balances, Treasury, SS58Prefix, Version,153 /// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.155 /// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.154 pub const OperationalFeeMultiplier: u8 = 5;156 pub const OperationalFeeMultiplier: u8 = 5;157158 pub FeeMultiplier: Multiplier = Multiplier::one();155}159}156160157impl pallet_transaction_payment::Config for Runtime {161impl pallet_transaction_payment::Config for Runtime {160 type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;164 type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;161 type OperationalFeeMultiplier = OperationalFeeMultiplier;165 type OperationalFeeMultiplier = OperationalFeeMultiplier;162 type WeightToFee = pallet_configuration::WeightToFee<Self, Balance>;166 type WeightToFee = pallet_configuration::WeightToFee<Self, Balance>;163 type FeeMultiplierUpdate = ();167 type FeeMultiplierUpdate = ConstFeeMultiplier<FeeMultiplier>;164}168}165169166parameter_types! {170parameter_types! {tests/src/calibrate.tsdiffbeforeafterboth1import {IKeyringPair} from '@polkadot/types/types';1import {IKeyringPair} from '@polkadot/types/types';23import {usingEthPlaygrounds, EthUniqueHelper} from './eth/util';2import {usingEthPlaygrounds, EthUniqueHelper} from './eth/util';434class Fract {5 static ZERO = new Fract(0n);6 constructor(public readonly a: bigint, public readonly b: bigint = 1n) {7 if (b === 0n) throw new Error('division by zero');8 if (b < 0n) throw new Error('missing normalization');9 }5106function linearRegression(points: { x: bigint, y: bigint }[]) {11 mul(other: Fract) {7 let sumxy = 0n;12 return new Fract(this.a * other.a, this.b * other.b).optimize();8 let sumx = 0n;9 let sumy = 0n;10 let sumx2 = 0n;11 const n = points.length;12 for (let i = 0; i < n; i++) {13 const p = points[i];14 sumxy += p.x * p.y;15 sumx += p.x;16 sumy += p.y;17 sumx2 += p.x * p.x;18 }13 }191420 const nb = BigInt(n);15 div(other: Fract) {16 return this.mul(other.inv());17 }211822 const a = (nb * sumxy - sumx * sumy) / (nb * sumx2 - sumx * sumx);19 plus(other: Fract) {20 if (this.b === other.b) {21 return new Fract(this.a + other.a, this.b);23 const b = (sumy - a * sumx) / nb;22 }23 return new Fract(this.a * other.b + other.a * this.b, this.b * other.b).optimize();24 }242525 return {a, b};26 minus(other: Fract) {27 return this.plus(other.neg());26}28 }272928// JS has no builtin function to calculate sqrt of bigint30 neg() {29// https://stackoverflow.com/a/53684036/619016930function sqrt(value: bigint) {31 if (value < 0n) {31 return new Fract(-this.a, this.b);32 throw 'square root of negative numbers is not supported';33 }32 }33 inv() {34 if (this.a < 0) {35 return new Fract(-this.b, -this.a);36 } else {37 return new Fract(this.b, this.a);38 }39 }344035 if (value < 2n) {41 optimize() {42 function gcd(x: bigint, y: bigint) {43 if (x < 0n)44 x = -x;45 if (y < 0n)46 y = -y;47 while(y) {36 return value;48 const t = y;49 y = x % y;50 x = t;51 }52 return x;53 }54 const v = gcd(this.a, this.b);55 return new Fract(this.a / v, this.b / v);37 }56 }385739 function newtonIteration(n: bigint, x0: bigint): bigint {58 toBigInt() {59 return this.a / this.b;60 }61 toNumber() {40 const x1 = ((n / x0) + x0) >> 1n;62 const v = this.optimize();63 return Number(v.a) / Number(v.b);64 }65 toString() {66 const v = this.optimize();41 if (x0 === x1 || x0 === (x1 - 1n)) {67 return `${v.a} / ${v.b}`;68 }6970 lt(other: Fract) {71 return this.a * other.b < other.a * this.b;72 }73 eq(other: Fract) {74 return this.a * other.b === other.a * this.b;75 }7677 sqrt() {78 if (this.a < 0n) {42 return x0;79 throw 'square root of negative numbers is not supported';43 }80 }8144 return newtonIteration(n, x1);82 if (this.lt(new Fract(2n))) {83 return this;84 }8586 function newtonIteration(n: Fract, x0: Fract): Fract {87 const x1 = rpn(n, x0, '/', x0, '+', new Fract(2n), '/');88 if (x0.eq(x1) || x0.eq(x1.minus(new Fract(1n)))) {89 return x0;90 }91 return newtonIteration(n, x1);92 }9394 return newtonIteration(this, new Fract(1n));45 }95 }96}469747 return newtonIteration(value, 1n);98type Op = Fract | '+' | '-' | '*' | '/' | 'dup' | Op[];99function rpn(...ops: (Op)[]) {100 const stack: Fract[] = [];101 for (const op of ops) {102 if (op instanceof Fract) {103 stack.push(op);104 } else if (op === '+') {105 if (stack.length < 2)106 throw new Error('stack underflow');107 const b = stack.pop()!;108 const a = stack.pop()!;109 stack.push(a.plus(b));110 } else if (op === '*') {111 if (stack.length < 2)112 throw new Error('stack underflow');113 const b = stack.pop()!;114 const a = stack.pop()!;115 stack.push(a.mul(b));116 } else if (op === '-') {117 if (stack.length < 2)118 throw new Error('stack underflow');119 const b = stack.pop()!;120 const a = stack.pop()!;121 stack.push(a.minus(b));122 } else if (op === '/') {123 if (stack.length < 2)124 throw new Error('stack underflow');125 const b = stack.pop()!;126 const a = stack.pop()!;127 stack.push(a.div(b));128 } else if (op === 'dup') {129 if (stack.length < 1)130 throw new Error('stack underflow');131 const a = stack.pop()!;132 stack.push(a);133 stack.push(a);134 } else if (Array.isArray(op)) {135 stack.push(rpn(...op));136 } else {137 throw new Error(`unknown operand: ${op}`);138 }139 }140 if (stack.length != 1)141 throw new Error('one element should be left on stack');142 return stack[0]!;48}143}4914450function _error(points: { x: bigint, y: bigint }[], hypothesis: (a: bigint) => bigint) {145function linearRegression(points: { x: Fract, y: Fract }[]) {146 let sumxy = Fract.ZERO;147 let sumx = Fract.ZERO;148 let sumy = Fract.ZERO;149 let sumx2 = Fract.ZERO;150 const n = points.length;151 for (let i = 0; i < n; i++) {152 const p = points[i];153 sumxy = rpn(p.x, p.y, '*', sumxy, '+');154 sumx = sumx.plus(p.x);155 sumy = sumy.plus(p.y);156 sumx2 = rpn(p.x, p.x, '*', sumx2, '+');157 }158159 const nb = new Fract(BigInt(n));160161 const a = rpn(162 [nb, sumxy, '*', sumx, sumy, '*', '-'],163 [nb, sumx2, '*', sumx, sumx, '*', '-'],164 '/',165 );166 const b = rpn(167 [sumy, a, sumx, '*', '-'],168 nb,169 '/',170 );171172 return {a, b};173}174175const hypothesisLinear = (a: Fract, b: Fract) => (x: Fract) => rpn(x, a, '*', b, '+');176177function _error(points: { x: Fract, y: Fract }[], hypothesis: (a: Fract) => Fract) {51 return sqrt(points.map(p => {178 return points.map(p => {52 const v = hypothesis(p.x);179 const v = hypothesis(p.x);53 const vv = p.y;180 const vv = p.y;5418155 return (v - vv) ** 2n;182 return rpn(v, vv, '-', 'dup', '*');56 }).reduce((a, b) => a + b, 0n) / BigInt(points.length));183 }).reduce((a, b) => a.plus(b), Fract.ZERO).sqrt().div(new Fract(BigInt(points.length)));57}184}5818559async function calibrateWeightToFee(helper: EthUniqueHelper, privateKey: (account: string) => Promise<IKeyringPair>) {186async function calibrateWeightToFee(helper: EthUniqueHelper, privateKey: (account: string) => Promise<IKeyringPair>) {68 await token.transfer(alice, {Substrate: bob.address});195 await token.transfer(alice, {Substrate: bob.address});69 const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);196 const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);7019771 console.log(`Original price: ${Number(aliceBalanceBefore - aliceBalanceAfter) / Number(helper.balance.getOneTokenNominal())} UNQ`);198 console.log(`\t[NFT transfer] Original price: ${Number(aliceBalanceBefore - aliceBalanceAfter) / Number(helper.balance.getOneTokenNominal())} UNQ`);72 }199 }7320074 const api = helper.getApi();201 const api = helper.getApi();75 const defaultCoeff = (api.consts.configuration.defaultWeightToFeeCoefficient as any).toBigInt();202 const base = (await api.query.configuration.weightToFeeCoefficientOverride() as any).toBigInt();76 for (let i = -5; i < 5; i++) {203 for (let i = -5; i < 5; i++) {77 await helper.signTransaction(alice, api.tx.sudo.sudo(api.tx.configuration.setWeightToFeeCoefficientOverride(defaultCoeff + defaultCoeff / 1000n * BigInt(i))));204 await helper.signTransaction(alice, api.tx.sudo.sudo(api.tx.configuration.setWeightToFeeCoefficientOverride(base + base / 1000n * BigInt(i))));7820579 const coefficient = (await api.query.configuration.weightToFeeCoefficientOverride() as any).toBigInt();206 const coefficient = new Fract((await api.query.configuration.weightToFeeCoefficientOverride() as any).toBigInt());80 const collection = await helper.nft.mintCollection(alice, {name: 'New', description: 'New collection', tokenPrefix: 'NEW'});207 const collection = await helper.nft.mintCollection(alice, {name: 'New', description: 'New collection', tokenPrefix: 'NEW'});81 const token = await collection.mintToken(alice, {Substrate: alice.address});208 const token = await collection.mintToken(alice, {Substrate: alice.address});8220983 const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);210 const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);84 await token.transfer(alice, {Substrate: bob.address});211 await token.transfer(alice, {Substrate: bob.address});85 const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);212 const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);8621387 const transferPrice = aliceBalanceBefore - aliceBalanceAfter;214 const transferPrice = new Fract(aliceBalanceBefore - aliceBalanceAfter);8821589 dataPoints.push({x: transferPrice, y: coefficient});216 dataPoints.push({x: transferPrice, y: coefficient});90 }217 }91 const {a, b} = linearRegression(dataPoints);218 const {a, b} = linearRegression(dataPoints);9221993 // console.log(`Error: ${error(dataPoints, x => a*x+b)}`);220 const hyp = hypothesisLinear(a, b);221 // console.log(`\t[NFT transfer] Error: ${_error(dataPoints, hyp).toNumber()}`);9422295 const perfectValue = a * helper.balance.getOneTokenNominal() / 10n + b;223 // 0.1 UNQ224 const perfectValue = hyp(rpn(new Fract(helper.balance.getOneTokenNominal()), new Fract(1n, 10n), '*'));96 await helper.signTransaction(alice, api.tx.sudo.sudo(api.tx.configuration.setWeightToFeeCoefficientOverride(perfectValue.toString())));225 await helper.signTransaction(alice, api.tx.sudo.sudo(api.tx.configuration.setWeightToFeeCoefficientOverride(perfectValue.toBigInt())));9722698 {227 {99 const collection = await helper.nft.mintCollection(alice, {name: 'New', description: 'New collection', tokenPrefix: 'NEW'});228 const collection = await helper.nft.mintCollection(alice, {name: 'New', description: 'New collection', tokenPrefix: 'NEW'});102 await token.transfer(alice, {Substrate: bob.address});231 await token.transfer(alice, {Substrate: bob.address});103 const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);232 const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);104233105 console.log(`Calibrated price: ${Number(aliceBalanceBefore - aliceBalanceAfter) / Number(helper.balance.getOneTokenNominal())} UNQ`);234 console.log(`\t[NFT transfer] Calibrated price: ${Number(aliceBalanceBefore - aliceBalanceAfter) / Number(helper.balance.getOneTokenNominal())} UNQ`);106 }235 }107}236}108237121250122 const cost = await helper.eth.calculateFee({Ethereum: caller}, () => contract.methods.transfer(receiver, token.tokenId).send({from: caller, gas: helper.eth.DEFAULT_GAS}));251 const cost = await helper.eth.calculateFee({Ethereum: caller}, () => contract.methods.transfer(receiver, token.tokenId).send({from: caller, gas: helper.eth.DEFAULT_GAS}));123252124 console.log(`Original price: ${Number(cost) / Number(helper.balance.getOneTokenNominal())} UNQ`);253 console.log(`\t[ETH NFT transfer] Original price: ${Number(cost) / Number(helper.balance.getOneTokenNominal())} UNQ`);125 }254 }126255127 const api = helper.getApi();256 const api = helper.getApi();128 const defaultCoeff = (api.consts.configuration.defaultMinGasPrice as any).toBigInt();257 // const defaultCoeff = (api.consts.configuration.defaultMinGasPrice as any).toBigInt();258 const base = (await api.query.configuration.minGasPriceOverride() as any).toBigInt();129 for (let i = -8; i < 8; i++) {259 for (let i = -8; i < 8; i++) {130 const gasPrice = defaultCoeff + defaultCoeff / 100000n * BigInt(i);260 const gasPrice = base + base / 100000n * BigInt(i);131 const gasPriceStr = '0x' + gasPrice.toString(16);261 const gasPriceStr = '0x' + gasPrice.toString(16);132 await helper.signTransaction(alice, api.tx.sudo.sudo(api.tx.configuration.setMinGasPriceOverride(gasPrice)));262 await helper.signTransaction(alice, api.tx.sudo.sudo(api.tx.configuration.setMinGasPriceOverride(gasPrice)));133263134 const coefficient = (await api.query.configuration.minGasPriceOverride() as any).toBigInt();264 const coefficient = new Fract((await api.query.configuration.minGasPriceOverride() as any).toBigInt());135 const collection = await helper.nft.mintCollection(alice, {name: 'New', description: 'New collection', tokenPrefix: 'NEW'});265 const collection = await helper.nft.mintCollection(alice, {name: 'New', description: 'New collection', tokenPrefix: 'NEW'});136 const token = await collection.mintToken(alice, {Ethereum: caller});266 const token = await collection.mintToken(alice, {Ethereum: caller});137267138 const address = helper.ethAddress.fromCollectionId(collection.collectionId);268 const address = helper.ethAddress.fromCollectionId(collection.collectionId);139 const contract = helper.ethNativeContract.collection(address, 'nft', caller);269 const contract = helper.ethNativeContract.collection(address, 'nft', caller);140270141 const transferPrice = await helper.eth.calculateFee({Ethereum: caller}, () => contract.methods.transfer(receiver, token.tokenId).send({from: caller, gasPrice: gasPriceStr, gas: helper.eth.DEFAULT_GAS}));271 const transferPrice = new Fract(await helper.eth.calculateFee({Ethereum: caller}, () => contract.methods.transfer(receiver, token.tokenId).send({from: caller, gasPrice: gasPriceStr, gas: helper.eth.DEFAULT_GAS})));142272143 dataPoints.push({x: transferPrice, y: coefficient});273 dataPoints.push({x: transferPrice, y: coefficient});144 }274 }145275146 const {a, b} = linearRegression(dataPoints);276 const {a, b} = linearRegression(dataPoints);147277148 // console.log(`Error: ${error(dataPoints, x => a*x+b)}`);278 const hyp = hypothesisLinear(a, b);279 // console.log(`\t[ETH NFT transfer] Error: ${_error(dataPoints, hyp).toNumber()}`);149280150 // * 0.15 = * 10000 / 66666281 // 0.15 UNQ151 const perfectValue = a * helper.balance.getOneTokenNominal() * 1000000n / 6666666n + b;282 const perfectValue = hyp(rpn(new Fract(helper.balance.getOneTokenNominal()), new Fract(15n, 100n), '*'));152 await helper.signTransaction(alice, api.tx.sudo.sudo(api.tx.configuration.setMinGasPriceOverride(perfectValue.toString())));283 await helper.signTransaction(alice, api.tx.sudo.sudo(api.tx.configuration.setMinGasPriceOverride(perfectValue.toBigInt())));153284154 {285 {155 const collection = await helper.nft.mintCollection(alice, {name: 'New', description: 'New collection', tokenPrefix: 'NEW'});286 const collection = await helper.nft.mintCollection(alice, {name: 'New', description: 'New collection', tokenPrefix: 'NEW'});160291161 const cost = await helper.eth.calculateFee({Ethereum: caller}, () => contract.methods.transfer(receiver, token.tokenId).send({from: caller, gas: helper.eth.DEFAULT_GAS}));292 const cost = await helper.eth.calculateFee({Ethereum: caller}, () => contract.methods.transfer(receiver, token.tokenId).send({from: caller, gas: helper.eth.DEFAULT_GAS}));162293163 console.log(`Calibrated price: ${Number(cost) / Number(helper.balance.getOneTokenNominal())} UNQ`);294 console.log(`\t[ETH NFT transfer] Calibrated price: ${Number(cost) / Number(helper.balance.getOneTokenNominal())} UNQ`);164 }295 }165}296}166297167(async () => {298(async () => {168 await usingEthPlaygrounds(async (helper: EthUniqueHelper, privateKey) => {299 await usingEthPlaygrounds(async (helper: EthUniqueHelper, privateKey) => {169 // Second run slightly reduces error sometimes, as price line is not actually straight, this is a curve300 // Subsequent runs reduce error, as price line is not actually straight, this is a curve170301171 await calibrateWeightToFee(helper, privateKey);302 const iterations = 3;172 await calibrateWeightToFee(helper, privateKey);173303174 await calibrateMinGasPrice(helper, privateKey);304 console.log('[Calibrate WeightToFee]');305 for (let i = 0; i < iterations; i++) {306 await calibrateWeightToFee(helper, privateKey);175 await calibrateMinGasPrice(helper, privateKey);307 }308309 console.log();310311 console.log('[Calibrate MinGasPrice]');312 for (let i = 0; i < iterations; i++) {313 await calibrateMinGasPrice(helper, privateKey);314 }176 });315 });177})();316})();178317tests/src/eth/ethFeesAreCorrect.test.tsdiffbeforeafterbothno changes
tests/src/interfaces/augment-api-consts.tsdiffbeforeafterboth82 appPromotionDailyRate: Perbill & AugmentedConst<ApiType>;82 appPromotionDailyRate: Perbill & AugmentedConst<ApiType>;83 dayRelayBlocks: u32 & AugmentedConst<ApiType>;83 dayRelayBlocks: u32 & AugmentedConst<ApiType>;84 defaultMinGasPrice: u64 & AugmentedConst<ApiType>;84 defaultMinGasPrice: u64 & AugmentedConst<ApiType>;85 defaultWeightToFeeCoefficient: u32 & AugmentedConst<ApiType>;85 defaultWeightToFeeCoefficient: u64 & AugmentedConst<ApiType>;86 maxXcmAllowedLocations: u32 & AugmentedConst<ApiType>;86 maxXcmAllowedLocations: u32 & AugmentedConst<ApiType>;87 /**87 /**88 * Generic const88 * Generic consttests/src/interfaces/augment-api-query.tsdiffbeforeafterboth162 configuration: {162 configuration: {163 appPromomotionConfigurationOverride: AugmentedQuery<ApiType, () => Observable<PalletConfigurationAppPromotionConfiguration>, []> & QueryableStorageEntry<ApiType, []>;163 appPromomotionConfigurationOverride: AugmentedQuery<ApiType, () => Observable<PalletConfigurationAppPromotionConfiguration>, []> & QueryableStorageEntry<ApiType, []>;164 minGasPriceOverride: AugmentedQuery<ApiType, () => Observable<u64>, []> & QueryableStorageEntry<ApiType, []>;164 minGasPriceOverride: AugmentedQuery<ApiType, () => Observable<u64>, []> & QueryableStorageEntry<ApiType, []>;165 weightToFeeCoefficientOverride: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;165 weightToFeeCoefficientOverride: AugmentedQuery<ApiType, () => Observable<u64>, []> & QueryableStorageEntry<ApiType, []>;166 xcmAllowedLocationsOverride: AugmentedQuery<ApiType, () => Observable<Option<Vec<XcmV1MultiLocation>>>, []> & QueryableStorageEntry<ApiType, []>;166 xcmAllowedLocationsOverride: AugmentedQuery<ApiType, () => Observable<Option<Vec<XcmV1MultiLocation>>>, []> & QueryableStorageEntry<ApiType, []>;167 /**167 /**168 * Generic query168 * Generic querytests/src/interfaces/augment-api-rpc.tsdiffbeforeafterboth16import type { BlockHash } from '@polkadot/types/interfaces/chain';16import type { BlockHash } from '@polkadot/types/interfaces/chain';17import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';17import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';18import type { AuthorityId } from '@polkadot/types/interfaces/consensus';18import type { AuthorityId } from '@polkadot/types/interfaces/consensus';19import type { CodeUploadRequest, CodeUploadResult, ContractCallRequest, ContractExecResult, ContractInstantiateResult, InstantiateRequest } from '@polkadot/types/interfaces/contracts';19import type { CodeUploadRequest, CodeUploadResult, ContractCallRequest, ContractExecResult, ContractInstantiateResult, InstantiateRequestV1 } from '@polkadot/types/interfaces/contracts';20import type { BlockStats } from '@polkadot/types/interfaces/dev';20import type { BlockStats } from '@polkadot/types/interfaces/dev';21import type { CreatedBlock } from '@polkadot/types/interfaces/engine';21import type { CreatedBlock } from '@polkadot/types/interfaces/engine';22import type { EthAccount, EthCallRequest, EthFeeHistory, EthFilter, EthFilterChanges, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth';22import type { EthAccount, EthCallRequest, EthFeeHistory, EthFilter, EthFilterChanges, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth';23import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';23import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';24import type { EncodedFinalityProofs, JustificationNotification, ReportedRoundStates } from '@polkadot/types/interfaces/grandpa';24import type { EncodedFinalityProofs, JustificationNotification, ReportedRoundStates } from '@polkadot/types/interfaces/grandpa';25import type { MmrLeafBatchProof, MmrLeafProof } from '@polkadot/types/interfaces/mmr';25import type { MmrLeafBatchProof, MmrLeafProof } from '@polkadot/types/interfaces/mmr';26import type { StorageKind } from '@polkadot/types/interfaces/offchain';26import type { StorageKind } from '@polkadot/types/interfaces/offchain';27import type { FeeDetails, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';27import type { FeeDetails, RuntimeDispatchInfoV1 } from '@polkadot/types/interfaces/payment';28import type { RpcMethods } from '@polkadot/types/interfaces/rpc';28import type { RpcMethods } from '@polkadot/types/interfaces/rpc';29import type { AccountId, AccountId32, BlockNumber, H160, H256, H64, Hash, Header, Index, Justification, KeyValue, SignedBlock, StorageData } from '@polkadot/types/interfaces/runtime';29import type { AccountId, AccountId32, BlockNumber, H160, H256, H64, Hash, Header, Index, Justification, KeyValue, SignedBlock, StorageData } from '@polkadot/types/interfaces/runtime';30import type { MigrationStatusResult, ReadProof, RuntimeVersion, TraceBlockResponse } from '@polkadot/types/interfaces/state';30import type { MigrationStatusResult, ReadProof, RuntimeVersion, TraceBlockResponse } from '@polkadot/types/interfaces/state';174 * @deprecated Use the runtime interface `api.call.contractsApi.instantiate` instead174 * @deprecated Use the runtime interface `api.call.contractsApi.instantiate` instead175 * Instantiate a new contract175 * Instantiate a new contract176 **/176 **/177 instantiate: AugmentedRpc<(request: InstantiateRequest | { origin?: any; value?: any; gasLimit?: any; storageDepositLimit?: any; code?: any; data?: any; salt?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<ContractInstantiateResult>>;177 instantiate: AugmentedRpc<(request: InstantiateRequestV1 | { origin?: any; value?: any; gasLimit?: any; code?: any; data?: any; salt?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<ContractInstantiateResult>>;178 /**178 /**179 * @deprecated Not available in newer versions of the contracts interfaces179 * @deprecated Not available in newer versions of the contracts interfaces180 * Returns the projected time a given contract will be able to sustain paying its rent180 * Returns the projected time a given contract will be able to sustain paying its rent425 localStorageSet: AugmentedRpc<(kind: StorageKind | 'PERSISTENT' | 'LOCAL' | number | Uint8Array, key: Bytes | string | Uint8Array, value: Bytes | string | Uint8Array) => Observable<Null>>;425 localStorageSet: AugmentedRpc<(kind: StorageKind | 'PERSISTENT' | 'LOCAL' | number | Uint8Array, key: Bytes | string | Uint8Array, value: Bytes | string | Uint8Array) => Observable<Null>>;426 };426 };427 payment: {427 payment: {428 /**428 /**429 * Query the detailed fee of a given encoded extrinsic429 * @deprecated Use `api.call.transactionPaymentApi.queryFeeDetails` instead430 * Query the detailed fee of a given encoded extrinsic430 **/431 **/431 queryFeeDetails: AugmentedRpc<(extrinsic: Bytes | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<FeeDetails>>;432 queryFeeDetails: AugmentedRpc<(extrinsic: Bytes | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<FeeDetails>>;432 /**433 /**433 * Retrieves the fee information for an encoded extrinsic434 * @deprecated Use `api.call.transactionPaymentApi.queryInfo` instead435 * Retrieves the fee information for an encoded extrinsic434 **/436 **/435 queryInfo: AugmentedRpc<(extrinsic: Bytes | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<RuntimeDispatchInfo>>;437 queryInfo: AugmentedRpc<(extrinsic: Bytes | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<RuntimeDispatchInfoV1>>;436 };438 };437 rmrk: {439 rmrk: {438 /**440 /**tests/src/interfaces/augment-api-runtime.tsdiffbeforeafterboth6import '@polkadot/api-base/types/calls';6import '@polkadot/api-base/types/calls';778import type { ApiTypes, AugmentedCall, DecoratedCallBase } from '@polkadot/api-base/types';8import type { ApiTypes, AugmentedCall, DecoratedCallBase } from '@polkadot/api-base/types';9import type { Bytes, Null, Option, Result, U256, Vec, bool, u256, u64 } from '@polkadot/types-codec';9import type { Bytes, Null, Option, Result, U256, Vec, bool, u256, u32, u64 } from '@polkadot/types-codec';10import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';10import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';11import type { CheckInherentsResult, InherentData } from '@polkadot/types/interfaces/blockbuilder';11import type { CheckInherentsResult, InherentData } from '@polkadot/types/interfaces/blockbuilder';12import type { BlockHash } from '@polkadot/types/interfaces/chain';12import type { BlockHash } from '@polkadot/types/interfaces/chain';16import type { EvmAccount, EvmCallInfo, EvmCreateInfo } from '@polkadot/types/interfaces/evm';16import type { EvmAccount, EvmCallInfo, EvmCreateInfo } from '@polkadot/types/interfaces/evm';17import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';17import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';18import type { OpaqueMetadata } from '@polkadot/types/interfaces/metadata';18import type { OpaqueMetadata } from '@polkadot/types/interfaces/metadata';19import type { FeeDetails, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';19import type { AccountId, Block, H160, H256, Header, Index, KeyTypeId, Permill, SlotDuration } from '@polkadot/types/interfaces/runtime';20import type { AccountId, Block, H160, H256, Header, Index, KeyTypeId, Permill, SlotDuration } from '@polkadot/types/interfaces/runtime';20import type { RuntimeVersion } from '@polkadot/types/interfaces/state';21import type { RuntimeVersion } from '@polkadot/types/interfaces/state';21import type { ApplyExtrinsicResult, DispatchError } from '@polkadot/types/interfaces/system';22import type { ApplyExtrinsicResult, DispatchError } from '@polkadot/types/interfaces/system';228 **/229 **/229 [key: string]: DecoratedCallBase<ApiType>;230 [key: string]: DecoratedCallBase<ApiType>;230 };231 };232 /** 0x37c8bb1350a9a2a8/2 */233 transactionPaymentApi: {234 /**235 * The transaction fee details236 **/237 queryFeeDetails: AugmentedCall<ApiType, (uxt: Extrinsic | IExtrinsic | string | Uint8Array, len: u32 | AnyNumber | Uint8Array) => Observable<FeeDetails>>;238 /**239 * The transaction info240 **/241 queryInfo: AugmentedCall<ApiType, (uxt: Extrinsic | IExtrinsic | string | Uint8Array, len: u32 | AnyNumber | Uint8Array) => Observable<RuntimeDispatchInfo>>;242 /**243 * Generic call244 **/245 [key: string]: DecoratedCallBase<ApiType>;246 };231 } // AugmentedCalls247 } // AugmentedCalls232} // declare module248} // declare module233249tests/src/interfaces/augment-api-tx.tsdiffbeforeafterboth217 configuration: {217 configuration: {218 setAppPromotionConfigurationOverride: AugmentedSubmittable<(configuration: PalletConfigurationAppPromotionConfiguration | { recalculationInterval?: any; pendingInterval?: any; intervalIncome?: any; maxStakersPerCalculation?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletConfigurationAppPromotionConfiguration]>;218 setAppPromotionConfigurationOverride: AugmentedSubmittable<(configuration: PalletConfigurationAppPromotionConfiguration | { recalculationInterval?: any; pendingInterval?: any; intervalIncome?: any; maxStakersPerCalculation?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletConfigurationAppPromotionConfiguration]>;219 setMinGasPriceOverride: AugmentedSubmittable<(coeff: Option<u64> | null | Uint8Array | u64 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u64>]>;219 setMinGasPriceOverride: AugmentedSubmittable<(coeff: Option<u64> | null | Uint8Array | u64 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u64>]>;220 setWeightToFeeCoefficientOverride: AugmentedSubmittable<(coeff: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>]>;220 setWeightToFeeCoefficientOverride: AugmentedSubmittable<(coeff: Option<u64> | null | Uint8Array | u64 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u64>]>;221 setXcmAllowedLocations: AugmentedSubmittable<(locations: Option<Vec<XcmV1MultiLocation>> | null | Uint8Array | Vec<XcmV1MultiLocation> | (XcmV1MultiLocation | { parents?: any; interior?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Option<Vec<XcmV1MultiLocation>>]>;221 setXcmAllowedLocations: AugmentedSubmittable<(locations: Option<Vec<XcmV1MultiLocation>> | null | Uint8Array | Vec<XcmV1MultiLocation> | (XcmV1MultiLocation | { parents?: any; interior?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Option<Vec<XcmV1MultiLocation>>]>;222 /**222 /**223 * Generic tx223 * Generic tx1431 * * `collection_id`: Collection to destroy.1431 * * `collection_id`: Collection to destroy.1432 **/1432 **/1433 destroyCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;1433 destroyCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;1434 /**1435 * Repairs a collection if the data was somehow corrupted.1436 * 1437 * # Arguments1438 * 1439 * * `collection_id`: ID of the collection to repair.1440 **/1441 forceRepairCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;1442 /**1443 * Repairs a token if the data was somehow corrupted.1444 * 1445 * # Arguments1446 * 1447 * * `collection_id`: ID of the collection the item belongs to.1448 * * `item_id`: ID of the item.1449 **/1450 forceRepairItem: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32]>;1434 /**1451 /**1435 * Remove admin of a collection.1452 * Remove admin of a collection.1436 * 1453 * 1474 * * `address`: ID of the address to be removed from the allowlist.1491 * * `address`: ID of the address to be removed from the allowlist.1475 **/1492 **/1476 removeFromAllowList: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, address: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;1493 removeFromAllowList: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, address: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;1477 /**1478 * Repairs a broken item1479 * 1480 * # Arguments1481 * 1482 * * `collection_id`: ID of the collection the item belongs to.1483 * * `item_id`: ID of the item.1484 **/1485 repairItem: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32]>;1486 /**1494 /**1487 * Re-partition a refungible token, while owning all of its parts/pieces.1495 * Re-partition a refungible token, while owning all of its parts/pieces.1488 * 1496 * tests/src/interfaces/augment-types.tsdiffbeforeafterboth24import type { StatementKind } from '@polkadot/types/interfaces/claims';24import type { StatementKind } from '@polkadot/types/interfaces/claims';25import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';25import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';26import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';26import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';27import type { AliveContractInfo, CodeHash, CodeSource, CodeUploadRequest, CodeUploadResult, CodeUploadResultValue, ContractCallFlags, ContractCallRequest, ContractExecResult, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractExecResultTo267, ContractInfo, ContractInstantiateResult, ContractInstantiateResultTo267, ContractInstantiateResultTo299, ContractReturnFlags, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateRequestV1, InstantiateRequestV2, InstantiateReturnValue, InstantiateReturnValueOk, InstantiateReturnValueTo267, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, StorageDeposit, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';27import type { AliveContractInfo, CodeHash, CodeSource, CodeUploadRequest, CodeUploadResult, CodeUploadResultValue, ContractCallFlags, ContractCallRequest, ContractExecResult, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractExecResultTo267, ContractExecResultU64, ContractInfo, ContractInstantiateResult, ContractInstantiateResultTo267, ContractInstantiateResultTo299, ContractInstantiateResultU64, ContractReturnFlags, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateRequestV1, InstantiateRequestV2, InstantiateReturnValue, InstantiateReturnValueOk, InstantiateReturnValueTo267, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, StorageDeposit, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';28import type { ContractConstructorSpecLatest, ContractConstructorSpecV0, ContractConstructorSpecV1, ContractConstructorSpecV2, ContractConstructorSpecV3, ContractContractSpecV0, ContractContractSpecV1, ContractContractSpecV2, ContractContractSpecV3, ContractContractSpecV4, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpecLatest, ContractEventParamSpecV0, ContractEventParamSpecV2, ContractEventSpecLatest, ContractEventSpecV0, ContractEventSpecV1, ContractEventSpecV2, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpecLatest, ContractMessageParamSpecV0, ContractMessageParamSpecV2, ContractMessageSpecLatest, ContractMessageSpecV0, ContractMessageSpecV1, ContractMessageSpecV2, ContractMetadata, ContractMetadataLatest, ContractMetadataV0, ContractMetadataV1, ContractMetadataV2, ContractMetadataV3, ContractMetadataV4, ContractProject, ContractProjectContract, ContractProjectInfo, ContractProjectSource, ContractProjectV0, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi';28import type { ContractConstructorSpecLatest, ContractConstructorSpecV0, ContractConstructorSpecV1, ContractConstructorSpecV2, ContractConstructorSpecV3, ContractContractSpecV0, ContractContractSpecV1, ContractContractSpecV2, ContractContractSpecV3, ContractContractSpecV4, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpecLatest, ContractEventParamSpecV0, ContractEventParamSpecV2, ContractEventSpecLatest, ContractEventSpecV0, ContractEventSpecV1, ContractEventSpecV2, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpecLatest, ContractMessageParamSpecV0, ContractMessageParamSpecV2, ContractMessageSpecLatest, ContractMessageSpecV0, ContractMessageSpecV1, ContractMessageSpecV2, ContractMetadata, ContractMetadataLatest, ContractMetadataV0, ContractMetadataV1, ContractMetadataV2, ContractMetadataV3, ContractMetadataV4, ContractProject, ContractProjectContract, ContractProjectInfo, ContractProjectSource, ContractProjectV0, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi';29import type { FundIndex, FundInfo, LastContribution, TrieIndex } from '@polkadot/types/interfaces/crowdloan';29import type { FundIndex, FundInfo, LastContribution, TrieIndex } from '@polkadot/types/interfaces/crowdloan';30import type { CollationInfo, CollationInfoV1, ConfigData, MessageId, OverweightIndex, PageCounter, PageIndexData } from '@polkadot/types/interfaces/cumulus';30import type { CollationInfo, CollationInfoV1, ConfigData, MessageId, OverweightIndex, PageCounter, PageIndexData } from '@polkadot/types/interfaces/cumulus';47import type { StorageKind } from '@polkadot/types/interfaces/offchain';47import type { StorageKind } from '@polkadot/types/interfaces/offchain';48import type { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences';48import type { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences';49import type { AbridgedCandidateReceipt, AbridgedHostConfiguration, AbridgedHrmpChannel, AssignmentId, AssignmentKind, AttestedCandidate, AuctionIndex, AuthorityDiscoveryId, AvailabilityBitfield, AvailabilityBitfieldRecord, BackedCandidate, Bidder, BufferedSessionChange, CandidateCommitments, CandidateDescriptor, CandidateEvent, CandidateHash, CandidateInfo, CandidatePendingAvailability, CandidateReceipt, CollatorId, CollatorSignature, CommittedCandidateReceipt, CoreAssignment, CoreIndex, CoreOccupied, CoreState, DisputeLocation, DisputeResult, DisputeState, DisputeStatement, DisputeStatementSet, DoubleVoteReport, DownwardMessage, ExplicitDisputeStatement, GlobalValidationData, GlobalValidationSchedule, GroupIndex, GroupRotationInfo, HeadData, HostConfiguration, HrmpChannel, HrmpChannelId, HrmpOpenChannelRequest, InboundDownwardMessage, InboundHrmpMessage, InboundHrmpMessages, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, InvalidDisputeStatementKind, LeasePeriod, LeasePeriodOf, LocalValidationData, MessageIngestionType, MessageQueueChain, MessagingStateSnapshot, MessagingStateSnapshotEgressEntry, MultiDisputeStatementSet, NewBidder, OccupiedCore, OccupiedCoreAssumption, OldV1SessionInfo, OutboundHrmpMessage, ParaGenesisArgs, ParaId, ParaInfo, ParaLifecycle, ParaPastCodeMeta, ParaScheduling, ParaValidatorIndex, ParachainDispatchOrigin, ParachainInherentData, ParachainProposal, ParachainsInherentData, ParathreadClaim, ParathreadClaimQueue, ParathreadEntry, PersistedValidationData, PvfCheckStatement, QueuedParathread, RegisteredParachainInfo, RelayBlockNumber, RelayChainBlockNumber, RelayChainHash, RelayHash, Remark, ReplacementTimes, Retriable, ScheduledCore, Scheduling, ScrapedOnChainVotes, ServiceQuality, SessionInfo, SessionInfoValidatorGroup, SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, SlotRange, SlotRange10, Statement, SubId, SystemInherentData, TransientValidationData, UpgradeGoAhead, UpgradeRestriction, UpwardMessage, ValidDisputeStatementKind, ValidationCode, ValidationCodeHash, ValidationData, ValidationDataType, ValidationFunctionParams, ValidatorSignature, ValidityAttestation, VecInboundHrmpMessage, WinnersData, WinnersData10, WinnersDataTuple, WinnersDataTuple10, WinningData, WinningData10, WinningDataEntry } from '@polkadot/types/interfaces/parachains';49import type { AbridgedCandidateReceipt, AbridgedHostConfiguration, AbridgedHrmpChannel, AssignmentId, AssignmentKind, AttestedCandidate, AuctionIndex, AuthorityDiscoveryId, AvailabilityBitfield, AvailabilityBitfieldRecord, BackedCandidate, Bidder, BufferedSessionChange, CandidateCommitments, CandidateDescriptor, CandidateEvent, CandidateHash, CandidateInfo, CandidatePendingAvailability, CandidateReceipt, CollatorId, CollatorSignature, CommittedCandidateReceipt, CoreAssignment, CoreIndex, CoreOccupied, CoreState, DisputeLocation, DisputeResult, DisputeState, DisputeStatement, DisputeStatementSet, DoubleVoteReport, DownwardMessage, ExplicitDisputeStatement, GlobalValidationData, GlobalValidationSchedule, GroupIndex, GroupRotationInfo, HeadData, HostConfiguration, HrmpChannel, HrmpChannelId, HrmpOpenChannelRequest, InboundDownwardMessage, InboundHrmpMessage, InboundHrmpMessages, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, InvalidDisputeStatementKind, LeasePeriod, LeasePeriodOf, LocalValidationData, MessageIngestionType, MessageQueueChain, MessagingStateSnapshot, MessagingStateSnapshotEgressEntry, MultiDisputeStatementSet, NewBidder, OccupiedCore, OccupiedCoreAssumption, OldV1SessionInfo, OutboundHrmpMessage, ParaGenesisArgs, ParaId, ParaInfo, ParaLifecycle, ParaPastCodeMeta, ParaScheduling, ParaValidatorIndex, ParachainDispatchOrigin, ParachainInherentData, ParachainProposal, ParachainsInherentData, ParathreadClaim, ParathreadClaimQueue, ParathreadEntry, PersistedValidationData, PvfCheckStatement, QueuedParathread, RegisteredParachainInfo, RelayBlockNumber, RelayChainBlockNumber, RelayChainHash, RelayHash, Remark, ReplacementTimes, Retriable, ScheduledCore, Scheduling, ScrapedOnChainVotes, ServiceQuality, SessionInfo, SessionInfoValidatorGroup, SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, SlotRange, SlotRange10, Statement, SubId, SystemInherentData, TransientValidationData, UpgradeGoAhead, UpgradeRestriction, UpwardMessage, ValidDisputeStatementKind, ValidationCode, ValidationCodeHash, ValidationData, ValidationDataType, ValidationFunctionParams, ValidatorSignature, ValidityAttestation, VecInboundHrmpMessage, WinnersData, WinnersData10, WinnersDataTuple, WinnersDataTuple10, WinningData, WinningData10, WinningDataEntry } from '@polkadot/types/interfaces/parachains';50import type { FeeDetails, InclusionFee, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';50import type { FeeDetails, InclusionFee, RuntimeDispatchInfo, RuntimeDispatchInfoV1, RuntimeDispatchInfoV2 } from '@polkadot/types/interfaces/payment';51import type { Approvals } from '@polkadot/types/interfaces/poll';51import type { Approvals } from '@polkadot/types/interfaces/poll';52import type { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/types/interfaces/proxy';52import type { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/types/interfaces/proxy';53import type { AccountStatus, AccountValidity } from '@polkadot/types/interfaces/purchase';53import type { AccountStatus, AccountValidity } from '@polkadot/types/interfaces/purchase';273 ContractExecResultTo255: ContractExecResultTo255;273 ContractExecResultTo255: ContractExecResultTo255;274 ContractExecResultTo260: ContractExecResultTo260;274 ContractExecResultTo260: ContractExecResultTo260;275 ContractExecResultTo267: ContractExecResultTo267;275 ContractExecResultTo267: ContractExecResultTo267;276 ContractExecResultU64: ContractExecResultU64;276 ContractInfo: ContractInfo;277 ContractInfo: ContractInfo;277 ContractInstantiateResult: ContractInstantiateResult;278 ContractInstantiateResult: ContractInstantiateResult;278 ContractInstantiateResultTo267: ContractInstantiateResultTo267;279 ContractInstantiateResultTo267: ContractInstantiateResultTo267;279 ContractInstantiateResultTo299: ContractInstantiateResultTo299;280 ContractInstantiateResultTo299: ContractInstantiateResultTo299;281 ContractInstantiateResultU64: ContractInstantiateResultU64;280 ContractLayoutArray: ContractLayoutArray;282 ContractLayoutArray: ContractLayoutArray;281 ContractLayoutCell: ContractLayoutCell;283 ContractLayoutCell: ContractLayoutCell;282 ContractLayoutEnum: ContractLayoutEnum;284 ContractLayoutEnum: ContractLayoutEnum;1057 RpcMethods: RpcMethods;1059 RpcMethods: RpcMethods;1058 RuntimeDbWeight: RuntimeDbWeight;1060 RuntimeDbWeight: RuntimeDbWeight;1059 RuntimeDispatchInfo: RuntimeDispatchInfo;1061 RuntimeDispatchInfo: RuntimeDispatchInfo;1062 RuntimeDispatchInfoV1: RuntimeDispatchInfoV1;1063 RuntimeDispatchInfoV2: RuntimeDispatchInfoV2;1060 RuntimeVersion: RuntimeVersion;1064 RuntimeVersion: RuntimeVersion;1061 RuntimeVersionApi: RuntimeVersionApi;1065 RuntimeVersionApi: RuntimeVersionApi;1062 RuntimeVersionPartial: RuntimeVersionPartial;1066 RuntimeVersionPartial: RuntimeVersionPartial;tests/src/interfaces/default/types.tsdiffbeforeafterboth1303export interface PalletConfigurationCall extends Enum {1303export interface PalletConfigurationCall extends Enum {1304 readonly isSetWeightToFeeCoefficientOverride: boolean;1304 readonly isSetWeightToFeeCoefficientOverride: boolean;1305 readonly asSetWeightToFeeCoefficientOverride: {1305 readonly asSetWeightToFeeCoefficientOverride: {1306 readonly coeff: Option<u32>;1306 readonly coeff: Option<u64>;1307 } & Struct;1307 } & Struct;1308 readonly isSetMinGasPriceOverride: boolean;1308 readonly isSetMinGasPriceOverride: boolean;1309 readonly asSetMinGasPriceOverride: {1309 readonly asSetMinGasPriceOverride: {2319 readonly operator: PalletEvmAccountBasicCrossAccountIdRepr;2319 readonly operator: PalletEvmAccountBasicCrossAccountIdRepr;2320 readonly approve: bool;2320 readonly approve: bool;2321 } & Struct;2321 } & Struct;2322 readonly isRepairItem: boolean;2322 readonly isForceRepairCollection: boolean;2323 readonly asForceRepairCollection: {2324 readonly collectionId: u32;2325 } & Struct;2326 readonly isForceRepairItem: boolean;2323 readonly asRepairItem: {2327 readonly asForceRepairItem: {2324 readonly collectionId: u32;2328 readonly collectionId: u32;2325 readonly itemId: u32;2329 readonly itemId: u32;2326 } & Struct;2330 } & Struct;2327 readonly type: 'CreateCollection' | 'CreateCollectionEx' | 'DestroyCollection' | 'AddToAllowList' | 'RemoveFromAllowList' | 'ChangeCollectionOwner' | 'AddCollectionAdmin' | 'RemoveCollectionAdmin' | 'SetCollectionSponsor' | 'ConfirmSponsorship' | 'RemoveCollectionSponsor' | 'CreateItem' | 'CreateMultipleItems' | 'SetCollectionProperties' | 'DeleteCollectionProperties' | 'SetTokenProperties' | 'DeleteTokenProperties' | 'SetTokenPropertyPermissions' | 'CreateMultipleItemsEx' | 'SetTransfersEnabledFlag' | 'BurnItem' | 'BurnFrom' | 'Transfer' | 'Approve' | 'TransferFrom' | 'SetCollectionLimits' | 'SetCollectionPermissions' | 'Repartition' | 'SetAllowanceForAll' | 'RepairItem';2331 readonly type: 'CreateCollection' | 'CreateCollectionEx' | 'DestroyCollection' | 'AddToAllowList' | 'RemoveFromAllowList' | 'ChangeCollectionOwner' | 'AddCollectionAdmin' | 'RemoveCollectionAdmin' | 'SetCollectionSponsor' | 'ConfirmSponsorship' | 'RemoveCollectionSponsor' | 'CreateItem' | 'CreateMultipleItems' | 'SetCollectionProperties' | 'DeleteCollectionProperties' | 'SetTokenProperties' | 'DeleteTokenProperties' | 'SetTokenPropertyPermissions' | 'CreateMultipleItemsEx' | 'SetTransfersEnabledFlag' | 'BurnItem' | 'BurnFrom' | 'Transfer' | 'Approve' | 'TransferFrom' | 'SetCollectionLimits' | 'SetCollectionPermissions' | 'Repartition' | 'SetAllowanceForAll' | 'ForceRepairCollection' | 'ForceRepairItem';2328}2332}232923332330/** @name PalletUniqueError */2334/** @name PalletUniqueError */tests/src/interfaces/lookup.tsdiffbeforeafterboth2282 operator: 'PalletEvmAccountBasicCrossAccountIdRepr',2282 operator: 'PalletEvmAccountBasicCrossAccountIdRepr',2283 approve: 'bool',2283 approve: 'bool',2284 },2284 },2285 force_repair_collection: {2286 collectionId: 'u32',2287 },2285 repair_item: {2288 force_repair_item: {2286 collectionId: 'u32',2289 collectionId: 'u32',2287 itemId: 'u32'2290 itemId: 'u32'2288 }2291 }2452 PalletConfigurationCall: {2455 PalletConfigurationCall: {2453 _enum: {2456 _enum: {2454 set_weight_to_fee_coefficient_override: {2457 set_weight_to_fee_coefficient_override: {2455 coeff: 'Option<u32>',2458 coeff: 'Option<u64>',2456 },2459 },2457 set_min_gas_price_override: {2460 set_min_gas_price_override: {2458 coeff: 'Option<u64>',2461 coeff: 'Option<u64>',tests/src/interfaces/types-lookup.tsdiffbeforeafterboth2517 readonly operator: PalletEvmAccountBasicCrossAccountIdRepr;2517 readonly operator: PalletEvmAccountBasicCrossAccountIdRepr;2518 readonly approve: bool;2518 readonly approve: bool;2519 } & Struct;2519 } & Struct;2520 readonly isRepairItem: boolean;2520 readonly isForceRepairCollection: boolean;2521 readonly asForceRepairCollection: {2522 readonly collectionId: u32;2523 } & Struct;2524 readonly isForceRepairItem: boolean;2521 readonly asRepairItem: {2525 readonly asForceRepairItem: {2522 readonly collectionId: u32;2526 readonly collectionId: u32;2523 readonly itemId: u32;2527 readonly itemId: u32;2524 } & Struct;2528 } & Struct;2525 readonly type: 'CreateCollection' | 'CreateCollectionEx' | 'DestroyCollection' | 'AddToAllowList' | 'RemoveFromAllowList' | 'ChangeCollectionOwner' | 'AddCollectionAdmin' | 'RemoveCollectionAdmin' | 'SetCollectionSponsor' | 'ConfirmSponsorship' | 'RemoveCollectionSponsor' | 'CreateItem' | 'CreateMultipleItems' | 'SetCollectionProperties' | 'DeleteCollectionProperties' | 'SetTokenProperties' | 'DeleteTokenProperties' | 'SetTokenPropertyPermissions' | 'CreateMultipleItemsEx' | 'SetTransfersEnabledFlag' | 'BurnItem' | 'BurnFrom' | 'Transfer' | 'Approve' | 'TransferFrom' | 'SetCollectionLimits' | 'SetCollectionPermissions' | 'Repartition' | 'SetAllowanceForAll' | 'RepairItem';2529 readonly type: 'CreateCollection' | 'CreateCollectionEx' | 'DestroyCollection' | 'AddToAllowList' | 'RemoveFromAllowList' | 'ChangeCollectionOwner' | 'AddCollectionAdmin' | 'RemoveCollectionAdmin' | 'SetCollectionSponsor' | 'ConfirmSponsorship' | 'RemoveCollectionSponsor' | 'CreateItem' | 'CreateMultipleItems' | 'SetCollectionProperties' | 'DeleteCollectionProperties' | 'SetTokenProperties' | 'DeleteTokenProperties' | 'SetTokenPropertyPermissions' | 'CreateMultipleItemsEx' | 'SetTransfersEnabledFlag' | 'BurnItem' | 'BurnFrom' | 'Transfer' | 'Approve' | 'TransferFrom' | 'SetCollectionLimits' | 'SetCollectionPermissions' | 'Repartition' | 'SetAllowanceForAll' | 'ForceRepairCollection' | 'ForceRepairItem';2526 }2530 }252725312528 /** @name UpDataStructsCollectionMode (237) */2532 /** @name UpDataStructsCollectionMode (237) */2675 interface PalletConfigurationCall extends Enum {2679 interface PalletConfigurationCall extends Enum {2676 readonly isSetWeightToFeeCoefficientOverride: boolean;2680 readonly isSetWeightToFeeCoefficientOverride: boolean;2677 readonly asSetWeightToFeeCoefficientOverride: {2681 readonly asSetWeightToFeeCoefficientOverride: {2678 readonly coeff: Option<u32>;2682 readonly coeff: Option<u64>;2679 } & Struct;2683 } & Struct;2680 readonly isSetMinGasPriceOverride: boolean;2684 readonly isSetMinGasPriceOverride: boolean;2681 readonly asSetMinGasPriceOverride: {2685 readonly asSetMinGasPriceOverride: {tests/src/nesting/collectionProperties.test.tsdiffbeforeafterboth209 before(async () => {209 before(async () => {210 await usingPlaygrounds(async (helper, privateKey) => {210 await usingPlaygrounds(async (helper, privateKey) => {211 const donor = await privateKey({filename: __filename});211 const donor = await privateKey({filename: __filename});212 [alice, bob] = await helper.arrange.createAccounts([100n, 10n], donor);212 [alice, bob] = await helper.arrange.createAccounts([1000n, 100n], donor);213 });213 });214 });214 });215215