Skip to content

Commit

Permalink
test - forwarder multi transfer, multi transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
BiancaIalangi committed Dec 2, 2024
1 parent 259a4fb commit 1b32b53
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"sc:forwarder": {
"nonce": "0",
"balance": "0",
"balance": "4000",
"esdt": {
"str:FWD-TOKEN": "1000",
"str:NFT-123456": {
Expand Down Expand Up @@ -89,7 +89,7 @@
},
"sc:forwarder": {
"nonce": "0",
"balance": "0",
"balance": "4000",
"esdt": {
"str:FWD-TOKEN": "700",
"str:NFT-123456": {
Expand Down Expand Up @@ -130,6 +130,9 @@
"str:NFT-123456",
"1",
"1",
"str:EGLD-000000",
"0",
"100",
"str:SFT-456789",
"3",
"6"
Expand All @@ -156,7 +159,7 @@
},
"sc:vault": {
"nonce": "0",
"balance": "0",
"balance": "100",
"esdt": {
"str:FWD-TOKEN": "800",
"str:NFT-123456": {
Expand All @@ -183,7 +186,7 @@
},
"sc:forwarder": {
"nonce": "0",
"balance": "0",
"balance": "3900",
"esdt": {
"str:FWD-TOKEN": "200",
"str:SFT-456789": {
Expand All @@ -200,4 +203,4 @@
}
}
]
}
}
4 changes: 2 additions & 2 deletions framework/base/src/api/managed_types/const_handles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub const UNINITIALIZED_HANDLE: RawHandle = i32::MAX;
/// WARNING! With the current VM this still needs to be initialized before use.
pub const BIG_INT_CONST_ZERO: RawHandle = -10;

pub const CALL_VALUE_EGLD: RawHandle = -11;
pub const CALL_VALUE_EGLD: RawHandle = -11; // useful
pub const CALL_VALUE_SINGLE_ESDT: RawHandle = -13;

pub const BIG_INT_TEMPORARY_1: RawHandle = -14;
Expand All @@ -17,7 +17,7 @@ pub const BIG_FLOAT_TEMPORARY: RawHandle = -16;

/// WARNING! With the current VM this still needs to be initialized before use.
pub const MBUF_CONST_EMPTY: RawHandle = -20;
pub const CALL_VALUE_MULTI_ESDT: RawHandle = -21;
pub const CALL_VALUE_MULTI_ESDT: RawHandle = -21; // useful
pub const CALL_VALUE_SINGLE_ESDT_TOKEN_NAME: RawHandle = -22;
pub const CALLBACK_CLOSURE_ARGS_BUFFER: RawHandle = -23;
pub const MBUF_TEMPORARY_1: RawHandle = -25;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"accounts": {
"address:A": {
"nonce": "0",
"balance": "0x1000000000",
"balance": "1000000000",
"esdt": {
"str:TOK-123456": "150",
"str:OTHERTOK-123456": "500",
Expand Down Expand Up @@ -41,14 +41,17 @@
"tokenIdentifier": "str:OTHERTOK-123456",
"value": "400"
},
{
"tokenIdentifier": "str:EGLD-000000",
"value": "500"
},
{
"tokenIdentifier": "str:NFT-123456",
"nonce": "5",
"value": "10"
}
],
"gasLimit": "0x100000000",
"gasPrice": "0x01"
"gasLimit": "0x100000000"
}
},
{
Expand All @@ -57,7 +60,7 @@
"accounts": {
"address:A": {
"nonce": "1",
"balance": "0xf00000000",
"balance": "999999500",
"esdt": {
"str:TOK-123456": "50",
"str:OTHERTOK-123456": "100",
Expand All @@ -75,6 +78,7 @@
},
"address:B": {
"nonce": "0",
"balance": "500",
"esdt": {
"str:TOK-123456": "100",
"str:OTHERTOK-123456": "400",
Expand All @@ -93,4 +97,4 @@
}
}
]
}
}
181 changes: 181 additions & 0 deletions framework/scenario/tests/scenarios_self_go_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
use multiversx_sc_scenario::*;

// These tests don't really test any contract, but the testing framework itself.

fn world() -> ScenarioWorld {
ScenarioWorld::vm_go()
}

/// Checks that externalSteps work fine.
#[test]
fn external_steps_go() {
world().run("tests/scenarios-self/external_steps/external_steps.scen.json");
}

#[test]
#[should_panic]
fn set_account_addr_len_err1_go() {
world().run("tests/scenarios-self/set-check/set-account-addr-len.err1.json");
}

#[test]
#[should_panic]
fn set_account_addr_len_err2_go() {
world().run("tests/scenarios-self/set-check/set-account-addr-len.err2.json");
}

#[test]
#[should_panic]
fn set_account_sc_addr_err1_go() {
world().run("tests/scenarios-self/set-check/set-account-sc-addr.err1.json");
}

#[test]
#[should_panic]
fn set_account_sc_addr_err2_go() {
world().run("tests/scenarios-self/set-check/set-account-sc-addr.err2.json");
}

#[test]
#[should_panic]
fn set_account_sc_addr_err3_go() {
world().run("tests/scenarios-self/set-check/set-account-sc-addr.err3.json");
}

#[test]
#[should_panic]
fn set_check_balance_err_go() {
world().run("tests/scenarios-self/set-check/set-check-balance.err.json");
}

#[test]
fn set_check_balance_go() {
world().run("tests/scenarios-self/set-check/set-check-balance.scen.json");
}

#[test]
#[should_panic]
fn set_check_code_err_go() {
world().run("tests/scenarios-self/set-check/set-check-code.err.json");
}

#[test]
fn set_check_code() {
world().run("tests/scenarios-self/set-check/set-check-code.scen.json");
}

#[test]
#[should_panic]
fn set_check_codemetadata_err_go() {
world().run("tests/scenarios-self/set-check/set-check-codemetadata.err.json");
}

#[test]
fn set_check_codemetadata() {
world().run("tests/scenarios-self/set-check/set-check-codemetadata.scen.json");
}

#[test]
#[should_panic]
fn set_check_esdt_err_go() {
world().run("tests/scenarios-self/set-check/set-check-esdt.err1.json");
}

#[test]
fn set_check_esdt_go() {
world().run("tests/scenarios-self/set-check/set-check-esdt.scen.json");
}

#[test]
#[should_panic]
fn set_check_nonce_err_go() {
world().run("tests/scenarios-self/set-check/set-check-nonce.err.json");
}

#[test]
fn set_check_nonce_go() {
world().run("tests/scenarios-self/set-check/set-check-nonce.scen.json");
}

#[test]
#[should_panic]
fn set_check_storage_err1_go() {
world().run("tests/scenarios-self/set-check/set-check-storage.err1.json");
}

#[test]
#[should_panic]
fn set_check_storage_err2_go() {
world().run("tests/scenarios-self/set-check/set-check-storage.err2.json");
}

#[test]
#[should_panic]
fn set_check_storage_err3_go() {
world().run("tests/scenarios-self/set-check/set-check-storage.err3.json");
}

#[test]
#[should_panic]
fn set_check_storage_err4_go() {
world().run("tests/scenarios-self/set-check/set-check-storage.err4.json");
}

#[test]
#[should_panic]
fn set_check_storage_err5_go() {
world().run("tests/scenarios-self/set-check/set-check-storage.err5.json");
}

#[test]
fn set_check_storage_go() {
world().run("tests/scenarios-self/set-check/set-check-storage.scen.json");
}

#[test]
#[should_panic]
fn set_check_username_err_go() {
world().run("tests/scenarios-self/set-check/set-check-username.err.json");
}

#[test]
fn set_check_username_go() {
world().run("tests/scenarios-self/set-check/set-check-username.scen.json");
}

#[test]
fn builtin_func_esdt_transfer() {
world().run("tests/scenarios-self/builtin-func-esdt-transfer.scen.json");
}

#[test]
#[should_panic]
fn esdt_non_zero_balance_check_err_go() {
world().run("tests/scenarios-self/esdt-non-zero-balance-check-err.scen.json");
}

#[test]
#[should_panic]
fn esdt_zero_balance_check_err_go() {
world().run("tests/scenarios-self/esdt-zero-balance-check-err.scen.json");
}

#[test]
fn multi_transfer_esdt_go() {
world().run("tests/scenarios-self/multi-transfer-esdt.scen.json");
}

#[test]
fn transfer_egld_go() {
world().run("tests/scenarios-self/transfer-egld.scen.json");
}

#[test]
fn transfer_esdt_go() {
world().run("tests/scenarios-self/transfer-esdt.scen.json");
}

#[test]
fn validator_reward_go() {
world().run("tests/scenarios-self/validatorReward.scen.json");
}

0 comments on commit 1b32b53

Please sign in to comment.