git.delta.rocks / unique-network / refs/commits / 47ec26c60804

difftreelog

quartz release v916001

Igor Kozyrev2022-02-11parent: #f13427c.patch.diff
in: master

4 files changed

modifiedREADME.mddiffbeforeafterboth
--- a/README.md
+++ b/README.md
@@ -160,13 +160,13 @@
 location:
 	V0(X2(Parent, Parachain(PARA_ID))) 
 metadata:
-	name         OPL
-	symbol       OPL
+	name         QTZ
+	symbol       QTZ
 	decimals     18
 minimalBalance	 1
 ```
 
-### Next, we can send tokens from Opal to Karura:
+### Next, we can send tokens from Quartz to Karura:
 ```
 polkadotXcm -> reserveTransferAssets
 dest:
@@ -184,7 +184,7 @@
 The result will be displayed in ChainState   
 tokens -> accounts	
 
-### To send tokens from Karura to Opal:
+### To send tokens from Karura to Quartz:
 ```
 xtokens -> transfer
 
modifiednode/cli/src/command.rsdiffbeforeafterboth
--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -52,7 +52,7 @@
 impl SubstrateCli for Cli {
 	// TODO use args
 	fn impl_name() -> String {
-		"Opal Node".into()
+		"Quartz Node".into()
 	}
 
 	fn impl_version() -> String {
@@ -61,7 +61,7 @@
 	// TODO use args
 	fn description() -> String {
 		format!(
-			"Opal Node\n\nThe command-line arguments provided first will be \
+			"Quartz Node\n\nThe command-line arguments provided first will be \
 		passed to the parachain node, while the arguments provided after -- will be passed \
 		to the relaychain node.\n\n\
 		{} [parachain-args] -- [relaychain-args]",
@@ -94,7 +94,7 @@
 impl SubstrateCli for RelayChainCli {
 	// TODO use args
 	fn impl_name() -> String {
-		"Opal Node".into()
+		"Quartz Node".into()
 	}
 
 	fn impl_version() -> String {
@@ -102,7 +102,7 @@
 	}
 	// TODO use args
 	fn description() -> String {
-		"Opal Node\n\nThe command-line arguments provided first will be \
+		"Quartz Node\n\nThe command-line arguments provided first will be \
 		passed to the parachain node, while the arguments provided after -- will be passed \
 		to the relaychain node.\n\n\
 		parachain-collator [parachain-args] -- [relaychain-args]"
modifiedruntime/src/lib.rsdiffbeforeafterboth
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -157,8 +157,8 @@
 
 /// This runtime version.
 pub const VERSION: RuntimeVersion = RuntimeVersion {
-	spec_name: create_runtime_str!("opal"),
-	impl_name: create_runtime_str!("opal"),
+	spec_name: create_runtime_str!("quartz"),
+	impl_name: create_runtime_str!("quartz"),
 	authoring_version: 1,
 	spec_version: 916001,
 	impl_version: 0,
@@ -247,7 +247,7 @@
 		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
 		.build_or_panic();
 	pub const Version: RuntimeVersion = VERSION;
-	pub const SS58Prefix: u8 = 42;
+	pub const SS58Prefix: u8 = 255;
 }
 
 parameter_types! {
modifiedtests/src/xcmTransfer.test.tsdiffbeforeafterboth
before · tests/src/xcmTransfer.test.ts
1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import chai from 'chai';7import chaiAsPromised from 'chai-as-promised';89import {WsProvider} from '@polkadot/api';10import {ApiOptions} from '@polkadot/api/types';11import {IKeyringPair} from '@polkadot/types/types';12import privateKey from './substrate/privateKey';13import usingApi, {submitTransactionAsync} from './substrate/substrate-api';14import {getGenericResult} from './util/helpers';15import waitNewBlocks from './substrate/wait-new-blocks';16import getBalance from './substrate/get-balance';17import {alicesPublicKey} from './accounts';1819chai.use(chaiAsPromised);20const expect = chai.expect;2122const UNIQUE_CHAIN = 1000;23const KARURA_CHAIN = 2000;24const KARURA_PORT = '9946';2526describe('Integration test: Exchanging OPL with Karura', () => {27  let alice: IKeyringPair;28  29  before(async () => {30    await usingApi(async () => {31      alice = privateKey('//Alice');32    });3334    const karuraApiOptions: ApiOptions = {35      provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT),36    };3738    await usingApi(async (api) => {39      const destination = {40        V0: {41          X2: [42            'Parent',43            {44              Parachain: UNIQUE_CHAIN,45            },46          ],47        },48      };4950      const metadata =51      {52        name: 'OPL',53        symbol: 'OPL',54        decimals: 18,55        minimalBalance: 1,56      };5758      const tx = api.tx.assetRegistry.registerForeignAsset(destination, metadata);59      const sudoTx = api.tx.sudo.sudo(tx as any);60      const events = await submitTransactionAsync(alice, sudoTx);61      const result = getGenericResult(events);62      expect(result.success).to.be.true;63    }, karuraApiOptions);64  });6566  it('Should connect and send OPL to Karura', async () => {67    let balanceOnKaruraBefore: bigint;68    69    await usingApi(async (api) => {70      const {free} = (await api.query.tokens.accounts(alice.addressRaw, {ForeignAsset: 0})).toJSON() as any;71      balanceOnKaruraBefore = free;72    }, {provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT)});7374    await usingApi(async (api) => {75      const destination = {76        V0: {77          X2: [78            'Parent',79            {80              Parachain: KARURA_CHAIN,81            },82          ],83        },84      };8586      const beneficiary = {87        V0: {88          X1: {89            AccountId32: {90              network: 'Any',91              id: alice.addressRaw,92            },93          },94        },95      };9697      const assets = {98        V1: [99          {100            id: {101              Concrete: {102                parents: 0,103                interior: 'Here',104              },105            },106            fun: {107              Fungible: 5000000000,108            },109          },110        ],111      };112113      const feeAssetItem = 0;114115      const weightLimit = {116        Limited: 5000000000,117      };118119      const tx = api.tx.polkadotXcm.limitedReserveTransferAssets(destination, beneficiary, assets, feeAssetItem, weightLimit);120      const events = await submitTransactionAsync(alice, tx);121      const result = getGenericResult(events);122      expect(result.success).to.be.true;123    });124125    await usingApi(async (api) => {126      // todo do something about instant sealing, where there might not be any new blocks127      await waitNewBlocks(api, 3);128      const {free} = (await api.query.tokens.accounts(alice.addressRaw, {ForeignAsset: 0})).toJSON() as any;129      expect(free > balanceOnKaruraBefore).to.be.true;130    }, {provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT)});131  });132133  it('Should connect to Karura and send OPL back', async () => {134    let balanceBefore: bigint;135    136    await usingApi(async (api) => {137      [balanceBefore] = await getBalance(api, [alicesPublicKey]);138    });139140    await usingApi(async (api) => {141      const destination = {142        V0: {143          X3: [144            'Parent',145            {146              Parachain: UNIQUE_CHAIN,147            },148            {149              AccountId32: {150                network: 'Any',151                id: alice.addressRaw,152              },153            },154          ],155        },156      };157158      const id = {159        ForeignAsset: 0,160      };161162      const amount = 5000000000;163      const destWeight = 50000000;164165      const tx = api.tx.xTokens.transfer(id, amount, destination, destWeight);166      const events = await submitTransactionAsync(alice, tx);167      const result = getGenericResult(events);168      expect(result.success).to.be.true;169    }, {provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT)});170171    await usingApi(async (api) => {172      // todo do something about instant sealing, where there might not be any new blocks173      await waitNewBlocks(api, 3);174      const [balanceAfter] = await getBalance(api, [alicesPublicKey]);175      expect(balanceAfter > balanceBefore).to.be.true;176    });177  });178});
after · tests/src/xcmTransfer.test.ts
1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import chai from 'chai';7import chaiAsPromised from 'chai-as-promised';89import {WsProvider} from '@polkadot/api';10import {ApiOptions} from '@polkadot/api/types';11import {IKeyringPair} from '@polkadot/types/types';12import privateKey from './substrate/privateKey';13import usingApi, {submitTransactionAsync} from './substrate/substrate-api';14import {getGenericResult} from './util/helpers';15import waitNewBlocks from './substrate/wait-new-blocks';16import getBalance from './substrate/get-balance';17import {alicesPublicKey} from './accounts';1819chai.use(chaiAsPromised);20const expect = chai.expect;2122const UNIQUE_CHAIN = 1000;23const KARURA_CHAIN = 2000;24const KARURA_PORT = '9946';2526describe('Integration test: Exchanging QTZ with Karura', () => {27  let alice: IKeyringPair;28  29  before(async () => {30    await usingApi(async () => {31      alice = privateKey('//Alice');32    });3334    const karuraApiOptions: ApiOptions = {35      provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT),36    };3738    await usingApi(async (api) => {39      const destination = {40        V0: {41          X2: [42            'Parent',43            {44              Parachain: UNIQUE_CHAIN,45            },46          ],47        },48      };4950      const metadata =51      {52        name: 'QTZ',53        symbol: 'QTZ',54        decimals: 18,55        minimalBalance: 1,56      };5758      const tx = api.tx.assetRegistry.registerForeignAsset(destination, metadata);59      const sudoTx = api.tx.sudo.sudo(tx as any);60      const events = await submitTransactionAsync(alice, sudoTx);61      const result = getGenericResult(events);62      expect(result.success).to.be.true;63    }, karuraApiOptions);64  });6566  it('Should connect and send QTZ to Karura', async () => {67    let balanceOnKaruraBefore: bigint;68    69    await usingApi(async (api) => {70      const {free} = (await api.query.tokens.accounts(alice.addressRaw, {ForeignAsset: 0})).toJSON() as any;71      balanceOnKaruraBefore = free;72    }, {provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT)});7374    await usingApi(async (api) => {75      const destination = {76        V0: {77          X2: [78            'Parent',79            {80              Parachain: KARURA_CHAIN,81            },82          ],83        },84      };8586      const beneficiary = {87        V0: {88          X1: {89            AccountId32: {90              network: 'Any',91              id: alice.addressRaw,92            },93          },94        },95      };9697      const assets = {98        V1: [99          {100            id: {101              Concrete: {102                parents: 0,103                interior: 'Here',104              },105            },106            fun: {107              Fungible: 5000000000,108            },109          },110        ],111      };112113      const feeAssetItem = 0;114115      const weightLimit = {116        Limited: 5000000000,117      };118119      const tx = api.tx.polkadotXcm.limitedReserveTransferAssets(destination, beneficiary, assets, feeAssetItem, weightLimit);120      const events = await submitTransactionAsync(alice, tx);121      const result = getGenericResult(events);122      expect(result.success).to.be.true;123    });124125    await usingApi(async (api) => {126      // todo do something about instant sealing, where there might not be any new blocks127      await waitNewBlocks(api, 3);128      const {free} = (await api.query.tokens.accounts(alice.addressRaw, {ForeignAsset: 0})).toJSON() as any;129      expect(free > balanceOnKaruraBefore).to.be.true;130    }, {provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT)});131  });132133  it('Should connect to Karura and send QTZ back', async () => {134    let balanceBefore: bigint;135    136    await usingApi(async (api) => {137      [balanceBefore] = await getBalance(api, [alicesPublicKey]);138    });139140    await usingApi(async (api) => {141      const destination = {142        V0: {143          X3: [144            'Parent',145            {146              Parachain: UNIQUE_CHAIN,147            },148            {149              AccountId32: {150                network: 'Any',151                id: alice.addressRaw,152              },153            },154          ],155        },156      };157158      const id = {159        ForeignAsset: 0,160      };161162      const amount = 5000000000;163      const destWeight = 50000000;164165      const tx = api.tx.xTokens.transfer(id, amount, destination, destWeight);166      const events = await submitTransactionAsync(alice, tx);167      const result = getGenericResult(events);168      expect(result.success).to.be.true;169    }, {provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT)});170171    await usingApi(async (api) => {172      // todo do something about instant sealing, where there might not be any new blocks173      await waitNewBlocks(api, 3);174      const [balanceAfter] = await getBalance(api, [alicesPublicKey]);175      expect(balanceAfter > balanceBefore).to.be.true;176    });177  });178});