difftreelog
merge master
in: master
10 files changed
README.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
client/rpc/src/lib.rsdiffbeforeafterboth1// 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/>.1617use std::sync::Arc;1819use codec::Decode;20use jsonrpc_core::{Error as RpcError, ErrorCode, Result};21use jsonrpc_derive::rpc;22use up_data_structs::{Collection, CollectionId, CollectionStats, TokenId};23use sp_api::{BlockId, BlockT, ProvideRuntimeApi, ApiExt};24use sp_blockchain::HeaderBackend;25use up_rpc::UniqueApi as UniqueRuntimeApi;2627#[rpc]28pub trait UniqueApi<BlockHash, CrossAccountId, AccountId> {29 #[rpc(name = "unique_accountTokens")]30 fn account_tokens(31 &self,32 collection: CollectionId,33 account: CrossAccountId,34 at: Option<BlockHash>,35 ) -> Result<Vec<TokenId>>;36 #[rpc(name = "unique_tokenExists")]37 fn token_exists(38 &self,39 collection: CollectionId,40 token: TokenId,41 at: Option<BlockHash>,42 ) -> Result<bool>;4344 #[rpc(name = "unique_tokenOwner")]45 fn token_owner(46 &self,47 collection: CollectionId,48 token: TokenId,49 at: Option<BlockHash>,50 ) -> Result<Option<CrossAccountId>>;51 #[rpc(name = "unique_constMetadata")]52 fn const_metadata(53 &self,54 collection: CollectionId,55 token: TokenId,56 at: Option<BlockHash>,57 ) -> Result<Vec<u8>>;58 #[rpc(name = "unique_variableMetadata")]59 fn variable_metadata(60 &self,61 collection: CollectionId,62 token: TokenId,63 at: Option<BlockHash>,64 ) -> Result<Vec<u8>>;6566 #[rpc(name = "unique_collectionTokens")]67 fn collection_tokens(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<u32>;68 #[rpc(name = "unique_accountBalance")]69 fn account_balance(70 &self,71 collection: CollectionId,72 account: CrossAccountId,73 at: Option<BlockHash>,74 ) -> Result<u32>;75 #[rpc(name = "unique_balance")]76 fn balance(77 &self,78 collection: CollectionId,79 account: CrossAccountId,80 token: TokenId,81 at: Option<BlockHash>,82 ) -> Result<String>;83 #[rpc(name = "unique_allowance")]84 fn allowance(85 &self,86 collection: CollectionId,87 sender: CrossAccountId,88 spender: CrossAccountId,89 token: TokenId,90 at: Option<BlockHash>,91 ) -> Result<String>;9293 #[rpc(name = "unique_adminlist")]94 fn adminlist(95 &self,96 collection: CollectionId,97 at: Option<BlockHash>,98 ) -> Result<Vec<CrossAccountId>>;99 #[rpc(name = "unique_allowlist")]100 fn allowlist(101 &self,102 collection: CollectionId,103 at: Option<BlockHash>,104 ) -> Result<Vec<CrossAccountId>>;105 #[rpc(name = "unique_allowed")]106 fn allowed(107 &self,108 collection: CollectionId,109 user: CrossAccountId,110 at: Option<BlockHash>,111 ) -> Result<bool>;112 #[rpc(name = "unique_lastTokenId")]113 fn last_token_id(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<TokenId>;114 #[rpc(name = "unique_collectionById")]115 fn collection_by_id(116 &self,117 collection: CollectionId,118 at: Option<BlockHash>,119 ) -> Result<Option<Collection<AccountId>>>;120 #[rpc(name = "unique_collectionStats")]121 fn collection_stats(&self, at: Option<BlockHash>) -> Result<CollectionStats>;122}123124pub struct Unique<C, P> {125 client: Arc<C>,126 _marker: std::marker::PhantomData<P>,127}128129impl<C, P> Unique<C, P> {130 pub fn new(client: Arc<C>) -> Self {131 Self {132 client,133 _marker: Default::default(),134 }135 }136}137138pub enum Error {139 RuntimeError,140}141142impl From<Error> for i64 {143 fn from(e: Error) -> i64 {144 match e {145 Error::RuntimeError => 1,146 }147 }148}149150macro_rules! pass_method {151 (152 $method_name:ident($($name:ident: $ty:ty),* $(,)?) -> $result:ty $(=> $mapper:expr)?153 $(; changed_in $ver:expr, $changed_method_name:ident ($($changed_name:expr), * $(,)?) => $fixer:expr)*154 ) => {155 fn $method_name(156 &self,157 $(158 $name: $ty,159 )*160 at: Option<<Block as BlockT>::Hash>,161 ) -> Result<$result> {162 let api = self.client.runtime_api();163 let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash));164 let _api_version = if let Ok(Some(api_version)) =165 api.api_version::<dyn UniqueRuntimeApi<Block, CrossAccountId, AccountId>>(&at)166 {167 api_version168 } else {169 // unreachable for our runtime170 return Err(RpcError {171 code: ErrorCode::InvalidParams,172 message: "Api is not available".into(),173 data: None,174 })175 };176177 let result = $(if _api_version < $ver {178 api.$changed_method_name(&at, $($changed_name),*).map(|r| r.map($fixer))179 } else)*180 { api.$method_name(&at, $($name),*) };181182 let result = result.map_err(|e| RpcError {183 code: ErrorCode::ServerError(Error::RuntimeError.into()),184 message: "Unable to query".into(),185 data: Some(format!("{:?}", e).into()),186 })?;187 result.map_err(|e| RpcError {188 code: ErrorCode::InvalidParams,189 message: "Runtime returned error".into(),190 data: Some(format!("{:?}", e).into()),191 })$(.map($mapper))?192 }193 };194}195196#[allow(deprecated)]197impl<C, Block, CrossAccountId, AccountId>198 UniqueApi<<Block as BlockT>::Hash, CrossAccountId, AccountId> for Unique<C, Block>199where200 Block: BlockT,201 AccountId: Decode,202 C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,203 C::Api: UniqueRuntimeApi<Block, CrossAccountId, AccountId>,204 CrossAccountId: pallet_common::account::CrossAccountId<AccountId>,205{206 pass_method!(account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId>);207 pass_method!(token_exists(collection: CollectionId, token: TokenId) -> bool);208 pass_method!(209 token_owner(collection: CollectionId, token: TokenId) -> Option<CrossAccountId>;210 changed_in 2, token_owner_before_version_2(collection, token) => |u| Some(u)211 );212 pass_method!(const_metadata(collection: CollectionId, token: TokenId) -> Vec<u8>);213 pass_method!(variable_metadata(collection: CollectionId, token: TokenId) -> Vec<u8>);214 pass_method!(collection_tokens(collection: CollectionId) -> u32);215 pass_method!(account_balance(collection: CollectionId, account: CrossAccountId) -> u32);216 pass_method!(balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> String => |v| v.to_string());217 pass_method!(allowance(collection: CollectionId, sender: CrossAccountId, spender: CrossAccountId, token: TokenId) -> String => |v| v.to_string());218219 pass_method!(adminlist(collection: CollectionId) -> Vec<CrossAccountId>);220 pass_method!(allowlist(collection: CollectionId) -> Vec<CrossAccountId>);221 pass_method!(allowed(collection: CollectionId, user: CrossAccountId) -> bool);222 pass_method!(last_token_id(collection: CollectionId) -> TokenId);223 pass_method!(collection_by_id(collection: CollectionId) -> Option<Collection<AccountId>>);224 pass_method!(collection_stats() -> CollectionStats);225}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/>.1617// Original License18use std::sync::Arc;1920use codec::Decode;21use jsonrpc_core::{Error as RpcError, ErrorCode, Result};22use jsonrpc_derive::rpc;23use up_data_structs::{Collection, CollectionId, CollectionStats, TokenId};24use sp_api::{BlockId, BlockT, ProvideRuntimeApi, ApiExt};25use sp_blockchain::HeaderBackend;26use up_rpc::UniqueApi as UniqueRuntimeApi;2728#[rpc]29pub trait UniqueApi<BlockHash, CrossAccountId, AccountId> {30 #[rpc(name = "unique_accountTokens")]31 fn account_tokens(32 &self,33 collection: CollectionId,34 account: CrossAccountId,35 at: Option<BlockHash>,36 ) -> Result<Vec<TokenId>>;37 #[rpc(name = "unique_tokenExists")]38 fn token_exists(39 &self,40 collection: CollectionId,41 token: TokenId,42 at: Option<BlockHash>,43 ) -> Result<bool>;4445 #[rpc(name = "unique_tokenOwner")]46 fn token_owner(47 &self,48 collection: CollectionId,49 token: TokenId,50 at: Option<BlockHash>,51 ) -> Result<Option<CrossAccountId>>;52 #[rpc(name = "unique_constMetadata")]53 fn const_metadata(54 &self,55 collection: CollectionId,56 token: TokenId,57 at: Option<BlockHash>,58 ) -> Result<Vec<u8>>;59 #[rpc(name = "unique_variableMetadata")]60 fn variable_metadata(61 &self,62 collection: CollectionId,63 token: TokenId,64 at: Option<BlockHash>,65 ) -> Result<Vec<u8>>;6667 #[rpc(name = "unique_collectionTokens")]68 fn collection_tokens(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<u32>;69 #[rpc(name = "unique_accountBalance")]70 fn account_balance(71 &self,72 collection: CollectionId,73 account: CrossAccountId,74 at: Option<BlockHash>,75 ) -> Result<u32>;76 #[rpc(name = "unique_balance")]77 fn balance(78 &self,79 collection: CollectionId,80 account: CrossAccountId,81 token: TokenId,82 at: Option<BlockHash>,83 ) -> Result<String>;84 #[rpc(name = "unique_allowance")]85 fn allowance(86 &self,87 collection: CollectionId,88 sender: CrossAccountId,89 spender: CrossAccountId,90 token: TokenId,91 at: Option<BlockHash>,92 ) -> Result<String>;9394 #[rpc(name = "unique_adminlist")]95 fn adminlist(96 &self,97 collection: CollectionId,98 at: Option<BlockHash>,99 ) -> Result<Vec<CrossAccountId>>;100 #[rpc(name = "unique_allowlist")]101 fn allowlist(102 &self,103 collection: CollectionId,104 at: Option<BlockHash>,105 ) -> Result<Vec<CrossAccountId>>;106 #[rpc(name = "unique_allowed")]107 fn allowed(108 &self,109 collection: CollectionId,110 user: CrossAccountId,111 at: Option<BlockHash>,112 ) -> Result<bool>;113 #[rpc(name = "unique_lastTokenId")]114 fn last_token_id(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<TokenId>;115 #[rpc(name = "unique_collectionById")]116 fn collection_by_id(117 &self,118 collection: CollectionId,119 at: Option<BlockHash>,120 ) -> Result<Option<Collection<AccountId>>>;121 #[rpc(name = "unique_collectionStats")]122 fn collection_stats(&self, at: Option<BlockHash>) -> Result<CollectionStats>;123}124125pub struct Unique<C, P> {126 client: Arc<C>,127 _marker: std::marker::PhantomData<P>,128}129130impl<C, P> Unique<C, P> {131 pub fn new(client: Arc<C>) -> Self {132 Self {133 client,134 _marker: Default::default(),135 }136 }137}138139pub enum Error {140 RuntimeError,141}142143impl From<Error> for i64 {144 fn from(e: Error) -> i64 {145 match e {146 Error::RuntimeError => 1,147 }148 }149}150151macro_rules! pass_method {152 (153 $method_name:ident($($name:ident: $ty:ty),* $(,)?) -> $result:ty $(=> $mapper:expr)?154 $(; changed_in $ver:expr, $changed_method_name:ident ($($changed_name:expr), * $(,)?) => $fixer:expr)*155 ) => {156 fn $method_name(157 &self,158 $(159 $name: $ty,160 )*161 at: Option<<Block as BlockT>::Hash>,162 ) -> Result<$result> {163 let api = self.client.runtime_api();164 let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash));165 let _api_version = if let Ok(Some(api_version)) =166 api.api_version::<dyn UniqueRuntimeApi<Block, CrossAccountId, AccountId>>(&at)167 {168 api_version169 } else {170 // unreachable for our runtime171 return Err(RpcError {172 code: ErrorCode::InvalidParams,173 message: "Api is not available".into(),174 data: None,175 })176 };177178 let result = $(if _api_version < $ver {179 api.$changed_method_name(&at, $($changed_name),*).map(|r| r.map($fixer))180 } else)*181 { api.$method_name(&at, $($name),*) };182183 let result = result.map_err(|e| RpcError {184 code: ErrorCode::ServerError(Error::RuntimeError.into()),185 message: "Unable to query".into(),186 data: Some(format!("{:?}", e).into()),187 })?;188 result.map_err(|e| RpcError {189 code: ErrorCode::InvalidParams,190 message: "Runtime returned error".into(),191 data: Some(format!("{:?}", e).into()),192 })$(.map($mapper))?193 }194 };195}196197#[allow(deprecated)]198impl<C, Block, CrossAccountId, AccountId>199 UniqueApi<<Block as BlockT>::Hash, CrossAccountId, AccountId> for Unique<C, Block>200where201 Block: BlockT,202 AccountId: Decode,203 C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,204 C::Api: UniqueRuntimeApi<Block, CrossAccountId, AccountId>,205 CrossAccountId: pallet_common::account::CrossAccountId<AccountId>,206{207 pass_method!(account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId>);208 pass_method!(token_exists(collection: CollectionId, token: TokenId) -> bool);209 pass_method!(210 token_owner(collection: CollectionId, token: TokenId) -> Option<CrossAccountId>;211 changed_in 2, token_owner_before_version_2(collection, token) => |u| Some(u)212 );213 pass_method!(const_metadata(collection: CollectionId, token: TokenId) -> Vec<u8>);214 pass_method!(variable_metadata(collection: CollectionId, token: TokenId) -> Vec<u8>);215 pass_method!(collection_tokens(collection: CollectionId) -> u32);216 pass_method!(account_balance(collection: CollectionId, account: CrossAccountId) -> u32);217 pass_method!(balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> String => |v| v.to_string());218 pass_method!(allowance(collection: CollectionId, sender: CrossAccountId, spender: CrossAccountId, token: TokenId) -> String => |v| v.to_string());219220 pass_method!(adminlist(collection: CollectionId) -> Vec<CrossAccountId>);221 pass_method!(allowlist(collection: CollectionId) -> Vec<CrossAccountId>);222 pass_method!(allowed(collection: CollectionId, user: CrossAccountId) -> bool);223 pass_method!(last_token_id(collection: CollectionId) -> TokenId);224 pass_method!(collection_by_id(collection: CollectionId) -> Option<Collection<AccountId>>);225 pass_method!(collection_stats() -> CollectionStats);226}node/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;
pallets/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.
runtime/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;
tests/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");
tests/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!.
//
tests/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!.
//
tests/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;
tests/src/xcmTransfer.test.tsdiffbeforeafterboth--- a/tests/src/xcmTransfer.test.ts
+++ b/tests/src/xcmTransfer.test.ts
@@ -34,7 +34,7 @@
const KARURA_CHAIN = 2000;
const KARURA_PORT = '9946';
-describe('Integration test: Exchanging OPL with Karura', () => {
+describe('Integration test: Exchanging QTZ with Karura', () => {
let alice: IKeyringPair;
before(async () => {
@@ -60,8 +60,8 @@
const metadata =
{
- name: 'OPL',
- symbol: 'OPL',
+ name: 'QTZ',
+ symbol: 'QTZ',
decimals: 18,
minimalBalance: 1,
};
@@ -74,7 +74,7 @@
}, karuraApiOptions);
});
- it('Should connect and send OPL to Karura', async () => {
+ it('Should connect and send QTZ to Karura', async () => {
let balanceOnKaruraBefore: bigint;
await usingApi(async (api) => {
@@ -141,7 +141,7 @@
}, {provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT)});
});
- it('Should connect to Karura and send OPL back', async () => {
+ it('Should connect to Karura and send QTZ back', async () => {
let balanceBefore: bigint;
await usingApi(async (api) => {