difftreelog
Merge pull request #254 from UniqueNetwork/feature/decimals-18-v2
in: master
change decimals from 15 to 18
8 files changed
launch-config-westend.jsondiffbeforeafterboth79 },79 },80 "parachains": [80 "parachains": [81 {81 {82 "bin": "../unique-chain/target/release/nft",82 "bin": "../unique-chain/target/release/unique-collator",83 "chain": "westend-local",83 "chain": "westend-local",84 "balance": "1000000000000000000000",84 "balance": "1000000000000000000000000",85 "nodes": [85 "nodes": [86 {86 {87 "port": 31200,87 "port": 31200,launch-config.jsondiffbeforeafterboth57 {57 {58 "bin": "../unique-chain/target/release/unique-collator",58 "bin": "../unique-chain/target/release/unique-collator",59 "id": "2000",59 "id": "2000",60 "balance": "1000000000000000000000",60 "balance": "1000000000000000000000000",61 "nodes": [61 "nodes": [62 {62 {63 "port": 31200,63 "port": 31200,node/cli/src/chain_spec.rsdiffbeforeafterboth535354pub fn development_config(id: ParaId) -> ChainSpec {54pub fn development_config(id: ParaId) -> ChainSpec {55 let mut properties = Map::new();55 let mut properties = Map::new();56 properties.insert("tokenSymbol".into(), "testUNQ".into());56 properties.insert("tokenSymbol".into(), "OPL".into());57 properties.insert("tokenDecimals".into(), 15.into());57 properties.insert("tokenDecimals".into(), 15.into());58 properties.insert("ss58Format".into(), 42.into()); // Generic Substrate wildcard (SS58 checksum preimage)58 properties.insert("ss58Format".into(), 42.into());595960 ChainSpec::from_genesis(60 ChainSpec::from_genesis(61 // Name61 // Nameruntime/src/lib.rsdiffbeforeafterboth243impl FeeCalculator for FixedFee {243impl FeeCalculator for FixedFee {244 fn min_gas_price() -> U256 {244 fn min_gas_price() -> U256 {245 // Targeting 0.15 UNQ per transfer245 // Targeting 0.15 UNQ per transfer246 1_024_947_215u32.into()246 1_024_947_215_000u64.into()247 }247 }248}248}249249403 type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;403 type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;404}404}405405406pub const MICROUNIQUE: Balance = 1_000_000_000;406pub const MICROUNIQUE: Balance = 1_000_000_000_000;407pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;407pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;408pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;408pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;409pub const UNIQUE: Balance = 100 * CENTIUNIQUE;409pub const UNIQUE: Balance = 100 * CENTIUNIQUE;481 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {481 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {482 smallvec!(WeightToFeeCoefficient {482 smallvec!(WeightToFeeCoefficient {483 // Targeting 0.1 Unique per NFT transfer483 // Targeting 0.1 Unique per NFT transfer484 coeff_integer: 142_688u32.into(),484 coeff_integer: 142_688_000u32.into(),485 coeff_frac: Perbill::zero(),485 coeff_frac: Perbill::zero(),486 negative: false,486 negative: false,487 degree: 1,487 degree: 1,tests/src/confirmSponsorship.test.tsdiffbeforeafterboth21 normalizeAccountId,21 normalizeAccountId,22 addCollectionAdminExpectSuccess,22 addCollectionAdminExpectSuccess,23 getCreatedCollectionCount,23 getCreatedCollectionCount,24 UNIQUE,24} from './util/helpers';25} from './util/helpers';25import {Keyring} from '@polkadot/api';26import {Keyring} from '@polkadot/api';26import {IKeyringPair} from '@polkadot/types/types';27import {IKeyringPair} from '@polkadot/types/types';198 const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();199 const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();199200200 // Try again after Zero gets some balance - now it should succeed201 // Try again after Zero gets some balance - now it should succeed201 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);202 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);202 await submitTransactionAsync(alice, balancetx);203 await submitTransactionAsync(alice, balancetx);203 const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);204 const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);204 const result2 = getGenericResult(events2);205 const result2 = getGenericResult(events2);232 const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();233 const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();233234234 // Try again after Zero gets some balance - now it should succeed235 // Try again after Zero gets some balance - now it should succeed235 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);236 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);236 await submitTransactionAsync(alice, balancetx);237 await submitTransactionAsync(alice, balancetx);237 const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);238 const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);238 const result2 = getGenericResult(events2);239 const result2 = getGenericResult(events2);268 expect(sponsorBalanceAfter).to.be.equal(sponsorBalanceBefore);269 expect(sponsorBalanceAfter).to.be.equal(sponsorBalanceBefore);269270270 // Try again after Zero gets some balance - now it should succeed271 // Try again after Zero gets some balance - now it should succeed271 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);272 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);272 await submitTransactionAsync(alice, balancetx);273 await submitTransactionAsync(alice, balancetx);273 const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);274 const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);274 const result2 = getGenericResult(events2);275 const result2 = getGenericResult(events2);307 const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();308 const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();308309309 // Try again after Zero gets some balance - now it should succeed310 // Try again after Zero gets some balance - now it should succeed310 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);311 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);311 await submitTransactionAsync(alice, balancetx);312 await submitTransactionAsync(alice, balancetx);312 await createItemExpectSuccess(zeroBalance, collectionId, 'NFT', zeroBalance.address);313 await createItemExpectSuccess(zeroBalance, collectionId, 'NFT', zeroBalance.address);313314tests/src/creditFeesToTreasury.test.tsdiffbeforeafterboth154 const aliceBalanceAfter: bigint = (await api.query.system.account(alicesPublicKey)).data.free.toBigInt();154 const aliceBalanceAfter: bigint = (await api.query.system.account(alicesPublicKey)).data.free.toBigInt();155 const fee = aliceBalanceBefore - aliceBalanceAfter;155 const fee = aliceBalanceBefore - aliceBalanceAfter;156156157 expect(fee / 10n ** 15n < BigInt(Math.ceil(saneMaximumFee + createCollectionDeposit))).to.be.true;157 expect(fee / UNIQUE < BigInt(Math.ceil(saneMaximumFee + createCollectionDeposit))).to.be.true;158 expect(fee / 10n ** 15n < BigInt(Math.ceil(saneMinimumFee + createCollectionDeposit))).to.be.true;158 expect(fee / UNIQUE < BigInt(Math.ceil(saneMinimumFee + createCollectionDeposit))).to.be.true;159 });159 });160 });160 });161161tests/src/eth/payable.test.tsdiffbeforeafterboth54 expect(await contract.methods.getUnaccounted().call()).to.be.equal('10000');54 expect(await contract.methods.getUnaccounted().call()).to.be.equal('10000');55 });55 });565657 itWeb3('Balance can be retrieved from evm contract', async({api, web3}) => {57 itWeb3.only('Balance can be retrieved from evm contract', async({api, web3}) => {58 const FEE_BALANCE = 10n ** 18n;58 const FEE_BALANCE = 10n ** 18n;59 const CONTRACT_BALANCE = 10n ** 14n;59 const CONTRACT_BALANCE = 10n ** 14n;6060tests/src/util/helpers.tsdiffbeforeafterboth696970export const U128_MAX = (1n << 128n) - 1n;70export const U128_MAX = (1n << 128n) - 1n;717172const MICROUNIQUE = 1_000_000_000n;72const MICROUNIQUE = 1_000_000_000_000n;73const MILLIUNIQUE = 1_000n * MICROUNIQUE;73const MILLIUNIQUE = 1_000n * MICROUNIQUE;74const CENTIUNIQUE = 10n * MILLIUNIQUE;74const CENTIUNIQUE = 10n * MILLIUNIQUE;75export const UNIQUE = 100n * CENTIUNIQUE;75export const UNIQUE = 100n * CENTIUNIQUE;