-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initially adding paseo-local and zombienet cfg * revert bogus sdk upgrade * adapt zombienet config * try 4th validator * zombienet paseo works * psvn bump 1.9.0 * remove all orml stuff. maybe temporary * XCMv4 shizzle * overwritten node from template. xcm fixes * builds * cargo fix * fmt * zombienet cfg which produces blocks incl asset hub. but needs fixing spec * bump versions
- Loading branch information
Showing
20 changed files
with
1,858 additions
and
1,552 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
name = "integritee-collator" | ||
description = "The Integritee parachain collator binary" | ||
# align major.minor revision with the runtimes. bump patch revision ad lib. make this the github release tag | ||
version = "1.9.4" | ||
version = "1.9.5" | ||
authors = ["Integritee AG <[email protected]>"] | ||
homepage = "https://integritee.network/" | ||
repository = "https://github.com/integritee-network/parachain" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,85 @@ | ||
use core::marker::PhantomData; | ||
use frame_support::traits::ContainsPair; | ||
use sp_runtime::traits::{CheckedConversion, Convert}; | ||
use staging_xcm::{ | ||
latest::{Asset, AssetId, Junction, Location}, | ||
prelude::{Fungible, Parachain}, | ||
}; | ||
use staging_xcm_executor::traits::MatchesFungible; | ||
|
||
/// Type alias to conveniently refer to `frame_system`'s `Config::AccountId`. | ||
pub type AccountIdOf<R> = <R as frame_system::Config>::AccountId; | ||
|
||
// ORML remainders | ||
pub trait Reserve { | ||
/// Returns assets reserve location. | ||
fn reserve(asset: &Asset) -> Option<Location>; | ||
} | ||
|
||
// Provide reserve in relative path view | ||
// Self tokens are represeneted as Here | ||
pub struct RelativeReserveProvider; | ||
|
||
impl Reserve for RelativeReserveProvider { | ||
fn reserve(asset: &Asset) -> Option<Location> { | ||
let AssetId(location) = &asset.id; | ||
if location.parents == 0 && !is_chain_junction(location.first_interior()) { | ||
Some(Location::here()) | ||
} else { | ||
chain_part(location) | ||
} | ||
} | ||
} | ||
/// A `ContainsPair` implementation. Filters multi native assets whose | ||
/// reserve is same with `origin`. | ||
pub struct MultiNativeAsset<ReserveProvider>(PhantomData<ReserveProvider>); | ||
impl<ReserveProvider> ContainsPair<Asset, Location> for MultiNativeAsset<ReserveProvider> | ||
where | ||
ReserveProvider: Reserve, | ||
{ | ||
fn contains(asset: &Asset, origin: &Location) -> bool { | ||
if let Some(ref reserve) = ReserveProvider::reserve(asset) { | ||
if reserve == origin { | ||
return true; | ||
} | ||
} | ||
false | ||
} | ||
} | ||
|
||
/// A `MatchesFungible` implementation. It matches concrete fungible assets | ||
/// whose `id` could be converted into `CurrencyId`. | ||
pub struct IsNativeConcrete<CurrencyId, CurrencyIdConvert>( | ||
PhantomData<(CurrencyId, CurrencyIdConvert)>, | ||
); | ||
impl<CurrencyId, CurrencyIdConvert, Amount> MatchesFungible<Amount> | ||
for IsNativeConcrete<CurrencyId, CurrencyIdConvert> | ||
where | ||
CurrencyIdConvert: Convert<Location, Option<CurrencyId>>, | ||
Amount: TryFrom<u128>, | ||
{ | ||
fn matches_fungible(a: &Asset) -> Option<Amount> { | ||
if let (Fungible(ref amount), AssetId(location)) = (&a.fun, &a.id) { | ||
if CurrencyIdConvert::convert(location.clone()).is_some() { | ||
return CheckedConversion::checked_from(*amount); | ||
} | ||
} | ||
None | ||
} | ||
} | ||
|
||
fn is_chain_junction(junction: Option<&Junction>) -> bool { | ||
matches!(junction, Some(Parachain(_))) | ||
} | ||
|
||
fn chain_part(loc: &Location) -> Option<Location> { | ||
match (loc.parents, loc.first_interior()) { | ||
// sibling parachain | ||
(1, Some(Parachain(id))) => Some(Location::new(1, [Parachain(*id)])), | ||
// parent | ||
(1, _) => Some(Location::parent()), | ||
// children parachain | ||
(0, Some(Parachain(id))) => Some(Location::new(0, [Parachain(*id)])), | ||
_ => None, | ||
} | ||
} |
Oops, something went wrong.