tx · 6Mc3XStPnFATV4aFF2bJsSSBc6RBYjKtnf2LbWw7j1v5

3N86zk6P6pyxFnu5o1U62pZeiRQ6Q1b3Lgb:  -0.01000010 Waves

2021.07.09 11:11 [1605820] smart account 3N86zk6P6pyxFnu5o1U62pZeiRQ6Q1b3Lgb > SELF 0.00000000 Waves

{ "type": 13, "id": "6Mc3XStPnFATV4aFF2bJsSSBc6RBYjKtnf2LbWw7j1v5", "fee": 1000010, "feeAssetId": null, "timestamp": 1625818307016, "version": 2, "chainId": 84, "sender": "3N86zk6P6pyxFnu5o1U62pZeiRQ6Q1b3Lgb", "senderPublicKey": "J5UWSH8o2ZgSCRmahKoyq3Zzf9CSXEJtFQjoxuiqw8jN", "proofs": [ "47sDgGaT8CcZ7P96wBJesaBE7iVB82C2PcK1mWvZMuUMAWZKzxHNoJTxkrarHnG5DyJA17Uc1NeEMfLJeDBWDMDL" ], "script": "base64:AAIFAAAAAAAAAKMIAhIECgIICBokCgJhMRIeZ2V0RXh0VmFsdWVJdGVtV2hpdGVMaXN0U3RhdHVzGgoKAmEyEgRpdGVtGg4KAmEzEgh2ZXJpZmllchoOCgJhNBIIVkVSSUZJRUQaEQoCYTUSC0JMQUNLTElTVEVEGgcKAmE2EgFpGg4KAmE3EghzdXBwbGllchoMCgJhOBIGc3RhdHVzGg0KAmE5EgdhY2NvdW50AAAABAEAAAACYTEAAAABAAAAAmEyCQABLAAAAAIFAAAAAmEyAgAAABBfdmVyaWZpZXJfc3RhdHVzAAAAAAJhMwIAAAAAAAAAAAJhNAIAAAAIdmVyaWZpZWQAAAAAAmE1AgAAAAlibGFja2xpc3QAAAABAAAAAmE2AQAAAAlzZXRzdGF0dXMAAAACAAAAAmE3AAAAAmE4BAAAAAJhOQkAAlgAAAABCAgFAAAAAmE2AAAABmNhbGxlcgAAAAVieXRlcwMJAQAAAAIhPQAAAAIFAAAAAmE5BQAAAAJhMwkAAAIAAAABAgAAADFvbmx5IG9yYWNsZSB2ZXJ5ZmllciBhcmUgYWJsZSB0byBtYW5hZ2Ugd2hpbGVsaXN0AwMJAQAAAAIhPQAAAAIFAAAAAmE4BQAAAAJhNAkBAAAAAiE9AAAAAgUAAAACYTgFAAAAAmE1BwkAAAIAAAABAgAAAA53YWl0aW5nIHN0YXR1cwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQEAAAACYTEAAAABBQAAAAJhNwUAAAACYTgFAAAAA25pbAAAAABS+3XG", "height": 1605820, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 99uJVYqixKRVEV7pCvK1LsqQ6NeWsQyEGf8hxt78eNVp Next: 3FLYHxTcgsRVkwUGqG5rvJRBHbssDJ2gjfWjfoMtCVoT Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let NONE = "none"
5-
6-func getNumberByKey (key) = {
7- let num = match getInteger(this, key) {
8- case a: Int =>
9- a
10- case _ =>
11- 0
12- }
13- num
14- }
4+func getExtValueItemWhiteListStatus (item) = (item + "_verifier_status")
155
166
17-func getStrByKey (key) = {
18- let str = match getString(this, key) {
19- case a: String =>
20- a
21- case _ =>
22- NONE
23- }
24- str
25- }
7+let verifier = ""
268
9+let VERIFIED = "verified"
2710
28-func getKeyItemPrice (item) = (item + "_price")
29-
30-
31-func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item))
32-
33-
34-func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt")
35-
36-
37-func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item))
38-
39-
40-func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title)))))
41-
42-
43-func getKeyItemData (item) = (item + "_data")
44-
45-
46-func getKeyItemSupplier (item) = (item + "_data")
47-
48-
49-func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item))
50-
51-
52-func getKeyBalanceSupplier (account) = (account + "_balance")
53-
54-
55-func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account))
56-
11+let BLACKLISTED = "blacklist"
5712
5813 @Callable(i)
59-func addItem (title,price,data) = {
60- let supplierAddress = toBase58String(i.caller.bytes)
61- let item = getKeyItem(supplierAddress, title)
62- if ((0 >= price))
63- then throw("purchase amount cannot be less than item price")
64- else if ((getValueItemSupplier(item) != NONE))
65- then throw("an item is already exist")
66- else [StringEntry(getKeyItemSupplier(item), supplierAddress), IntegerEntry(getKeyItemPrice(item), price), StringEntry(getKeyItemData(item), data)]
67- }
68-
69-
70-
71-@Callable(i)
72-func purchase (item) = {
73- let pmt = i.payments[0]
74- if (isDefined(pmt.assetId))
75- then throw("WAVES token only at the moment")
76- else {
77- let userAddress = toBase58String(i.caller.bytes)
78- let price = getValueItemPrice(item)
79- let supplierAddres = getValueItemSupplier(item)
80- if ((price > pmt.amount))
81- then throw("purchase amunt cannot be less than item price")
82- else if ((pmt.amount > price))
83- then throw("purchase amount cannot be higher than item price")
84- else if ((supplierAddres == NONE))
85- then throw("Supplier address doesn't exist")
86- else [IntegerEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), IntegerEntry(getKeyBalanceSupplier(supplierAddres), (getValueBalanceSupplier(supplierAddres) + pmt.amount))]
87- }
88- }
89-
90-
91-
92-@Callable(i)
93-func withdraw () = {
94- let supplierAddress = toBase58String(i.caller.bytes)
95- let balance = getValueBalanceSupplier(supplierAddress)
96- if ((0 >= balance))
97- then throw("za mało środków")
98- else [IntegerEntry(getKeyBalanceSupplier(supplierAddress), 0), ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)]
14+func setstatus (supplier,status) = {
15+ let account = toBase58String(i.caller.bytes)
16+ if ((account != verifier))
17+ then throw("only oracle veryfier are able to manage whilelist")
18+ else if (if ((status != VERIFIED))
19+ then (status != BLACKLISTED)
20+ else false)
21+ then throw("waiting status")
22+ else [StringEntry(getExtValueItemWhiteListStatus(supplier), status)]
9923 }
10024
10125

github/deemru/w8io/c3f4982 
45.42 ms