Enum solana_sdk::budget_expr::BudgetExpr
source · #[repr(C)]
pub enum BudgetExpr {
Pay(Payment),
After(Condition, Payment),
Or((Condition, Payment), (Condition, Payment)),
And(Condition, Condition, Payment),
}
Expand description
A data type representing a payment plan.
Variants
Pay(Payment)
Make a payment.
After(Condition, Payment)
Make a payment after some condition.
Or((Condition, Payment), (Condition, Payment))
Either make a payment after one condition or a different payment after another condition, which ever condition is satisfied first.
And(Condition, Condition, Payment)
Make a payment after both of two conditions are satisfied
Implementations
sourceimpl BudgetExpr
impl BudgetExpr
sourcepub fn new_payment(tokens: u64, to: Pubkey) -> Self
pub fn new_payment(tokens: u64, to: Pubkey) -> Self
Create the simplest budget - one that pays tokens
to Pubkey.
Create a budget that pays tokens
to to
after being witnessed by from
.
sourcepub fn new_2_2_multisig_payment(
from0: Pubkey,
from1: Pubkey,
tokens: u64,
to: Pubkey
) -> Self
pub fn new_2_2_multisig_payment(
from0: Pubkey,
from1: Pubkey,
tokens: u64,
to: Pubkey
) -> Self
Create a budget that pays tokensto
toafter being witnessed by 2x
from`s
sourcepub fn new_future_payment(
dt: DateTime<Utc>,
from: Pubkey,
tokens: u64,
to: Pubkey
) -> Self
pub fn new_future_payment(
dt: DateTime<Utc>,
from: Pubkey,
tokens: u64,
to: Pubkey
) -> Self
Create a budget that pays tokens
to to
after the given DateTime.
sourcepub fn new_cancelable_future_payment(
dt: DateTime<Utc>,
from: Pubkey,
tokens: u64,
to: Pubkey
) -> Self
pub fn new_cancelable_future_payment(
dt: DateTime<Utc>,
from: Pubkey,
tokens: u64,
to: Pubkey
) -> Self
Create a budget that pays tokens
to to
after the given DateTime
unless cancelled 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_tokens: u64) -> bool
pub fn verify(&self, spendable_tokens: u64) -> bool
Return true if the budget spends exactly spendable_tokens
.
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
sourceimpl Clone for BudgetExpr
impl Clone for BudgetExpr
sourcefn clone(&self) -> BudgetExpr
fn clone(&self) -> BudgetExpr
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more