git.delta.rocks / unique-network / refs/commits / f9563faaa852

difftreelog

fix(xcm test) hooks for `Astar`\`Shiden`

PraetorP2023-10-03parent: #f5ed3da.patch.diff
in: master

5 files changed

modifiedtests/src/util/playgrounds/unique.xcm.tsdiffbeforeafterboth
244 await this.helper.executeExtrinsic(signer, 'api.tx.assets.create', [assetId, admin, minimalBalance], true);244 await this.helper.executeExtrinsic(signer, 'api.tx.assets.create', [assetId, admin, minimalBalance], true);
245 }245 }
246
247 async forceCreate(signer: TSigner, assetId: number | bigint, admin: string, minimalBalance: bigint, isSufficient = true) {
248 await this.helper.executeExtrinsic(signer, 'api.tx.assets.forceCreate', [assetId, admin, isSufficient, minimalBalance], true);
249 }
246250
247 async setMetadata(signer: TSigner, assetId: number | bigint, name: string, symbol: string, decimals: number) {251 async setMetadata(signer: TSigner, assetId: number | bigint, name: string, symbol: string, decimals: number) {
248 await this.helper.executeExtrinsic(signer, 'api.tx.assets.setMetadata', [assetId, name, symbol, decimals], true);252 await this.helper.executeExtrinsic(signer, 'api.tx.assets.setMetadata', [assetId, name, symbol, decimals], true);
modifiedtests/src/xcm/lowLevelXcmQuartz.test.tsdiffbeforeafterboth
243 await usingShidenPlaygrounds(shidenUrl, async (helper) => {243 await usingShidenPlaygrounds(shidenUrl, async (helper) => {
244 if(!(await helper.callRpc('api.query.assets.asset', [QTZ_ASSET_ID_ON_SHIDEN])).toJSON()) {244 if(!(await helper.callRpc('api.query.assets.asset', [QTZ_ASSET_ID_ON_SHIDEN])).toJSON()) {
245 console.log('1. Create foreign asset and metadata');245 console.log('1. Create foreign asset and metadata');
246 await helper.assets.create(246 await helper.getSudo().assets.forceCreate(
247 alice,247 alice,
248 QTZ_ASSET_ID_ON_SHIDEN,248 QTZ_ASSET_ID_ON_SHIDEN,
249 alice.address,249 alice.address,
modifiedtests/src/xcm/lowLevelXcmUnique.test.tsdiffbeforeafterboth
309 await usingAstarPlaygrounds(astarUrl, async (helper) => {309 await usingAstarPlaygrounds(astarUrl, async (helper) => {
310 if(!(await helper.callRpc('api.query.assets.asset', [UNQ_ASSET_ID_ON_ASTAR])).toJSON()) {310 if(!(await helper.callRpc('api.query.assets.asset', [UNQ_ASSET_ID_ON_ASTAR])).toJSON()) {
311 console.log('1. Create foreign asset and metadata');311 console.log('1. Create foreign asset and metadata');
312 await helper.assets.create(312 await helper.getSudo().assets.forceCreate(
313 alice,313 alice,
314 UNQ_ASSET_ID_ON_ASTAR,314 UNQ_ASSET_ID_ON_ASTAR,
315 alice.address,315 alice.address,
modifiedtests/src/xcm/xcmQuartz.test.tsdiffbeforeafterboth
1290 const shidenInitialBalance = 1n * (10n ** SHIDEN_DECIMALS); // 1 SHD, existential deposit required to actually create the account on Shiden1290 const shidenInitialBalance = 1n * (10n ** SHIDEN_DECIMALS); // 1 SHD, existential deposit required to actually create the account on Shiden
1291 const unitsPerSecond = 500_451_000_000_000_000_000n; // The value is taken from the live Shiden1291 const unitsPerSecond = 500_451_000_000_000_000_000n; // The value is taken from the live Shiden
1292 const qtzToShidenTransferred = 10n * (10n ** QTZ_DECIMALS); // 10 QTZ1292 const qtzToShidenTransferred = 10n * (10n ** QTZ_DECIMALS); // 10 QTZ
1293 const qtzToShidenArrived = 9_999_999_999_088_000_000n; // 9.999 ... QTZ, Shiden takes a commision in foreign tokens1293 const qtzToShidenArrived = 7_998_196_000_000_000_000n; // 7.99 ... QTZ, Shiden takes a commision in foreign tokens
12941294
1295 // Shiden -> Quartz1295 // Shiden -> Quartz
1296 const qtzFromShidenTransfered = 5n * (10n ** QTZ_DECIMALS); // 5 QTZ1296 const qtzFromShidenTransfered = 5n * (10n ** QTZ_DECIMALS); // 5 QTZ
1297 const qtzOnShidenLeft = qtzToShidenArrived - qtzFromShidenTransfered; // 4.999_999_999_088_000_000n QTZ1297 const qtzOnShidenLeft = qtzToShidenArrived - qtzFromShidenTransfered; // 2.99 ... QTZ
12981298
1299 let balanceAfterQuartzToShidenXCM: bigint;1299 let balanceAfterQuartzToShidenXCM: bigint;
13001300
1311 await usingShidenPlaygrounds(shidenUrl, async (helper) => {1311 await usingShidenPlaygrounds(shidenUrl, async (helper) => {
1312 if(!(await helper.callRpc('api.query.assets.asset', [QTZ_ASSET_ID_ON_SHIDEN])).toJSON()) {1312 if(!(await helper.callRpc('api.query.assets.asset', [QTZ_ASSET_ID_ON_SHIDEN])).toJSON()) {
1313 console.log('1. Create foreign asset and metadata');1313 console.log('1. Create foreign asset and metadata');
1314 await helper.assets.create(1314 await helper.getSudo().assets.forceCreate(
1315 alice,1315 alice,
1316 QTZ_ASSET_ID_ON_SHIDEN,1316 QTZ_ASSET_ID_ON_SHIDEN,
1317 alice.address,1317 alice.address,
modifiedtests/src/xcm/xcmUnique.test.tsdiffbeforeafterboth
1518 const astarInitialBalance = 1n * (10n ** ASTAR_DECIMALS); // 1 ASTR, existential deposit required to actually create the account on Astar.1518 const astarInitialBalance = 1n * (10n ** ASTAR_DECIMALS); // 1 ASTR, existential deposit required to actually create the account on Astar.
1519 const unitsPerSecond = 9_451_000_000_000_000_000n; // The value is taken from the live Astar1519 const unitsPerSecond = 9_451_000_000_000_000_000n; // The value is taken from the live Astar
1520 const unqToAstarTransferred = 10n * (10n ** UNQ_DECIMALS); // 10 UNQ1520 const unqToAstarTransferred = 10n * (10n ** UNQ_DECIMALS); // 10 UNQ
1521 const unqToAstarArrived = 9_999_999_999_088_000_000n; // 9.999 ... UNQ, Astar takes a commision in foreign tokens1521 const unqToAstarArrived = 9_962_196_000_000_000_000n; // 9.962 ... UNQ, Astar takes a commision in foreign tokens
15221522
1523 // Astar -> Unique1523 // Astar -> Unique
1524 const unqFromAstarTransfered = 5n * (10n ** UNQ_DECIMALS); // 5 UNQ1524 const unqFromAstarTransfered = 5n * (10n ** UNQ_DECIMALS); // 5 UNQ
1525 const unqOnAstarLeft = unqToAstarArrived - unqFromAstarTransfered; // 4.999_999_999_088_000_000n UNQ1525 const unqOnAstarLeft = unqToAstarArrived - unqFromAstarTransfered; // 4.962_219_600_000_000_000n UNQ
15261526
1527 let balanceAfterUniqueToAstarXCM: bigint;1527 let balanceAfterUniqueToAstarXCM: bigint;
15281528
1539 await usingAstarPlaygrounds(astarUrl, async (helper) => {1539 await usingAstarPlaygrounds(astarUrl, async (helper) => {
1540 if(!(await helper.callRpc('api.query.assets.asset', [UNQ_ASSET_ID_ON_ASTAR])).toJSON()) {1540 if(!(await helper.callRpc('api.query.assets.asset', [UNQ_ASSET_ID_ON_ASTAR])).toJSON()) {
1541 console.log('1. Create foreign asset and metadata');1541 console.log('1. Create foreign asset and metadata');
1542 await helper.assets.create(1542 await helper.getSudo().assets.forceCreate(
1543 alice,1543 alice,
1544 UNQ_ASSET_ID_ON_ASTAR,1544 UNQ_ASSET_ID_ON_ASTAR,
1545 alice.address,1545 alice.address,