git.delta.rocks / unique-network / refs/commits / 52f3d47930d0

difftreelog

build merge from develop

Yaroslav Bolyukin2023-06-01parents: #ca8bb41 #ac58597.patch.diff
in: master

7 files changed

modified.docker/Dockerfile-xcm.j2diffbeforeafterboth
--- a/.docker/Dockerfile-xcm.j2
+++ b/.docker/Dockerfile-xcm.j2
@@ -58,7 +58,7 @@
 COPY --from=uniquenetwork/builder-polkadot:{{ POLKADOT_BUILD_BRANCH }} /unique_parachain/polkadot/target/release/polkadot /polkadot/target/release/
 COPY --from=uniquenetwork/builder-moonbeam:{{ MOONBEAM_BUILD_BRANCH }} /unique_parachain/moonbeam/target/release/moonbeam /moonbeam/target/release/
 COPY --from=uniquenetwork/builder-cumulus:{{ CUMULUS_BUILD_BRANCH }} /unique_parachain/cumulus/target/release/polkadot-parachain /cumulus/target/release/cumulus
-COPY --from=uniquenetwork/builder-acala:{{ ACALA_BUILD_BRANCH }} /unique_parachain/Acala/target/production/acala /acala/target/release/
+COPY --from=uniquenetwork/builder-acala:{{ ACALA_BUILD_BRANCH }} /unique_parachain/acala/target/production/acala /acala/target/release/
 COPY --from=uniquenetwork/builder-astar:{{ ASTAR_BUILD_BRANCH }} /unique_parachain/astar/target/release/astar /astar/target/release/
 COPY --from=uniquenetwork/builder-chainql:{{ CHAINQL }} /chainql/target/release/chainql /chainql/target/release/
 
modified.envdiffbeforeafterboth
--- a/.env
+++ b/.env
@@ -5,25 +5,25 @@
 
 POLKADOT_MAINNET_BRANCH=release-v0.9.37
 STATEMINT_BUILD_BRANCH=release-parachains-v9370
-ACALA_BUILD_BRANCH=2.12.0
-MOONBEAM_BUILD_BRANCH=runtime-2201
-ASTAR_BUILD_BRANCH=v5.3.0
-UNIQUE_MAINNET_BRANCH=release-v937053
+ACALA_BUILD_BRANCH=2.17.0
+MOONBEAM_BUILD_BRANCH=runtime-2302
+ASTAR_BUILD_BRANCH=v5.4.0
+UNIQUE_MAINNET_BRANCH=release-v941055
 UNIQUE_REPLICA_FROM=wss://ws.unique.network:443
 
 KUSAMA_MAINNET_BRANCH=release-v0.9.38
 STATEMINE_BUILD_BRANCH=release-parachains-v9382
-KARURA_BUILD_BRANCH=release-karura-2.15.0
-MOONRIVER_BUILD_BRANCH=runtime-2201
-SHIDEN_BUILD_BRANCH=v4.49.0
-QUARTZ_MAINNET_BRANCH=release-v937053
+KARURA_BUILD_BRANCH=release-karura-2.17.0
+MOONRIVER_BUILD_BRANCH=runtime-2302
+SHIDEN_BUILD_BRANCH=v5.4.0
+QUARTZ_MAINNET_BRANCH=release-v941055
 QUARTZ_REPLICA_FROM=wss://ws-quartz.unique.network:443
 
-UNIQUEWEST_MAINNET_BRANCH=release-v0.9.40
-WESTMINT_BUILD_BRANCH=parachains-v9400
-OPAL_MAINNET_BRANCH=release-v937053
+UNIQUEWEST_MAINNET_BRANCH=release-v0.9.42
+WESTMINT_BUILD_BRANCH=parachains-v9420
+OPAL_MAINNET_BRANCH=release-v941055
 OPAL_REPLICA_FROM=wss://ws-opal.unique.network:443
 
-UNIQUEEAST_MAINNET_BRANCH=release-v0.9.32
-SAPPHIRE_MAINNET_BRANCH=release-v937053
+UNIQUEEAST_MAINNET_BRANCH=release-v0.9.42
+SAPPHIRE_MAINNET_BRANCH=release-v941055
 SAPPHIRE_REPLICA_FROM=wss://ws-sapphire.unique.network:443
modifiedREADME.mddiffbeforeafterboth
before · README.md
1# Unique Parachain23## Project Description45The Unique Pallet is the core of NFT functionality. Like ERC-721 standard in Ethereum ecosystem, this pallet provides the6basement for creating collections of unique non-divisible things, also called Non Fungible Tokens (NFTs), minting NFT of7a given Collection, and managing their ownership.89The pallet also enables storing NFT properties. Though (according to ERC-721) NFT properties belong to logic of a10concrete application that operates a Collection, so purposefully the NFT Tracking Module does not have any knowledge11about properties except their byte size leaving application logic out to be controlled by Smart Contracts.1213The Unique Chain also provides:1415-   Smart Contracts Pallet and example smart contract that interacts with Unique Runtime16-   ERC-1155 Functionality (currently PoC as Re-Fungible tokens, i.e. items that are still unique, but that can be split17    between multiple users)18-   Variety of economic options for dapp producers to choose from to create freemium games and other ways to attract19    users. As a step one, we implemented an economic model when a collection sponsor can be set to pay for collection20    Transfer transactions.2122Wider Unique Ecosystem (most of it was developed during Hackusama):2324-   [SubstraPunks Game hosted on IPFS](https://github.com/UniqueNetwork/substrapunks)25-   [Unique Wallet and UI](https://wallet.unique.network)26-   [NFT Asset for Unity Framework](https://github.com/usetech-llc/nft_unity)2728Please see our [walk-through instructions](doc/hackusama_walk_through.md) to try everything out!2930## Application Development3132If you are building an application that operates NFT tokens, use [this document](doc/application_development.md).333435## Building3637Building Unique chain requires special versions of Rust and toolchain. We don't use the most recent versions of everything38so that we can keep the builds stable.39401. Install Rust:4142```bash43sudo apt-get install git curl libssl-dev llvm pkg-config libclang-dev clang make cmake protobuf-compiler44curl https://sh.rustup.rs -sSf | sh45```46472. Remove all installed toolchains with `rustup toolchain list` and `rustup toolchain uninstall <toolchain>`.48493. Install toolchain nightly-2022-11-15 and make it default:5051```bash52rustup toolchain install nightly-2022-11-1553rustup default nightly-2022-11-1554```55564. Add wasm target for nightly toolchain:5758```bash59rustup target add wasm32-unknown-unknown --toolchain nightly-2022-11-1560```61625. Build:6364Opal65```bash66cargo build --release67```68Quartz69```bash70cargo build --features=quartz-runtime --release71```72Unique73```bash74cargo build --features=unique-runtime --release75```7677## Building as Parachain locally7879Note: checkout this project and all related projects (see below) in the sibling folders (both under the same folder)8081### Polkadot launch utility8283```84git clone https://github.com/UniqueNetwork/polkadot-launch.git85git checkout unique-network86```8788### Build relay8990```91git clone https://github.com/paritytech/polkadot.git92cd polkadot93git checkout release-v0.9.3994cargo build --release95```9697### Build Unique parachain9899Run in the root of this project:100```101cargo build --release102```103104### Build Acala parachain (optional, full config only)105106```107git clone https://github.com/AcalaNetwork/Acala108cd Acala109git checkout 54db3acd409a0b787f116f20e163a3b24101ce38110make build-release111```112113## Running as Parachain locally114115```116./launch-testnet.sh117```118119Optional, full setup with Acala and Statemint120```121./launch-testnet-full.sh122```123124## Run Integration Tests1251261. Install all needed dependecies127```128cd tests129yarn install130```1311322. Run tests133```134yarn test135```136137138## Code Formatting139140### Apply formatting and clippy fixes141```bash142cargo clippy143cargo fmt144```145146### Format tests147```bash148pushd tests && yarn fix ; popd149```150151### Check code style in tests152```bash153cd tests && yarn eslint --ext .ts,.js src/154```155156157## Karura token transfer158159To get started, you need to open inbound and outbound hrmp channels.160161### Next, we need to register our asset at Karura.162```163assetRegistry -> registerForeignAsset(location, metadata)164location:165	V0(X2(Parent, Parachain(PARA_ID)))166metadata:167	name         QTZ168	symbol       QTZ169	decimals     18170minimalBalance	 1171```172173### Next, we can send tokens from Quartz to Karura:174```175polkadotXcm -> reserveTransferAssets176dest:177	V0(X2(Parent, Parachain(<KARURA_PARA_ID>)))178beneficiary:179	X1(AccountId(Any, <ACCOUNT>))180assets:181	V1(Concrete(0,Here), Fungible(<AMOUNT>))182feeAssetItem:183	0184weightLimit:185	<LIMIT>186```187188The result will be displayed in ChainState189tokens -> accounts190191### To send tokens from Karura to Quartz:192```193xtokens -> transfer194195currencyId:196	ForeignAsset197		<TOKEN_ID>198199amount:200		<AMOUNT>201dest:202	V1203	(204		Parents:1,205		X2(Parachain(<KARURA_PARA_ID>), AccountId(Any, <ACCOUNT>)206	)207destWeight:208	<WEIGHT>209```
modifiedtests/package.jsondiffbeforeafterboth
--- a/tests/package.json
+++ b/tests/package.json
@@ -118,7 +118,8 @@
     "polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9933 > src/interfaces/metadata.json",
     "polkadot-types-from-defs": "ts-node --esm ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .",
     "polkadot-types-from-chain": "ts-node --esm ./node_modules/.bin/polkadot-types-from-chain --endpoint src/interfaces/metadata.json --output src/interfaces/ --package .",
