pub trait CallframeInterface {
Show 29 methods
// Required methods
fn address(&self) -> H160;
fn set_address(&mut self, address: H160);
fn code_address(&self) -> H160;
fn set_code_address(&mut self, address: H160);
fn caller(&self) -> H160;
fn set_caller(&mut self, address: H160);
fn program_counter(&self) -> Option<u16>;
fn set_program_counter(&mut self, value: u16);
fn exception_handler(&self) -> u16;
fn set_exception_handler(&mut self, value: u16);
fn is_static(&self) -> bool;
fn is_kernel(&self) -> bool;
fn gas(&self) -> u32;
fn set_gas(&mut self, new_gas: u32);
fn stipend(&self) -> u32;
fn context_u128(&self) -> u128;
fn set_context_u128(&mut self, value: u128);
fn is_near_call(&self) -> bool;
fn read_stack(&self, index: u16) -> (U256, bool);
fn write_stack(&mut self, index: u16, value: U256, is_pointer: bool);
fn stack_pointer(&self) -> u16;
fn set_stack_pointer(&mut self, value: u16);
fn heap(&self) -> HeapId;
fn heap_bound(&self) -> u32;
fn set_heap_bound(&mut self, value: u32);
fn aux_heap(&self) -> HeapId;
fn aux_heap_bound(&self) -> u32;
fn set_aux_heap_bound(&mut self, value: u32);
fn read_contract_code(&self, slot: u16) -> U256;
}
Expand description
Public interface of an EraVM call frame.
Required Methods§
sourcefn address(&self) -> H160
fn address(&self) -> H160
Address of the storage context associated with this frame. For delegate calls, this address is inherited from the calling contract;
otherwise, it’s the same as Self::code_address()
.
sourcefn set_address(&mut self, address: H160)
fn set_address(&mut self, address: H160)
Sets the address of the executing contract.
sourcefn code_address(&self) -> H160
fn code_address(&self) -> H160
Address of the contract being executed.
sourcefn set_code_address(&mut self, address: H160)
fn set_code_address(&mut self, address: H160)
Sets the address of the contract being executed. Does not cause the contract at the specified address get loaded per se, just updates
the value used internally by the VM (e.g., returned by the CodeAddress
opcode).
sourcefn set_caller(&mut self, address: H160)
fn set_caller(&mut self, address: H160)
Sets the address of the calling contract.
sourcefn program_counter(&self) -> Option<u16>
fn program_counter(&self) -> Option<u16>
Returns the current program counter (i.e., 0-based index of the instruction being executed).
During panic this returns None
.
sourcefn set_program_counter(&mut self, value: u16)
fn set_program_counter(&mut self, value: u16)
Sets the program counter. The VM will execute an invalid instruction if you jump out of the program.
sourcefn exception_handler(&self) -> u16
fn exception_handler(&self) -> u16
Returns the program counter that the parent frame should continue from if this frame fails.
sourcefn set_exception_handler(&mut self, value: u16)
fn set_exception_handler(&mut self, value: u16)
Sets the exception handler as specified above.
sourcefn context_u128(&self) -> u128
fn context_u128(&self) -> u128
Returns the context value for this call. This context is accessible via ContextU128
opcode.
sourcefn set_context_u128(&mut self, value: u128)
fn set_context_u128(&mut self, value: u128)
Sets the context value for this call.
sourcefn is_near_call(&self) -> bool
fn is_near_call(&self) -> bool
Checks whether this frame corresponds to a near call.
sourcefn read_stack(&self, index: u16) -> (U256, bool)
fn read_stack(&self, index: u16) -> (U256, bool)
Reads the specified stack slot. Returns a value together with a pointer flag.
sourcefn write_stack(&mut self, index: u16, value: U256, is_pointer: bool)
fn write_stack(&mut self, index: u16, value: U256, is_pointer: bool)
Sets the value and pointer flag for the specified stack slot.
sourcefn stack_pointer(&self) -> u16
fn stack_pointer(&self) -> u16
Returns the stack pointer.
sourcefn set_stack_pointer(&mut self, value: u16)
fn set_stack_pointer(&mut self, value: u16)
Sets the stack pointer.
sourcefn heap_bound(&self) -> u32
fn heap_bound(&self) -> u32
Returns the main heap boundary (number of paid bytes).
sourcefn set_heap_bound(&mut self, value: u32)
fn set_heap_bound(&mut self, value: u32)
Sets the main heap boundary.
sourcefn aux_heap_bound(&self) -> u32
fn aux_heap_bound(&self) -> u32
Returns the auxiliary heap boundary (number of paid bytes).
sourcefn set_aux_heap_bound(&mut self, value: u32)
fn set_aux_heap_bound(&mut self, value: u32)
Sets the auxiliary heap boundary.
sourcefn read_contract_code(&self, slot: u16) -> U256
fn read_contract_code(&self, slot: u16) -> U256
Reads a word from the bytecode of the executing contract.