use nexus_sdk::{
solidity::{*, SafeMath},
contract_api::ez::ret,
require,
};
use nexus_sdk::solidity::uint256 as U256;
// State variables using Solidity-compatible Mappings
static VALUE: Mapping<&[u8], U256> = Mapping::new(b"value");
static OWNER: Mapping<&[u8], Address> = Mapping::new(b"owner");
nexus_fn! {
fn init() {
let sender = Blockchain::msg.sender();
OWNER.set(&b"val".as_slice(), sender);
VALUE.set(&b"val".as_slice(), U256::from(0));
ret::u32(1)
}
}
nexus_fn! {
fn my_function() {
let current = VALUE.get(&b"val".as_slice());
let mut out = [0u8; 32];
current.to_little_endian(&mut out);
ret::u256(&out)
}
}