-    "polkadot-types": "echo \"export default {}\" > src/interfaces/lookup.ts && yarn polkadot-types-fetch-metadata && yarn polkadot-types-from-defs && yarn polkadot-types-from-defs && yarn polkadot-types-from-chain"
+    "polkadot-types": "echo \"export default {}\" > src/interfaces/lookup.ts && yarn polkadot-types-fetch-metadata && yarn polkadot-types-from-defs && yarn polkadot-types-from-defs && yarn polkadot-types-from-chain",
+    "generateEnv": "ts-node --esm ./src/generateEnv.ts"
   },
   "author": "",
   "license": "SEE LICENSE IN ../LICENSE",
modifiedtests/src/generateEnv.tsdiffbeforeafterboth
--- a/tests/src/generateEnv.ts
+++ b/tests/src/generateEnv.ts
@@ -62,12 +62,14 @@
     ff('wss://rpc.astar.network/', /^(.+)$/, (_, r) => {
       switch (r) {
         case '55': return 'v5.3.0';
+        case '57': return 'v5.4.0';
         default: throw new Error('unknown astar branch for runtime ' + r);
       }
     }).then(v => env = setVar(env, 'ASTAR_BUILD_BRANCH', v)),
     ff('wss://shiden.api.onfinality.io/public-ws', /^(.+)$/, (_, r) => {
       switch (r) {
         case '90': return 'v4.49.0';
+        case '96': return 'v5.4.0';
         default: throw new Error('unknown shiden branch for runtime ' + r);
       }
     }).then(v => env = setVar(env, 'SHIDEN_BUILD_BRANCH', v)),
modifiedtests/src/xcm/xcmQuartz.test.tsdiffbeforeafterboth
--- a/tests/src/xcm/xcmQuartz.test.ts
+++ b/tests/src/xcm/xcmQuartz.test.ts
@@ -797,6 +797,7 @@
   let quartzParachainMultilocation: any;
   let quartzAccountMultilocation: any;
   let quartzCombinedMultilocation: any;
+  let quartzCombinedMultilocationKarura: any; // TODO remove it when Karura goes V2
 
   let messageSent: any;
 
