tx · DFRTPFnUanQgUyoLbxExrRgPpPFEAQ1b8s5iqfe4im5j 3NBYw8rxLmTvyEdsvaYor8nHG6GJ4NjB2Aw: -0.01000000 Waves 2023.01.23 14:28 [2417532] smart account 3NBYw8rxLmTvyEdsvaYor8nHG6GJ4NjB2Aw > SELF 0.00000000 Waves
{ "type": 13, "id": "DFRTPFnUanQgUyoLbxExrRgPpPFEAQ1b8s5iqfe4im5j", "fee": 1000000, "feeAssetId": null, "timestamp": 1674473411601, "version": 2, "chainId": 84, "sender": "3NBYw8rxLmTvyEdsvaYor8nHG6GJ4NjB2Aw", "senderPublicKey": "4NDsd3dGKXuKLCoSbYvcWCX276K9ShP75cs9HTBMLJEN", "proofs": [ "3DRHqHJeQuw8WtoopURo9r5F8DaV36aMuKVmAzJYgGBXPTyLNeVn7aBW1NRsZWiNkt3TNkvBpZmyKPEkwJBrkp3j" ], "script": "base64:BgIbCAISCwoJCAgICAgBCAgIEgQKAggIEgQKAggICQAJc2VwYXJhdG9yAgFfAARrQnV5AgNidXkABmtQcmljZQIFcHJpY2UABWtTZWxsAgRzZWxsABJtYXhBdWN0aW9uRHVyYXRpb24ABwAEa0JpZAIDYmlkAAxzdGF0dXNGb3JORlQJAJYKBAIET1BFTgIGQ0xPU0VEAghSRVdBUkRFRAIIQ0FOQ0VMRUQAC2RBcHBBZGRyZXNzARoBVEq4T2zewtqT7fSO6Uo2+NVPf5XVVVtdoAEFaXNOZnQBB2Fzc2V0SWQEByRtYXRjaDAJAOwHAQUHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgVBc3NldAQFdG9rZW4FByRtYXRjaDADAwkAAAIIBQV0b2tlbghkZWNpbWFscwAACQAAAggFBXRva2VuCHF1YW50aXR5AAEHCQAAAggFBXRva2VuCnJlaXNzdWFibGUHBwcDAWkBCWNyZWF0ZU5mdAkIbmZ0X25hbWUJbmZ0X293bmVyD25mdF9kQXBwQWRkcmVzcwhuZnRfdHlwZQhuZnRfdGFncxFuZnRfc2VsbGluZ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mtQcmljZQUJc2VwYXJhdG9yBQVuZnRJRAIBXwURY3VycmVudF9uZnRfb3duZXIDCQECIT0CCAkAkQMCCAUBaQhwYXltZW50cwAAB2Fzc2V0SWQFBHVuaXQJAAIBAiNPbmx5IHBheSBpbiBBU0lNSSBvciBXQVZFUyBhY2NlcHRlZAMJAAACBRFjdXJyZW50X25mdF9vd25lcgkApQgBCAUBaQZjYWxsZXIJAAIBAiljdXJyZW50IE93bmVyIG9mIE5GVCBub3QgYWJsZSB0byBwdXJjaGFzZQkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIAAQUHYXNzZXRJZAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCQEHQWRkcmVzcwEJANkEAQURY3VycmVudF9uZnRfb3duZXIFBmFtb3VudAUEdW5pdAkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJAKwCAgkApQgBCAUBaQZjYWxsZXIFCXNlcGFyYXRvcgUEa0J1eQkArAICCQCsAgIFBW5mdElEBQlzZXBhcmF0b3IJAKQDAQUGYW1vdW50CQDMCAIJAQtEZWxldGVFbnRyeQEJAKwCAgkArAICAgRuZnRfBRFjdXJyZW50X25mdF9vd25lcgIGX293bmVyCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkArAICAgRuZnRfBRFjdXJyZW50X25mdF9vd25lcgIGX293bmVyCQClCAEIBQFpBmNhbGxlcgkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJAKwCAgUFbmZ0SUQFCXNlcGFyYXRvcgIGX293bmVyCQClCAEIBQFpBmNhbGxlcgUDbmlsAKtuT88=", "height": 2417532, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7QiuvxFLEf4dRpUJkD3JQhxnAREpSE2H2KCHdWSirzqj Next: JC4PqRSKzEA2HSxasJ1WoXBKBejcdFNJc46Vw5F1CFF6 Diff:
Old | New | Differences | |
---|---|---|---|
40 | 40 | ||
41 | 41 | ||
42 | 42 | @Callable(i) | |
43 | - | func sellNFT (price) = { | |
43 | + | func sellNFT (price,asset) = { | |
44 | 44 | let txId = i.transactionId | |
45 | 45 | let seller = i.caller.bytes | |
46 | - | let $ | |
47 | - | let token0 = $ | |
48 | - | let amount0 = $ | |
46 | + | let $t018061891 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
47 | + | let token0 = $t018061891._1 | |
48 | + | let amount0 = $t018061891._2 | |
49 | 49 | if (!(isNft(token0))) | |
50 | 50 | then throw("Token is not NFT") | |
51 | 51 | else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), price), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))] | |
64 | 64 | false | |
65 | 65 | } | |
66 | 66 | let price = getStringValue(((((kPrice + separator) + nftID) + "_") + current_nft_owner)) | |
67 | - | if ((current_nft_owner == toString(i.caller))) | |
68 | - | then throw("current Owner of NFT not able to purchase") | |
69 | - | else [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), amount, unit), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount))), DeleteEntry((("nft_" + current_nft_owner) + "_owner")), StringEntry((("nft_" + current_nft_owner) + "_owner"), toString(i.caller)), StringEntry(((nftID + separator) + "_owner"), toString(i.caller))] | |
67 | + | if ((i.payments[0].assetId != unit)) | |
68 | + | then throw("Only pay in ASIMI or WAVES accepted") | |
69 | + | else if ((current_nft_owner == toString(i.caller))) | |
70 | + | then throw("current Owner of NFT not able to purchase") | |
71 | + | else [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), amount, unit), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount))), DeleteEntry((("nft_" + current_nft_owner) + "_owner")), StringEntry((("nft_" + current_nft_owner) + "_owner"), toString(i.caller)), StringEntry(((nftID + separator) + "_owner"), toString(i.caller))] | |
70 | 72 | } | |
71 | 73 | ||
72 | 74 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "_" | |
5 | 5 | ||
6 | 6 | let kBuy = "buy" | |
7 | 7 | ||
8 | 8 | let kPrice = "price" | |
9 | 9 | ||
10 | 10 | let kSell = "sell" | |
11 | 11 | ||
12 | 12 | let maxAuctionDuration = 7 | |
13 | 13 | ||
14 | 14 | let kBid = "bid" | |
15 | 15 | ||
16 | 16 | let statusForNFT = $Tuple4("OPEN", "CLOSED", "REWARDED", "CANCELED") | |
17 | 17 | ||
18 | 18 | let dAppAddress = base58'3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq' | |
19 | 19 | ||
20 | 20 | func isNft (assetId) = match assetInfo(assetId) { | |
21 | 21 | case token: Asset => | |
22 | 22 | if (if ((token.decimals == 0)) | |
23 | 23 | then (token.quantity == 1) | |
24 | 24 | else false) | |
25 | 25 | then (token.reissuable == false) | |
26 | 26 | else false | |
27 | 27 | case _ => | |
28 | 28 | false | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | @Callable(i) | |
33 | 33 | func createNft (nft_name,nft_owner,nft_dAppAddress,nft_type,nft_tags,nft_selling_price,nft_description,nft_onSell,nft_data) = { | |
34 | 34 | let newToken = Issue(nft_name, nft_description, 1, 0, false) | |
35 | 35 | let issueId = calculateAssetId(newToken) | |
36 | 36 | let txId = i.transactionId | |
37 | 37 | [newToken, ScriptTransfer(i.caller, 1, issueId), StringEntry(((toBase58String(issueId) + separator) + "Owner"), toString(i.caller)), StringEntry(((toBase58String(issueId) + separator) + "nft_type"), nft_type), StringEntry(((toBase58String(issueId) + separator) + "nft_tags"), nft_tags), StringEntry(((toBase58String(issueId) + separator) + "nft_dAppAddress"), nft_dAppAddress), IntegerEntry(((toBase58String(issueId) + separator) + "nft_selling_price"), nft_selling_price), StringEntry(((toBase58String(issueId) + separator) + "nft_onSell"), nft_onSell), StringEntry(((toBase58String(issueId) + separator) + "nft_data"), nft_data), StringEntry(((toBase58String(txId) + separator) + "issue_nft"), toBase58String(issueId))] | |
38 | 38 | } | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | ||
42 | 42 | @Callable(i) | |
43 | - | func sellNFT (price) = { | |
43 | + | func sellNFT (price,asset) = { | |
44 | 44 | let txId = i.transactionId | |
45 | 45 | let seller = i.caller.bytes | |
46 | - | let $ | |
47 | - | let token0 = $ | |
48 | - | let amount0 = $ | |
46 | + | let $t018061891 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
47 | + | let token0 = $t018061891._1 | |
48 | + | let amount0 = $t018061891._2 | |
49 | 49 | if (!(isNft(token0))) | |
50 | 50 | then throw("Token is not NFT") | |
51 | 51 | else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), price), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))] | |
52 | 52 | } | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | ||
56 | 56 | @Callable(i) | |
57 | 57 | func buyNFT (nftID,current_nft_owner) = { | |
58 | 58 | let assetId = fromBase58String(nftID) | |
59 | 59 | let amount = value(i.payments[0].amount) | |
60 | 60 | let checkOwnerIsSame = match getString(this, (("nft_" + current_nft_owner) + "_owner")) { | |
61 | 61 | case a: String => | |
62 | 62 | a | |
63 | 63 | case _ => | |
64 | 64 | false | |
65 | 65 | } | |
66 | 66 | let price = getStringValue(((((kPrice + separator) + nftID) + "_") + current_nft_owner)) | |
67 | - | if ((current_nft_owner == toString(i.caller))) | |
68 | - | then throw("current Owner of NFT not able to purchase") | |
69 | - | else [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), amount, unit), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount))), DeleteEntry((("nft_" + current_nft_owner) + "_owner")), StringEntry((("nft_" + current_nft_owner) + "_owner"), toString(i.caller)), StringEntry(((nftID + separator) + "_owner"), toString(i.caller))] | |
67 | + | if ((i.payments[0].assetId != unit)) | |
68 | + | then throw("Only pay in ASIMI or WAVES accepted") | |
69 | + | else if ((current_nft_owner == toString(i.caller))) | |
70 | + | then throw("current Owner of NFT not able to purchase") | |
71 | + | else [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), amount, unit), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount))), DeleteEntry((("nft_" + current_nft_owner) + "_owner")), StringEntry((("nft_" + current_nft_owner) + "_owner"), toString(i.caller)), StringEntry(((nftID + separator) + "_owner"), toString(i.caller))] | |
70 | 72 | } | |
71 | 73 | ||
72 | 74 |
github/deemru/w8io/026f985 50.69 ms ◑