-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
165 additions
and
16 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,18 @@ | ||
use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; | ||
use scale_info::TypeInfo; | ||
|
||
#[derive( | ||
Clone, | ||
Copy, | ||
Default, | ||
PartialOrd, | ||
Ord, | ||
PartialEq, | ||
Eq, | ||
Debug, | ||
Encode, | ||
Decode, | ||
TypeInfo, | ||
MaxEncodedLen, | ||
)] | ||
pub struct CustomMetadata; |
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,30 @@ | ||
use crate::{AssetId, Runtime}; | ||
use orml_asset_registry::DefaultAssetMetadata; | ||
use orml_traits::asset_registry::AssetProcessor; | ||
use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; | ||
use scale_info::TypeInfo; | ||
use sp_runtime::DispatchError; | ||
|
||
#[derive( | ||
Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Debug, Encode, Decode, TypeInfo, MaxEncodedLen, | ||
)] | ||
pub struct CustomAssetProcessor; | ||
|
||
impl AssetProcessor<AssetId, DefaultAssetMetadata<Runtime>> for CustomAssetProcessor { | ||
fn pre_register( | ||
id: Option<AssetId>, | ||
metadata: DefaultAssetMetadata<Runtime>, | ||
) -> Result<(AssetId, DefaultAssetMetadata<Runtime>), DispatchError> { | ||
match id { | ||
Some(id) => Ok((id, metadata)), | ||
None => Err(DispatchError::Other("asset-registry: AssetId is required")), | ||
} | ||
} | ||
|
||
fn post_register( | ||
_id: AssetId, | ||
_metadata: DefaultAssetMetadata<Runtime>, | ||
) -> Result<(), DispatchError> { | ||
Ok(()) | ||
} | ||
} |
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