Trait fuel_vm::interpreter::ExecutableTransaction
source · pub trait ExecutableTransaction: Default + Clone + Chargeable + Executable + IntoChecked + EstimatePredicates + UniqueIdentifier + Outputs + Witnesses + Into<Transaction> + PrepareSign + Serialize {
Show 13 methods
// Required method
fn transaction_type() -> Word;
// Provided methods
fn as_script(&self) -> Option<&Script> { ... }
fn as_script_mut(&mut self) -> Option<&mut Script> { ... }
fn as_create(&self) -> Option<&Create> { ... }
fn as_create_mut(&mut self) -> Option<&mut Create> { ... }
fn as_upgrade(&self) -> Option<&Upgrade> { ... }
fn as_upgrade_mut(&mut self) -> Option<&mut Upgrade> { ... }
fn as_upload(&self) -> Option<&Upload> { ... }
fn as_upload_mut(&mut self) -> Option<&mut Upload> { ... }
fn replace_variable_output(
&mut self,
idx: usize,
output: Output,
) -> SimpleResult<()> { ... }
fn update_outputs<I>(
&mut self,
revert: bool,
used_gas: Word,
initial_balances: &InitialBalances,
balances: &I,
gas_costs: &GasCosts,
fee_params: &FeeParameters,
base_asset_id: &AssetId,
gas_price: Word,
) -> Result<(), ValidityError>
where I: for<'a> Index<&'a AssetId, Output = Word> { ... }
fn find_output_contract(&self, input: usize) -> Option<(usize, &Output)> { ... }
fn prepare_init_execute(&mut self) { ... }
}
Expand description
The definition of the executable transaction supported by the Interpreter
.
Required Methods§
sourcefn transaction_type() -> Word
fn transaction_type() -> Word
Returns the type of the transaction like Transaction::Create
or
Transaction::Script
.
Provided Methods§
sourcefn as_script_mut(&mut self) -> Option<&mut Script>
fn as_script_mut(&mut self) -> Option<&mut Script>
Casts the Self
transaction into &mut Script
if any.
sourcefn as_create_mut(&mut self) -> Option<&mut Create>
fn as_create_mut(&mut self) -> Option<&mut Create>
Casts the Self
transaction into &mut Create
if any.
sourcefn as_upgrade(&self) -> Option<&Upgrade>
fn as_upgrade(&self) -> Option<&Upgrade>
Casts the Self
transaction into &Upgrade
if any.
sourcefn as_upgrade_mut(&mut self) -> Option<&mut Upgrade>
fn as_upgrade_mut(&mut self) -> Option<&mut Upgrade>
Casts the Self
transaction into &mut Upgrade
if any.
sourcefn as_upload_mut(&mut self) -> Option<&mut Upload>
fn as_upload_mut(&mut self) -> Option<&mut Upload>
Casts the Self
transaction into &mut Upload
if any.
sourcefn replace_variable_output(
&mut self,
idx: usize,
output: Output,
) -> SimpleResult<()>
fn replace_variable_output( &mut self, idx: usize, output: Output, ) -> SimpleResult<()>
Replaces the Output::Variable
with the output
(should be also
Output::Variable
) by the idx
index.
sourcefn update_outputs<I>(
&mut self,
revert: bool,
used_gas: Word,
initial_balances: &InitialBalances,
balances: &I,
gas_costs: &GasCosts,
fee_params: &FeeParameters,
base_asset_id: &AssetId,
gas_price: Word,
) -> Result<(), ValidityError>
fn update_outputs<I>( &mut self, revert: bool, used_gas: Word, initial_balances: &InitialBalances, balances: &I, gas_costs: &GasCosts, fee_params: &FeeParameters, base_asset_id: &AssetId, gas_price: Word, ) -> Result<(), ValidityError>
Update change and variable outputs.
revert
will signal if the execution was reverted. It will refund the unused gas
cost to the base asset and reset output changes to their initial_balances
.
remaining_gas
expects the raw content of $ggas
initial_balances
contains the initial state of the free balances
balances
will contain the current state of the free balances
sourcefn find_output_contract(&self, input: usize) -> Option<(usize, &Output)>
fn find_output_contract(&self, input: usize) -> Option<(usize, &Output)>
Finds Output::Contract
corresponding to the input
index.
sourcefn prepare_init_execute(&mut self)
fn prepare_init_execute(&mut self)
Prepares the transaction for execution.