Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insert payable token test #832

Draft
wants to merge 3 commits into
base: rc/v1.7.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
117 changes: 117 additions & 0 deletions test/features/payable-features/scenarios/payable_token_5.scen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
{
"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": ["0x64", "0x50415941424c452d46454154555245532d544f4b454e"],
"status": "0",
"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:bad call value token provided",
"logs": "*",
"gas": "*",
"refund": "*"
}
}
]
}
Loading