token_gateway_primitives/
lib.rs1#![doc = include_str!("../README.md")]
17#![cfg_attr(not(feature = "std"), no_std)]
18
19use alloy_primitives::hex;
20use ismp::host::StateMachine;
21use polkadot_sdk::*;
22use sp_core::{ConstU32, H160, H256};
23use sp_runtime::BoundedVec;
24
25extern crate alloc;
26use alloc::vec::Vec;
27use codec::{Decode, DecodeWithMemTracking, Encode};
28
29pub const TOKEN_GOVERNOR_ID: [u8; 8] = *b"registry";
31
32pub const PALLET_TOKEN_GATEWAY_ID: [u8; 20] = hex!("a09b1c60e8650245f92518c8a17314878c4043ed");
36
37#[derive(
39 Debug,
40 Clone,
41 Encode,
42 Decode,
43 DecodeWithMemTracking,
44 scale_info::TypeInfo,
45 PartialEq,
46 Eq,
47 Default,
48)]
49pub struct AssetMetadata {
50 pub name: BoundedVec<u8, ConstU32<50>>,
52 pub symbol: BoundedVec<u8, ConstU32<20>>,
54}
55
56#[derive(
58 Debug,
59 Clone,
60 Encode,
61 Decode,
62 DecodeWithMemTracking,
63 scale_info::TypeInfo,
64 PartialEq,
65 Eq,
66 Default,
67)]
68pub struct DeregisterAssets {
69 pub asset_ids: Vec<H256>,
71}
72
73#[derive(
75 Debug, Clone, Encode, Decode, DecodeWithMemTracking, scale_info::TypeInfo, PartialEq, Eq,
76)]
77pub struct GatewayAssetRegistration {
78 pub name: BoundedVec<u8, ConstU32<50>>,
80 pub symbol: BoundedVec<u8, ConstU32<20>>,
82 pub chains: Vec<StateMachine>,
84 pub minimum_balance: Option<u128>,
86}
87
88#[derive(
90 Debug,
91 Clone,
92 Encode,
93 Decode,
94 DecodeWithMemTracking,
95 scale_info::TypeInfo,
96 PartialEq,
97 Eq,
98 Default,
99)]
100pub struct GatewayAssetUpdate {
101 pub asset_id: H256,
103 pub add_chains: BoundedVec<StateMachine, ConstU32<100>>,
105 pub remove_chains: BoundedVec<StateMachine, ConstU32<100>>,
107 pub new_admins: BoundedVec<(StateMachine, H160), ConstU32<100>>,
109}
110
111#[derive(
113 Debug, Clone, Encode, Decode, DecodeWithMemTracking, scale_info::TypeInfo, PartialEq, Eq,
114)]
115pub enum RemoteERC6160AssetRegistration {
116 CreateAsset(GatewayAssetRegistration),
118 UpdateAsset(GatewayAssetUpdate),
120}