tx · 56mR8Qtk2XdCtCjpsmo36moCPyVivyMoZySHa4BoeJSd

3MteeMicpvRbmpGtb55Ym7qajPGJqju6DfD:  -0.01400000 Waves

2019.07.13 15:23 [583960] smart account 3MteeMicpvRbmpGtb55Ym7qajPGJqju6DfD > SELF 0.00000000 Waves

{ "type": 13, "id": "56mR8Qtk2XdCtCjpsmo36moCPyVivyMoZySHa4BoeJSd", "fee": 1400000, "feeAssetId": null, "timestamp": 1563020612579, "version": 1, "sender": "3MteeMicpvRbmpGtb55Ym7qajPGJqju6DfD", "senderPublicKey": "Ag9VhLi94fq2sVuC1mHGQFUv1ioh2E2RqXkjYpTWakT5", "proofs": [ "5fV9fGBxKJrM4QCoZR5QJ57k7wqYtEnmDnfEELE8cHwLRLPuta41z1DRx3iS48hhw7QiDKtTVTMcGXkNdi1jv5NK" ], "script": "base64:AAIDAAAAAAAAAAAAAAAeAAAAAAROT05FAgAAAARub25lAAAAAAdCQUxBTkNFAgAAAAlfQkFMQU5DRV8AAAAABlZPVEVSUwAAAAAAAAAAAwAAAAAGUVVPUlVNAAAAAAAAAAACAAAAAAZWT1RJTkcCAAAABnZvdGluZwAAAAAGUkVWRUFMAgAAAAZyZXZlYWwAAAAACEZFQVRVUkVEAgAAAAhmZWF0dXJlZAAAAAAIREVMSVNURUQCAAAACGRlbGlzdGVkAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwB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aXRlbQMJAABnAAAAAgUAAAAMbmV3Vm90ZUNvdW50BQAAAAZRVU9SVU0FAAAABHZvdGUFAAAABlJFVkVBTAUAAAADbmlsAAAAAMsl2JM=", "chainId": 84, "height": 583960, "spentComplexity": 0 } View: original | compacted Prev: 9qzs2HCnVD7xXDh7qxmibE5kkfCk2Tb9zFncCxf526Nh Next: none Diff:
OldNewDifferences
203203 }
204204
205205
206+
207+@Callable(P)
208+func voteReveal (q,A,ad) = {
209+ let r = toBase58String(P.caller.bytes)
210+ let ac = y(q)
211+ let ae = (B(q, A) + 1)
212+ if ((toBase58String(sha256(toBytes((A + ad)))) != s(q, r)))
213+ then throw("reveal data is not valid")
214+ else if ((c > u(q)))
215+ then throw("max num of voters hasn't reached yet")
216+ else if ((w(q, r) != a))
217+ then throw("user has already participated")
218+ else if (if ((ac != e))
219+ then (ac != f)
220+ else false)
221+ then throw("wrong status")
222+ else if (if ((A != g))
223+ then (A != h)
224+ else false)
225+ then throw("wrong vote")
226+ else if (if ((ac == g))
227+ then true
228+ else (ac == h))
229+ then throw("vote has finished")
230+ else WriteSet([DataEntry(v(q, r), A), DataEntry(z(q, A), ae), DataEntry(x(q), if ((ae >= d))
231+ then A
232+ else f)])
233+ }
234+
235+
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = "none"
55
66 let b = "_BALANCE_"
77
88 let c = 3
99
1010 let d = 2
1111
1212 let e = "voting"
1313
1414 let f = "reveal"
1515
1616 let g = "featured"
1717
1818 let h = "delisted"
1919
2020 func i (j) = {
2121 let k = {
2222 let l = getInteger(this, j)
2323 if ($isInstanceOf(l, "Int"))
2424 then {
2525 let m = l
2626 m
2727 }
2828 else 0
2929 }
3030 k
3131 }
3232
3333
3434 func n (j) = {
3535 let o = {
3636 let l = getString(this, j)
3737 if ($isInstanceOf(l, "String"))
3838 then {
3939 let m = l
4040 m
4141 }
4242 else a
4343 }
4444 o
4545 }
4646
4747
4848 func p (q,r) = (((q + "_") + r) + "_commit")
4949
5050
5151 func s (q,r) = n(p(q, r))
5252
5353
5454 func t (q) = (q + "_comcnt")
5555
5656
5757 func u (q) = i(t(q))
5858
5959
6060 func v (q,r) = (((q + "_") + r) + "_reveal")
6161
6262
6363 func w (q,r) = n(v(q, r))
6464
6565
6666 func x (q) = (q + "_status")
6767
6868
6969 func y (q) = n(x(q))
7070
7171
7272 func z (q,A) = ((q + "_res:") + A)
7373
7474
7575 func B (q,A) = i(z(q, A))
7676
7777
7878 func C (q) = (q + "_price")
7979
8080
8181 func D (q) = i(C(q))
8282
8383
8484 func E (r,q) = (((q + "_") + r) + "_cnt")
8585
8686
8787 func F (r,q) = i(E(r, q))
8888
8989
9090 func G (H,I) = ("item_" + toBase58String(sha256(toBytes((H + I)))))
9191
9292
9393 func J (q) = (q + "_data")
9494
9595
9696 func K (q) = (q + "_owner")
9797
9898
9999 func L (q) = n(K(q))
100100
101101
102102 func M (N) = (N + "_balance")
103103
104104
105105 func O (N) = i(M(N))
106106
107107
108108 @Callable(P)
109109 func deposit () = {
110110 let Q = extract(P.payment)
111111 if (isDefined(Q.assetId))
112112 then throw("can hold waves only at the moment")
113113 else {
114114 let R = toBase58String(P.caller.bytes)
115115 let S = {
116116 let l = getInteger(this, R)
117117 if ($isInstanceOf(l, "Int"))
118118 then {
119119 let m = l
120120 m
121121 }
122122 else 0
123123 }
124124 let T = {
125125 let l = getString(this, ("wl_sts_" + R))
126126 if ($isInstanceOf(l, "String"))
127127 then {
128128 let m = l
129129 m
130130 }
131131 else throw("user has been not waitlisted")
132132 }
133133 let U = (S + Q.amount)
134134 WriteSet([DataEntry((b + R), U)])
135135 }
136136 }
137137
138138
139139
140140 @Callable(P)
141141 func addItem (I,V,W) = {
142142 let X = toBase58String(P.caller.bytes)
143143 let q = G(X, I)
144144 if ((0 >= V))
145145 then throw("purchase amount cannot be less then item price")
146146 else if ((L(q) != a))
147147 then throw("an item is already exist")
148148 else WriteSet([DataEntry(K(q), X), DataEntry(C(q), V), DataEntry(J(q), W)])
149149 }
150150
151151
152152
153153 @Callable(P)
154154 func purchase (q) = {
155155 let Q = extract(P.payment)
156156 if (isDefined(Q.assetId))
157157 then throw("WAVES tokens only at the moment")
158158 else {
159159 let Y = toBase58String(P.caller.bytes)
160160 let V = D(q)
161161 let X = L(q)
162162 if ((V > Q.amount))
163163 then throw("purchase amount cannot be less then item price")
164164 else if ((Q.amount > V))
165165 then throw("purchase amount cannot be higher then item price")
166166 else if ((X == a))
167167 then throw("supplier does not exist")
168168 else WriteSet([DataEntry(E(Y, q), (F(Y, q) + 1)), DataEntry(M(X), (O(X) + Q.amount))])
169169 }
170170 }
171171
172172
173173
174174 @Callable(P)
175175 func withdraw () = {
176176 let X = toBase58String(P.caller.bytes)
177177 let Z = O(X)
178178 if ((0 >= Z))
179179 then throw("insufficient balance")
180180 else ScriptResult(WriteSet([DataEntry(M(X), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(X), Z, unit)]))
181181 }
182182
183183
184184
185185 @Callable(P)
186186 func voteCommit (q,aa) = {
187187 let r = toBase58String(P.caller.bytes)
188188 let ab = u(q)
189189 let ac = y(q)
190190 if ((ab >= c))
191191 then throw("reached max num of voters")
192192 else if ((s(q, r) != a))
193193 then throw("user has already participated")
194194 else if ((K(q) == a))
195195 then throw("item does not exist")
196196 else if (if ((ac != a))
197197 then (ac != e)
198198 else false)
199199 then throw("voting is not possible")
200200 else WriteSet([DataEntry(p(q, r), aa), DataEntry(t(q), (ab + 1)), DataEntry(x(q), if ((ab == c))
201201 then f
202202 else e)])
203203 }
204204
205205
206+
207+@Callable(P)
208+func voteReveal (q,A,ad) = {
209+ let r = toBase58String(P.caller.bytes)
210+ let ac = y(q)
211+ let ae = (B(q, A) + 1)
212+ if ((toBase58String(sha256(toBytes((A + ad)))) != s(q, r)))
213+ then throw("reveal data is not valid")
214+ else if ((c > u(q)))
215+ then throw("max num of voters hasn't reached yet")
216+ else if ((w(q, r) != a))
217+ then throw("user has already participated")
218+ else if (if ((ac != e))
219+ then (ac != f)
220+ else false)
221+ then throw("wrong status")
222+ else if (if ((A != g))
223+ then (A != h)
224+ else false)
225+ then throw("wrong vote")
226+ else if (if ((ac == g))
227+ then true
228+ else (ac == h))
229+ then throw("vote has finished")
230+ else WriteSet([DataEntry(v(q, r), A), DataEntry(z(q, A), ae), DataEntry(x(q), if ((ae >= d))
231+ then A
232+ else f)])
233+ }
234+
235+

github/deemru/w8io/026f985 
45.52 ms