@@ -815,7 +816,7 @@
       };
 
       quartzParachainMultilocation = {
-        V1: {
+        V2: {
           parents: 1,
           interior: {
             X1: quartzParachainJunction,
@@ -824,7 +825,7 @@
       };
 
       quartzAccountMultilocation = {
-        V1: {
+        V2: {
           parents: 0,
           interior: {
             X1: quartzAccountJunction,
@@ -833,6 +834,15 @@
       };
 
       quartzCombinedMultilocation = {
+        V2: {
+          parents: 1,
+          interior: {
+            X2: [quartzParachainJunction, quartzAccountJunction],
+          },
+        },
+      };
+
+      quartzCombinedMultilocationKarura = {
         V1: {
           parents: 1,
           interior: {
@@ -861,7 +871,7 @@
       const id = {
         Token: 'KAR',
       };
-      const destination = quartzCombinedMultilocation;
+      const destination = quartzCombinedMultilocationKarura;
       await helper.xTokens.transfer(alice, id, testAmount, destination, 'Unlimited');
 
       messageSent = await helper.wait.expectEvent(maxWaitBlocks, Event.XcmpQueue.XcmpMessageSent);
@@ -887,7 +897,7 @@
       const destinationParachain = quartzParachainMultilocation;
       const beneficiary = quartzAccountMultilocation;
       const assets = {
-        V1: [{
+        V2: [{
           id: {
             Concrete: {
               parents: 0,
@@ -1061,7 +1071,7 @@
   itSub('Should connect to Moonriver and send QTZ back', async ({helper}) => {
     await usingMoonriverPlaygrounds(moonriverUrl, async (helper) => {
       const asset = {
-        V1: {
+        V2: {
           id: {
             Concrete: {
               parents: 1,
@@ -1076,7 +1086,7 @@
         },
       };
       const destination = {
-        V1: {
+        V2: {
           parents: 1,
           interior: {
             X2: [
@@ -1131,7 +1141,7 @@
     const [targetAccount] = await helper.arrange.createAccounts([targetAccountBalance], alice);
 
     const quartzMultilocation = {
-      V1: {
+      V2: {
         parents: 1,
         interior: {
           X1: {Parachain: QUARTZ_CHAIN},
@@ -1202,7 +1212,7 @@
     const [targetAccount] = await helper.arrange.createAccounts([0n], alice);
 
     const quartzMultilocation = {
-      V1: {
+      V2: {
         parents: 1,
         interior: {
           X1: {
@@ -1327,7 +1337,7 @@
 
       console.log('2. Register asset location on Shiden');
       const assetLocation = {
-        V1: {
+        V2: {
           parents: 1,
           interior: {
             X1: {
@@ -1419,7 +1429,7 @@
   itSub('Should connect to Shiden and send QTZ back', async ({helper}) => {
     await usingShidenPlaygrounds(shidenUrl, async (helper) => {
       const destination = {
-        V1: {
+        V2: {
           parents: 1,
           interior: {
             X1: {
@@ -1430,7 +1440,7 @@
       };
 
       const beneficiary = {
-        V1: {
+        V2: {
           parents: 0,
           interior: {
             X1: {
@@ -1444,7 +1454,7 @@
       };
 
       const assets = {
-        V1: [
+        V2: [
           {
             id: {
               Concrete: {
@@ -1501,7 +1511,7 @@
     const [targetAccount] = await helper.arrange.createAccounts([targetAccountBalance], alice);
 
     const quartzMultilocation = {
-      V1: {
+      V2: {
         parents: 1,
         interior: {
           X1: {Parachain: QUARTZ_CHAIN},
@@ -1564,7 +1574,7 @@
     const [targetAccount] = await helper.arrange.createAccounts([0n], alice);
 
     const quartzMultilocation = {
-      V1: {
+      V2: {
         parents: 1,
         interior: {
           X1: {
modifiedtests/src/xcm/xcmUnique.test.tsdiffbeforeafterboth
--- a/tests/src/xcm/xcmUnique.test.ts
+++ b/tests/src/xcm/xcmUnique.test.ts
@@ -799,6 +799,7 @@
   let uniqueParachainMultilocation: any;
   let uniqueAccountMultilocation: any;
   let uniqueCombinedMultilocation: any;
+  let uniqueCombinedMultilocationAcala: any; // TODO remove when Acala goes V2
 
   let messageSent: any;
 
@@ -817,7 +818,7 @@
       };
 
       uniqueParachainMultilocation = {
-        V1: {
+        V2: {
           parents: 1,
           interior: {
             X1: uniqueParachainJunction,
@@ -826,7 +827,7 @@
       };
 
       uniqueAccountMultilocation = {
-        V1: {
+        V2: {
           parents: 0,
           interior: {
             X1: uniqueAccountJunction,
@@ -835,6 +836,15 @@
       };
 
       uniqueCombinedMultilocation = {
+        V2: {
+          parents: 1,
+          interior: {
+            X2: [uniqueParachainJunction, uniqueAccountJunction],
+          },
+        },
+      };
+
+      uniqueCombinedMultilocationAcala = {
         V1: {
           parents: 1,
           interior: {
@@ -863,7 +873,7 @@
       const id = {
         Token: 'ACA',
       };
-      const destination = uniqueCombinedMultilocation;
+      const destination = uniqueCombinedMultilocationAcala;
       await helper.xTokens.transfer(alice, id, testAmount, destination, 'Unlimited');
 
       messageSent = await helper.wait.expectEvent(maxWaitBlocks, Event.XcmpQueue.XcmpMessageSent);
@@ -889,7 +899,7 @@
       const destinationParachain = uniqueParachainMultilocation;
       const beneficiary = uniqueAccountMultilocation;
       const assets = {
-        V1: [{
+        V2: [{
           id: {
             Concrete: {
               parents: 0,
@@ -1064,7 +1074,7 @@
   itSub('Should connect to Moonbeam and send UNQ back', async ({helper}) => {
     await usingMoonbeamPlaygrounds(moonbeamUrl, async (helper) => {
       const asset = {
-        V1: {
+        V2: {
           id: {
             Concrete: {
               parents: 1,
@@ -1079,7 +1089,7 @@
         },
       };
       const destination = {
-        V1: {
+        V2: {
           parents: 1,
           interior: {
             X2: [
@@ -1134,7 +1144,7 @@
     const [targetAccount] = await helper.arrange.createAccounts([targetAccountBalance], alice);
 
     const uniqueMultilocation = {
-      V1: {
+      V2: {
         parents: 1,
         interior: {
           X1: {Parachain: UNIQUE_CHAIN},
@@ -1205,7 +1215,7 @@
     const [targetAccount] = await helper.arrange.createAccounts([0n], alice);
 
     const uniqueMultilocation = {
-      V1: {
+      V2: {
         parents: 1,
         interior: {
           X1: {
@@ -1330,7 +1340,7 @@
 
       console.log('2. Register asset location on Astar');
       const assetLocation = {
-        V1: {
+        V2: {
           parents: 1,
           interior: {
             X1: {
@@ -1422,7 +1432,7 @@
   itSub('Should connect to Astar and send UNQ back', async ({helper}) => {
     await usingAstarPlaygrounds(astarUrl, async (helper) => {
       const destination = {
-        V1: {
+        V2: {
           parents: 1,
           interior: {
             X1: {
@@ -1433,7 +1443,7 @@
       };
 
       const beneficiary = {
-        V1: {
+        V2: {
           parents: 0,
           interior: {
             X1: {
@@ -1447,7 +1457,7 @@
       };
 
       const assets = {
-        V1: [
+        V2: [
           {
             id: {
               Concrete: {
@@ -1503,7 +1513,7 @@
     const [targetAccount] = await helper.arrange.createAccounts([targetAccountBalance], alice);
 
     const uniqueMultilocation = {
-      V1: {
+      V2: {
         parents: 1,
         interior: {
           X1: {Parachain: UNIQUE_CHAIN},
@@ -1566,7 +1576,7 @@
     const [targetAccount] = await helper.arrange.createAccounts([0n], alice);
 
     const uniqueMultilocation = {
-      V1: {
+      V2: {
         parents: 1,
         interior: {
           X1: {
@@ -1632,5 +1642,4 @@
     accountBalance = await helper.balance.getSubstrate(targetAccount.address);
     expect(accountBalance).to.be.equal(0n);
   });
-
 });