tx · EZf5F82QaYz9o1ByvDTiwFQgoLmvB7twQ6n2HKz26rh

3MtCHmt8V4k4fyG1Guw7pFNrWMMCAYMRSyk:  -0.01500000 Waves

2019.06.21 23:35 [552265] smart account 3MtCHmt8V4k4fyG1Guw7pFNrWMMCAYMRSyk > SELF 0.00000000 Waves

{ "type": 13, "id": "EZf5F82QaYz9o1ByvDTiwFQgoLmvB7twQ6n2HKz26rh", "fee": 1500000, "feeAssetId": null, "timestamp": 1561149410567, "version": 1, "sender": "3MtCHmt8V4k4fyG1Guw7pFNrWMMCAYMRSyk", "senderPublicKey": "7CMNQt6PkgEA269dkY26xWpGkAmNRKnG4YgxXKcG9oKs", "proofs": [ "562Psho9d6MuSoh2DJ53uMvCzdXDXi9PX3ZMbqVTFr2AZ5Rh1wUD7Rv2NSmyqx9SUUqp9L4cE4jShxHdEYeB2jLn" ], "script": "base64:AAIDAAAAAAAAAAAAAAABAAAAAAR3RVVSAQAAACCSgegasKfGc6F18oCEKgRGYHsJ+t6sgI8K0yBC5YeXSwAAAAIAAAABaQEAAAAHZGVwb3NpdAAAAAAEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAAAiE9AAAAAggFAAAAA3BtdAAAAAdhc3NldElkBQAAAAR3RVVSCQAAAgAAAAECAAAAF3dFVVIgb25seSBhdCB0aGUgbW9tZW50BAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAADWN1cnJlbnRBbW91bnQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAKY3VycmVudEtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAAluZXdBbW91bnQJAABkAAAAAgUAAAANY3VycmVudEFtb3VudAgFAAAAA3BtdAAAAAZhbW91bnQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkFAAAACW5ld0Ftb3VudAUAAAADbmlsAAAAAWkBAAAACHdpdGhkcmF3AAAAAQAAAAZhbW91bnQEAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACW5ld0Ftb3VudAkAAGUAAAACBQAAAA1jdXJyZW50QW1vdW50BQAAAAZhbW91bnQDCQAAZgAAAAIAAAAAAAAAAAAFAAAABmFtb3VudAkAAAIAAAABAgAAAB1jYW50IHdpdGhkcmF3IG5lZ2F0aXZlIGFtb3VudAMJAABmAAAAAgAAAAAAAAAAAAUAAAAJbmV3QW1vdW50CQAAAgAAAAECAAAAEm5vdCBlbm91Z2ggYmFsYW5jZQkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkFAAAACW5ld0Ftb3VudAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAGYW1vdW50BQAAAAR3RVVSBQAAAANuaWwAAAAApY5otw==", "chainId": 84, "height": 552265, "spentComplexity": 0 } View: original | compacted Prev: ei1UBfZiJ14nFT95YFbcpMAypVDSBapAZuuN73A1BUJ Next: none Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let a = "none"
4+let a = base58'AruR1dLrcRGEmtGUjQHHmq6tbHMFdRcFW7AkAjTdJA9G'
55
6-let b = 3
7-
8-let c = 2
9-
10-let d = "voting"
11-
12-let e = "reveal"
13-
14-let f = "featured"
15-
16-let g = "delisted"
17-
18-let h = base58'Ce7p5ejhjAmupqL2uKDVM6RuGazLdnPTY6fx71E4N3uV'
19-
20-func i (j) = (j + "_price")
21-
22-
23-func k (l) = {
24- let m = {
25- let n = getInteger(this, l)
26- if ($isInstanceOf(n, "Int"))
27- then {
28- let o = n
29- o
6+@Callable(b)
7+func deposit () = {
8+ let c = extract(b.payment)
9+ if ((c.assetId != a))
10+ then throw("wEUR only at the moment")
11+ else {
12+ let d = toBase58String(b.caller.bytes)
13+ let e = {
14+ let f = getInteger(this, d)
15+ if ($isInstanceOf(f, "Int"))
16+ then {
17+ let g = f
18+ g
19+ }
20+ else 0
3021 }
31- else 0
32- }
33- m
34- }
35-
36-
37-func p (j) = k(i(j))
38-
39-
40-func q (r,j) = (((j + "_") + r) + "_cnt")
41-
42-
43-func s (r,j) = k(q(r, j))
44-
45-
46-func t (u,v) = ("item_" + toBase58String(sha256(toBytes((u + v)))))
47-
48-
49-func w (j) = (j + "_data")
50-
51-
52-func x (j) = (j + "_owner")
53-
54-
55-func y (l) = {
56- let z = {
57- let n = getString(this, l)
58- if ($isInstanceOf(n, "String"))
59- then {
60- let o = n
61- o
62- }
63- else a
64- }
65- z
66- }
67-
68-
69-func A (j) = y(x(j))
70-
71-
72-func B (C) = (C + "_balance")
73-
74-
75-func D (C) = k(B(C))
76-
77-
78-func E (j,r) = (((j + "_") + r) + "_commit")
79-
80-
81-func F (j,r) = y(E(j, r))
82-
83-
84-func G (j) = (j + "_comcnt")
85-
86-
87-func H (j) = k(G(j))
88-
89-
90-func I (j,r) = (((j + "_") + r) + "_reveal")
91-
92-
93-func J (j,r) = y(I(j, r))
94-
95-
96-func K (j) = (j + "_status")
97-
98-
99-func L (j) = y(K(j))
100-
101-
102-func M (j,N) = ((j + "_res") + N)
103-
104-
105-func O (j,N) = k(M(j, N))
106-
107-
108-@Callable(P)
109-func addItem (v,Q,R) = {
110- let S = toBase58String(P.caller.bytes)
111- let j = t(S, v)
112- if ((0 >= Q))
113- then throw("purchase amount cannot be less than item price")
114- else if ((A(j) != a))
115- then throw("an item already exists")
116- else WriteSet([DataEntry(x(j), S), DataEntry(i(j), Q), DataEntry(w(j), R)])
117- }
118-
119-
120-
121-@Callable(P)
122-func purchase (j) = {
123- let T = extract(P.payment)
124- if (isDefined(T.assetId))
125- then throw("can hold waves only at the moment")
126- else {
127- let U = toBase58String(P.caller.bytes)
128- let Q = p(j)
129- let S = A(j)
130- if ((Q > T.amount))
131- then throw("purchase amount cannot be less than item price")
132- else if ((T.amount > Q))
133- then throw("purchase amount cannot be higher than item price")
134- else if ((S == a))
135- then throw("supplier does not exist")
136- else WriteSet([DataEntry(q(U, j), (s(U, j) + 1)), DataEntry(B(S), (D(S) + T.amount))])
22+ let h = (e + c.amount)
23+ WriteSet([DataEntry(d, h)])
13724 }
13825 }
13926
14027
14128
142-@Callable(P)
143-func voteCommit (j,V) = {
144- let r = toBase58String(P.caller.bytes)
145- let W = H(j)
146- let X = L(j)
147- if ((W >= b))
148- then throw("reached max num of voters")
149- else if ((F(j, r) != a))
150- then throw("user has already participated")
151- else if ((x(j) == a))
152- then throw("item does not exist")
153- else if (if ((X != a))
154- then (X != d)
155- else false)
156- then throw("voting is not possible")
157- else WriteSet([DataEntry(E(j, r), V), DataEntry(G(j), (W + 1)), DataEntry(K(j), if ((W == b))
158- then e
159- else d)])
160- }
161-
162-
163-
164-@Callable(P)
165-func voteReveal (j,N,Y) = {
166- let r = toBase58String(P.caller.bytes)
167- let X = L(j)
168- let Z = (O(j, N) + 1)
169- if ((toBase58String(sha256(toBytes((N + Y)))) != F(j, r)))
170- then throw("reveal data is not valid")
171- else if ((b > H(j)))
172- then throw("max number of votes hasn't reach yet")
173- else if ((J(j, r) != a))
174- then throw("user has already participated")
175- else if (if ((X != d))
176- then (X != e)
177- else false)
178- then throw("wrong status")
179- else if (if ((N != f))
180- then (N != g)
181- else false)
182- then throw("wrong vote")
183- else if (if ((X == f))
184- then true
185- else (X == g))
186- then throw("vote has finished")
187- else WriteSet([DataEntry(I(j, r), N), DataEntry(M(j, N), Z), DataEntry(K(j), if ((Z >= c))
188- then N
189- else e)])
190- }
191-
192-
193-
194-@Callable(P)
195-func deposit () = {
196- let T = extract(P.payment)
197- if ((T.assetId != h))
198- then throw("wEUR only at the moment")
199- else {
200- let aa = toBase58String(P.caller.bytes)
201- let ab = {
202- let n = getInteger(this, aa)
203- if ($isInstanceOf(n, "Int"))
204- then {
205- let o = n
206- o
207- }
208- else 0
209- }
210- let ac = (ab + T.amount)
211- WriteSet([DataEntry(aa, ac)])
212- }
213- }
214-
215-
216-
217-@Callable(P)
218-func withdraw (ad) = {
219- let aa = toBase58String(P.caller.bytes)
220- let ab = {
221- let n = getInteger(this, aa)
222- if ($isInstanceOf(n, "Int"))
29+@Callable(b)
30+func withdraw (i) = {
31+ let d = toBase58String(b.caller.bytes)
32+ let e = {
33+ let f = getInteger(this, d)
34+ if ($isInstanceOf(f, "Int"))
22335 then {
224- let o = n
225- o
36+ let g = f
37+ g
22638 }
22739 else 0
22840 }
229- let ac = (ab - ad)
230- if ((0 > ad))
41+ let h = (e - i)
42+ if ((0 > i))
23143 then throw("cant withdraw negative amount")
232- else if ((0 > ac))
44+ else if ((0 > h))
23345 then throw("not enough balance")
234- else ScriptResult(WriteSet([DataEntry(aa, ac)]), TransferSet([ScriptTransfer(P.caller, ad, h)]))
46+ else ScriptResult(WriteSet([DataEntry(d, h)]), TransferSet([ScriptTransfer(b.caller, i, a)]))
23547 }
23648
23749

github/deemru/w8io/03bedc9 
35.89 ms