tx · 6yB45WYSVaj5DC12Rd3kHNKU6y151e1ZHJUnLoe1cTmr 3N4LSmPe4zjEW81X1ix6maibiT5HzXrWpTj: -0.00400000 Waves 2022.07.27 22:29 [2158643] smart account 3N4LSmPe4zjEW81X1ix6maibiT5HzXrWpTj > SELF 0.00000000 Waves
{ "type": 13, "id": "6yB45WYSVaj5DC12Rd3kHNKU6y151e1ZHJUnLoe1cTmr", "fee": 400000, "feeAssetId": null, "timestamp": 1658950197713, "version": 2, "chainId": 84, "sender": "3N4LSmPe4zjEW81X1ix6maibiT5HzXrWpTj", "senderPublicKey": "3ket5TT3jvwuk1Zy5vmeyEBvFWWieoTc5WY3abj3Gqpq", "proofs": [ "4xsNjgZYaUxdXxjL4mgtdXkoP6Gs9mKqQLn9gCEei9NfHqkeLm4nggZpjWnHHj5uYJZ7iCRCwYrmoLZodmS2m7U1" ], "script": "base64:AAIFAAAAAAAAAAwIAhIGCgQICAgIEgAAAAADAQAAAA10cnlHZXRJbnRlZ2VyAAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAABAAAADHRyeUdldFN0cmluZwAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAgAAAAABAAAACGNoZWNrTkZUAAAAAQAAAAVhc3NldAMDAwkAAAAAAAACCAgFAAAABWFzc2V0AAAABmlzc3VlcgAAAAVieXRlcwgFAAAABHRoaXMAAAAFYnl0ZXMJAAAAAAAAAggFAAAABWFzc2V0AAAACGRlY2ltYWxzAAAAAAAAAAAABwkAAAAAAAACCAUAAAAFYXNzZXQAAAAKcmVpc3N1YWJsZQcHCQAAA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dGlvbkRvbWFpbgIAAAAFX3NpemUJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgIAAAALY29sbGVjdGlvbl8FAAAAEGNvbGxlY3Rpb25Eb21haW4CAAAABV9zaXplCQAAZQAAAAIFAAAABm5mdE51bQAAAAAAAAAAAQkABEwAAAACBQAAABB1cGRhdGVDb2xsZWN0aW9uCQAETAAAAAIJAQAAAARCdXJuAAAAAgUAAAAHYXNzZXRJZAAAAAAAAAAAAQkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQABLAAAAAIJAAEsAAAAAgIAAAAEbmZ0XwUAAAAKYXNzZXRJZFN0cgIAAAAFX2RhdGEJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkAASwAAAACCQABLAAAAAICAAAABG5mdF8FAAAACmFzc2V0SWRTdHICAAAABl9pbWFnZQkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQABLAAAAAIJAAEsAAAAAgIAAAAEbmZ0XwUAAAAKYXNzZXRJZFN0cgIAAAAHX2lzc3VlcgkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAtjb2xsZWN0aW9uXwUAAAAQY29sbGVjdGlvbkRvbWFpbgIAAAAJX2Fzc2V0SWRfBQAAAAphc3NldElkU3RyBQAAAANuaWwJAAACAAAAAQIAAAAWSXZhbGlkIGNvbGxlY3Rpb24gbmFtZQkAAAIAAAABAgAAABNJdmFsaWQgTkZUIGF0dGFjaGVkAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXlI6TI1", "height": 2158643, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func tryGetInteger (key) = match getInteger(this, key) { | |
5 | + | case b: Int => | |
6 | + | b | |
7 | + | case _ => | |
8 | + | 0 | |
9 | + | } | |
10 | + | ||
11 | + | ||
12 | + | func tryGetString (key) = match getString(this, key) { | |
13 | + | case b: String => | |
14 | + | b | |
15 | + | case _ => | |
16 | + | "" | |
17 | + | } | |
18 | + | ||
19 | + | ||
20 | + | func checkNFT (asset) = if (if (if ((asset.issuer.bytes == this.bytes)) | |
21 | + | then (asset.decimals == 0) | |
22 | + | else false) | |
23 | + | then (asset.reissuable == false) | |
24 | + | else false) | |
25 | + | then (asset.quantity == 1) | |
26 | + | else false | |
27 | + | ||
28 | + | ||
29 | + | @Callable(i) | |
30 | + | func createNFT (nftName,nftDesc,image,collectionName) = if ((indexOf(image, "https://") != 0)) | |
31 | + | then throw("https link to image required") | |
32 | + | else { | |
33 | + | let asset = Issue(nftName, nftDesc, 1, 0, false, unit, 0) | |
34 | + | let assetId = calculateAssetId(asset) | |
35 | + | let assetIdStr = toBase58String(assetId) | |
36 | + | let collectionDomain = ((toString(i.caller) + "_") + (if ((size(collectionName) > 0)) | |
37 | + | then collectionName | |
38 | + | else "basic")) | |
39 | + | let nftNum = (tryGetInteger((("collection_" + collectionDomain) + "_size")) + 1) | |
40 | + | $Tuple2([StringEntry((("nft_" + assetIdStr) + "_data"), (((("{'collection': '" + collectionDomain) + "', 'num': ") + toString(nftNum)) + "}")), StringEntry((("nft_" + assetIdStr) + "_image"), image), StringEntry((("nft_" + assetIdStr) + "_issuer"), toString(i.caller)), StringEntry(toBase58String(assetId), toBase58String(assetId)), StringEntry(toBase58String(i.transactionId), toBase58String(assetId)), IntegerEntry((("collection_" + collectionDomain) + "_size"), nftNum), StringEntry(((("collection_" + collectionDomain) + "_assetId_") + assetIdStr), assetIdStr), asset, ScriptTransfer(i.caller, 1, assetId)], assetIdStr) | |
41 | + | } | |
42 | + | ||
43 | + | ||
44 | + | ||
45 | + | @Callable(i) | |
46 | + | func burnNFT () = { | |
47 | + | let assetId = value(value(i.payments[0]).assetId) | |
48 | + | let asset = value(assetInfo(assetId)) | |
49 | + | if (if ((value(i.payments[0]).amount == 1)) | |
50 | + | then checkNFT(asset) | |
51 | + | else false) | |
52 | + | then { | |
53 | + | let assetIdStr = toBase58String(assetId) | |
54 | + | let issuer = tryGetString((("nft_" + assetIdStr) + "_issuer")) | |
55 | + | let data = tryGetString((("nft_" + assetIdStr) + "_data")) | |
56 | + | let partsData = split(data, ", ") | |
57 | + | let partsCollection = split(partsData[0], ": ") | |
58 | + | let collectionDomain = dropRight(drop(partsCollection[1], 1), 1) | |
59 | + | let nftNum = tryGetInteger((("collection_" + collectionDomain) + "_size")) | |
60 | + | if ((nftNum > 0)) | |
61 | + | then { | |
62 | + | let updateCollection = if ((nftNum == 1)) | |
63 | + | then DeleteEntry((("collection_" + collectionDomain) + "_size")) | |
64 | + | else IntegerEntry((("collection_" + collectionDomain) + "_size"), (nftNum - 1)) | |
65 | + | [updateCollection, Burn(assetId, 1), DeleteEntry((("nft_" + assetIdStr) + "_data")), DeleteEntry((("nft_" + assetIdStr) + "_image")), DeleteEntry((("nft_" + assetIdStr) + "_issuer")), DeleteEntry(((("collection_" + collectionDomain) + "_assetId_") + assetIdStr))] | |
66 | + | } | |
67 | + | else throw("Ivalid collection name") | |
68 | + | } | |
69 | + | else throw("Ivalid NFT attached") | |
70 | + | } | |
71 | + | ||
72 | + | ||
73 | + | @Verifier(tx) | |
74 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
75 | + |
github/deemru/w8io/026f985 15.79 ms ◑