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