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