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

difftreelog

merge master

Igor Kozyrev2022-03-30parents: #c21a15c #17c0e89.patch.diff
in: master

10 files changed

modifiedREADME.mddiffbeforeafterboth
--- a/README.md
+++ b/README.md
@@ -155,13 +155,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:
@@ -179,7 +179,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
 
modifiedclient/rpc/src/lib.rsdiffbeforeafterboth
--- a/client/rpc/src/lib.rs
+++ b/client/rpc/src/lib.rs
@@ -14,6 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
+// Original License
 use std::sync::Arc;
 
 use codec::Decode;
modifiednode/cli/src/service.rsdiffbeforeafterboth
--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -14,8 +14,6 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-//! Service and ServiceFactory implementation. Specialized wrapper over substrate service.
-
 // std
 use std::sync::Arc;
 use std::sync::Mutex;
modifiedpallets/scheduler/src/lib.rsdiffbeforeafterboth
--- a/pallets/scheduler/src/lib.rs
+++ b/pallets/scheduler/src/lib.rs
@@ -14,7 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-// Original license
+// Original license:
 // This file is part of Substrate.
 
 // Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -216,11 +216,15 @@
 		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
 		.build_or_panic();
 	pub const Version: RuntimeVersion = VERSION;
-	pub const SS58Prefix: u8 = 42;
+	/*
+	255 - Quartz
+	42 - Opal
+	*/
+	pub const SS58Prefix: u8 = 255;
 }
 
 parameter_types! {
-	pub const ChainId: u64 = 8882;
+	pub const ChainId: u64 = 8881;
 }
 
 pub struct FixedFee;
modifiedtests/flipper-src/lib.rsdiffbeforeafterboth
--- a/tests/flipper-src/lib.rs
+++ b/tests/flipper-src/lib.rs
@@ -14,7 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-// Original license
+// Original License
 // Copyright 2018-2020 Parity Technologies (UK) Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
modifiedtests/ink-types-node-runtime/src/calls.rsdiffbeforeafterboth
--- a/tests/ink-types-node-runtime/src/calls.rs
+++ b/tests/ink-types-node-runtime/src/calls.rs
@@ -14,7 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-// Original license
+// Original License
 // Copyright 2019 Parity Technologies (UK) Ltd.
 // This file is part of ink!.
 //
modifiedtests/ink-types-node-runtime/src/lib.rsdiffbeforeafterboth
--- a/tests/ink-types-node-runtime/src/lib.rs
+++ b/tests/ink-types-node-runtime/src/lib.rs
@@ -14,7 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-// Original license
+// Original License
 // Copyright 2018-2019 Parity Technologies (UK) Ltd.
 // This file is part of ink!.
 //
modifiedtests/loadtester-src/lib.rsdiffbeforeafterboth
--- a/tests/loadtester-src/lib.rs
+++ b/tests/loadtester-src/lib.rs
@@ -14,6 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
+// Original License
 #![cfg_attr(not(feature = "std"), no_std)]
 
 use ink_lang as ink;
modifiedtests/src/xcmTransfer.test.tsdiffbeforeafterboth
before · tests/src/xcmTransfer.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import chai from 'chai';18import chaiAsPromised from 'chai-as-promised';1920import {WsProvider} from '@polkadot/api';21import {ApiOptions} from '@polkadot/api/types';22import {IKeyringPair} from '@polkadot/types/types';23import privateKey from './substrate/privateKey';24import usingApi, {submitTransactionAsync} from './substrate/substrate-api';25import {getGenericResult} from './util/helpers';26import waitNewBlocks from './substrate/wait-new-blocks';27import getBalance from './substrate/get-balance';28import {alicesPublicKey} from './accounts';2930chai.use(chaiAsPromised);31const expect = chai.expect;3233const UNIQUE_CHAIN = 1000;34const KARURA_CHAIN = 2000;35const KARURA_PORT = '9946';3637describe('Integration test: Exchanging OPL with Karura', () => {38  let alice: IKeyringPair;39  40  before(async () => {41    await usingApi(async () => {42      alice = privateKey('//Alice');43    });4445    const karuraApiOptions: ApiOptions = {46      provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT),47    };4849    await usingApi(async (api) => {50      const destination = {51        V0: {52          X2: [53            'Parent',54            {55              Parachain: UNIQUE_CHAIN,56            },57          ],58        },59      };6061      const metadata =62      {63        name: 'OPL',64        symbol: 'OPL',65        decimals: 18,66        minimalBalance: 1,67      };6869      const tx = api.tx.assetRegistry.registerForeignAsset(destination, metadata);70      const sudoTx = api.tx.sudo.sudo(tx as any);71      const events = await submitTransactionAsync(alice, sudoTx);72      const result = getGenericResult(events);73      expect(result.success).to.be.true;74    }, karuraApiOptions);75  });7677  it('Should connect and send OPL to Karura', async () => {78    let balanceOnKaruraBefore: bigint;79    80    await usingApi(async (api) => {81      const {free} = (await api.query.tokens.accounts(alice.addressRaw, {ForeignAsset: 0})).toJSON() as any;82      balanceOnKaruraBefore = free;83    }, {provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT)});8485    await usingApi(async (api) => {86      const destination = {87        V0: {88          X2: [89            'Parent',90            {91              Parachain: KARURA_CHAIN,92            },93          ],94        },95      };9697      const beneficiary = {98        V0: {99          X1: {100            AccountId32: {101              network: 'Any',102              id: alice.addressRaw,103            },104          },105        },106      };107108      const assets = {109        V1: [110          {111            id: {112              Concrete: {113                parents: 0,114                interior: 'Here',115              },116            },117            fun: {118              Fungible: 5000000000,119            },120          },121        ],122      };123124      const feeAssetItem = 0;125126      const weightLimit = {127        Limited: 5000000000,128      };129130      const tx = api.tx.polkadotXcm.limitedReserveTransferAssets(destination, beneficiary, assets, feeAssetItem, weightLimit);131      const events = await submitTransactionAsync(alice, tx);132      const result = getGenericResult(events);133      expect(result.success).to.be.true;134    });135136    await usingApi(async (api) => {137      // todo do something about instant sealing, where there might not be any new blocks138      await waitNewBlocks(api, 3);139      const {free} = (await api.query.tokens.accounts(alice.addressRaw, {ForeignAsset: 0})).toJSON() as any;140      expect(free > balanceOnKaruraBefore).to.be.true;141    }, {provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT)});142  });143144  it('Should connect to Karura and send OPL back', async () => {145    let balanceBefore: bigint;146    147    await usingApi(async (api) => {148      [balanceBefore] = await getBalance(api, [alicesPublicKey]);149    });150151    await usingApi(async (api) => {152      const destination = {153        V0: {154          X3: [155            'Parent',156            {157              Parachain: UNIQUE_CHAIN,158            },159            {160              AccountId32: {161                network: 'Any',162                id: alice.addressRaw,163              },164            },165          ],166        },167      };168169      const id = {170        ForeignAsset: 0,171      };172173      const amount = 5000000000;174      const destWeight = 50000000;175176      const tx = api.tx.xTokens.transfer(id, amount, destination, destWeight);177      const events = await submitTransactionAsync(alice, tx);178      const result = getGenericResult(events);179      expect(result.success).to.be.true;180    }, {provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT)});181182    await usingApi(async (api) => {183      // todo do something about instant sealing, where there might not be any new blocks184      await waitNewBlocks(api, 3);185      const [balanceAfter] = await getBalance(api, [alicesPublicKey]);186      expect(balanceAfter > balanceBefore).to.be.true;187    });188  });189});