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.jsondiffbeforeafterboth--- a/launch-config-westend.json
+++ b/launch-config-westend.json
@@ -79,9 +79,9 @@
},
"parachains": [
{
- "bin": "../unique-chain/target/release/nft",
+ "bin": "../unique-chain/target/release/unique-collator",
"chain": "westend-local",
- "balance": "1000000000000000000000",
+ "balance": "1000000000000000000000000",
"nodes": [
{
"port": 31200,
launch-config.jsondiffbeforeafterboth1{2 "relaychain": {3 "bin": "../polkadot/target/release/polkadot",4 "chain": "rococo-local",5 "nodes": [6 {7 "name": "alice",8 "wsPort": 9844,9 "rpcPort": 9843,10 "port": 30444,11 "flags": [12 "-lparachain::candidate_validation=debug"13 ]14 },15 {16 "name": "bob",17 "wsPort": 9855,18 "rpcPort": 9854,19 "port": 30555,20 "flags": [21 "-lparachain::candidate_validation=debug"22 ]23 },24 {25 "name": "charlie",26 "wsPort": 9866,27 "rpcPort": 9865,28 "port": 30666,29 "flags": [30 "-lparachain::candidate_validation=debug"31 ]32 },33 {34 "name": "dave",35 "wsPort": 9877,36 "rpcPort": 9876,37 "port": 30777,38 "flags": [39 "-lparachain::candidate_validation=debug"40 ]41 }42 ],43 "genesis": {44 "runtime": {45 "runtime_genesis_config": {46 "parachainsConfiguration": {47 "config": {48 "validation_upgrade_frequency": 1,49 "validation_upgrade_delay": 150 }51 }52 }53 }54 }55 },56 "parachains": [57 {58 "bin": "../unique-chain/target/release/unique-collator",59 "id": "2000",60 "balance": "1000000000000000000000",61 "nodes": [62 {63 "port": 31200,64 "wsPort": 9944,65 "rpcPort": 9933,66 "name": "alice",67 "flags": [68 "--rpc-cors=all",69 "--unsafe-rpc-external",70 "--unsafe-ws-external"71 ]72 },73 {74 "port": 31201,75 "wsPort": 9945,76 "rpcPort": 9934,77 "name": "bob",78 "flags": [79 "--rpc-cors=all",80 "--unsafe-rpc-external",81 "--unsafe-ws-external"82 ]83 }84 ]85 }86 ],87 "simpleParachains": [],88 "hrmpChannels": [],89 "finalization": false90}1{2 "relaychain": {3 "bin": "../polkadot/target/release/polkadot",4 "chain": "rococo-local",5 "nodes": [6 {7 "name": "alice",8 "wsPort": 9844,9 "rpcPort": 9843,10 "port": 30444,11 "flags": [12 "-lparachain::candidate_validation=debug"13 ]14 },15 {16 "name": "bob",17 "wsPort": 9855,18 "rpcPort": 9854,19 "port": 30555,20 "flags": [21 "-lparachain::candidate_validation=debug"22 ]23 },24 {25 "name": "charlie",26 "wsPort": 9866,27 "rpcPort": 9865,28 "port": 30666,29 "flags": [30 "-lparachain::candidate_validation=debug"31 ]32 },33 {34 "name": "dave",35 "wsPort": 9877,36 "rpcPort": 9876,37 "port": 30777,38 "flags": [39 "-lparachain::candidate_validation=debug"40 ]41 }42 ],43 "genesis": {44 "runtime": {45 "runtime_genesis_config": {46 "parachainsConfiguration": {47 "config": {48 "validation_upgrade_frequency": 1,49 "validation_upgrade_delay": 150 }51 }52 }53 }54 }55 },56 "parachains": [57 {58 "bin": "../unique-chain/target/release/unique-collator",59 "id": "2000",60 "balance": "1000000000000000000000000",61 "nodes": [62 {63 "port": 31200,64 "wsPort": 9944,65 "rpcPort": 9933,66 "name": "alice",67 "flags": [68 "--rpc-cors=all",69 "--unsafe-rpc-external",70 "--unsafe-ws-external"71 ]72 },73 {74 "port": 31201,75 "wsPort": 9945,76 "rpcPort": 9934,77 "name": "bob",78 "flags": [79 "--rpc-cors=all",80 "--unsafe-rpc-external",81 "--unsafe-ws-external"82 ]83 }84 ]85 }86 ],87 "simpleParachains": [],88 "hrmpChannels": [],89 "finalization": false90}node/cli/src/chain_spec.rsdiffbeforeafterboth--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -53,9 +53,9 @@
pub fn development_config(id: ParaId) -> ChainSpec {
let mut properties = Map::new();
- properties.insert("tokenSymbol".into(), "testUNQ".into());
+ properties.insert("tokenSymbol".into(), "OPL".into());
properties.insert("tokenDecimals".into(), 15.into());
- properties.insert("ss58Format".into(), 42.into()); // Generic Substrate wildcard (SS58 checksum preimage)
+ properties.insert("ss58Format".into(), 42.into());
ChainSpec::from_genesis(
// Name
runtime/src/lib.rsdiffbeforeafterboth--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -243,7 +243,7 @@
impl FeeCalculator for FixedFee {
fn min_gas_price() -> U256 {
// Targeting 0.15 UNQ per transfer
- 1_024_947_215u32.into()
+ 1_024_947_215_000u64.into()
}
}
@@ -403,7 +403,7 @@
type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;
}
-pub const MICROUNIQUE: Balance = 1_000_000_000;
+pub const MICROUNIQUE: Balance = 1_000_000_000_000;
pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;
pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;
pub const UNIQUE: Balance = 100 * CENTIUNIQUE;
@@ -481,7 +481,7 @@
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
smallvec!(WeightToFeeCoefficient {
// Targeting 0.1 Unique per NFT transfer
- coeff_integer: 142_688u32.into(),
+ coeff_integer: 142_688_000u32.into(),
coeff_frac: Perbill::zero(),
negative: false,
degree: 1,
tests/src/confirmSponsorship.test.tsdiffbeforeafterboth--- a/tests/src/confirmSponsorship.test.ts
+++ b/tests/src/confirmSponsorship.test.ts
@@ -21,6 +21,7 @@
normalizeAccountId,
addCollectionAdminExpectSuccess,
getCreatedCollectionCount,
+ UNIQUE,
} from './util/helpers';
import {Keyring} from '@polkadot/api';
import {IKeyringPair} from '@polkadot/types/types';
@@ -198,7 +199,7 @@
const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();
// Try again after Zero gets some balance - now it should succeed
- const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);
+ const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);
await submitTransactionAsync(alice, balancetx);
const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);
const result2 = getGenericResult(events2);
@@ -232,7 +233,7 @@
const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();
// Try again after Zero gets some balance - now it should succeed
- const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);
+ const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);
await submitTransactionAsync(alice, balancetx);
const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);
const result2 = getGenericResult(events2);
@@ -268,7 +269,7 @@
expect(sponsorBalanceAfter).to.be.equal(sponsorBalanceBefore);
// Try again after Zero gets some balance - now it should succeed
- const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);
+ const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);
await submitTransactionAsync(alice, balancetx);
const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);
const result2 = getGenericResult(events2);
@@ -307,7 +308,7 @@
const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();
// Try again after Zero gets some balance - now it should succeed
- const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);
+ const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);
await submitTransactionAsync(alice, balancetx);
await createItemExpectSuccess(zeroBalance, collectionId, 'NFT', zeroBalance.address);
tests/src/creditFeesToTreasury.test.tsdiffbeforeafterboth--- a/tests/src/creditFeesToTreasury.test.ts
+++ b/tests/src/creditFeesToTreasury.test.ts
@@ -154,8 +154,8 @@
const aliceBalanceAfter: bigint = (await api.query.system.account(alicesPublicKey)).data.free.toBigInt();
const fee = aliceBalanceBefore - aliceBalanceAfter;
- expect(fee / 10n ** 15n < BigInt(Math.ceil(saneMaximumFee + createCollectionDeposit))).to.be.true;
- expect(fee / 10n ** 15n < BigInt(Math.ceil(saneMinimumFee + createCollectionDeposit))).to.be.true;
+ expect(fee / UNIQUE < BigInt(Math.ceil(saneMaximumFee + createCollectionDeposit))).to.be.true;
+ expect(fee / UNIQUE < BigInt(Math.ceil(saneMinimumFee + createCollectionDeposit))).to.be.true;
});
});
tests/src/eth/payable.test.tsdiffbeforeafterboth--- a/tests/src/eth/payable.test.ts
+++ b/tests/src/eth/payable.test.ts
@@ -54,7 +54,7 @@
expect(await contract.methods.getUnaccounted().call()).to.be.equal('10000');
});
- itWeb3('Balance can be retrieved from evm contract', async({api, web3}) => {
+ itWeb3.only('Balance can be retrieved from evm contract', async({api, web3}) => {
const FEE_BALANCE = 10n ** 18n;
const CONTRACT_BALANCE = 10n ** 14n;
tests/src/util/helpers.tsdiffbeforeafterboth--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -69,7 +69,7 @@
export const U128_MAX = (1n << 128n) - 1n;
-const MICROUNIQUE = 1_000_000_000n;
+const MICROUNIQUE = 1_000_000_000_000n;
const MILLIUNIQUE = 1_000n * MICROUNIQUE;
const CENTIUNIQUE = 10n * MILLIUNIQUE;
export const UNIQUE = 100n * CENTIUNIQUE;