difftreelog
Karura
in: master
3 files changed
README.mddiffbeforeafterboth333*/333*/334334335```335```336337338## Karura token transfer339340To get started, you need to open the hrmr channel.341Next, we need to register our asset in Karura.342343assetRegistry -> registerForeignAsset(location, metadata)344location:345 V0(X2(Parent, Parachain(PARA_ID))) 346metadata:347 name OPL348 symbol OPL349 decimals 15350minimalBalance 1351352Next, we can send tokens of our chain:353polkadotXcm -> reserveTransferAssets354dest:355 V0(X2(Parent, Parachain(KARURA_PARA_ID))) 356beneficiary:357 X1(AccountId(Any, ACCOUNT))358assets:359 V1(Concrete(0,Here), Fungible(AMOUNT))360feeAssetItem: 361 0 362weightLimit:363 Limit364 365366The result will be displayed in ChainState 367tokens -> accounts 336368launch-config.jsondiffbeforeafterboth9 "rpcPort": 9843,9 "rpcPort": 9843,10 "port": 30444,10 "port": 30444,11 "flags": [11 "flags": [12 "-lparachain::candidate_validation=debug"12 "-lparachain::candidate_validation=debug",13 "-lxcm=trace"13 ]14 ]14 },15 },15 {16 {18 "rpcPort": 9854,19 "rpcPort": 9854,19 "port": 30555,20 "port": 30555,20 "flags": [21 "flags": [21 "-lparachain::candidate_validation=debug"22 "-lparachain::candidate_validation=debug",23 "-lxcm=trace"22 ]24 ]23 },25 },24 {26 {67 "flags": [69 "flags": [68 "--rpc-cors=all",70 "--rpc-cors=all",69 "--unsafe-rpc-external",71 "--unsafe-rpc-external",70 "--unsafe-ws-external"72 "--unsafe-ws-external",73 "-lxcm=trace"71 ]74 ]72 },75 },73 {76 {78 "flags": [81 "flags": [79 "--rpc-cors=all",82 "--rpc-cors=all",80 "--unsafe-rpc-external",83 "--unsafe-rpc-external",81 "--unsafe-ws-external"84 "--unsafe-ws-external",85 "-lxcm=trace"82 ]86 ]83 }87 }84 ]88 ]85 }89 },90 {91 "bin": "../Acala/target/release/acala",92 "id": "2000",93 "chain": "karura-dev",94 "balance": "1000000000000000000000",95 "nodes": [96 {97 "wsPort": 9988,98 "port": 31200,99 "name": "alice",100 "flags": [101 "--rpc-cors=all",102 "--unsafe-rpc-external",103 "--unsafe-ws-external",104 "-lxcm=trace"105 ]106 }107 ]108 }86 ],109 ],87 "simpleParachains": [],110 "simpleParachains": [],88 "hrmpChannels": [],111 "hrmpChannels": [112 {113 "sender": 2000,114 "recipient": 1000,115 "maxCapacity": 8,116 "maxMessageSize": 512117 },118 {119 "sender": 1000,120 "recipient": 2000,121 "maxCapacity": 8,122 "maxMessageSize": 512123 }124 ],89 "finalization": false125 "finalization": false90}126}runtime/src/lib.rsdiffbeforeafterboth82use 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};9192use xcm::latest::{93// Xcm, 94 AssetId::{Concrete},95 Fungibility::Fungible as XcmFungible,96 MultiAsset97};98use xcm_executor::traits::MatchesFungible;99use sp_runtime::traits::CheckedConversion;9110092// mod chain_extension;101// mod chain_extension;93// use crate::chain_extension::{NFTExtension, Imbalance};102// use crate::chain_extension::{NFTExtension, Imbalance};617);626);627628629pub 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}618639619/// 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):