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
37const RELAY_DECIMALS = 12;37const RELAY_DECIMALS = 12;
38const STATEMINE_DECIMALS = 12;38const STATEMINE_DECIMALS = 12;
39const KARURA_DECIMALS = 12;39const KARURA_DECIMALS = 12;
40const SHIDEN_DECIMALS = 18n;
41const QTZ_DECIMALS = 18n;
4042
41const TRANSFER_AMOUNT = 2000000000000000000000000n;43const TRANSFER_AMOUNT = 2000000000000000000000000n;
4244
986 let sender: IKeyringPair;988 let sender: IKeyringPair;
987989
988 // Quartz -> Shiden990 // Quartz -> Shiden
989 const shidenInitialBalance = 1n * (10n ** 18n); // 1 SHD, existencial deposit required in order to perform XCM call991 const shidenInitialBalance = 1n * SHIDEN_DECIMALS; // 1 SHD, existential deposit required to actually create the account on Shiden
990 const unitsPerSecond = 228_000_000_000n; // This is Phala's value. What will be ours?992 const unitsPerSecond = 228_000_000_000n; // This is Phala's value. What will be ours?
991 const qtzToShidenTransferred = 10n * (10n ** 18n); // 10 QTZ993 const qtzToShidenTransferred = 10n * QTZ_DECIMALS; // 10 QTZ
992 const qtzToShidenArrived = 9_999_999_999_088_000_000n; // 9.999 ... QTZ, Shiden takes a commision in foreign tokens994 const qtzToShidenArrived = 9_999_999_999_088_000_000n; // 9.999 ... QTZ, Shiden takes a commision in foreign tokens
993 const senderIinitialBalanceQTZ = 100n * (10n ** 18n); // How many QTZ sender has initially995 const senderIinitialBalanceQTZ = 100n * QTZ_DECIMALS; // How many QTZ sender has initially
994 const senderBalanceAfterXCM = 89_941967662676666465n; // 89.94... QTZ after XCM call996 const senderBalanceAfterXCM = 89_941967662676666465n; // 89.94... QTZ after XCM call
995997
996 // Shiden -> Quartz998 // Shiden -> Quartz
997 const qtzFromShidenTransfered = 5n * (10n ** 18n); // 5 QTZ999 const qtzFromShidenTransfered = 5n * QTZ_DECIMALS; // 5 QTZ
998 const qtzOnShidenLeft = qtzToShidenArrived - qtzFromShidenTransfered; // 4.999_999_999_088_000_000n QTZ1000 const qtzOnShidenLeft = qtzToShidenArrived - qtzFromShidenTransfered; // 4.999_999_999_088_000_000n QTZ
9991001
1000 before(async () => {1002 before(async () => {
modifiedtests/src/xcm/xcmUnique.test.tsdiffbeforeafterboth
--- a/tests/src/xcm/xcmUnique.test.ts
+++ b/tests/src/xcm/xcmUnique.test.ts
@@ -37,6 +37,8 @@
 const RELAY_DECIMALS = 12;
 const STATEMINT_DECIMALS = 12;
 const ACALA_DECIMALS = 12;
+const ASTAR_DECIMALS = 18n;
+const UNQ_DECIMALS = 18n;
 
 const TRANSFER_AMOUNT = 2000000000000000000000000n;
 
@@ -988,15 +990,15 @@
   let randomAccount: IKeyringPair;
 
   // Unique -> Astar
-  const astarInitialBalance = 1n * (10n ** 18n); // 1 ASTR. Existencial deposit required in order to perform XCM call
+  const astarInitialBalance = 1n * ASTAR_DECIMALS; // 1 ASTR, 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 unqToAstarTransferred = 10n * (10n ** 18n); // 10 UNQ
+  const unqToAstarTransferred = 10n * UNQ_DECIMALS; // 10 UNQ
   const unqToAstarArrived = 9_999_999_999_088_000_000n; // 9.999 ... UNQ, Shiden takes a commision in foreign tokens
-  const senderIinitialBalanceUNQ = 100n * (10n ** 18n); // How many UNQ sender has initially
+  const senderIinitialBalanceUNQ = 100n * UNQ_DECIMALS; // How many UNQ sender has initially
   const senderBalanceAfterXCM = 89_941967662676666465n; // 89.94... UNQ after XCM call
 
   // Astar -> Unique
-  const unqFromAstarTransfered = 5n * (10n ** 18n); // 5 UNQ
+  const unqFromAstarTransfered = 5n * UNQ_DECIMALS; // 5 UNQ
   const unqOnAstarLeft = unqToAstarArrived - unqFromAstarTransfered; // 4.999_999_999_088_000_000n UNQ
 
   before(async () => {