From d96df7d1f80a1c5b7e65dcfa18a9983ffaf63eb8 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Mon, 23 Dec 2024 07:54:36 +0200 Subject: [PATCH] separate multi egld tests --- ...warder_call_async_multi_transfer.scen.json | 13 +- ...r_call_async_multi_transfer_egld.scen.json | 206 ++++++++++++++++++ .../call-value-check-multi-egld.scen.json | 128 +++++++++++ .../scenarios/call-value-check.scen.json | 8 +- .../scenarios/payable_multi_array.scen.json | 11 +- .../payable_multi_array_egld.scen.json | 146 +++++++++++++ .../scenarios/payable_multiple.scen.json | 10 +- .../scenarios/payable_multiple_egld.scen.json | 78 +++++++ 8 files changed, 570 insertions(+), 30 deletions(-) create mode 100644 contracts/feature-tests/composability/scenarios/forwarder_call_async_multi_transfer_egld.scen.json create mode 100644 contracts/feature-tests/payable-features/scenarios/call-value-check-multi-egld.scen.json create mode 100644 contracts/feature-tests/payable-features/scenarios/payable_multi_array_egld.scen.json create mode 100644 contracts/feature-tests/payable-features/scenarios/payable_multiple_egld.scen.json diff --git a/contracts/feature-tests/composability/scenarios/forwarder_call_async_multi_transfer.scen.json b/contracts/feature-tests/composability/scenarios/forwarder_call_async_multi_transfer.scen.json index 7dc86ee64f..81b18ee338 100644 --- a/contracts/feature-tests/composability/scenarios/forwarder_call_async_multi_transfer.scen.json +++ b/contracts/feature-tests/composability/scenarios/forwarder_call_async_multi_transfer.scen.json @@ -10,7 +10,7 @@ }, "sc:forwarder": { "nonce": "0", - "balance": "4000", + "balance": "0", "esdt": { "str:FWD-TOKEN": "1000", "str:NFT-123456": { @@ -89,7 +89,7 @@ }, "sc:forwarder": { "nonce": "0", - "balance": "4000", + "balance": "0", "esdt": { "str:FWD-TOKEN": "700", "str:NFT-123456": { @@ -130,9 +130,6 @@ "str:NFT-123456", "1", "1", - "str:EGLD-000000", - "0", - "100", "str:SFT-456789", "3", "6" @@ -159,7 +156,7 @@ }, "sc:vault": { "nonce": "0", - "balance": "100", + "balance": "0", "esdt": { "str:FWD-TOKEN": "800", "str:NFT-123456": { @@ -186,7 +183,7 @@ }, "sc:forwarder": { "nonce": "0", - "balance": "3900", + "balance": "0", "esdt": { "str:FWD-TOKEN": "200", "str:SFT-456789": { @@ -203,4 +200,4 @@ } } ] -} \ No newline at end of file +} diff --git a/contracts/feature-tests/composability/scenarios/forwarder_call_async_multi_transfer_egld.scen.json b/contracts/feature-tests/composability/scenarios/forwarder_call_async_multi_transfer_egld.scen.json new file mode 100644 index 0000000000..7dc86ee64f --- /dev/null +++ b/contracts/feature-tests/composability/scenarios/forwarder_call_async_multi_transfer_egld.scen.json @@ -0,0 +1,206 @@ +{ + "gasSchedule": "v3", + "steps": [ + { + "step": "setState", + "accounts": { + "address:a_user": { + "nonce": "0", + "balance": "0" + }, + "sc:forwarder": { + "nonce": "0", + "balance": "4000", + "esdt": { + "str:FWD-TOKEN": "1000", + "str:NFT-123456": { + "instances": [ + { + "nonce": "1", + "balance": "1" + } + ] + }, + "str:SFT-456789": { + "instances": [ + { + "nonce": "3", + "balance": "10" + } + ] + } + }, + "code": "mxsc:../forwarder/output/forwarder.mxsc.json" + }, + "sc:vault": { + "nonce": "0", + "balance": "0", + "code": "mxsc:../vault/output/vault.mxsc.json" + } + } + }, + { + "step": "scCall", + "id": "1", + "comment": "send fungible twice", + "tx": { + "from": "address:a_user", + "to": "sc:forwarder", + "function": "send_async_accept_multi_transfer", + "arguments": [ + "sc:vault", + "str:FWD-TOKEN", + "0", + "100", + "str:FWD-TOKEN", + "0", + "200" + ], + "gasLimit": "80,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "0", + "message": "", + "gas": "*", + "refund": "*" + } + }, + { + "step": "checkState", + "accounts": { + "address:a_user": { + "nonce": "*", + "balance": "0", + "storage": {}, + "code": "" + }, + "sc:vault": { + "nonce": "0", + "balance": "0", + "esdt": { + "str:FWD-TOKEN": "300" + }, + "storage": { + "str:call_counts|nested:str:accept_funds": "1" + }, + "code": "mxsc:../vault/output/vault.mxsc.json" + }, + "sc:forwarder": { + "nonce": "0", + "balance": "4000", + "esdt": { + "str:FWD-TOKEN": "700", + "str:NFT-123456": { + "instances": [ + { + "nonce": "1", + "balance": "1" + } + ] + }, + "str:SFT-456789": { + "instances": [ + { + "nonce": "3", + "balance": "10" + } + ] + } + }, + "storage": {}, + "code": "mxsc:../forwarder/output/forwarder.mxsc.json" + } + } + }, + { + "step": "scCall", + "id": "2", + "comment": "send all types", + "tx": { + "from": "address:a_user", + "to": "sc:forwarder", + "function": "send_async_accept_multi_transfer", + "arguments": [ + "sc:vault", + "str:FWD-TOKEN", + "0", + "500", + "str:NFT-123456", + "1", + "1", + "str:EGLD-000000", + "0", + "100", + "str:SFT-456789", + "3", + "6" + ], + "gasLimit": "80,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "0", + "message": "", + "gas": "*", + "refund": "*" + } + }, + { + "step": "checkState", + "accounts": { + "address:a_user": { + "nonce": "*", + "balance": "0", + "storage": {}, + "code": "" + }, + "sc:vault": { + "nonce": "0", + "balance": "100", + "esdt": { + "str:FWD-TOKEN": "800", + "str:NFT-123456": { + "instances": [ + { + "nonce": "1", + "balance": "1" + } + ] + }, + "str:SFT-456789": { + "instances": [ + { + "nonce": "3", + "balance": "6" + } + ] + } + }, + "storage": { + "str:call_counts|nested:str:accept_funds": "2" + }, + "code": "mxsc:../vault/output/vault.mxsc.json" + }, + "sc:forwarder": { + "nonce": "0", + "balance": "3900", + "esdt": { + "str:FWD-TOKEN": "200", + "str:SFT-456789": { + "instances": [ + { + "nonce": "3", + "balance": "4" + } + ] + } + }, + "code": "mxsc:../forwarder/output/forwarder.mxsc.json" + } + } + } + ] +} \ No newline at end of file diff --git a/contracts/feature-tests/payable-features/scenarios/call-value-check-multi-egld.scen.json b/contracts/feature-tests/payable-features/scenarios/call-value-check-multi-egld.scen.json new file mode 100644 index 0000000000..8490c055fe --- /dev/null +++ b/contracts/feature-tests/payable-features/scenarios/call-value-check-multi-egld.scen.json @@ -0,0 +1,128 @@ +{ + "steps": [ + { + "step": "setState", + "accounts": { + "sc:payable-features": { + "nonce": "0", + "balance": "0", + "code": "mxsc:../output/payable-features.mxsc.json" + }, + "address:an-account": { + "nonce": "0", + "balance": "10000", + "esdt": { + "str:TOK-123456": "1000", + "str:OTHERTOK-123456": "500", + "str:SFT-123": { + "instances": [ + { + "nonce": "5", + "balance": "20" + } + ] + } + } + } + } + }, + { + "step": "scCall", + "id": "call-value-egld", + "tx": { + "from": "address:an-account", + "to": "sc:payable-features", + "egldValue": "100", + "function": "echo_call_value", + "arguments": [], + "gasLimit": "50,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [ + "100", + "" + ], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "call-value-single-esdt", + "tx": { + "from": "address:an-account", + "to": "sc:payable-features", + "esdtValue": [ + { + "tokenIdentifier": "str:TOK-123456", + "value": "100" + } + ], + "function": "echo_call_value", + "arguments": [], + "gasLimit": "50,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [ + "0", + [ + "nested:str:TOK-123456|u64:0|biguint:100" + ] + ], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "call-value-multi-esdt", + "tx": { + "from": "address:an-account", + "to": "sc:payable-features", + "esdtValue": [ + { + "tokenIdentifier": "str:EGLD-000000", + "value": "15" + }, + { + "tokenIdentifier": "str:TOK-123456", + "value": "100" + }, + { + "tokenIdentifier": "str:OTHERTOK-123456", + "value": "400" + }, + { + "tokenIdentifier": "str:SFT-123", + "nonce": "5", + "value": "10" + } + ], + "function": "echo_call_value", + "arguments": [], + "gasLimit": "50,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [ + "15", + [ + "nested:str:TOK-123456|u64:0|biguint:100", + "nested:str:OTHERTOK-123456|u64:0|biguint:400", + "nested:str:SFT-123|u64:5|biguint:10" + ] + ], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + } + ] +} \ No newline at end of file diff --git a/contracts/feature-tests/payable-features/scenarios/call-value-check.scen.json b/contracts/feature-tests/payable-features/scenarios/call-value-check.scen.json index 8490c055fe..23da3773d6 100644 --- a/contracts/feature-tests/payable-features/scenarios/call-value-check.scen.json +++ b/contracts/feature-tests/payable-features/scenarios/call-value-check.scen.json @@ -86,10 +86,6 @@ "from": "address:an-account", "to": "sc:payable-features", "esdtValue": [ - { - "tokenIdentifier": "str:EGLD-000000", - "value": "15" - }, { "tokenIdentifier": "str:TOK-123456", "value": "100" @@ -111,7 +107,7 @@ }, "expect": { "out": [ - "15", + "0", [ "nested:str:TOK-123456|u64:0|biguint:100", "nested:str:OTHERTOK-123456|u64:0|biguint:400", @@ -125,4 +121,4 @@ } } ] -} \ No newline at end of file +} diff --git a/contracts/feature-tests/payable-features/scenarios/payable_multi_array.scen.json b/contracts/feature-tests/payable-features/scenarios/payable_multi_array.scen.json index 16fa1cea20..b05028dfae 100644 --- a/contracts/feature-tests/payable-features/scenarios/payable_multi_array.scen.json +++ b/contracts/feature-tests/payable-features/scenarios/payable_multi_array.scen.json @@ -52,11 +52,6 @@ "tokenIdentifier": "str:SFT-123", "nonce": "5", "value": "10" - }, - { - "tokenIdentifier": "str:EGLD-000000", - "nonce": "0", - "value": "103" } ], "function": "payment_array_3", @@ -116,7 +111,7 @@ "value": "100" }, { - "tokenIdentifier": "str:EGLD-000000", + "tokenIdentifier": "str:TOK-000002", "value": "400" }, { @@ -133,7 +128,7 @@ "expect": { "out": [ "nested:str:TOK-000001|u64:0|biguint:100", - "nested:str:EGLD-000000|u64:0|biguint:400", + "nested:str:TOK-000002|u64:0|biguint:400", "nested:str:SFT-123|u64:5|biguint:10" ], "status": "", @@ -143,4 +138,4 @@ } } ] -} \ No newline at end of file +} diff --git a/contracts/feature-tests/payable-features/scenarios/payable_multi_array_egld.scen.json b/contracts/feature-tests/payable-features/scenarios/payable_multi_array_egld.scen.json new file mode 100644 index 0000000000..16fa1cea20 --- /dev/null +++ b/contracts/feature-tests/payable-features/scenarios/payable_multi_array_egld.scen.json @@ -0,0 +1,146 @@ +{ + "name": "payable", + "gasSchedule": "v3", + "steps": [ + { + "step": "setState", + "accounts": { + "sc:payable-features": { + "nonce": "0", + "balance": "0", + "code": "mxsc:../output/payable-features.mxsc.json" + }, + "address:an-account": { + "nonce": "0", + "balance": "10000", + "esdt": { + "str:TOK-000001": "1000", + "str:TOK-000002": "500", + "str:TOK-000003": "500", + "str:SFT-123": { + "instances": [ + { + "nonce": "5", + "balance": "20" + } + ] + } + } + } + } + }, + { + "step": "scCall", + "id": "payment-array-too-many", + "tx": { + "from": "address:an-account", + "to": "sc:payable-features", + "esdtValue": [ + { + "tokenIdentifier": "str:TOK-000001", + "value": "100" + }, + { + "tokenIdentifier": "str:TOK-000002", + "value": "400" + }, + { + "tokenIdentifier": "str:TOK-000003", + "value": "400" + }, + { + "tokenIdentifier": "str:SFT-123", + "nonce": "5", + "value": "10" + }, + { + "tokenIdentifier": "str:EGLD-000000", + "nonce": "0", + "value": "103" + } + ], + "function": "payment_array_3", + "arguments": [], + "gasLimit": "50,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "4", + "message": "str:incorrect number of ESDT transfers", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "payment-array-too-few", + "tx": { + "from": "address:an-account", + "to": "sc:payable-features", + "esdtValue": [ + { + "tokenIdentifier": "str:TOK-000001", + "value": "100" + }, + { + "tokenIdentifier": "str:SFT-123", + "nonce": "5", + "value": "10" + } + ], + "function": "payment_array_3", + "arguments": [], + "gasLimit": "50,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "4", + "message": "str:incorrect number of ESDT transfers", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "payment-array-ok", + "tx": { + "from": "address:an-account", + "to": "sc:payable-features", + "esdtValue": [ + { + "tokenIdentifier": "str:TOK-000001", + "value": "100" + }, + { + "tokenIdentifier": "str:EGLD-000000", + "value": "400" + }, + { + "tokenIdentifier": "str:SFT-123", + "nonce": "5", + "value": "10" + } + ], + "function": "payment_array_3", + "arguments": [], + "gasLimit": "50,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [ + "nested:str:TOK-000001|u64:0|biguint:100", + "nested:str:EGLD-000000|u64:0|biguint:400", + "nested:str:SFT-123|u64:5|biguint:10" + ], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + } + ] +} \ No newline at end of file diff --git a/contracts/feature-tests/payable-features/scenarios/payable_multiple.scen.json b/contracts/feature-tests/payable-features/scenarios/payable_multiple.scen.json index 28e667b322..45d92e9fa7 100644 --- a/contracts/feature-tests/payable-features/scenarios/payable_multiple.scen.json +++ b/contracts/feature-tests/payable-features/scenarios/payable_multiple.scen.json @@ -47,11 +47,6 @@ "tokenIdentifier": "str:SFT-123", "nonce": "5", "value": "10" - }, - { - "tokenIdentifier": "str:EGLD-000000", - "nonce": "0", - "value": "120" } ], "function": "payment_multiple", @@ -64,8 +59,7 @@ [ "nested:str:TOK-123456|u64:0|biguint:100|", "nested:str:OTHERTOK-123456|u64:0|biguint:400", - "nested:str:SFT-123|u64:5|biguint:10", - "nested:str:EGLD-000000|u64:0|biguint:120" + "nested:str:SFT-123|u64:5|biguint:10" ] ], "status": "", @@ -75,4 +69,4 @@ } } ] -} \ No newline at end of file +} diff --git a/contracts/feature-tests/payable-features/scenarios/payable_multiple_egld.scen.json b/contracts/feature-tests/payable-features/scenarios/payable_multiple_egld.scen.json new file mode 100644 index 0000000000..28e667b322 --- /dev/null +++ b/contracts/feature-tests/payable-features/scenarios/payable_multiple_egld.scen.json @@ -0,0 +1,78 @@ +{ + "name": "payable", + "gasSchedule": "v3", + "steps": [ + { + "step": "setState", + "accounts": { + "sc:payable-features": { + "nonce": "0", + "balance": "0", + "code": "mxsc:../output/payable-features.mxsc.json" + }, + "address:an-account": { + "nonce": "0", + "balance": "10000", + "esdt": { + "str:TOK-123456": "1000", + "str:OTHERTOK-123456": "500", + "str:SFT-123": { + "instances": [ + { + "nonce": "5", + "balance": "20" + } + ] + } + } + } + } + }, + { + "step": "scCall", + "id": "payment-multiple", + "tx": { + "from": "address:an-account", + "to": "sc:payable-features", + "esdtValue": [ + { + "tokenIdentifier": "str:TOK-123456", + "value": "100" + }, + { + "tokenIdentifier": "str:OTHERTOK-123456", + "value": "400" + }, + { + "tokenIdentifier": "str:SFT-123", + "nonce": "5", + "value": "10" + }, + { + "tokenIdentifier": "str:EGLD-000000", + "nonce": "0", + "value": "120" + } + ], + "function": "payment_multiple", + "arguments": [], + "gasLimit": "50,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [ + [ + "nested:str:TOK-123456|u64:0|biguint:100|", + "nested:str:OTHERTOK-123456|u64:0|biguint:400", + "nested:str:SFT-123|u64:5|biguint:10", + "nested:str:EGLD-000000|u64:0|biguint:120" + ] + ], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + } + ] +} \ No newline at end of file