ghost-node/pallets/traits/src/networks.rs
Uncle Stretch 66719626bb
inital commit, which is clearly not initial
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2024-10-03 15:38:52 +03:00

30 lines
804 B
Rust
Executable File

use frame_support::{
pallet_prelude::*,
storage::PrefixIterator,
};
use sp_runtime::{
DispatchResult,
traits::{AtLeast32BitUnsigned, Member},
};
pub trait NetworkDataBasicHandler {
type NetworkId: Parameter
+ Member
+ AtLeast32BitUnsigned
+ Default
+ Copy
+ TypeInfo
+ MaybeSerializeDeserialize
+ MaxEncodedLen;
}
pub trait NetworkDataInspectHandler<Network>: NetworkDataBasicHandler {
fn get(n: &Self::NetworkId) -> Option<Network>;
fn iter() -> PrefixIterator<(Self::NetworkId, Network)>;
}
pub trait NetworkDataMutateHandler<Network>: NetworkDataInspectHandler<Network> {
fn register(chain_id: Self::NetworkId, network: Network) -> DispatchResult;
fn remove(chain_id: Self::NetworkId) -> DispatchResult;
}