tx · 3Pqoo3iC4kP1pZBAGnSvzu1tLGieMSwx8ti7tbsUuEif

3N5VwnYrNqyfyHzTVYscDTT8svAHujRLLXV:  -0.01000000 Waves

2021.07.20 10:23 [1621638] smart account 3N5VwnYrNqyfyHzTVYscDTT8svAHujRLLXV > SELF 0.00000000 Waves

{ "type": 13, "id": "3Pqoo3iC4kP1pZBAGnSvzu1tLGieMSwx8ti7tbsUuEif", "fee": 1000000, "feeAssetId": null, "timestamp": 1626765918079, "version": 2, "chainId": 84, "sender": "3N5VwnYrNqyfyHzTVYscDTT8svAHujRLLXV", "senderPublicKey": "3KSveC7ZDPJrz8Cx7Rbj434TF6s5oNuXKTLRxy1sjywF", "proofs": [ "2tNUV9CADpXZJgbSvDh7oiQyxVe6CieeTYwEUVxWg3GKuqJdJQwaWhtp1CgfNMb7yq56jeurMdqYfhb2v2VBK3jK" ], "script": "base64:AAIFAAAAAAAAADoIAhIAGgcKAmExEgFpGggKAmEyEgJ4ZBoJCgJhMxIDeGQzGggKAmE0EgJ0eBoMCgJhNRIGdmVyaWZ5AAAAAAAAAAEAAAACYTEBAAAABGNhbGwAAAAABAAAAAJhMgkAAlgAAAABCAUAAAACYTEAAAAPY2FsbGVyUHVibGljS2V5BAAAAAJhMwIAAAAsNHc4RXZUTG9ZaXVyY29qRERHQ3NMM1ZhZmdBOWN4dUVhdGlOblJyQndyd2sDCQAAAAAAAAIFAAAAAmEyBQAAAAJhMwkABEwAAAACCQEAAAAEQnVybgAAAAIBAAAAIBglIW67mT3zAiNF9FFVOphYeAsJSgfmai5ijpDwgvk4AAAAAAAAAAABBQAAAANuaWwJAAACAAAAAQIAAAACWEQAAAABAAAAAmE0AQAAAAJhNQAAAAAJAAH0AAAAAwgFAAAAAmE0AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACYTQAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACYTQAAAAPc2VuZGVyUHVibGljS2V598WG6Q==", "height": 1621638, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4R2A1w6dQDq8bB7qynnNFLEDp4oXo4F5do9D6YUnisRZ Next: none Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let NONE = "none"
54
6-func getNumberByKey (key) = {
7- let num = match getInteger(this, key) {
8- case a: Int =>
9- a
10- case _ =>
11- 0
12- }
13- num
5+
6+@Callable(i)
7+func call () = {
8+ let xd = toBase58String(i.callerPublicKey)
9+ let xd3 = "4w8EvTLoYiurcojDDGCsL3VafgA9cxuEatiNnRrBwrwk"
10+ if ((xd == xd3))
11+ then [Burn(base58'2dFd9ZLYU2ZXQk1FACPmkxeAkHrm5X4mZthxSo8peYHd', 1)]
12+ else throw("XD")
1413 }
1514
1615
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- }
26-
27-
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 + "_owner")
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-
57-
58-let VOTERS = 3
59-
60-let QUORUM = 2
61-
62-let VOTING = "voting"
63-
64-let REVEAL = "reveal"
65-
66-let FEATURED = "featured"
67-
68-let DELISTED = "delisted"
69-
70-func getKeyCommit (item,user) = (((item + "_") + user) + "_commit")
71-
72-
73-func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user))
74-
75-
76-func getKeyCommitsCount (item) = (item + "_comcnt")
77-
78-
79-func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item))
80-
81-
82-func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal")
83-
84-
85-func getValueReveal (item,user) = getStrByKey(getKeyReveal(item, user))
86-
87-
88-func getKeyItemStatus (item) = (item + "_status")
89-
90-
91-func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item))
92-
93-
94-func getKeyVoteCount (item,vote) = ((item + "_res:") + vote)
95-
96-
97-func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote))
98-
99-
100-func getExtAddressOracle () = value(addressFromString("3MsbiyFyy8B3aN3kF8ntda474SPn4YMVkiq"))
101-
102-
103-let BLACKLISTED = "blacklist"
104-
105-func getExtKeyItemWhiteListStatus (account) = (account + "_verifier_status")
106-
107-
108-func getExtValueItemWhiteListStatus (oracle,account) = {
109- let str = match getString(oracle, getExtKeyItemWhiteListStatus(account)) {
110- case a: String =>
111- a
112- case _ =>
113- NONE
114- }
115- str
116- }
117-
118-
119-@Callable(i)
120-func addItem (title,price,data) = {
121- let supplierAddress = toBase58String(i.caller.bytes)
122- let item = getKeyItem(supplierAddress, title)
123- let supplierWhiteList = getExtValueItemWhiteListStatus(getExtAddressOracle(), supplierAddress)
124- if ((0 >= price))
125- then throw("Purchase amount cannot be less than item price")
126- else if ((getValueItemSupplier(item) != NONE))
127- then throw("an item already exists")
128- else if ((supplierWhiteList == BLACKLISTED))
129- then throw("supplier's account has been blacklisted")
130- else [StringEntry(getKeyItemSupplier(item), supplierAddress), IntegerEntry(getKeyItemPrice(item), price), StringEntry(getKeyItemData(item), data), StringEntry(getExtKeyItemWhiteListStatus(supplierAddress), supplierWhiteList)]
131- }
132-
133-
134-
135-@Callable(i)
136-func purchase (item) = {
137- let pmt = i.payments[0]
138- if (isDefined(pmt.assetId))
139- then throw("WAVES ONLY HHEUAWHEUAS")
140- else {
141- let userAddress = toBase58String(i.caller.bytes)
142- let price = getValueItemPrice(item)
143- let supplierAddress = getValueItemSupplier(item)
144- if ((price > pmt.amount))
145- then throw("Purchase amount cannot be less than item price")
146- else if ((supplierAddress == NONE))
147- then throw("Supplier does not exist")
148- else [IntegerEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), IntegerEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))]
149- }
150- }
151-
152-
153-
154-@Callable(i)
155-func withdraw () = {
156- let supplierAddress = toBase58String(i.caller.bytes)
157- let balance = getValueBalanceSupplier(supplierAddress)
158- if ((0 >= balance))
159- then throw("insuficient balance")
160- else [IntegerEntry(getKeyBalanceSupplier(supplierAddress), 0), ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)]
161- }
162-
163-
164-
165-@Callable(i)
166-func voteCommit (item,hash) = {
167- let user = toBase58String(i.caller.bytes)
168- let commits = getValueCommitsCount(item)
169- let status = getValueItemStatus(item)
170- if ((commits >= VOTERS))
171- then throw("Reached max num of voters")
172- else if ((getValueCommit(item, user) != NONE))
173- then throw("b1")
174- else if ((getKeyItemSupplier(item) == NONE))
175- then throw("b2")
176- else if (if ((status != NONE))
177- then (status != VOTING)
178- else false)
179- then throw("b3")
180- else [StringEntry(getKeyCommit(item, user), hash), IntegerEntry(getKeyCommitsCount(item), (commits + 1)), StringEntry(getKeyItemStatus(item), if ((commits == VOTERS))
181- then REVEAL
182- else VOTING)]
183- }
184-
185-
186-
187-@Callable(i)
188-func voteReveal (item,vote,salt) = {
189- let user = toBase58String(i.caller.bytes)
190- let status = getValueItemStatus(item)
191- let newVoteCount = (getValueVoteCount(item, vote) + 1)
192- if ((toBase58String(sha256(toBytes((vote + salt)))) != getValueCommit(item, user)))
193- then throw("Reveal data is not valid")
194- else if ((VOTERS > getValueCommitsCount(item)))
195- then throw("max num of voters hasnt reached yet")
196- else if ((getValueReveal(item, user) != NONE))
197- then throw("user has already participated")
198- else if (if ((status != VOTING))
199- then (status != REVEAL)
200- else false)
201- then throw("wrong status")
202- else if (if ((vote != FEATURED))
203- then (vote != DELISTED)
204- else false)
205- then throw("wrong vote")
206- else if (if ((status == FEATURED))
207- then true
208- else (status == DELISTED))
209- then throw("vote has finished")
210- else [StringEntry(getKeyReveal(item, user), vote), IntegerEntry(getKeyVoteCount(item, vote), newVoteCount), StringEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM))
211- then vote
212- else REVEAL)]
213- }
214-
16+@Verifier(tx)
17+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
21518

github/deemru/w8io/026f985 
31.92 ms