tx · Hhr2L8CMXXQpRZeM625GnCbisUzPurMtPdEjrf9WAXoD 3NBzKMPpmXT7kQt7nwdkuAyu3snUy1RTC6n: -0.00300000 Waves 2022.07.10 00:59 [2132754] smart account 3NBzKMPpmXT7kQt7nwdkuAyu3snUy1RTC6n > SELF 0.00000000 Waves
{ "type": 13, "id": "Hhr2L8CMXXQpRZeM625GnCbisUzPurMtPdEjrf9WAXoD", "fee": 300000, "feeAssetId": null, "timestamp": 1657404050519, "version": 2, "chainId": 84, "sender": "3NBzKMPpmXT7kQt7nwdkuAyu3snUy1RTC6n", "senderPublicKey": "8XeWci9aaCjzH79BACEeCGyh6HS9RXZRBC6uSbjmpeeZ", "proofs": [ "5JdJcoDyrQAHCpAdGkjmaBBJT2zcsQvJ2mWC416WkWAGxaSVtLGEuQV5NEDwCJgAjsAa4JhGuPrpEFfu7CQ95onU" ], "script": "base64:BgIMCAISBgoECAgICBIAAwENdHJ5R2V0SW50ZWdlcgEDa2V5BAckbWF0Y2gwCQCaCAIFBHRoaXMFA2tleQMJAAECBQckbWF0Y2gwAgNJbnQEAWIFByRtYXRjaDAFAWIAAAEMdHJ5R2V0U3RyaW5nAQNrZXkEByRtYXRjaDAJAJ0IAgUEdGhpcwUDa2V5AwkAAQIFByRtYXRjaDACBlN0cmluZwQBYgUHJG1hdGNoMAUBYgIAAQhjaGVja05GVAEFYXNzZXQDAwMJAAACCAgFBWFzc2V0Bmlzc3VlcgVieXRlcwgFBHRoaXMFYnl0ZXMJAAACCAUFYXNzZXQIZGVjaW1hbHMAAAcJAAACCAUFYXNzZXQKcmVpc3N1YWJsZQcHCQAAAggFBWFzc2V0CHF1YW50aXR5AAEHAgFpAQljcmVhdGVORlQEB25mdE5hbWUHbmZ0RGVzYwVpbWFnZQ5jb2xsZWN0aW9uTmFtZQQFYXNzZXQJAMMIBwUHbmZ0TmFtZQUHbmZ0RGVzYwABAAAHBQR1bml0AAAEB2Fzc2V0SWQJALgIAQUFYXNzZXQECmFzc2V0SWRT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AgRuZnRfBQphc3NldElkU3RyAgdfaXNzdWVyCQDMCAIJAQtEZWxldGVFbnRyeQEJAKwCAgkArAICCQCsAgICC2NvbGxlY3Rpb25fBRBjb2xsZWN0aW9uRG9tYWluAglfYXNzZXRJZF8FCmFzc2V0SWRTdHIFA25pbAkAAgECFkl2YWxpZCBjb2xsZWN0aW9uIG5hbWUJAAIBAhNJdmFsaWQgTkZUIGF0dGFjaGVkAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleTSqTXA=", "height": 2132754, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
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) = { | |
31 | + | let asset = Issue(nftName, nftDesc, 1, 0, false, unit, 0) | |
32 | + | let assetId = calculateAssetId(asset) | |
33 | + | let assetIdStr = toBase58String(assetId) | |
34 | + | let collectionDomain = ((toString(i.caller) + "_") + (if ((size(collectionName) > 0)) | |
35 | + | then collectionName | |
36 | + | else "basic")) | |
37 | + | let nftNum = (tryGetInteger((("collection_" + collectionDomain) + "_size")) + 1) | |
38 | + | $Tuple2([StringEntry((("nft_" + assetIdStr) + "_data"), (((("{'collection': '" + collectionDomain) + "', 'num': ") + toString(nftNum)) + "}")), StringEntry((("nft_" + assetIdStr) + "_image"), image), StringEntry((("nft_" + assetIdStr) + "_issuer"), toString(i.caller)), IntegerEntry((("collection_" + collectionDomain) + "_size"), nftNum), StringEntry(((("collection_" + collectionDomain) + "_assetId_") + assetIdStr), assetIdStr), asset, ScriptTransfer(i.caller, 1, assetId)], assetIdStr) | |
39 | + | } | |
40 | + | ||
41 | + | ||
42 | + | ||
43 | + | @Callable(i) | |
44 | + | func burnNFT () = { | |
45 | + | let assetId = value(value(i.payments[0]).assetId) | |
46 | + | let asset = value(assetInfo(assetId)) | |
47 | + | if (if ((value(i.payments[0]).amount == 1)) | |
48 | + | then checkNFT(asset) | |
49 | + | else false) | |
50 | + | then { | |
51 | + | let assetIdStr = toBase58String(assetId) | |
52 | + | let issuer = tryGetString((("nft_" + assetIdStr) + "_issuer")) | |
53 | + | let data = tryGetString((("nft_" + assetIdStr) + "_data")) | |
54 | + | let partsData = split(data, ", ") | |
55 | + | let partsCollection = split(partsData[0], ": ") | |
56 | + | let collectionDomain = dropRight(drop(partsCollection[1], 1), 1) | |
57 | + | let nftNum = tryGetInteger((("collection_" + collectionDomain) + "_size")) | |
58 | + | if ((nftNum > 0)) | |
59 | + | then { | |
60 | + | let updateCollection = if ((nftNum == 1)) | |
61 | + | then DeleteEntry((("collection_" + collectionDomain) + "_size")) | |
62 | + | else IntegerEntry((("collection_" + collectionDomain) + "_size"), (nftNum - 1)) | |
63 | + | [updateCollection, Burn(assetId, 1), DeleteEntry((("nft_" + assetIdStr) + "_data")), DeleteEntry((("nft_" + assetIdStr) + "_image")), DeleteEntry((("nft_" + assetIdStr) + "_issuer")), DeleteEntry(((("collection_" + collectionDomain) + "_assetId_") + assetIdStr))] | |
64 | + | } | |
65 | + | else throw("Ivalid collection name") | |
66 | + | } | |
67 | + | else throw("Ivalid NFT attached") | |
68 | + | } | |
69 | + | ||
70 | + | ||
71 | + | @Verifier(tx) | |
72 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
73 | + |
github/deemru/w8io/169f3d6 23.24 ms ◑