From 5c3d95c5915dcb94b5cb9a8f89ed3928914f737f Mon Sep 17 00:00:00 2001 From: BiancaIalangi Date: Mon, 19 Feb 2024 17:42:01 +0200 Subject: [PATCH 1/3] add payable token test --- .../scenarios/payable_token_5.scen.json | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 test/features/payable-features/scenarios/payable_token_5.scen.json diff --git a/test/features/payable-features/scenarios/payable_token_5.scen.json b/test/features/payable-features/scenarios/payable_token_5.scen.json new file mode 100644 index 000000000..45dd8eb6d --- /dev/null +++ b/test/features/payable-features/scenarios/payable_token_5.scen.json @@ -0,0 +1,118 @@ +{ + "name": "payable", + "gasSchedule": "v3", + "steps": [ + { + "step": "setState", + "accounts": { + "sc:payable-features": { + "nonce": "0", + "balance": "0", + "code": "mxsc:../output/payable-features.mxsc.json", + "codeMetadata": "0x0000" + }, + "address:an-account": { + "nonce": "0", + "balance": "1,000,000,000,000", + "esdt": { + "str:PAYABLE-FEATURES-TOKEN": "1,000,000,000,000", + "str:OTHER-TOKEN": "1,000,000,000,000" + } + } + } + }, + { + "step": "scCall", + "id": "payable_token_1.1", + "tx": { + "from": "address:an-account", + "to": "sc:payable-features", + "function": "payable_token_1", + "arguments": [], + "gasLimit": "50,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "4", + "message": "str:function expects single ESDT payment", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "payable_token_1.2", + "tx": { + "from": "address:an-account", + "to": "sc:payable-features", + "egldValue": "5", + "function": "payable_token_1", + "arguments": [], + "gasLimit": "50,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "4", + "message": "str:function expects single ESDT payment", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "payable_token_1.3", + "tx": { + "from": "address:an-account", + "to": "sc:payable-features", + "esdtValue": [ + { + "tokenIdentifier": "str:PAYABLE-FEATURES-TOKEN", + "value": "100" + } + ], + "function": "payable_token_1", + "arguments": [], + "gasLimit": "50,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "4", + "message":"str:function expects single ESDT payment", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "payable_token_1.4", + "tx": { + "from": "address:an-account", + "to": "sc:payable-features", + "esdtValue": [ + { + "tokenIdentifier": "str:OTHER-TOKEN", + "value": "100" + } + ], + "function": "payable_token_1", + "arguments": [], + "gasLimit": "50,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "4", + "message": "str:function expects single ESDT payment", + "logs": "*", + "gas": "*", + "refund": "*" + } + } + ] +} \ No newline at end of file From 815601a8510e4d6093667a1d43b414b5254eea00 Mon Sep 17 00:00:00 2001 From: BiancaIalangi Date: Tue, 20 Feb 2024 16:23:54 +0200 Subject: [PATCH 2/3] change test --- .../payable-features/scenarios/payable_token_5.scen.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/features/payable-features/scenarios/payable_token_5.scen.json b/test/features/payable-features/scenarios/payable_token_5.scen.json index 45dd8eb6d..4a6d7840c 100644 --- a/test/features/payable-features/scenarios/payable_token_5.scen.json +++ b/test/features/payable-features/scenarios/payable_token_5.scen.json @@ -80,9 +80,8 @@ "gasPrice": "0" }, "expect": { - "out": [], - "status": "4", - "message":"str:function expects single ESDT payment", + "out": ["0x64", "0x50415941424c452d46454154555245532d544f4b454e"], + "status": "0", "logs": "*", "gas": "*", "refund": "*" @@ -108,7 +107,7 @@ "expect": { "out": [], "status": "4", - "message": "str:function expects single ESDT payment", + "message": "str:bad call value token provided", "logs": "*", "gas": "*", "refund": "*" From 4998680d67461fc71c6a750068f7c97faf46f5ce Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 27 Feb 2024 00:59:41 +0200 Subject: [PATCH 3/3] go.mod scenario-go update --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 04db5ae6d..49244a82b 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/multiversx/mx-chain-core-go v1.2.19-0.20240129082057-a76d0c995cf2 github.com/multiversx/mx-chain-crypto-go v1.2.10-0.20231206065052-38843c1f1479 github.com/multiversx/mx-chain-logger-go v1.0.14-0.20240129144507-d00e967c890c - github.com/multiversx/mx-chain-scenario-go v1.4.3-0.20240212160120-cc32d1580157 + github.com/multiversx/mx-chain-scenario-go v1.4.3-0.20240226225444-a29ebbc3b810 github.com/multiversx/mx-chain-storage-go v1.0.15-0.20240129144933-b1c0d642d7f8 github.com/multiversx/mx-chain-vm-common-go v1.5.12-0.20240129145149-4fe61574f566 github.com/multiversx/mx-components-big-int v1.0.0 diff --git a/go.sum b/go.sum index 5a6108acb..d6d3d79ee 100644 --- a/go.sum +++ b/go.sum @@ -89,8 +89,8 @@ github.com/multiversx/mx-chain-crypto-go v1.2.10-0.20231206065052-38843c1f1479 h github.com/multiversx/mx-chain-crypto-go v1.2.10-0.20231206065052-38843c1f1479/go.mod h1:Ap6p7QZFtwPlb++OvCG+85BfuZ+bLP/JtQp6EwjWJsI= github.com/multiversx/mx-chain-logger-go v1.0.14-0.20240129144507-d00e967c890c h1:QIUOn8FgNRa5cir4BCWHZi/Qcr6Gg0eGNhns4+jy6+k= github.com/multiversx/mx-chain-logger-go v1.0.14-0.20240129144507-d00e967c890c/go.mod h1:fH/fR/GEBsDjPkBoZDVJMoYo2HhlA7++DP6QfITJ1N8= -github.com/multiversx/mx-chain-scenario-go v1.4.3-0.20240212160120-cc32d1580157 h1:ydzN3f+Y7H0InXuxAcNUSyVc+omNYL8uYtLqVzqaaX4= -github.com/multiversx/mx-chain-scenario-go v1.4.3-0.20240212160120-cc32d1580157/go.mod h1:ndk45i9J9McuCJpTcgiaK4ocd0yhnBBCPrlFwO6GRcs= +github.com/multiversx/mx-chain-scenario-go v1.4.3-0.20240226225444-a29ebbc3b810 h1:IE8YYGAnEvX8ebYVq0bje/iWPsAOaajEpuYksC1QB4w= +github.com/multiversx/mx-chain-scenario-go v1.4.3-0.20240226225444-a29ebbc3b810/go.mod h1:ndk45i9J9McuCJpTcgiaK4ocd0yhnBBCPrlFwO6GRcs= github.com/multiversx/mx-chain-storage-go v1.0.15-0.20240129144933-b1c0d642d7f8 h1:/EYv/HGX0OKbeNFt667J0yZRtuJiZH0lEK8YtobuH/c= github.com/multiversx/mx-chain-storage-go v1.0.15-0.20240129144933-b1c0d642d7f8/go.mod h1:zl1A6teNe39T8yhdZlkX3ckm5aLYrMIJJZ6Ord1E71M= github.com/multiversx/mx-chain-vm-common-go v1.5.12-0.20240129145149-4fe61574f566 h1:zImJa/r6B5L2OLWbKTn5io53U11PPGDla12H2OaJ9y0=