mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-12 10:31:04 +00:00
implement address and msg.sender
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
@@ -75,6 +75,14 @@ sol!(
|
||||
}
|
||||
);
|
||||
|
||||
sol!(
|
||||
contract Context {
|
||||
function address_this() public view returns (address);
|
||||
|
||||
function caller() public pure returns (address);
|
||||
}
|
||||
);
|
||||
|
||||
impl Contract {
|
||||
pub fn baseline() -> Self {
|
||||
let code = include_str!("../contracts/Baseline.sol");
|
||||
@@ -196,6 +204,28 @@ impl Contract {
|
||||
calldata: Block::timestampCall::new(()).abi_encode(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn context_address() -> Self {
|
||||
let code = include_str!("../contracts/Context.sol");
|
||||
let name = "Context";
|
||||
|
||||
Self {
|
||||
evm_runtime: crate::compile_evm_bin_runtime(name, code),
|
||||
pvm_runtime: crate::compile_blob(name, code),
|
||||
calldata: Context::address_thisCall::new(()).abi_encode(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn context_caller() -> Self {
|
||||
let code = include_str!("../contracts/Context.sol");
|
||||
let name = "Context";
|
||||
|
||||
Self {
|
||||
evm_runtime: crate::compile_evm_bin_runtime(name, code),
|
||||
pvm_runtime: crate::compile_blob(name, code),
|
||||
calldata: Context::callerCall::new(()).abi_encode(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user