pub struct NeoRuntime {
execution_context: ExecutionContext,
state_manager: StateManager,
storage_manager: StorageManager,
vm_bridge: VMBridge,
gas_tracker: GasTracker,
}Expand description
Neo runtime for executing compiled Yul contracts
Fields§
§execution_context: ExecutionContext§state_manager: StateManager§storage_manager: StorageManager§vm_bridge: VMBridge§gas_tracker: GasTrackerImplementations§
§impl NeoRuntime
impl NeoRuntime
pub fn override_block_height(&mut self, height: u64)
pub fn override_block_height(&mut self, height: u64)
Override block height for the next execution.
pub fn override_timestamp(&mut self, timestamp: u64)
pub fn override_timestamp(&mut self, timestamp: u64)
Override timestamp for the next execution.
pub fn override_caller_account(
&mut self,
account: &str,
) -> Result<(), RuntimeError>
pub fn override_caller_account( &mut self, account: &str, ) -> Result<(), RuntimeError>
Override caller script hash for the next execution.
pub fn execute_with_overrides(
&mut self,
bytecode: &[u8],
input: &[u8],
overrides: &ExecutionOverrides,
) -> Result<ExecutionResult, RuntimeError>
pub fn execute_with_overrides( &mut self, bytecode: &[u8], input: &[u8], overrides: &ExecutionOverrides, ) -> Result<ExecutionResult, RuntimeError>
Execute bytecode with optional metadata overrides applied to this invocation.
pub fn new(config: RuntimeConfig) -> Result<Self, RuntimeError>
pub fn new(config: RuntimeConfig) -> Result<Self, RuntimeError>
Create new runtime instance
fn capture_metadata(&self) -> ExecutionMetadata
pub fn execute(
&mut self,
bytecode: &[u8],
input: &[u8],
) -> Result<ExecutionResult, RuntimeError>
pub fn execute( &mut self, bytecode: &[u8], input: &[u8], ) -> Result<ExecutionResult, RuntimeError>
Execute bytecode with given input
pub fn execute_with_tokens(
&mut self,
bytecode: &[u8],
input: &[u8],
tokens: &[MethodToken],
) -> Result<ExecutionResult, RuntimeError>
pub fn execute_with_tokens( &mut self, bytecode: &[u8], input: &[u8], tokens: &[MethodToken], ) -> Result<ExecutionResult, RuntimeError>
Execute bytecode with a NEF method token table.
This is required when the script contains the CALLT opcode (0x37).
pub fn call_function(
&mut self,
bytecode: &[u8],
function_name: &str,
args: &[StackItem],
) -> Result<ExecutionResult, RuntimeError>
pub fn call_function( &mut self, bytecode: &[u8], function_name: &str, args: &[StackItem], ) -> Result<ExecutionResult, RuntimeError>
Call specific function with arguments
§impl NeoRuntime
impl NeoRuntime
pub fn deploy_contract(
&mut self,
bytecode: &[u8],
constructor_args: &[u8],
) -> Result<String, RuntimeError>
pub fn deploy_contract( &mut self, bytecode: &[u8], constructor_args: &[u8], ) -> Result<String, RuntimeError>
Deploy contract and return address
fn generate_contract_address(&self) -> Result<String, RuntimeError>
§impl NeoRuntime
impl NeoRuntime
pub fn get_state_snapshot(&self) -> StateSnapshot
pub fn get_state_snapshot(&self) -> StateSnapshot
Get current state of the runtime
pub fn restore_state(
&mut self,
snapshot: StateSnapshot,
) -> Result<(), RuntimeError>
pub fn restore_state( &mut self, snapshot: StateSnapshot, ) -> Result<(), RuntimeError>
Restore state from snapshot
pub fn get_storage(
&mut self,
account: &str,
key: &[u8],
) -> Result<Option<Vec<u8>>, RuntimeError>
pub fn get_storage( &mut self, account: &str, key: &[u8], ) -> Result<Option<Vec<u8>>, RuntimeError>
Get storage value for account and key
pub fn set_storage(
&mut self,
account: &str,
key: &[u8],
value: &[u8],
) -> Result<(), RuntimeError>
pub fn set_storage( &mut self, account: &str, key: &[u8], value: &[u8], ) -> Result<(), RuntimeError>
Set storage value for account and key
pub fn get_balance(&self, account: &str) -> Result<u64, RuntimeError>
pub fn get_balance(&self, account: &str) -> Result<u64, RuntimeError>
Get account balance
pub fn set_balance(
&mut self,
account: &str,
balance: u64,
) -> Result<(), RuntimeError>
pub fn set_balance( &mut self, account: &str, balance: u64, ) -> Result<(), RuntimeError>
Set account balance
pub fn get_statistics(&self) -> RuntimeStatistics
pub fn get_statistics(&self) -> RuntimeStatistics
Get runtime statistics
§impl NeoRuntime
impl NeoRuntime
pub fn enable_debugging(&mut self)
pub fn enable_debugging(&mut self)
Enable debugging mode
pub fn disable_debugging(&mut self)
pub fn disable_debugging(&mut self)
Disable debugging mode
pub fn set_breakpoint(&mut self, instruction_pointer: u32)
pub fn set_breakpoint(&mut self, instruction_pointer: u32)
Set breakpoint at instruction
pub fn remove_breakpoint(&mut self, instruction_pointer: u32)
pub fn remove_breakpoint(&mut self, instruction_pointer: u32)
Remove breakpoint
pub fn step(&mut self) -> Result<StepResult, RuntimeError>
pub fn step(&mut self) -> Result<StepResult, RuntimeError>
Step through execution
§impl NeoRuntime
impl NeoRuntime
fn prepare_function_call( &self, function_name: &str, args: &[StackItem], ) -> Result<Vec<u8>, RuntimeError>
fn calculate_function_selector( &self, function_name: &str, ) -> Result<[u8; 4], RuntimeError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NeoRuntime
impl !RefUnwindSafe for NeoRuntime
impl !Send for NeoRuntime
impl !Sync for NeoRuntime
impl Unpin for NeoRuntime
impl !UnwindSafe for NeoRuntime
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
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