additional function for exposure trait

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch 2026-02-26 14:42:39 +03:00
parent cc300fefb0
commit ba7d2a8222
Signed by: str3tch
GPG Key ID: 84F3190747EE79AA
2 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ghost-traits" name = "ghost-traits"
version = "0.3.31" version = "0.3.32"
license.workspace = true license.workspace = true
authors.workspace = true authors.workspace = true
edition.workspace = true edition.workspace = true
@ -10,10 +10,12 @@ repository.workspace = true
[dependencies] [dependencies]
frame-support = { workspace = true } frame-support = { workspace = true }
sp-runtime = { workspace = true } sp-runtime = { workspace = true }
sp-std = { workspace = true }
[features] [features]
default = ["std"] default = ["std"]
std = [ std = [
"frame-support/std", "frame-support/std",
"sp-runtime/std", "sp-runtime/std",
"sp-std/std",
] ]

View File

@ -1,6 +1,9 @@
use sp_runtime::traits::AtLeast32BitUnsigned; use sp_runtime::traits::AtLeast32BitUnsigned;
pub trait ExposureListener<Balance: AtLeast32BitUnsigned, AccountId> { pub trait ExposureListener<Balance: AtLeast32BitUnsigned, AccountId> {
fn get_accounts_by_indexes(
indexes: impl Iterator<Item = usize>,
) -> sp_std::prelude::Vec<AccountId>;
fn get_account_by_index(index: usize) -> Option<AccountId>; fn get_account_by_index(index: usize) -> Option<AccountId>;
fn get_total_exposure() -> Balance; fn get_total_exposure() -> Balance;
fn get_validator_exposure(index: &AccountId) -> Balance; fn get_validator_exposure(index: &AccountId) -> Balance;