-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1227 from thounyy/master
NFT Subscription module
- Loading branch information
Showing
18 changed files
with
1,013 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
/target/ | ||
*/target/ | ||
|
||
# The mxpy output | ||
output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "nft-subscription" | ||
version = "0.0.0" | ||
authors = ["Thouny <[email protected]>"] | ||
edition = "2021" | ||
publish = false | ||
|
||
[lib] | ||
path = "src/lib.rs" | ||
|
||
[dependencies.multiversx-sc] | ||
version = "0.43.4" | ||
path = "../../../framework/base" | ||
|
||
[dependencies.multiversx-sc-modules] | ||
version = "0.43.4" | ||
path = "../../../contracts/modules" | ||
|
||
[dev-dependencies.multiversx-sc-scenario] | ||
version = "0.43.4" | ||
path = "../../../framework/scenario" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "nft-subscription-meta" | ||
version = "0.0.0" | ||
authors = ["Thouny <[email protected]>"] | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies.nft-subscription] | ||
path = ".." | ||
|
||
[dependencies.multiversx-sc-meta] | ||
version = "0.43.4" | ||
path = "../../../../framework/meta" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
multiversx_sc_meta::cli_main::<nft_subscription::AbiProvider>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"language": "rust" | ||
} |
78 changes: 78 additions & 0 deletions
78
contracts/examples/nft-subscription/scenarios/init.scen.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"name": "init", | ||
"steps": [ | ||
{ | ||
"step": "setState", | ||
"accounts": { | ||
"address:owner": { | ||
"nonce": "0", | ||
"balance": "0" | ||
}, | ||
"address:buyer": { | ||
"nonce": "0", | ||
"balance": "1000" | ||
} | ||
}, | ||
"newAddresses": [ | ||
{ | ||
"creatorAddress": "address:owner", | ||
"creatorNonce": "0", | ||
"newAddress": "sc:nft-subscription" | ||
} | ||
] | ||
}, | ||
{ | ||
"step": "scDeploy", | ||
"id": "deploy", | ||
"tx": { | ||
"from": "address:owner", | ||
"contractCode": "file:../output/nft-subscription.wasm", | ||
"arguments": [], | ||
"gasLimit": "10,000,000", | ||
"gasPrice": "0" | ||
}, | ||
"expect": { | ||
"out": [], | ||
"status": "0", | ||
"logs": [], | ||
"gas": "*", | ||
"refund": "*" | ||
} | ||
}, | ||
{ | ||
"step": "checkState", | ||
"accounts": { | ||
"sc:nft-subscription": { | ||
"nonce": "0", | ||
"balance": "0", | ||
"storage": {}, | ||
"code": "file:../output/nft-subscription.wasm" | ||
}, | ||
"+": "" | ||
} | ||
}, | ||
{ | ||
"step": "setState", | ||
"accounts": { | ||
"sc:nft-subscription": { | ||
"nonce": "0", | ||
"balance": "0", | ||
"esdt": { | ||
"str:NFT-123456": { | ||
"lastNonce": "0", | ||
"roles": [ | ||
"ESDTRoleNFTCreate", | ||
"ESDTRoleNFTUpdateAttributes" | ||
] | ||
} | ||
}, | ||
"storage": { | ||
"str:tokenId": "str:NFT-123456" | ||
}, | ||
"code": "file:../output/nft-subscription.wasm", | ||
"owner": "address:owner" | ||
} | ||
} | ||
} | ||
] | ||
} |
92 changes: 92 additions & 0 deletions
92
contracts/examples/nft-subscription/scenarios/mint_nft.scen.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
{ | ||
"name": "mint and update nft", | ||
"steps": [ | ||
{ | ||
"step": "externalSteps", | ||
"path": "init.scen.json" | ||
}, | ||
{ | ||
"step": "scCall", | ||
"id": "create-NFT-1", | ||
"tx": { | ||
"from": "address:owner", | ||
"to": "sc:nft-subscription", | ||
"function": "mint", | ||
"arguments": [], | ||
"gasLimit": "20,000,000", | ||
"gasPrice": "0" | ||
} | ||
}, | ||
{ | ||
"step": "checkState", | ||
"accounts": { | ||
"address:owner": { | ||
"nonce": "2", | ||
"balance": "0", | ||
"esdt": { | ||
"str:NFT-123456": { | ||
"instances": [ | ||
{ | ||
"nonce": "1", | ||
"balance": "1", | ||
"creator": "sc:nft-subscription", | ||
"attributes": { | ||
"0-expiration": "u64:0", | ||
"1-attributes": "nested:str:common" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"+": "" | ||
} | ||
}, | ||
{ | ||
"step": "scCall", | ||
"id": "update-NFT-1", | ||
"tx": { | ||
"from": "address:owner", | ||
"to": "sc:nft-subscription", | ||
"esdtValue": [ | ||
{ | ||
"tokenIdentifier": "str:NFT-123456", | ||
"nonce": "1", | ||
"value": "1" | ||
} | ||
], | ||
"function": "update_attributes", | ||
"arguments": [ | ||
"str:rare" | ||
], | ||
"gasLimit": "20,000,000", | ||
"gasPrice": "0" | ||
} | ||
}, | ||
{ | ||
"step": "checkState", | ||
"accounts": { | ||
"address:owner": { | ||
"nonce": "3", | ||
"balance": "0", | ||
"esdt": { | ||
"str:NFT-123456": { | ||
"instances": [ | ||
{ | ||
"nonce": "1", | ||
"balance": "1", | ||
"creator": "sc:nft-subscription", | ||
"attributes": { | ||
"0-expiration": "u64:0", | ||
"1-attributes": "nested:str:rare" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"+": "" | ||
} | ||
} | ||
] | ||
} |
Oops, something went wrong.