git.delta.rocks / unique-network / refs/commits / 17703e6a9d58

difftreelog

fix set correct shiden/astar values for our chain

Daniel Shiposha2023-10-02parent: #cefeef5.patch.diff
in: master

5 files changed

modifiedtests/src/util/playgrounds/unique.xcm.tsdiffbeforeafterboth
240}240}
241241
242export class AssetsGroup<T extends ChainHelperBase> extends HelperGroup<T> {242export class AssetsGroup<T extends ChainHelperBase> extends HelperGroup<T> {
243 async create(signer: TSigner, assetId: number, admin: string, minimalBalance: bigint) {243 async create(signer: TSigner, assetId: number | bigint, admin: string, minimalBalance: bigint) {
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 }
246246
247 async setMetadata(signer: TSigner, assetId: number, name: string, symbol: string, decimals: number) {247 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);248 await this.helper.executeExtrinsic(signer, 'api.tx.assets.setMetadata', [assetId, name, symbol, decimals], true);
249 }249 }
250250
251 async mint(signer: TSigner, assetId: number, beneficiary: string, amount: bigint) {251 async mint(signer: TSigner, assetId: number | bigint, beneficiary: string, amount: bigint) {
252 await this.helper.executeExtrinsic(signer, 'api.tx.assets.mint', [assetId, beneficiary, amount], true);252 await this.helper.executeExtrinsic(signer, 'api.tx.assets.mint', [assetId, beneficiary, amount], true);
253 }253 }
254254
255 async account(assetId: string | number, address: string) {255 async account(assetId: string | number | bigint, address: string) {
256 const accountAsset = (256 const accountAsset = (
257 await this.helper.callRpc('api.query.assets.account', [assetId, address])257 await this.helper.callRpc('api.query.assets.account', [assetId, address])
258 ).toJSON()! as any;258 ).toJSON()! as any;
modifiedtests/src/xcm/lowLevelXcmQuartz.test.tsdiffbeforeafterboth
222 let alice: IKeyringPair;222 let alice: IKeyringPair;
223 let randomAccount: IKeyringPair;223 let randomAccount: IKeyringPair;
224224
225 const QTZ_ASSET_ID_ON_SHIDEN = 1;225 const QTZ_ASSET_ID_ON_SHIDEN = 18_446_744_073_709_551_633n; // The value is taken from the live Shiden
226 const QTZ_MINIMAL_BALANCE_ON_SHIDEN = 1n;226 const QTZ_MINIMAL_BALANCE_ON_SHIDEN = 1n; // The value is taken from the live Shiden
227227
228 // Quartz -> Shiden228 // Quartz -> Shiden
229 const shidenInitialBalance = 1n * (10n ** SHIDEN_DECIMALS); // 1 SHD, existential deposit required to actually create the account on Shiden229 const shidenInitialBalance = 1n * (10n ** SHIDEN_DECIMALS); // 1 SHD, existential deposit required to actually create the account on Shiden
230 const unitsPerSecond = 228_000_000_000n; // This is Phala's value. What will be ours?230 const unitsPerSecond = 500_451_000_000_000_000_000n; // The value is taken from the live Shiden
231
232
233231
245 await usingShidenPlaygrounds(shidenUrl, async (helper) => {243 await usingShidenPlaygrounds(shidenUrl, async (helper) => {
246 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()) {
247 console.log('1. Create foreign asset and metadata');245 console.log('1. Create foreign asset and metadata');
248 // TODO update metadata with values from production
249 await helper.assets.create(246 await helper.assets.create(
250 alice,247 alice,
251 QTZ_ASSET_ID_ON_SHIDEN,248 QTZ_ASSET_ID_ON_SHIDEN,
256 await helper.assets.setMetadata(253 await helper.assets.setMetadata(
257 alice,254 alice,
258 QTZ_ASSET_ID_ON_SHIDEN,255 QTZ_ASSET_ID_ON_SHIDEN,
259 'Cross chain QTZ',256 'Quartz',
260 'xcQTZ',257 'QTZ',
261 Number(QTZ_DECIMALS),258 Number(QTZ_DECIMALS),
262 );259 );
263260
modifiedtests/src/xcm/lowLevelXcmUnique.test.tsdiffbeforeafterboth
288 let alice: IKeyringPair;288 let alice: IKeyringPair;
289 let randomAccount: IKeyringPair;289 let randomAccount: IKeyringPair;
290290
291 const UNQ_ASSET_ID_ON_ASTAR = 1;291 const UNQ_ASSET_ID_ON_ASTAR = 18_446_744_073_709_551_631n; // The value is taken from the live Astar
292 const UNQ_MINIMAL_BALANCE_ON_ASTAR = 1n;292 const UNQ_MINIMAL_BALANCE_ON_ASTAR = 1n; // The value is taken from the live Astar
293293
294 // Unique -> Astar294 // Unique -> Astar
295 const astarInitialBalance = 1n * (10n ** ASTAR_DECIMALS); // 1 ASTR, existential deposit required to actually create the account on Astar.295 const astarInitialBalance = 1n * (10n ** ASTAR_DECIMALS); // 1 ASTR, existential deposit required to actually create the account on Astar.
296 const unitsPerSecond = 228_000_000_000n; // This is Phala's value. What will be ours?296 const unitsPerSecond = 9_451_000_000_000_000_000n; // The value is taken from the live Astar
297297
298 before(async () => {298 before(async () => {
299 await usingPlaygrounds(async (helper, privateKey) => {299 await usingPlaygrounds(async (helper, privateKey) => {
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 // TODO update metadata with values from production
313 await helper.assets.create(312 await helper.assets.create(
314 alice,313 alice,
315 UNQ_ASSET_ID_ON_ASTAR,314 UNQ_ASSET_ID_ON_ASTAR,
320 await helper.assets.setMetadata(319 await helper.assets.setMetadata(
321 alice,320 alice,
322 UNQ_ASSET_ID_ON_ASTAR,321 UNQ_ASSET_ID_ON_ASTAR,
323 'Cross chain UNQ',322 'Unique Network',
324 'xcUNQ',323 'UNQ',
325 Number(UNQ_DECIMALS),324 Number(UNQ_DECIMALS),
326 );325 );
327326
modifiedtests/src/xcm/xcmQuartz.test.tsdiffbeforeafterboth
1283 let alice: IKeyringPair;1283 let alice: IKeyringPair;
1284 let sender: IKeyringPair;1284 let sender: IKeyringPair;
12851285
1286 const QTZ_ASSET_ID_ON_SHIDEN = 1;1286 const QTZ_ASSET_ID_ON_SHIDEN = 18_446_744_073_709_551_633n; // The value is taken from the live Shiden
1287 const QTZ_MINIMAL_BALANCE_ON_SHIDEN = 1n;1287 const QTZ_MINIMAL_BALANCE_ON_SHIDEN = 1n; // The value is taken from the live Shiden
12881288
1289 // Quartz -> Shiden1289 // Quartz -> Shiden
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 = 228_000_000_000n; // This is Phala's value. What will be ours?1291 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 = 9_999_999_999_088_000_000n; // 9.999 ... QTZ, Shiden takes a commision in foreign tokens
12941294
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 // TODO update metadata with values from production
1315 await helper.assets.create(1314 await helper.assets.create(
1316 alice,1315 alice,
1317 QTZ_ASSET_ID_ON_SHIDEN,1316 QTZ_ASSET_ID_ON_SHIDEN,
1322 await helper.assets.setMetadata(1321 await helper.assets.setMetadata(
1323 alice,1322 alice,
1324 QTZ_ASSET_ID_ON_SHIDEN,1323 QTZ_ASSET_ID_ON_SHIDEN,
1325 'Cross chain QTZ',1324 'Quartz',
1326 'xcQTZ',1325 'QTZ',
1327 Number(QTZ_DECIMALS),1326 Number(QTZ_DECIMALS),
1328 );1327 );
13291328
modifiedtests/src/xcm/xcmUnique.test.tsdiffbeforeafterboth
1511 let alice: IKeyringPair;1511 let alice: IKeyringPair;
1512 let randomAccount: IKeyringPair;1512 let randomAccount: IKeyringPair;
15131513
1514 const UNQ_ASSET_ID_ON_ASTAR = 1;1514 const UNQ_ASSET_ID_ON_ASTAR = 18_446_744_073_709_551_631n; // The value is taken from the live Astar
1515 const UNQ_MINIMAL_BALANCE_ON_ASTAR = 1n;1515 const UNQ_MINIMAL_BALANCE_ON_ASTAR = 1n; // The value is taken from the live Astar
15161516
1517 // Unique -> Astar1517 // Unique -> Astar
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 = 228_000_000_000n; // This is Phala's value. What will be ours?1519 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_999_999_999_088_000_000n; // 9.999 ... UNQ, Astar takes a commision in foreign tokens
15221522
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 // TODO update metadata with values from production
1543 await helper.assets.create(1542 await helper.assets.create(
1544 alice,1543 alice,
1545 UNQ_ASSET_ID_ON_ASTAR,1544 UNQ_ASSET_ID_ON_ASTAR,
1550 await helper.assets.setMetadata(1549 await helper.assets.setMetadata(
1551 alice,1550 alice,
1552 UNQ_ASSET_ID_ON_ASTAR,1551 UNQ_ASSET_ID_ON_ASTAR,
1553 'Cross chain UNQ',1552 'Unique Network',
1554 'xcUNQ',1553 'UNQ',
1555 Number(UNQ_DECIMALS),1554 Number(UNQ_DECIMALS),
1556 );1555 );
15571556