tx · GzfC11FM8Ky3Q1MqjGtL1ngdoWM4Q97vUBsCVEmsgcUL 3N1Dhq5ZZyoojQisuTLusYjnGisqrxDwGLy: -0.01000000 Waves 2022.04.15 15:50 [2009691] smart account 3N1Dhq5ZZyoojQisuTLusYjnGisqrxDwGLy > SELF 0.00000000 Waves
{ "type": 13, "id": "GzfC11FM8Ky3Q1MqjGtL1ngdoWM4Q97vUBsCVEmsgcUL", "fee": 1000000, "feeAssetId": null, "timestamp": 1650027033071, "version": 2, "chainId": 84, "sender": "3N1Dhq5ZZyoojQisuTLusYjnGisqrxDwGLy", "senderPublicKey": "4ogfEQE7KGDWQR7Vd5VThqBebZ47NxrMLmAApR3sFuXW", "proofs": [ "4vcpNz2DpLQu3NTt9yz5RqvyEPgyTsz1F1rr9C3WtDtpoNtp2etfpUR8PaMg1QEu7rwBr5eo6HcXtR2TknFwwDzW" ], "script": "base64:AAIFAAAAAAAAABcIAhIDCgEIEgUKAwgICBIHCgUICAgICAAAAA0BAAAADWtleUNvbGxlY3Rpb24AAAACAAAABmNhbGxlcgAAAAxjb2xsZWN0aW9uSWQJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAAC2NvbGxlY3Rpb25fBQAAAAxjb2xsZWN0aW9uSWQCAAAAAV8FAAAABmNhbGxlcgEAAAAaa2V5U3ViY29sbGVjdGlvbkNvbGxlY3Rpb24AAAADAAAABmNhbGxlcgAAAAxjb2xsZWN0aW9uSWQAAAAKY29sbGVjdGlvbgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAAGXN1YmNvbGxlY3Rpb25fY29sbGVjdGlvbl8FAAAADGNvbGxlY3Rpb25JZAIAAAABXwUAAAAGY2FsbGVyAgAAAAFfBQAAAApjb2xsZWN0aW9uAQAAAAlrZXlPblNhbGUAAAACAAAABmNhbGxlcgAAAAxjb2xsZWN0aW9uSWQJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAAC2FydF9vbnNhbGVfBQAAAA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AAAANuaWwJAAROAAAAAgUAAAANZGVsZXRlRW50cmllcwkBAAAAC2NvbGxlY3Rpb25zAAAABQUAAAAFYXJ0SWQFAAAAAWkFAAAACmNvbGxlY3Rpb24FAAAADXN1YmNvbGxlY3Rpb24FAAAABmNhbGxlcgAAAADHyU+B", "height": 2009691, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: D3GPD7zcr56GxrjrorjqPRgBWNM1SdJU71yuZ5dvaWCp Next: AiCnVu5K6MujUiPJj45hwwmwYETwGWNsFCJtaD89CqQP Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func keyCollection (caller,collectionId) = ((("collection_" + collectionId) + "_") + caller) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func keySubcollectionCollection (caller,collectionId,collection) = ((((("subcollection_collection_" + collectionId) + "_") + caller) + "_") + collection) | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | func keyOnSale (caller,collectionId) = ((("art_onsale_" + collectionId) + "_") + caller) | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | let sconexDappKey = "sconexDapp" | |
14 | 14 | ||
15 | 15 | let oracleKey = "oracleKey" | |
16 | 16 | ||
17 | 17 | func getStr (key) = match getString(this, key) { | |
18 | 18 | case b: String => | |
19 | 19 | b | |
20 | 20 | case _ => | |
21 | 21 | "" | |
22 | 22 | } | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | let oracle = getStr(oracleKey) | |
26 | 26 | ||
27 | 27 | let oracleFee = valueOrErrorMessage(addressFromString(oracle), "Collections dapp doesnt have oracle defined") | |
28 | 28 | ||
29 | 29 | let sconexDapp = getStringValue(oracleFee, sconexDappKey) | |
30 | 30 | ||
31 | 31 | func getBooleanByKey (key) = valueOrElse(getBoolean(addressFromStringValue(sconexDapp), key), false) | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func invokerIsSconexDapp (invoker) = if ((invoker == addressFromString(sconexDapp))) | |
35 | 35 | then true | |
36 | 36 | else throw("Only the sconex dapp can invoke this") | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func getStringByKeyFromDapp (dapp,key) = valueOrElse(getString(dapp, key), "") | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func collections (collectionId,i,collection,subcollection,creator) = if ((collection == "")) | |
43 | 43 | then throw("Collections can not be empty!") | |
44 | 44 | else if ((subcollection == "")) | |
45 | 45 | then [StringEntry(keyCollection(creator, collectionId), collection)] | |
46 | 46 | else [StringEntry(keyCollection(creator, collectionId), collection), StringEntry(keySubcollectionCollection(creator, collectionId, collection), subcollection)] | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | @Callable(i) | |
50 | 50 | func initDapp (dappKey) = if ((i.caller != this)) | |
51 | 51 | then throw("You cannot do this action") | |
52 | 52 | else if ((oracle != "")) | |
53 | 53 | then throw("oracle already set, you can't override!") | |
54 | 54 | else [StringEntry(oracleKey, dappKey)] | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | ||
58 | 58 | @Callable(i) | |
59 | 59 | func collectionProcess (collection,subcollection,creator) = if (if (invokerIsSconexDapp(i.caller)) | |
60 | 60 | then true | |
61 | 61 | else (i.caller == this)) | |
62 | 62 | then $Tuple2(collections(toBase58String(i.transactionId), i, collection, subcollection, creator), toBase58String(i.transactionId)) | |
63 | 63 | else throw("Wrong invoker") | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | ||
67 | 67 | @Callable(i) | |
68 | 68 | func updateCollection (oldCollection,oldSubcollection,artId,collection,subcollection) = { | |
69 | 69 | let caller = toBase58String(i.caller.bytes) | |
70 | 70 | let saleKey = keyOnSale(artId, caller) | |
71 | 71 | if (getBooleanByKey(saleKey)) | |
72 | 72 | then throw("Can not update collection from artwork for sale") | |
73 | 73 | else { | |
74 | 74 | let deleteEntries = if (if ((oldCollection != collection)) | |
75 | 75 | then true | |
76 | 76 | else (oldSubcollection != subcollection)) | |
77 | 77 | then [DeleteEntry(keySubcollectionCollection(caller, artId, collection))] | |
78 | 78 | else nil | |
79 | 79 | (deleteEntries ++ collections(artId, i, collection, subcollection, caller)) | |
80 | 80 | } | |
81 | 81 | } | |
82 | 82 | ||
83 | 83 |
github/deemru/w8io/169f3d6 26.54 ms ◑