mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-29 08:57:56 +00:00
Implement delegate_call (#80)
This commit is contained in:
@@ -106,3 +106,30 @@ pub fn call(context: &Context) -> StructType {
|
||||
true,
|
||||
)
|
||||
}
|
||||
|
||||
/// Returns a packed struct argument type for the `delegate_call` API.
|
||||
pub fn delegate_call(context: &Context) -> StructType {
|
||||
context.struct_type(
|
||||
&[
|
||||
// flags: u32,
|
||||
context.i32_type().as_basic_type_enum(),
|
||||
// address_ptr:
|
||||
context.ptr_type(Default::default()).as_basic_type_enum(),
|
||||
// ref_time_limit: u64,
|
||||
context.i64_type().as_basic_type_enum(),
|
||||
// proof_size_limit: u64,
|
||||
context.i64_type().as_basic_type_enum(),
|
||||
// deposit_ptr: u32,
|
||||
context.ptr_type(Default::default()).as_basic_type_enum(),
|
||||
// input_data_ptr: u32,
|
||||
context.ptr_type(Default::default()).as_basic_type_enum(),
|
||||
// input_data_len: u32,
|
||||
context.i32_type().as_basic_type_enum(),
|
||||
// output_ptr: u32,
|
||||
context.ptr_type(Default::default()).as_basic_type_enum(),
|
||||
// output_len_ptr: u32,
|
||||
context.ptr_type(Default::default()).as_basic_type_enum(),
|
||||
],
|
||||
true,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -76,6 +76,8 @@ POLKAVM_IMPORT(void, block_number, uint32_t)
|
||||
|
||||
POLKAVM_IMPORT(uint32_t, call, uint32_t)
|
||||
|
||||
POLKAVM_IMPORT(uint32_t, delegate_call, uint32_t)
|
||||
|
||||
POLKAVM_IMPORT(void, caller, uint32_t)
|
||||
|
||||
POLKAVM_IMPORT(void, chain_id, uint32_t)
|
||||
|
||||
@@ -26,6 +26,8 @@ pub static BLOCK_NUMBER: &str = "block_number";
|
||||
|
||||
pub static CALL: &str = "call";
|
||||
|
||||
pub static DELEGATE_CALL: &str = "delegate_call";
|
||||
|
||||
pub static CALLER: &str = "caller";
|
||||
|
||||
pub static CHAIN_ID: &str = "chain_id";
|
||||
@@ -64,7 +66,7 @@ pub static VALUE_TRANSFERRED: &str = "value_transferred";
|
||||
|
||||
/// All imported runtime API symbols.
|
||||
/// Useful for configuring common attributes and linkage.
|
||||
pub static IMPORTS: [&str; 26] = [
|
||||
pub static IMPORTS: [&str; 27] = [
|
||||
SBRK,
|
||||
MEMORY_SIZE,
|
||||
ADDRESS,
|
||||
@@ -73,6 +75,7 @@ pub static IMPORTS: [&str; 26] = [
|
||||
BLOCK_HASH,
|
||||
BLOCK_NUMBER,
|
||||
CALL,
|
||||
DELEGATE_CALL,
|
||||
CALLER,
|
||||
CHAIN_ID,
|
||||
CODE_SIZE,
|
||||
|
||||
Reference in New Issue
Block a user