Last active
April 16, 2024 02:37
-
-
Save IGI-111/a80da960073f4dbbf03693ec9e41c675 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract; | |
abi ProxyAbi { | |
#[storage(read)] | |
fn read_val() -> u64; | |
#[storage(write)] | |
fn write_target(target: ContractId); | |
} | |
#[namespace(proxy_47892374)] | |
storage { | |
target: ContractId, | |
} | |
impl ProxyAbi for Contract { | |
#[storage(read)] | |
fn read_val() -> u64 { | |
let target = storage.target.read(); | |
std::execution::run_external(target); | |
} | |
#[storage(write)] | |
fn write_target(target: ContractId) { | |
storage.target.write(target); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract; | |
abi TargetAbi { | |
#[storage(read)] | |
fn read_val() -> u64; | |
#[storage(write)] | |
fn write_val(val: u64); | |
} | |
storage { | |
val: u64, | |
} | |
impl TargetAbi for Contract { | |
#[storage(read)] | |
fn read_val() -> u64 { | |
storage.val.read() | |
} | |
#[storage(write)] | |
fn write_val(val: u64) { | |
storage.val.write(val); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment