ghost-node/pallets/traits/src/networks.rs
Uncle Stinky 116ca39dc4
rustfmt the ghost-traits pallet
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-25 18:16:06 +03:00

44 lines
1.4 KiB
Rust

use frame_support::{pallet_prelude::*, storage::PrefixIterator};
use sp_runtime::{
traits::{AtLeast32BitUnsigned, Member},
DispatchResult,
};
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)>;
fn is_nullification_period() -> bool;
}
pub trait NetworkDataMutateHandler<Network, Balance>: NetworkDataInspectHandler<Network> {
fn register(chain_id: Self::NetworkId, network: Network) -> DispatchResult;
fn remove(chain_id: Self::NetworkId) -> DispatchResult;
fn increase_gatekeeper_amount(
chain_id: &Self::NetworkId,
amount: &Balance,
) -> Result<Balance, ()>;
fn decrease_gatekeeper_amount(
chain_id: &Self::NetworkId,
amount: &Balance,
) -> Result<Balance, ()>;
fn accumulate_outgoing_imbalance(amount: &Balance) -> Result<Balance, ()>;
fn accumulate_incoming_imbalance(amount: &Balance) -> Result<Balance, ()>;
fn accumulate_commission(commission: &Balance) -> Result<Balance, ()>;
fn nullify_commission();
fn trigger_nullification();
}