git.delta.rocks / unique-network / refs/commits / 647e949b2676

difftreelog

Add decimal constants

Max Andreev2023-03-30parent: #45e62ca.patch.diff
in: master

2 files changed

modifiedtests/src/xcm/xcmQuartz.test.tsdiffbeforeafterboth
--- a/tests/src/xcm/xcmQuartz.test.ts
+++ b/tests/src/xcm/xcmQuartz.test.ts
@@ -37,6 +37,8 @@
 const RELAY_DECIMALS = 12;
 const STATEMINE_DECIMALS = 12;
 const KARURA_DECIMALS = 12;
+const SHIDEN_DECIMALS = 18n;
+const QTZ_DECIMALS = 18n;
 
 const TRANSFER_AMOUNT = 2000000000000000000000000n;
 
@@ -986,15 +988,15 @@
   let sender: IKeyringPair;
 
   // Quartz -> Shiden
-  const shidenInitialBalance = 1n * (10n ** 18n); // 1 SHD, existencial deposit required in order to perform XCM call
+  const shidenInitialBalance = 1n * SHIDEN_DECIMALS; // 1 SHD, existential deposit required to actually create the account on Shiden
   const unitsPerSecond = 228_000_000_000n; // This is Phala's value. What will be ours?
-  const qtzToShidenTransferred = 10n * (10n ** 18n); // 10 QTZ
+  const qtzToShidenTransferred = 10n * QTZ_DECIMALS; // 10 QTZ
   const qtzToShidenArrived = 9_999_999_999_088_000_000n; // 9.999 ... QTZ, Shiden takes a commision in foreign tokens
-  const senderIinitialBalanceQTZ = 100n * (10n ** 18n); // How many QTZ sender has initially
+  const senderIinitialBalanceQTZ = 100n * QTZ_DECIMALS; // How many QTZ sender has initially
   const senderBalanceAfterXCM = 89_941967662676666465n; // 89.94... QTZ after XCM call
 
   // Shiden -> Quartz
-  const qtzFromShidenTransfered = 5n * (10n ** 18n); // 5 QTZ
+  const qtzFromShidenTransfered = 5n * QTZ_DECIMALS; // 5 QTZ
   const qtzOnShidenLeft = qtzToShidenArrived - qtzFromShidenTransfered; // 4.999_999_999_088_000_000n QTZ
 
   before(async () => {
modifiedtests/src/xcm/xcmUnique.test.tsdiffbeforeafterboth
37const RELAY_DECIMALS = 12;37const RELAY_DECIMALS = 12;
38const STATEMINT_DECIMALS = 12;38const STATEMINT_DECIMALS = 12;
39const ACALA_DECIMALS = 12;39const ACALA_DECIMALS = 12;
40const ASTAR_DECIMALS = 18n;
41const UNQ_DECIMALS = 18n;
4042
41const TRANSFER_AMOUNT = 2000000000000000000000000n;43const TRANSFER_AMOUNT = 2000000000000000000000000n;
4244
988 let randomAccount: IKeyringPair;990 let randomAccount: IKeyringPair;
989991
990 // Unique -> Astar992 // Unique -> Astar
991 const astarInitialBalance = 1n * (10n ** 18n); // 1 ASTR. Existencial deposit required in order to perform XCM call993 const astarInitialBalance = 1n * ASTAR_DECIMALS; // 1 ASTR, existential deposit required to actually create the account on Shiden.
992 const unitsPerSecond = 228_000_000_000n; // This is Phala's value. What will be ours?994 const unitsPerSecond = 228_000_000_000n; // This is Phala's value. What will be ours?
993 const unqToAstarTransferred = 10n * (10n ** 18n); // 10 UNQ995 const unqToAstarTransferred = 10n * UNQ_DECIMALS; // 10 UNQ
994 const unqToAstarArrived = 9_999_999_999_088_000_000n; // 9.999 ... UNQ, Shiden takes a commision in foreign tokens996 const unqToAstarArrived = 9_999_999_999_088_000_000n; // 9.999 ... UNQ, Shiden takes a commision in foreign tokens
995 const senderIinitialBalanceUNQ = 100n * (10n ** 18n); // How many UNQ sender has initially997 const senderIinitialBalanceUNQ = 100n * UNQ_DECIMALS; // How many UNQ sender has initially
996 const senderBalanceAfterXCM = 89_941967662676666465n; // 89.94... UNQ after XCM call998 const senderBalanceAfterXCM = 89_941967662676666465n; // 89.94... UNQ after XCM call
997999
998 // Astar -> Unique1000 // Astar -> Unique
999 const unqFromAstarTransfered = 5n * (10n ** 18n); // 5 UNQ1001 const unqFromAstarTransfered = 5n * UNQ_DECIMALS; // 5 UNQ
1000 const unqOnAstarLeft = unqToAstarArrived - unqFromAstarTransfered; // 4.999_999_999_088_000_000n UNQ1002 const unqOnAstarLeft = unqToAstarArrived - unqFromAstarTransfered; // 4.999_999_999_088_000_000n UNQ
10011003
1002 before(async () => {1004 before(async () => {