-
Notifications
You must be signed in to change notification settings - Fork 683
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Trusted Query API calls (#6039)
Implemented is_trusted_reserve and is_trusted_teleporter API methods. Tested them with regular and chopstick tests. Fixes #97 --------- Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
- Loading branch information
1 parent
d23a1bb
commit 7240b47
Showing
19 changed files
with
424 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// This file is part of Polkadot. | ||
|
||
// Polkadot is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Polkadot is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//! Runtime API definition for checking if given <Asset, Location> is trusted reserve or teleporter. | ||
|
||
use codec::{Decode, Encode}; | ||
use frame_support::pallet_prelude::TypeInfo; | ||
use xcm::{VersionedAsset, VersionedLocation}; | ||
|
||
sp_api::decl_runtime_apis! { | ||
// API for querying trusted reserves and trusted teleporters. | ||
pub trait TrustedQueryApi { | ||
/// Returns if the location is a trusted reserve for the asset. | ||
/// | ||
/// # Arguments | ||
/// * `asset`: `VersionedAsset`. | ||
/// * `location`: `VersionedLocation`. | ||
fn is_trusted_reserve(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, Error>; | ||
/// Returns if the asset can be teleported to the location. | ||
/// | ||
/// # Arguments | ||
/// * `asset`: `VersionedAsset`. | ||
/// * `location`: `VersionedLocation`. | ||
fn is_trusted_teleporter(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, Error>; | ||
} | ||
} | ||
|
||
#[derive(Copy, Clone, Encode, Decode, Eq, PartialEq, Debug, TypeInfo)] | ||
pub enum Error { | ||
/// Converting a versioned Asset structure from one version to another failed. | ||
#[codec(index = 1)] | ||
VersionedAssetConversionFailed, | ||
/// Converting a versioned Location structure from one version to another failed. | ||
#[codec(index = 1)] | ||
VersionedLocationConversionFailed, | ||
} |
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
Oops, something went wrong.