tx · FKVricbxSRgsqAwBFoMrhN6oJbGZWKVpqFpBRXda9y1J 3NBYw8rxLmTvyEdsvaYor8nHG6GJ4NjB2Aw: -0.01000000 Waves 2023.01.24 12:39 [2418871] smart account 3NBYw8rxLmTvyEdsvaYor8nHG6GJ4NjB2Aw > SELF 0.00000000 Waves
{ "type": 13, "id": "FKVricbxSRgsqAwBFoMrhN6oJbGZWKVpqFpBRXda9y1J", "fee": 1000000, "feeAssetId": null, "timestamp": 1674553272475, "version": 2, "chainId": 84, "sender": "3NBYw8rxLmTvyEdsvaYor8nHG6GJ4NjB2Aw", "senderPublicKey": "4NDsd3dGKXuKLCoSbYvcWCX276K9ShP75cs9HTBMLJEN", "proofs": [ "4z8av3zGcZkJcT4CLeiuiRvGXvJ62pGwQuizRodgHS8nBKc9WZLWV3tqwStsFLfFiNgDLrgx9QcuaedYgocD49Ff" ], "script": "base64:BgIaCAISCwoJCAgICAgBCAgIEgMKAQgSBAoCCAgLAAlzZXBhcmF0b3ICAV8ABGtCdXkCA2J1eQAGa1ByaWNlAgVwcmljZQAFa1NlbGwCBHNlbGwABXRlYW1zASCFY5Wj84iOsN4MF44ITr+aP5K7Jts66HaOFtwUIipIfgAFd2F2ZXMBAAASbWF4QXVjdGlvbkR1cmF0aW9uAAcABGtCaWQCA2JpZAAMc3RhdHVzRm9yTkZUCQCWCgQCBE9QRU4CBkNMT1NFRAIIUkVXQVJERUQCCENBTkNFTEVEAAtkQXBwQWRkcmVzcwEaAVRKuE9s3sLak+30julKNvjVT3+V1VVbXaABBWlzTmZ0AQdhc3NldElkBAckbWF0Y2gwCQDsBwEFB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIFQXNzZXQEBXRva2VuBQckbWF0Y2gwAwMJAAACCAUFdG9rZW4IZGVjaW1hbHMAAAkAAAIIBQV0b2tlbghxdWFudGl0eQABBwkAAAIIBQV0b2tlbgpyZWlzc3VhYmxlBwcHAwFpAQljcmVhdGVOZnQJCG5mdF9uYW1lCW5mdF9vd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MwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIJAKUIAQgFAWkGY2FsbGVyBQlzZXBhcmF0b3IFBGtCdXkJAKwCAgkArAICBQVuZnRJRAUJc2VwYXJhdG9yCQCkAwEFBmFtb3VudAkAzAgCCQELRGVsZXRlRW50cnkBCQCsAgIJAKwCAgIEbmZ0XwURY3VycmVudF9uZnRfb3duZXICBl9vd25lcgkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJAKwCAgIEbmZ0XwURY3VycmVudF9uZnRfb3duZXICBl9vd25lcgkApQgBCAUBaQZjYWxsZXIJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIFBW5mdElEBQlzZXBhcmF0b3ICBl9vd25lcgkApQgBCAUBaQZjYWxsZXIFA25pbAAG1qhK", "height": 2418871, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AGNkfzZ5MUYGbFJGU14MSjWWRTS6HRXqxqyiHatrSDLE Next: EsfxQBViRrTj1h7CuRstCtcmRT9pfYTSmMTsxd1hFVRL Diff:
Old | New | Differences | |
---|---|---|---|
67 | 67 | case _ => | |
68 | 68 | false | |
69 | 69 | } | |
70 | - | let $t025872672 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
71 | - | let token0 = $t025872672._1 | |
72 | - | let amount0 = $t025872672._2 | |
73 | 70 | let price = getStringValue(((((kPrice + separator) + nftID) + "_") + current_nft_owner)) | |
74 | 71 | if ((current_nft_owner == toString(i.caller))) | |
75 | 72 | then throw("current Owner of NFT not able to purchase") | |
76 | - | else if (!(isNft(token0))) | |
77 | - | then throw("Token is not NFT") | |
78 | - | else if ((i.payments[0].assetId == teams)) | |
79 | - | then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), amount, teams), 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))] | |
80 | - | 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))] | |
73 | + | else if ((i.payments[0].assetId == teams)) | |
74 | + | then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), amount, teams), 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))] | |
75 | + | 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))] | |
81 | 76 | } | |
82 | 77 | ||
83 | 78 |
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 teams = base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq' | |
13 | 13 | ||
14 | 14 | let waves = base58'' | |
15 | 15 | ||
16 | 16 | let maxAuctionDuration = 7 | |
17 | 17 | ||
18 | 18 | let kBid = "bid" | |
19 | 19 | ||
20 | 20 | let statusForNFT = $Tuple4("OPEN", "CLOSED", "REWARDED", "CANCELED") | |
21 | 21 | ||
22 | 22 | let dAppAddress = base58'3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq' | |
23 | 23 | ||
24 | 24 | func isNft (assetId) = match assetInfo(assetId) { | |
25 | 25 | case token: Asset => | |
26 | 26 | if (if ((token.decimals == 0)) | |
27 | 27 | then (token.quantity == 1) | |
28 | 28 | else false) | |
29 | 29 | then (token.reissuable == false) | |
30 | 30 | else false | |
31 | 31 | case _ => | |
32 | 32 | false | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | @Callable(i) | |
37 | 37 | func createNft (nft_name,nft_owner,nft_dAppAddress,nft_type,nft_tags,nft_selling_price,nft_description,nft_onSell,nft_data) = { | |
38 | 38 | let newToken = Issue(nft_name, nft_description, 1, 0, false) | |
39 | 39 | let issueId = calculateAssetId(newToken) | |
40 | 40 | let txId = i.transactionId | |
41 | 41 | [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))] | |
42 | 42 | } | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | ||
46 | 46 | @Callable(i) | |
47 | 47 | func sellNFT (price) = { | |
48 | 48 | let txId = i.transactionId | |
49 | 49 | let seller = i.caller.bytes | |
50 | 50 | let $t018781963 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
51 | 51 | let token0 = $t018781963._1 | |
52 | 52 | let amount0 = $t018781963._2 | |
53 | 53 | if (!(isNft(token0))) | |
54 | 54 | then throw("Token is not NFT") | |
55 | 55 | else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), price), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))] | |
56 | 56 | } | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | ||
60 | 60 | @Callable(i) | |
61 | 61 | func buyNFT (nftID,current_nft_owner) = { | |
62 | 62 | let assetId = fromBase58String(nftID) | |
63 | 63 | let amount = value(i.payments[0].amount) | |
64 | 64 | let checkOwnerIsSame = match getString(this, (("nft_" + current_nft_owner) + "_owner")) { | |
65 | 65 | case a: String => | |
66 | 66 | a | |
67 | 67 | case _ => | |
68 | 68 | false | |
69 | 69 | } | |
70 | - | let $t025872672 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
71 | - | let token0 = $t025872672._1 | |
72 | - | let amount0 = $t025872672._2 | |
73 | 70 | let price = getStringValue(((((kPrice + separator) + nftID) + "_") + current_nft_owner)) | |
74 | 71 | if ((current_nft_owner == toString(i.caller))) | |
75 | 72 | then throw("current Owner of NFT not able to purchase") | |
76 | - | else if (!(isNft(token0))) | |
77 | - | then throw("Token is not NFT") | |
78 | - | else if ((i.payments[0].assetId == teams)) | |
79 | - | then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), amount, teams), 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))] | |
80 | - | 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))] | |
73 | + | else if ((i.payments[0].assetId == teams)) | |
74 | + | then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), amount, teams), 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))] | |
75 | + | 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))] | |
81 | 76 | } | |
82 | 77 | ||
83 | 78 |
github/deemru/w8io/026f985 42.38 ms ◑