tx · Apj2QtegJziViG87eXxodQzCVjEBkbLPUkbYP6ph4CyV 3PNskFtDjfpFKZmutnSE5zdnNuhoYN7JVdQ: -0.00700000 Waves 2022.08.27 22:06 [3268756] smart account 3PNskFtDjfpFKZmutnSE5zdnNuhoYN7JVdQ > SELF 0.00000000 Waves
{ "type": 13, "id": "Apj2QtegJziViG87eXxodQzCVjEBkbLPUkbYP6ph4CyV", "fee": 700000, "feeAssetId": null, "timestamp": 1661627206378, "version": 2, "chainId": 87, "sender": "3PNskFtDjfpFKZmutnSE5zdnNuhoYN7JVdQ", "senderPublicKey": "9gx1f9wXFYg2kEiFodVfG9q8pWmeHL1rW8xc91zWZPSi", "proofs": [ "28T5rP9REPSx77RL8dMz39vjQQky9CAjhKJE33QwbBteS1tnaJLyih99GtiKcs4qkD4PhoVhVqJD8aLcR3n4fjNU" ], "script": "base64:AAIFAAAAAAAAAA4IAhIDCgEIEgUKAwgICAAAAA0AAAAAEWNlcnRTdGF0dXNSZXZva2VkAgAAAAdSRVZPS0VEAAAAABBjZXJ0U3RhdHVzQWN0aXZlAgAAAAZBQ1RJVkUAAAAACW9yYWNsZUtleQIAAAAJb3JhY2xlS2V5AQAAAAZnZXRTdHIAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgIAAAAAAAAAAAZvcmFjbGUJAQAAAAZnZXRTdHIAAAABBQAAAAlvcmFjbGVLZXkAAAAACW9yYWNsZUZlZQkBAAAABXZhbHVlAAAAAQkABCYAAAABBQAAAAZvcmFjbGUAAAAACnJlc2VsbERhcHAJAAQmAAAAAQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEHQAAAAIFAAAACW9yYWNsZUZlZQIAAAAKcmVzZWxsRGFwcAIAAAAUcmVzZWxsRGFwcCBub3QgZm91bmQAAAAACnNj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kAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAFY2VydF8FAAAABmNlcnRJZAIAAAAGX25mdElkBQAAAAVuZnRJZAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAFY2VydF8FAAAABmNlcnRJZAIAAAAGX293bmVyBQAAAAhuZnRPd25lcgkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAFY2VydF8FAAAABmNlcnRJZAIAAAAHX2FydGlzdAUAAAANYXJ0aXN0QWRkcmVzcwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAFY2VydF8FAAAABmNlcnRJZAIAAAAHX3N0YXR1cwUAAAAQY2VydFN0YXR1c0FjdGl2ZQUAAAADbmlsCQAETgAAAAIFAAAACnJldm9rZURhdGEFAAAACmNyZWF0ZURhdGEJAAACAAAAAQkAASwAAAACAgAAABdUaGUgTkZUIGlzbid0IG93bmVkIGJ5IAUAAAAIbmZ0T3duZXIJAAACAAAAAQIAAAAfVGhpcyBkYXBwIGNhbiBub3QgY3JlYXRlIGNlcnRzIQAAAADV/epb", "height": 3268756, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2Z5cN3adXSg7qWtLRweyJkq2YFpzrFccwFc3byZ5Up1w Next: CVWALshkhkKnP82fYaEitnYWh6MwgVn6WroqdypqDwi9 Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let certStatusRevoked = "REVOKED" | |
5 | 5 | ||
6 | 6 | let certStatusActive = "ACTIVE" | |
7 | 7 | ||
8 | 8 | let oracleKey = "oracleKey" | |
9 | 9 | ||
10 | 10 | func getStr (key) = match getString(this, key) { | |
11 | 11 | case b: String => | |
12 | 12 | b | |
13 | 13 | case _ => | |
14 | 14 | "" | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | let oracle = getStr(oracleKey) | |
19 | 19 | ||
20 | 20 | let oracleFee = value(addressFromString(oracle)) | |
21 | 21 | ||
22 | 22 | let resellDapp = addressFromString(valueOrErrorMessage(getString(oracleFee, "resellDapp"), "resellDapp not found")) | |
23 | 23 | ||
24 | 24 | let sconexDapp = addressFromString(valueOrErrorMessage(getString(oracleFee, "sconexDapp"), "sconexDapp not found")) | |
25 | 25 | ||
26 | 26 | let allowedDapps = [resellDapp, sconexDapp] | |
27 | 27 | ||
28 | 28 | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func tryGetNftInfo (assetId) = { | |
32 | 32 | let x = match assetInfo(assetId) { | |
33 | 33 | case asset: Asset => | |
34 | 34 | asset.quantity | |
35 | 35 | case _ => | |
36 | 36 | throw("Invalid NFT id") | |
37 | 37 | } | |
38 | 38 | x | |
39 | 39 | } | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func doesAddressOwnNft (assetId,address) = if ((assetBalance(Address(fromBase58String(address)), assetId) != 1)) | |
43 | 43 | then false | |
44 | 44 | else true | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func revokeOldCert (nftId) = { | |
48 | 48 | let certId = getStringByKey(("cert_" + nftId)) | |
49 | 49 | if ((certId != "")) | |
50 | 50 | then [StringEntry((("cert_" + certId) + "_status"), certStatusRevoked)] | |
51 | 51 | else nil | |
52 | 52 | } | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | @Callable(i) | |
56 | 56 | func initDapp (dappKey) = if ((i.caller != this)) | |
57 | 57 | then throw("You cannot do this action") | |
58 | 58 | else if ((oracle != "")) | |
59 | 59 | then throw("oracle already set, you can't override!") | |
60 | 60 | else [StringEntry(oracleKey, dappKey)] | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | ||
64 | 64 | @Callable(i) | |
65 | 65 | func createCert (nftOwner,nftId,artistAddress) = if (containsElement(allowedDapps, i.caller)) | |
66 | 66 | then { | |
67 | 67 | let certId = toBase58String(i.transactionId) | |
68 | 68 | let assetIdBytes = fromBase58String(nftId) | |
69 | 69 | let assetInfoOutput = tryGetNftInfo(assetIdBytes) | |
70 | 70 | if ((assetInfoOutput != 1)) | |
71 | 71 | then throw("This is not an NFT!") | |
72 | 72 | else if (doesAddressOwnNft(assetIdBytes, nftOwner)) | |
73 | 73 | then { | |
74 | 74 | let revokeData = revokeOldCert(nftId) | |
75 | 75 | let createData = [StringEntry(("cert_" + nftId), certId), StringEntry((("cert_" + certId) + "_nftId"), nftId), StringEntry((("cert_" + certId) + "_owner"), nftOwner), StringEntry((("cert_" + certId) + "_artist"), artistAddress), StringEntry((("cert_" + certId) + "_status"), certStatusActive)] | |
76 | 76 | (revokeData ++ createData) | |
77 | 77 | } | |
78 | 78 | else throw(("The NFT isn't owned by " + nftOwner)) | |
79 | 79 | } | |
80 | 80 | else throw("This dapp can not create certs!") | |
81 | 81 | ||
82 | 82 |
github/deemru/w8io/fabc49c 138.54 ms ◑