#[repr(C)]pub enum BudgetExpr {
Pay(Payment),
After(Condition, Box<BudgetExpr>),
Or((Condition, Box<BudgetExpr>), (Condition, Box<BudgetExpr>)),
And(Condition, Condition, Box<BudgetExpr>),
}Expand description
A data type representing a payment plan.
Variants§
Pay(Payment)
Make a payment.
After(Condition, Box<BudgetExpr>)
Make a payment after some condition.
Or((Condition, Box<BudgetExpr>), (Condition, Box<BudgetExpr>))
Either make a payment after one condition or a different payment after another condition, which ever condition is satisfied first.
And(Condition, Condition, Box<BudgetExpr>)
Make a payment after both of two conditions are satisfied
Implementations§
Source§impl BudgetExpr
impl BudgetExpr
Sourcepub fn new_payment(lamports: u64, to: &Pubkey) -> Self
pub fn new_payment(lamports: u64, to: &Pubkey) -> Self
Create the simplest budget - one that pays lamports to Pubkey.
Create a budget that pays lamports to to after being witnessed by from.
Sourcepub fn new_payment_when_account_data(
account_pubkey: &Pubkey,
account_program_id: &Pubkey,
account_hash: Hash,
lamports: u64,
to: &Pubkey,
) -> Self
pub fn new_payment_when_account_data( account_pubkey: &Pubkey, account_program_id: &Pubkey, account_hash: Hash, lamports: u64, to: &Pubkey, ) -> Self
Create a budget that pays lamports to to after witnessing account data in account_pubkey with the given hash.
Create a budget that pays lamports to to after being witnessed by witness unless
canceled with a signature from from.
Sourcepub fn new_2_2_multisig_payment(
from0: &Pubkey,
from1: &Pubkey,
lamports: u64,
to: &Pubkey,
) -> Self
pub fn new_2_2_multisig_payment( from0: &Pubkey, from1: &Pubkey, lamports: u64, to: &Pubkey, ) -> Self
Create a budget that pays lamportstotoafter being witnessed by 2xfrom`s
Sourcepub fn new_future_payment(
dt: DateTime<Utc>,
dt_pubkey: &Pubkey,
lamports: u64,
to: &Pubkey,
) -> Self
pub fn new_future_payment( dt: DateTime<Utc>, dt_pubkey: &Pubkey, lamports: u64, to: &Pubkey, ) -> Self
Create a budget that pays lamports to to after the given DateTime signed
by dt_pubkey.
Sourcepub fn new_cancelable_future_payment(
dt: DateTime<Utc>,
dt_pubkey: &Pubkey,
lamports: u64,
to: &Pubkey,
from: Option<Pubkey>,
) -> Self
pub fn new_cancelable_future_payment( dt: DateTime<Utc>, dt_pubkey: &Pubkey, lamports: u64, to: &Pubkey, from: Option<Pubkey>, ) -> Self
Create a budget that pays lamports to to after the given DateTime
signed by dt_pubkey unless canceled by from.
Sourcepub fn final_payment(&self) -> Option<Payment>
pub fn final_payment(&self) -> Option<Payment>
Return Payment if the budget requires no additional Witnesses.
Sourcepub fn verify(&self, spendable_lamports: u64) -> bool
pub fn verify(&self, spendable_lamports: u64) -> bool
Return true if the budget spends exactly spendable_lamports.
Sourcepub fn apply_witness(&mut self, witness: &Witness, from: &Pubkey)
pub fn apply_witness(&mut self, witness: &Witness, from: &Pubkey)
Apply a witness to the budget to see if the budget can be reduced. If so, modify the budget in-place.
Trait Implementations§
Source§impl Clone for BudgetExpr
impl Clone for BudgetExpr
Source§fn clone(&self) -> BudgetExpr
fn clone(&self) -> BudgetExpr
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BudgetExpr
impl Debug for BudgetExpr
Source§impl<'de> Deserialize<'de> for BudgetExpr
impl<'de> Deserialize<'de> for BudgetExpr
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>,
Source§impl PartialEq for BudgetExpr
impl PartialEq for BudgetExpr
Source§impl Serialize for BudgetExpr
impl Serialize for BudgetExpr
impl Eq for BudgetExpr
impl StructuralPartialEq for BudgetExpr
Auto Trait Implementations§
impl Freeze for BudgetExpr
impl RefUnwindSafe for BudgetExpr
impl Send for BudgetExpr
impl Sync for BudgetExpr
impl Unpin for BudgetExpr
impl UnwindSafe for BudgetExpr
Blanket Implementations§
Source§impl<T> AbiEnumVisitor for T
impl<T> AbiEnumVisitor for T
default fn visit_for_abi( &self, _digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>
Source§impl<T> AbiEnumVisitor for T
impl<T> AbiEnumVisitor for T
default fn visit_for_abi( &self, digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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