-
-
Save 0xZRA/19a9079f97f60a5143115e76a0eb84a9 to your computer and use it in GitHub Desktop.
Updated test/src/sdk-harness/test_projects/run_external_target/src/main.sw
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; | |
use std::constants::ZERO_B256; | |
use std::context::msg_amount; | |
storage { | |
owner: Identity = Identity::Address(Address::from(ZERO_B256)), | |
simple_value: u64 = 0, | |
} | |
abi RunExternalTest { | |
fn double_value(foo: u64) -> u64; | |
fn large_value() -> b256; | |
} | |
impl RunExternalTest for Contract { | |
fn double_value(foo: u64) -> u64 { | |
// __log(2); | |
foo * 2 | |
} | |
fn large_value() -> b256 { | |
0x00000000000000000000000059F2f1fCfE2474fD5F0b9BA1E73ca90b143Eb8d0 | |
} | |
} | |
// ANCHOR: fallback | |
#[fallback, storage(read, write)] | |
fn fallback() -> u64 { | |
use std::call_frames::*; | |
let foo = called_args::<u64>(); | |
// STORAGE READS are failing | |
let iden = storage.owner.read(); // this will fail | |
// storage.simple_value.read(); // this will fail | |
// BUT STORAGE WRITES are succesfull | |
// storage.simple_value.write(foo); // this will succeed | |
foo | |
} | |
// ANCHOR_END: fallback |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment