tx · GYMPrUygr1fgojneq5Lc7JFS2f19ZhEXxWNzfp1FCrZk

3MyABRbZe7rU1YAxiXQ3yXAqE2ghuJygfYL:  -0.01000000 Waves

2022.03.05 15:45 [1950679] smart account 3MyABRbZe7rU1YAxiXQ3yXAqE2ghuJygfYL > SELF 0.00000000 Waves

{ "type": 13, "id": "GYMPrUygr1fgojneq5Lc7JFS2f19ZhEXxWNzfp1FCrZk", "fee": 1000000, "feeAssetId": null, "timestamp": 1646484337161, "version": 2, "chainId": 84, "sender": "3MyABRbZe7rU1YAxiXQ3yXAqE2ghuJygfYL", "senderPublicKey": "Ca9neMzCqZ7i7Pb8SwTd272Ys4f6jps97HaZzLNRvDnN", "proofs": [ "5MiD4k2d8fsDY36tPM8afRoN1AWwjML2ttAe1XhAnwzEfUqvDA5rdUwZ8HuwtFNq7kPchJK2Dt3wNExEyT9wX43J" ], "script": "base64:AAIFAAAAAAAAAAkIAhIFCgMICAgAAAAGAAAAABFjZXJ0U3RhdHVzUmV2b2tlZAIAAAAHUkVWT0tFRAAAAAAQY2VydFN0YXR1c0FjdGl2ZQIAAAAGQUNUSVZFAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5CQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQIAAAAAAQAAAA10cnlHZXROZnRJbmZvAAAAAQAAAAdhc3NldElkBAAAAAF4BAAAAAckbWF0Y2gwCQAD7AAAAAEFAAAAB2Fzc2V0SWQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABUFzc2V0BAAAAAVhc3NldAUAAAAHJG1hdGNoMAgFAAAABWFzc2V0AAAACHF1YW50aXR5CQAAAgAAAAECAAAADkludmFsaWQgTkZUIGlkBQAAAAF4AQAAABFkb2VzQWRkcmVzc093bk5mdAAAAAIAAAAHYXNzZXRJZAAAAAdhZGRyZXNzAwkBAAAAAiE9AAAAAgkAA/AAAAACCQEAAAAHQWRkcmVzcwAAAAEJAAJZAAA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AAAAGX25mdElkBQAAAAVuZnRJZAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAFY2VydF8FAAAABmNlcnRJZAIAAAAGX293bmVyBQAAAAhuZnRPd25lcgkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAFY2VydF8FAAAABmNlcnRJZAIAAAAHX2FydGlzdAUAAAANYXJ0aXN0QWRkcmVzcwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAFY2VydF8FAAAABmNlcnRJZAIAAAAHX3N0YXR1cwUAAAAQY2VydFN0YXR1c0FjdGl2ZQUAAAADbmlsCQAETgAAAAIFAAAACnJldm9rZURhdGEFAAAACmNyZWF0ZURhdGEJAAACAAAAAQkAASwAAAACAgAAABdUaGUgTkZUIGlzbid0IG93bmVkIGJ5IAUAAAAIbmZ0T3duZXIAAAAAnCPX7w==", "height": 1950679, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 5 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let certStatusRevoked = "REVOKED"
5+
6+let certStatusActive = "ACTIVE"
7+
8+func getStringByKey (key) = valueOrElse(getString(this, key), "")
9+
10+
11+func tryGetNftInfo (assetId) = {
12+ let x = match assetInfo(assetId) {
13+ case asset: Asset =>
14+ asset.quantity
15+ case _ =>
16+ throw("Invalid NFT id")
17+ }
18+ x
19+ }
20+
21+
22+func doesAddressOwnNft (assetId,address) = if ((assetBalance(Address(fromBase58String(address)), assetId) != 1))
23+ then false
24+ else true
25+
26+
27+func revokeOldCert (nftId) = {
28+ let certId = getStringByKey(("cert_" + nftId))
29+ if ((certId != ""))
30+ then [StringEntry((("cert_" + certId) + "_status"), certStatusRevoked)]
31+ else nil
32+ }
33+
34+
35+@Callable(i)
36+func createCert (nftOwner,nftId,artistAddress) = {
37+ let certId = toBase58String(i.transactionId)
38+ let assetIdBytes = fromBase58String(nftId)
39+ let assetInfoOutput = tryGetNftInfo(assetIdBytes)
40+ if ((assetInfoOutput != 1))
41+ then throw("This is not an NFT!")
42+ else if (doesAddressOwnNft(assetIdBytes, nftOwner))
43+ then {
44+ let revokeData = revokeOldCert(nftId)
45+ 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)]
46+ (revokeData ++ createData)
47+ }
48+ else throw(("The NFT isn't owned by " + nftOwner))
49+ }
50+
51+

github/deemru/w8io/026f985 
16.07 ms