Skip to content

Commit

Permalink
Merge pull request #35 from multiversx/marketplace-with-offer-feature
Browse files Browse the repository at this point in the history
marketplace with offer feature
  • Loading branch information
psorinionut committed Jan 12, 2023
2 parents f31dcac + 0bc0cb2 commit b0eb431
Show file tree
Hide file tree
Showing 13 changed files with 1,118 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: ElrondNetwork/elrond-actions/.github/workflows/contracts.yml@v1
with:
rust-toolchain: nightly-2022-03-01
vmtools-version: v1.4.43
vmtools-version: v1.4.60
extra-build-args: --ignore-eei-checks
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
121 changes: 121 additions & 0 deletions esdt-nft-marketplace/mandos/offer_token.scen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"name": "offer token",
"gasSchedule": "v4",
"steps": [
{
"step": "externalSteps",
"path": "init.scen.json"
},
{
"step": "setState",
"comment": "set current block timestamp",
"currentBlockInfo": {
"blockTimestamp": "123,000"
}
},
{
"step": "scCall",
"txId": "offer token error",
"tx": {
"from": "address:first_bidder",
"to": "sc:marketplace",
"value": "10",
"function": "sendOffer",
"arguments": [
"str:NFT-123456",
"1",
"1",
"123,000",
"0"
],
"gasLimit": "15,000,000",
"gasPrice": "0"
},
"expect": {
"status": "4",
"message": "str:Deadline can't be in the past!",
"gas": "*",
"refund": "*"
}
},
{
"step": "scCall",
"txId": "offer token success",
"tx": {
"from": "address:first_bidder",
"to": "sc:marketplace",
"value": "10",
"function": "sendOffer",
"arguments": [
"str:NFT-123456",
"1",
"1",
"125,000"
],
"gasLimit": "15,000,000",
"gasPrice": "0"
},
"expect": {
"status": "0",
"message": "",
"out": [ "1" ],
"gas": "*",
"refund": "*"
}
},
{
"step": "checkState",
"accounts": {
"address:seller": {
"nonce": "0",
"balance": "0",
"esdt": {
"str:NFT-123456": {
"instances": [
{
"nonce": "1",
"balance": "1",
"creator": "address:nft_creator",
"royalties": "2000"
}
]
},
"str:SFT-123456": {
"instances": [
{
"nonce": "1",
"balance": "10",
"creator": "address:nft_creator",
"royalties": "2000"
}
]
}
},
"storage": {}
},
"address:first_bidder": {
"nonce": "2",
"balance": "990",
"storage": {}
},
"sc:marketplace": {
"nonce": "0",
"balance": "10",
"storage": {
"str:bidCutPercentage": "1000",
"str:lastValidOfferId": "1",
"str:offerById|u64:1": {
"01-offer_token": "nested:str:NFT-123456|u64:1|biguint:1",
"01-payment": "nested:str:EGLD|u64:0|biguint:10",
"04-start_time": "u64:123,000",
"05-deadline": "u64:125,000",
"06-offer_owner": "address:first_bidder"
}
},
"code": "file:../output/esdt-nft-marketplace.wasm"
},
"+": {}
}
}
]
}
109 changes: 109 additions & 0 deletions esdt-nft-marketplace/mandos/offer_token_accept.scen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"name": "offer token",
"gasSchedule": "v4",
"steps": [
{
"step": "externalSteps",
"path": "offer_token.scen.json"
},
{
"step": "setState",
"comment": "set current block timestamp",
"currentBlockInfo": {
"blockTimestamp": "124,500"
}
},
{
"step": "scCall",
"txId": "offer token success",
"tx": {
"from": "address:seller",
"to": "sc:marketplace",
"value": "0",
"function": "acceptOffer",
"esdt": {
"tokenIdentifier": "str:NFT-123456",
"nonce": "1",
"value": "1"
},
"arguments": [
"1"
],
"gasLimit": "15,000,000",
"gasPrice": "0"
},
"expect": {
"status": "0",
"message": "",
"gas": "*",
"refund": "*"
}
},
{
"step": "checkState",
"accounts": {
"address:seller": {
"nonce": "1",
"balance": "7",
"esdt": {
"str:SFT-123456": {
"instances": [
{
"nonce": "1",
"balance": "10",
"creator": "address:nft_creator",
"royalties": "2000"
}
]
}
},
"storage": {}
},
"address:first_bidder": {
"nonce": "2",
"balance": "990",
"esdt": {
"str:NFT-123456": {
"instances": [
{
"nonce": "1",
"balance": "1",
"creator": "address:nft_creator",
"royalties": "2000"
}
]
}
},
"storage": {}
},
"address:owner": {
"nonce": "1",
"balance": "1",
"storage": {}
},
"address:nft_creator": {
"nonce": "0",
"balance": "2",
"esdt": {
"str:NFT-123456": {
"roles": [
"ESDTRoleNFTCreate"
]
}
},
"storage": {}
},
"sc:marketplace": {
"nonce": "0",
"balance": "0",
"storage": {
"str:bidCutPercentage": "1000",
"str:lastValidOfferId": "1"
},
"code": "file:../output/esdt-nft-marketplace.wasm"
},
"+": {}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
{
"name": "auction token",
"gasSchedule": "v4",
"steps": [
{
"step": "externalSteps",
"path": "auction_token.scen.json"
},
{
"step": "scCall",
"txId": "offer token success",
"tx": {
"from": "address:first_bidder",
"to": "sc:marketplace",
"value": "10",
"function": "sendOffer",
"arguments": [
"str:NFT-123456",
"1",
"1",
"125,000",
"1"
],
"gasLimit": "15,000,000",
"gasPrice": "0"
},
"expect": {
"status": "0",
"message": "",
"out": [ "1" ],
"gas": "*",
"refund": "*"
}
},
{
"step": "scCall",
"txId": "first bid",
"tx": {
"from": "address:first_bidder",
"to": "sc:marketplace",
"value": "100",
"function": "bid",
"arguments": [
"1",
"str:NFT-123456",
"1"
],
"gasLimit": "15,000,000",
"gasPrice": "0"
},
"expect": {
"status": "0",
"message": "",
"gas": "*",
"refund": "*"
}
},
{
"step": "scCall",
"txId": "withdraw and accept",
"tx": {
"from": "address:seller",
"to": "sc:marketplace",
"value": "0",
"function": "withdrawAuctionAndAcceptOffer",
"arguments": [
"1",
"1"
],
"gasLimit": "15,000,000",
"gasPrice": "0"
},
"expect": {
"status": "4",
"message": "str:NFT auction has active bids",
"gas": "*",
"refund": "*"
}
},
{
"step": "checkState",
"accounts": {
"address:seller": {
"nonce": "2",
"balance": "0",
"esdt": {
"str:NFT-123456": {
"instances": []
},
"str:SFT-123456": {
"instances": [
{
"nonce": "1",
"balance": "10",
"creator": "address:nft_creator",
"royalties": "2000"
}
]
}
},
"storage": {}
},
"sc:marketplace": {
"nonce": "0",
"balance": "110",
"esdt": {
"str:NFT-123456": {
"instances": [
{
"nonce": "1",
"balance": "1",
"creator": "address:nft_creator",
"royalties": "2000"
}
]
}
},
"storage": {
"str:bidCutPercentage": "1000",
"str:lastValidAuctionId": "1",
"str:auctionById|u64:1": {
"00-auctioned_token": "nested:str:NFT-123456|u64:1",
"01-nr_auctioned_tokens": "biguint:1",
"02-auction_type": "u8:1",
"04-payment_token": "nested:str:EGLD|u64:0",
"05-min_bid": "biguint:100",
"06-max_bid": "u8:1|biguint:1000",
"07-min_bid_diff": "biguint:0",
"08-start_time": "u64:123,000",
"09-deadline": "u64:123,456",
"10-original_owner": "address:seller",
"11-current_bid": "biguint:100",
"12-current_winner": "address:first_bidder",
"13-marketplace_cut_percentage": "biguint:1000",
"14-creator_royalties_percentage": "biguint:2000"
},
"str:lastValidOfferId": "1",
"str:offerById|u64:1": {
"01-offer_token": "nested:str:NFT-123456|u64:1|biguint:1",
"01-payment": "nested:str:EGLD|u64:0|biguint:10",
"04-start_time": "u64:123,000",
"05-deadline": "u64:125,000",
"06-offer_owner": "address:first_bidder"
}
},
"code": "file:../output/esdt-nft-marketplace.wasm"
},
"+": {}
}
}
]
}
Loading

0 comments on commit b0eb431

Please sign in to comment.