Struct marlowe_lang::semantics::ContractInstance

source ·
pub struct ContractInstance {
    pub state: State,
    pub contract: Contract,
    pub payments: Vec<Payment>,
    pub logs: Vec<String>,
    pub warnings: Vec<TransactionWarning>,
    pub applied: Vec<AppliedInput>,
    pub role_payout_validator_hash: Option<String>,
    pub resolved_merkleized_continuations: HashMap<String, Contract>,
    pub hard_coded_time: Option<u64>,
    pub time_interval_end: Option<u64>,
}

Fields§

§state: State§contract: Contract§payments: Vec<Payment>§logs: Vec<String>§warnings: Vec<TransactionWarning>§applied: Vec<AppliedInput>§role_payout_validator_hash: Option<String>§resolved_merkleized_continuations: HashMap<String, Contract>§hard_coded_time: Option<u64>§time_interval_end: Option<u64>

Implementations§

source§

impl<'a> ContractInstance

source

pub fn is_closed(&self) -> bool

source

pub fn locked_amounts(&'a self) -> Vec<(&'a Party, &'a Token, u128)>

source

pub fn from_datum_cborhex(datum_cbor_hex: &str) -> Result<Self, String>

source

pub fn with_current_time(self, posix_time: u64) -> Self

source

pub fn with_time_interval_end(self, posix_time: u64) -> Self

source

pub fn truncate_upward_to_nearest_second(posix_time_ms: u64) -> u64

source

pub fn get_current_time() -> u64

source

pub fn add_continuation(&mut self, merkle_hash: &str, contract: &Contract)

source

pub fn from_datum(datum: &MarloweDatum) -> Self

source

pub fn new( contract: &Contract, role_payout_validator_hash: Option<String> ) -> Self

source

pub fn has_timed_out(&self) -> bool

source

pub fn as_datum(&self) -> MarloweDatum

Trait Implementations§

source§

impl Clone for ContractInstance

source§

fn clone(&self) -> ContractInstance

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl ContractSemantics<ContractInstance> for ContractInstance

source§

fn parties(&self) -> Vec<Party>

Lists all known parties in the contract.

source§

fn with_accounts(&self, accounts: &HashMap<(Party, Token), u128>) -> Self

Creates a new instance with the accounts replaced. Any account with less than 1 token will be dropped from the state.

source§

fn with_account(&self, party: &Party, asset: &Token, quantity: u128) -> Self

Creates a new instance with the account of a specific party replaced (or added if it does not already exist). Setting quantity to 0 will drop the account from the state.

source§

fn with_account_addr( &self, bech32_addr: &str, asset: &Token, quantity: u128 ) -> Result<Self, String>

Creates a new instance with the account of a specific address replaced (or added if it does not already exist)

source§

fn with_account_role(&self, role: &str, asset: &Token, quantity: u128) -> Self

Creates a new instance with the account of a specific role replaced (or added if it does not already exist)

source§

fn eval_num_value( &self, val: &Value ) -> Result<(i128, Vec<TransactionWarning>), String>

source§

fn assert_observation( &self, obs: &Observation ) -> Result<(bool, Vec<TransactionWarning>), String>

source§

fn apply_input_action( &self, action: InputAction ) -> Result<ContractInstance, ActionApplicationError>

source§

fn apply_input_choice( &self, applied_choice_name: &str, applied_choice_owner: Party, applied_chosen_value: i128 ) -> Result<ContractInstance, ApplyInputChoiceError>

source§

fn apply_input_deposit( &self, from: Party, asset: Token, quantity: i128, to: AccountId ) -> Result<ContractInstance, ApplyInputDepositError>

source§

fn process(&self) -> Result<(ContractInstance, MachineState), ProcessError>

source§

fn step( &self, force_observe: bool ) -> Result<(ContractInstance, MachineState), String>

source§

fn with_min_time(&self, val: &u64) -> ContractInstance

source§

impl Debug for ContractInstance

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for ContractInstance

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for ContractInstance

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,