diff --git a/tests/mx-rust-contracts/call-endpoint-args.1.args b/tests/mx-rust-contracts/call-endpoint-args.1.args new file mode 100644 index 0000000..e69de29 diff --git a/tests/mx-rust-contracts/call-endpoint-args.1.run b/tests/mx-rust-contracts/call-endpoint-args.1.run new file mode 100644 index 0000000..0b1f617 --- /dev/null +++ b/tests/mx-rust-contracts/call-endpoint-args.1.run @@ -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) diff --git a/tests/mx-rust-contracts/call-endpoint-args.rs b/tests/mx-rust-contracts/call-endpoint-args.rs new file mode 100644 index 0000000..0dcf76a --- /dev/null +++ b/tests/mx-rust-contracts/call-endpoint-args.rs @@ -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; + + #[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() + } +}