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
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 () => {