-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7f58e5
commit ceb17cf
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
setCallee("Owner"); | ||
|
||
push mxListValue(); | ||
push mxStringValue("getMyStorage"); | ||
push mxIntValue(0); | ||
push mxTransfersValue(); | ||
push mxIntValue(0); | ||
push mxStringValue("TestContract"); | ||
call 6 MX#managedExecuteOnDestContext; | ||
check_eq mxIntValue(0); | ||
|
||
push_return_value; | ||
check_eq mxIntValue(0); | ||
|
||
push mxListValue(mxIntValue(8)); | ||
push mxStringValue("setMyStorage"); | ||
push mxIntValue(0); | ||
push mxTransfersValue(); | ||
push mxIntValue(0); | ||
push mxStringValue("TestContract"); | ||
call 6 MX#managedExecuteOnDestContext; | ||
check_eq mxIntValue(0); | ||
|
||
push mxListValue(); | ||
push mxStringValue("getMyStorage"); | ||
push mxIntValue(0); | ||
push mxTransfersValue(); | ||
push mxIntValue(0); | ||
push mxStringValue("TestContract"); | ||
call 6 MX#managedExecuteOnDestContext; | ||
check_eq mxIntValue(0); | ||
|
||
push_return_value; | ||
check_eq mxIntValue(8) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#![no_std] | ||
|
||
#[allow(unused_imports)] | ||
use multiversx_sc::imports::*; | ||
|
||
#[multiversx_sc::contract] | ||
pub trait Contract { | ||
#[view(noArg)] | ||
#[storage_mapper("my_value")] | ||
fn my_storage(&self) -> SingleValueMapper<BigUint>; | ||
|
||
#[init] | ||
fn init(&self) {} | ||
|
||
#[upgrade] | ||
fn upgrade(&self) {} | ||
|
||
#[endpoint(setMyStorage)] | ||
fn set_my_storage(&self, value: &BigUint) { | ||
self.my_storage().set(value) | ||
} | ||
|
||
#[endpoint(getMyStorage)] | ||
fn get_my_storage(&self) -> BigUint { | ||
self.my_storage().get() | ||
} | ||
} |