From 17703e6a9d581279601cc75ee45cc594001bb2d6 Mon Sep 17 00:00:00 2001 From: Daniel Shiposha Date: Mon, 02 Oct 2023 12:27:15 +0000 Subject: [PATCH] fix: set correct shiden/astar values for our chain --- --- a/tests/src/util/playgrounds/unique.xcm.ts +++ b/tests/src/util/playgrounds/unique.xcm.ts @@ -240,19 +240,19 @@ } export class AssetsGroup extends HelperGroup { - async create(signer: TSigner, assetId: number, admin: string, minimalBalance: bigint) { + async create(signer: TSigner, assetId: number | bigint, admin: string, minimalBalance: bigint) { await this.helper.executeExtrinsic(signer, 'api.tx.assets.create', [assetId, admin, minimalBalance], true); } - async setMetadata(signer: TSigner, assetId: number, name: string, symbol: string, decimals: number) { + async setMetadata(signer: TSigner, assetId: number | bigint, name: string, symbol: string, decimals: number) { await this.helper.executeExtrinsic(signer, 'api.tx.assets.setMetadata', [assetId, name, symbol, decimals], true); } - async mint(signer: TSigner, assetId: number, beneficiary: string, amount: bigint) { + async mint(signer: TSigner, assetId: number | bigint, beneficiary: string, amount: bigint) { await this.helper.executeExtrinsic(signer, 'api.tx.assets.mint', [assetId, beneficiary, amount], true); } - async account(assetId: string | number, address: string) { + async account(assetId: string | number | bigint, address: string) { const accountAsset = ( await this.helper.callRpc('api.query.assets.account', [assetId, address]) ).toJSON()! as any; --- a/tests/src/xcm/lowLevelXcmQuartz.test.ts +++ b/tests/src/xcm/lowLevelXcmQuartz.test.ts @@ -222,14 +222,12 @@ let alice: IKeyringPair; let randomAccount: IKeyringPair; - const QTZ_ASSET_ID_ON_SHIDEN = 1; - const QTZ_MINIMAL_BALANCE_ON_SHIDEN = 1n; + const QTZ_ASSET_ID_ON_SHIDEN = 18_446_744_073_709_551_633n; // The value is taken from the live Shiden + const QTZ_MINIMAL_BALANCE_ON_SHIDEN = 1n; // The value is taken from the live Shiden // Quartz -> Shiden const shidenInitialBalance = 1n * (10n ** 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 unitsPerSecond = 500_451_000_000_000_000_000n; // The value is taken from the live Shiden before(async () => { await usingPlaygrounds(async (helper, privateKey) => { @@ -245,7 +243,6 @@ await usingShidenPlaygrounds(shidenUrl, async (helper) => { if(!(await helper.callRpc('api.query.assets.asset', [QTZ_ASSET_ID_ON_SHIDEN])).toJSON()) { console.log('1. Create foreign asset and metadata'); - // TODO update metadata with values from production await helper.assets.create( alice, QTZ_ASSET_ID_ON_SHIDEN, @@ -256,8 +253,8 @@ await helper.assets.setMetadata( alice, QTZ_ASSET_ID_ON_SHIDEN, - 'Cross chain QTZ', - 'xcQTZ', + 'Quartz', + 'QTZ', Number(QTZ_DECIMALS), ); --- a/tests/src/xcm/lowLevelXcmUnique.test.ts +++ b/tests/src/xcm/lowLevelXcmUnique.test.ts @@ -288,12 +288,12 @@ let alice: IKeyringPair; let randomAccount: IKeyringPair; - const UNQ_ASSET_ID_ON_ASTAR = 1; - const UNQ_MINIMAL_BALANCE_ON_ASTAR = 1n; + const UNQ_ASSET_ID_ON_ASTAR = 18_446_744_073_709_551_631n; // The value is taken from the live Astar + const UNQ_MINIMAL_BALANCE_ON_ASTAR = 1n; // The value is taken from the live Astar // Unique -> Astar const astarInitialBalance = 1n * (10n ** ASTAR_DECIMALS); // 1 ASTR, existential deposit required to actually create the account on Astar. - const unitsPerSecond = 228_000_000_000n; // This is Phala's value. What will be ours? + const unitsPerSecond = 9_451_000_000_000_000_000n; // The value is taken from the live Astar before(async () => { await usingPlaygrounds(async (helper, privateKey) => { @@ -309,7 +309,6 @@ await usingAstarPlaygrounds(astarUrl, async (helper) => { if(!(await helper.callRpc('api.query.assets.asset', [UNQ_ASSET_ID_ON_ASTAR])).toJSON()) { console.log('1. Create foreign asset and metadata'); - // TODO update metadata with values from production await helper.assets.create( alice, UNQ_ASSET_ID_ON_ASTAR, @@ -320,8 +319,8 @@ await helper.assets.setMetadata( alice, UNQ_ASSET_ID_ON_ASTAR, - 'Cross chain UNQ', - 'xcUNQ', + 'Unique Network', + 'UNQ', Number(UNQ_DECIMALS), ); --- a/tests/src/xcm/xcmQuartz.test.ts +++ b/tests/src/xcm/xcmQuartz.test.ts @@ -1283,12 +1283,12 @@ let alice: IKeyringPair; let sender: IKeyringPair; - const QTZ_ASSET_ID_ON_SHIDEN = 1; - const QTZ_MINIMAL_BALANCE_ON_SHIDEN = 1n; + const QTZ_ASSET_ID_ON_SHIDEN = 18_446_744_073_709_551_633n; // The value is taken from the live Shiden + const QTZ_MINIMAL_BALANCE_ON_SHIDEN = 1n; // The value is taken from the live Shiden // Quartz -> Shiden const shidenInitialBalance = 1n * (10n ** 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 unitsPerSecond = 500_451_000_000_000_000_000n; // The value is taken from the live Shiden const qtzToShidenTransferred = 10n * (10n ** QTZ_DECIMALS); // 10 QTZ const qtzToShidenArrived = 9_999_999_999_088_000_000n; // 9.999 ... QTZ, Shiden takes a commision in foreign tokens @@ -1311,7 +1311,6 @@ await usingShidenPlaygrounds(shidenUrl, async (helper) => { if(!(await helper.callRpc('api.query.assets.asset', [QTZ_ASSET_ID_ON_SHIDEN])).toJSON()) { console.log('1. Create foreign asset and metadata'); - // TODO update metadata with values from production await helper.assets.create( alice, QTZ_ASSET_ID_ON_SHIDEN, @@ -1322,8 +1321,8 @@ await helper.assets.setMetadata( alice, QTZ_ASSET_ID_ON_SHIDEN, - 'Cross chain QTZ', - 'xcQTZ', + 'Quartz', + 'QTZ', Number(QTZ_DECIMALS), ); --- a/tests/src/xcm/xcmUnique.test.ts +++ b/tests/src/xcm/xcmUnique.test.ts @@ -1511,12 +1511,12 @@ let alice: IKeyringPair; let randomAccount: IKeyringPair; - const UNQ_ASSET_ID_ON_ASTAR = 1; - const UNQ_MINIMAL_BALANCE_ON_ASTAR = 1n; + const UNQ_ASSET_ID_ON_ASTAR = 18_446_744_073_709_551_631n; // The value is taken from the live Astar + const UNQ_MINIMAL_BALANCE_ON_ASTAR = 1n; // The value is taken from the live Astar // Unique -> Astar const astarInitialBalance = 1n * (10n ** ASTAR_DECIMALS); // 1 ASTR, existential deposit required to actually create the account on Astar. - const unitsPerSecond = 228_000_000_000n; // This is Phala's value. What will be ours? + const unitsPerSecond = 9_451_000_000_000_000_000n; // The value is taken from the live Astar const unqToAstarTransferred = 10n * (10n ** UNQ_DECIMALS); // 10 UNQ const unqToAstarArrived = 9_999_999_999_088_000_000n; // 9.999 ... UNQ, Astar takes a commision in foreign tokens @@ -1539,7 +1539,6 @@ await usingAstarPlaygrounds(astarUrl, async (helper) => { if(!(await helper.callRpc('api.query.assets.asset', [UNQ_ASSET_ID_ON_ASTAR])).toJSON()) { console.log('1. Create foreign asset and metadata'); - // TODO update metadata with values from production await helper.assets.create( alice, UNQ_ASSET_ID_ON_ASTAR, @@ -1550,8 +1549,8 @@ await helper.assets.setMetadata( alice, UNQ_ASSET_ID_ON_ASTAR, - 'Cross chain UNQ', - 'xcUNQ', + 'Unique Network', + 'UNQ', Number(UNQ_DECIMALS), ); -- gitstuff