pub struct MultiSigPolicy {
pub threshold: u32,
pub total_signers: u32,
pub authorized_signers: Vec<AuthorId>,
}Expand description
Multi-signature policy defining required signers
Fields§
§threshold: u32Minimum required signatures (M in M-of-N)
total_signers: u32Total authorized signers (N in M-of-N)
List of authorized signer IDs
Implementations§
Source§impl MultiSigPolicy
impl MultiSigPolicy
Sourcepub fn new(threshold: u32, authorized_signers: Vec<AuthorId>) -> Result<Self>
pub fn new(threshold: u32, authorized_signers: Vec<AuthorId>) -> Result<Self>
Create a new multi-signature policy
§Arguments
threshold- Minimum signatures required (M)authorized_signers- List of authorized signer IDs
§Errors
Returns error if threshold > number of signers or threshold is 0
§Example
use aion_context::multisig::MultiSigPolicy;
use aion_context::types::AuthorId;
// 2-of-3 policy
let signers = vec![
AuthorId::new(1001),
AuthorId::new(1002),
AuthorId::new(1003),
];
let policy = MultiSigPolicy::new(2, signers).unwrap();
assert_eq!(policy.threshold, 2);
assert_eq!(policy.total_signers, 3);Sourcepub fn single_signer(signer: AuthorId) -> Self
pub fn single_signer(signer: AuthorId) -> Self
Create a 1-of-1 single signer policy
Check if an author is an authorized signer
Sourcepub fn description(&self) -> String
pub fn description(&self) -> String
Get the M-of-N description
Trait Implementations§
Source§impl Clone for MultiSigPolicy
impl Clone for MultiSigPolicy
Source§fn clone(&self) -> MultiSigPolicy
fn clone(&self) -> MultiSigPolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MultiSigPolicy
impl Debug for MultiSigPolicy
Source§impl<'de> Deserialize<'de> for MultiSigPolicy
impl<'de> Deserialize<'de> for MultiSigPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for MultiSigPolicy
impl RefUnwindSafe for MultiSigPolicy
impl Send for MultiSigPolicy
impl Sync for MultiSigPolicy
impl Unpin for MultiSigPolicy
impl UnsafeUnpin for MultiSigPolicy
impl UnwindSafe for MultiSigPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more