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

difftreelog

Karura

str-mv2022-01-17parent: #de5ac2f.patch.diff
in: master

3 files changed

modifiedREADME.mddiffbeforeafterboth
--- a/README.md
+++ b/README.md
@@ -333,3 +333,35 @@
 */
 
 ```
+
+
+## Karura token transfer
+
+To get started, you need to open the hrmr channel.
+Next, we need to register our asset in Karura.
+
+assetRegistry -> registerForeignAsset(location, metadata)
+location:
+	V0(X2(Parent, Parachain(PARA_ID))) 
+metadata:
+	name         OPL
+	symbol       OPL
+	decimals     15
+minimalBalance	 1
+
+Next, we can send tokens of our chain:
+polkadotXcm -> reserveTransferAssets
+dest:
+	V0(X2(Parent, Parachain(KARURA_PARA_ID))) 
+beneficiary:
+	X1(AccountId(Any, ACCOUNT))
+assets:
+	V1(Concrete(0,Here), Fungible(AMOUNT))
+feeAssetItem: 
+	0	
+weightLimit:
+	Limit
+	
+
+The result will be displayed in ChainState   
+tokens -> accounts	
modifiedlaunch-config.jsondiffbeforeafterboth
--- a/launch-config.json
+++ b/launch-config.json
@@ -9,7 +9,8 @@
                 "rpcPort": 9843,
                 "port": 30444,
                 "flags": [
-                    "-lparachain::candidate_validation=debug"
+                    "-lparachain::candidate_validation=debug",
+                    "-lxcm=trace"
                 ]
             },
             {
@@ -18,7 +19,8 @@
                 "rpcPort": 9854,
                 "port": 30555,
                 "flags": [
-                    "-lparachain::candidate_validation=debug"
+                    "-lparachain::candidate_validation=debug",
+                    "-lxcm=trace"
                 ]
             },
             {
@@ -67,7 +69,8 @@
                     "flags": [
                         "--rpc-cors=all",
                         "--unsafe-rpc-external",
-                        "--unsafe-ws-external"
+                        "--unsafe-ws-external",
+                        "-lxcm=trace"
                     ]
                 },
                 {
@@ -78,13 +81,46 @@
                     "flags": [
                         "--rpc-cors=all",
                         "--unsafe-rpc-external",
-                        "--unsafe-ws-external"
+                        "--unsafe-ws-external",
+                        "-lxcm=trace"
                     ]
                 }
             ]
+        },
+        {
+            "bin": "../Acala/target/release/acala",
+            "id": "2000",
+            "chain":  "karura-dev",
+			"balance": "1000000000000000000000",
+			"nodes": [
+				{
+					"wsPort": 9988,
+					"port": 31200,
+					"name": "alice",
+                    "flags": [
+                        "--rpc-cors=all",
+                        "--unsafe-rpc-external",
+                        "--unsafe-ws-external",
+                        "-lxcm=trace"
+                    ]
+				}
+			]
+		}
+    ],
+    "simpleParachains": [],
+    "hrmpChannels": [
+        {
+            "sender": 2000,
+            "recipient": 1000,
+            "maxCapacity": 8,
+            "maxMessageSize": 512
+        },
+        {
+            "sender": 1000,
+            "recipient": 2000,
+            "maxCapacity": 8,
+            "maxMessageSize": 512
         }
     ],
-    "simpleParachains": [],
-    "hrmpChannels": [],
     "finalization": false
 }
modifiedruntime/src/lib.rsdiffbeforeafterboth
82use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};82use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};
83use xcm_builder::{83use xcm_builder::{
84 AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,84 AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
85 EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset,85 EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset,
86 ParentAsSuperuser, ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative,86 ParentAsSuperuser, ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative,
87 SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,87 SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
88 SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,88 SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
89};89};
90use xcm_executor::{Config, XcmExecutor};90use xcm_executor::{Config, XcmExecutor};
91
92use xcm::latest::{
93// Xcm,
94 AssetId::{Concrete},
95 Fungibility::Fungible as XcmFungible,
96 MultiAsset
97};
98use xcm_executor::traits::MatchesFungible;
99use sp_runtime::traits::CheckedConversion;
91100
92// mod chain_extension;101// mod chain_extension;
93// use crate::chain_extension::{NFTExtension, Imbalance};102// use crate::chain_extension::{NFTExtension, Imbalance};
617);626);
627
628
629pub struct OnlySelfCurrency;
630impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {
631 fn matches_fungible(a: &MultiAsset) -> Option<B> {
632 match (&a.id, &a.fun) {
633 (Concrete(_), XcmFungible(ref amount)) =>
634 CheckedConversion::checked_from(*amount),
635 _ => None,
636 }
637 }
638}
618639
619/// Means for transacting assets on this chain.640/// Means for transacting assets on this chain.
620pub type LocalAssetTransactor = CurrencyAdapter<641pub type LocalAssetTransactor = CurrencyAdapter<
621 // Use this currency:642 // Use this currency:
622 Balances,643 Balances,
623 // Use this currency when it is a fungible asset matching the given location or name:644 // Use this currency when it is a fungible asset matching the given location or name:
624 IsConcrete<RelayLocation>,645 OnlySelfCurrency,
625 // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:646 // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:
626 LocationToAccountId,647 LocationToAccountId,
627 // Our chain's account ID type (we can't get away without mentioning it explicitly):648 // Our chain's account ID type (we can't get away without mentioning it explicitly):