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:AAIFAAAAAAAAABgIAhIDCgEIEgUKAwgICBIICgYICAgICAgAAAALAQAAAA1rZXlDb2xsZWN0aW9uAAAAAgAAAAZjYWxsZXIAAAAMY29sbGVjdGlvbklkCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAtjb2xsZWN0aW9uXwUAAAAMY29sbGVjdGlvbklkAgAAAAFfBQAAAAZjYWxsZXIBAAAAEGtleVN1YmNvbGxlY3Rpb24AAAACAAAABmNhbGxlcgAAAAxjb2xsZWN0aW9uSWQJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAADnN1YmNvbGxlY3Rpb25fBQAAAAxjb2xsZWN0aW9uSWQCAAAAAV8FAAAABmNhbGxlcgEAAAAaa2V5U3ViY29sbGVjdGlvbkNvbGxlY3Rpb24AAAADAAAABmNhbGxlcgAAAAxjb2xsZWN0aW9uSWQAAAAKY29sbGVjdGlvbgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAAGXN1YmNvbGxlY3Rpb25fY29sbGVjdGlvbl8FAAAADGNvbGxlY3Rpb25JZAIAAAABX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QEAAAACIT0AAAACBQAAABBvbGRTdWJjb2xsZWN0aW9uBQAAAA1zdWJjb2xsZWN0aW9uCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEJAQAAABprZXlTdWJjb2xsZWN0aW9uQ29sbGVjdGlvbgAAAAMFAAAABmNhbGxlcgUAAAAMY29sbGVjdGlvbklkBQAAAApjb2xsZWN0aW9uBQAAAANuaWwFAAAAA25pbAkABE4AAAACBQAAAA1kZWxldGVFbnRyaWVzCQEAAAALY29sbGVjdGlvbnMAAAAFBQAAAAxjb2xsZWN0aW9uSWQFAAAAAWkFAAAACmNvbGxlY3Rpb24FAAAADXN1YmNvbGxlY3Rpb24FAAAABmNhbGxlcgAAAACSZW2H", "height": 1922101, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BYCEoBuZfqUGpeQgvjJrrY65LaJ1Z2dcwF1kVGd9AwFn Next: none Diff:
OldNewDifferences
3333 else throw("Only the sconex dapp can invoke this")
3434
3535
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))
3740 then true
3841 else (i.caller == this))
3942 then if ((collection == ""))
4043 then throw("Collections can not be empty!")
4144 else if ((subcollection == ""))
42- then [StringEntry(keyCollection(creator, artId), collection)]
43- else [StringEntry(keyCollection(creator, artId), collection), StringEntry(keySubcollectionCollection(creator, artId, collection), subcollection)]
45+ then [StringEntry(keyCollection(creator, collectionId), collection)]
46+ else [StringEntry(keyCollection(creator, collectionId), collection), StringEntry(keySubcollectionCollection(creator, collectionId, collection), subcollection)]
4447 else throw("Wrong invoker")
4548
4649
5457
5558
5659 @Callable(i)
57-func collectionProcess (collection,subcollection,artId,creator) = $Tuple2(collections(toBase58String(i.transactionId), i, collection, subcollection, artId, creator), toBase58String(i.transactionId))
60+func collectionProcess (collection,subcollection,creator) = $Tuple2(collections(toBase58String(i.transactionId), i, collection, subcollection, creator), toBase58String(i.transactionId))
5861
5962
6063
6265 func updateCollection (collectionId,oldCollection,oldSubcollection,artId,collection,subcollection) = {
6366 let caller = toBase58String(i.caller.bytes)
6467 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+ }
7580 }
7681
7782
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func keyCollection (caller,collectionId) = ((("collection_" + collectionId) + "_") + caller)
55
66
77 func keySubcollection (caller,collectionId) = ((("subcollection_" + collectionId) + "_") + caller)
88
99
1010 func keySubcollectionCollection (caller,collectionId,collection) = ((((("subcollection_collection_" + collectionId) + "_") + caller) + "_") + collection)
1111
1212
1313 func keyOnSale (caller,collectionId) = ((("art_onsale_" + collectionId) + "_") + caller)
1414
1515
1616 let sconexDappKey = "sconexDappKey"
1717
1818 func getStr (key) = match getString(this, key) {
1919 case b: String =>
2020 b
2121 case _ =>
2222 ""
2323 }
2424
2525
2626 let sconexDapp = getStr(sconexDappKey)
2727
2828 func getBooleanByKey (key) = valueOrElse(getBoolean(addressFromStringValue(sconexDapp), key), false)
2929
3030
3131 func invokerIsSconexDapp (invoker) = if ((invoker == addressFromString(sconexDapp)))
3232 then true
3333 else throw("Only the sconex dapp can invoke this")
3434
3535
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))
3740 then true
3841 else (i.caller == this))
3942 then if ((collection == ""))
4043 then throw("Collections can not be empty!")
4144 else if ((subcollection == ""))
42- then [StringEntry(keyCollection(creator, artId), collection)]
43- else [StringEntry(keyCollection(creator, artId), collection), StringEntry(keySubcollectionCollection(creator, artId, collection), subcollection)]
45+ then [StringEntry(keyCollection(creator, collectionId), collection)]
46+ else [StringEntry(keyCollection(creator, collectionId), collection), StringEntry(keySubcollectionCollection(creator, collectionId, collection), subcollection)]
4447 else throw("Wrong invoker")
4548
4649
4750 @Callable(i)
4851 func initDapp (dappKey) = if ((i.caller != this))
4952 then throw("You cannot do this action")
5053 else if ((sconexDapp != ""))
5154 then throw("Sconex dapp already set, you can't override!")
5255 else [StringEntry(sconexDappKey, dappKey)]
5356
5457
5558
5659 @Callable(i)
57-func collectionProcess (collection,subcollection,artId,creator) = $Tuple2(collections(toBase58String(i.transactionId), i, collection, subcollection, artId, creator), toBase58String(i.transactionId))
60+func collectionProcess (collection,subcollection,creator) = $Tuple2(collections(toBase58String(i.transactionId), i, collection, subcollection, creator), toBase58String(i.transactionId))
5861
5962
6063
6164 @Callable(i)
6265 func updateCollection (collectionId,oldCollection,oldSubcollection,artId,collection,subcollection) = {
6366 let caller = toBase58String(i.caller.bytes)
6467 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+ }
7580 }
7681
7782

github/deemru/w8io/026f985 
31.82 ms