tx · 7hFmwEj7tsA1GPPDmqEX7hzjYL2U2T7T2acC183P1CJT

3MzvMg5dRiLMVdHJ3v4AfeCXttmaSPHdoVN:  -0.01400000 Waves

2019.11.17 22:59 [769590] smart account 3MzvMg5dRiLMVdHJ3v4AfeCXttmaSPHdoVN > SELF 0.00000000 Waves

{ "type": 13, "id": "7hFmwEj7tsA1GPPDmqEX7hzjYL2U2T7T2acC183P1CJT", "fee": 1400000, "feeAssetId": null, "timestamp": 1574020832361, "version": 1, "sender": "3MzvMg5dRiLMVdHJ3v4AfeCXttmaSPHdoVN", "senderPublicKey": "GvoCzLxrhCgZzNLksqhf43ehht8jTASRqtGBmXaNn7Jq", "proofs": [ "3rLXqGgRkaueNM5vQNe14nSx7cGTmjPS4AS2ycXcgrdwK4PSmqgxkPRLXJ8KrzmYypwF8Mb77UkwVn3LWrZPec3z" ], "script": "base64:AAIDAAAAAAAAABsIARIAEgMKAQESBQoDCAEIEgMKAQgSBAoCCAgAAAAdAAAAAAROT05FAgAAAARub25lAAAAAAZWT1RFUlMAAAAAAAAAAAMAAAAABlFVT1JVTQAAAAAAAAAAAgAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAAAAAAhGRUFUVVJFRAIAAAAIZmVhdHVyZWQAAAAACERFTElTVEVEAgAAAAhkZWxpc3RlZAEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUA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ycwMJAQAAAAIhPQAAAAIJAQAAAA5nZXRWYWx1ZUNvbW1pdAAAAAIFAAAABGl0ZW0FAAAABHVzZXIFAAAABE5PTkUJAAACAAAAAQIAAAAddXNlciBoYXMgYWxyZWFkeSBwYXJ0aWNpcGF0ZWQDCQAAAAAAAAIJAQAAABJnZXRLZXlJdGVtU3VwcGxpZXIAAAABBQAAAARpdGVtBQAAAAROT05FCQAAAgAAAAECAAAAE2l0ZW0gZG9lcyBub3QgZXhpc3QDAwkBAAAAAiE9AAAAAgUAAAAGc3RhdHVzBQAAAAROT05FCQEAAAACIT0AAAACBQAAAAZzdGF0dXMFAAAABlZPVElORwcJAAACAAAAAQIAAAAWdm90aW5nIGlzIG5vdCBwb3NzaWJsZQkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAADGdldEtleUNvbW1pdAAAAAIFAAAABGl0ZW0FAAAABHVzZXIFAAAABGhhc2gJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABJnZXRLZXlDb21taXRzQ291bnQAAAABBQAAAARpdGVtCQAAZAAAAAIFAAAAB2NvbW1pdHMAAAAAAAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABBnZXRLZXlJdGVtU3RhdHVzAAAAAQUAAAAEaXRlbQMJAAAAAAAAAgUAAAAHY29tbWl0cwUAAAAGVk9URVJTBQAAAAZSRVZFQUwFAAAABlZPVElORwUAAAADbmlsAAAAAALT8r0=", "chainId": 84, "height": 769590, "spentComplexity": 0 } View: original | compacted Prev: D41TLMtkcGZvmDMKpiW65tFGTht3f45Rao9FGtFJuk3r Next: FbSw7a8c85bkSpU2acvUEje6n1Q7PTAko4mK8j64e3LS Diff:
OldNewDifferences
5252 func r (s,p) = (((p + "_") + s) + "_cnt")
5353
5454
55-func t (u,v) = ("item_" + toBase58String(sha256(toBytes((u + v)))))
55+func t (s,p) = h(r(s, p))
5656
5757
58-func w (p) = (p + "_data")
58+func u (v,w) = ("item_" + toBase58String(sha256(toBytes((v + w)))))
5959
6060
61-func x (p) = (p + "_owner")
61+func x (p) = (p + "_data")
6262
6363
64-func y (p) = m(x(p))
64+func y (p) = (p + "_owner")
6565
6666
67-func z (A) = (A + "_balance")
67+func z (p) = m(y(p))
6868
6969
70-func B (A) = h(z(A))
70+func A (B) = (B + "_balance")
7171
7272
73-func C (p,s) = (((p + "_") + s) + "_commit")
73+func C (B) = h(A(B))
7474
7575
76-func D (p,s) = m(C(p, s))
76+func D (p,s) = (((p + "_") + s) + "_commit")
7777
7878
79-func E (p) = (p + "_comctn")
79+func E (p,s) = m(D(p, s))
8080
8181
82-func F (p) = h(E(p))
82+func F (p) = (p + "_comctn")
8383
8484
85-func G (p,s) = (((p + "_") + s) + "_reveal")
85+func G (p) = h(F(p))
8686
8787
88-func H (p,s) = m(G(p, s))
88+func H (p,s) = (((p + "_") + s) + "_reveal")
8989
9090
91-func I (p) = (p + "_status")
91+func I (p,s) = m(H(p, s))
9292
9393
94-func J (p) = m(I(p))
94+func J (p) = (p + "_status")
9595
9696
97-func K (p,L) = ((p + "_res:") + L)
97+func K (p) = m(J(p))
9898
9999
100-func M (p,L) = h(K(p, L))
100+func L (p,M) = ((p + "_res:") + M)
101101
102102
103-@Callable(N)
103+func N (p,M) = h(L(p, M))
104+
105+
106+@Callable(O)
104107 func deposit () = {
105- let O = extract(N.payment)
106- if (isDefined(O.assetId))
108+ let P = extract(O.payment)
109+ if (isDefined(P.assetId))
107110 then throw("can hold waves only at the moment")
108111 else {
109- let P = toBase58String(N.caller.bytes)
110- let Q = {
111- let k = getInteger(this, P)
112+ let Q = toBase58String(O.caller.bytes)
113+ let R = {
114+ let k = getInteger(this, Q)
112115 if ($isInstanceOf(k, "Int"))
113116 then {
114117 let l = k
116119 }
117120 else 0
118121 }
119- let R = {
120- let k = getString(this, ("wl_sts_" + P))
122+ let S = {
123+ let k = getString(this, ("wl_sts_" + Q))
121124 if ($isInstanceOf(k, "String"))
122125 then {
123126 let l = k
125128 }
126129 else throw("User has not been whitelisted")
127130 }
128- let S = (Q + O.amount)
129- WriteSet([DataEntry(P, S)])
131+ let T = (R + P.amount)
132+ WriteSet([DataEntry(Q, T)])
130133 }
131134 }
132135
133136
134137
135-@Callable(N)
136-func withdraw (T) = {
137- let P = toBase58String(N.caller.bytes)
138- let Q = {
139- let k = getInteger(this, P)
138+@Callable(O)
139+func withdraw (U) = {
140+ let Q = toBase58String(O.caller.bytes)
141+ let R = {
142+ let k = getInteger(this, Q)
140143 if ($isInstanceOf(k, "Int"))
141144 then {
142145 let l = k
144147 }
145148 else 0
146149 }
147- let S = (Q - T)
148- if ((0 > T))
150+ let T = (R - U)
151+ if ((0 > U))
149152 then throw("Can't withdraw negative amount")
150- else if ((0 > S))
153+ else if ((0 > T))
151154 then throw("Not enough balance")
152- else ScriptResult(WriteSet([DataEntry(P, S)]), TransferSet([ScriptTransfer(N.caller, T, unit)]))
155+ else ScriptResult(WriteSet([DataEntry(Q, T)]), TransferSet([ScriptTransfer(O.caller, U, unit)]))
153156 }
154157
155158
156159
157-@Callable(N)
158-func addItem (v,U,V) = {
159- let W = toBase58String(N.caller.bytes)
160- let p = t(W, v)
161- if ((0 >= U))
160+@Callable(O)
161+func addItem (w,V,W) = {
162+ let X = toBase58String(O.caller.bytes)
163+ let p = u(X, w)
164+ if ((0 >= V))
162165 then throw("purchase amount cannot be less than item price")
163- else if ((y(p) != a))
166+ else if ((z(p) != a))
164167 then throw("an item is already exist")
165- else WriteSet([DataEntry(x(p), W), DataEntry(o(p), U), DataEntry(w(p), V)])
168+ else WriteSet([DataEntry(y(p), X), DataEntry(o(p), V), DataEntry(x(p), W)])
166169 }
167170
168171
169172
170-@Callable(N)
171-func voteCommit (p,X) = {
172- let s = toBase58String(N.caller.bytes)
173- let Y = F(p)
174- let Z = J(p)
175- if ((Y >= b))
173+@Callable(O)
174+func purchase (p) = {
175+ let P = extract(O.payment)
176+ if (isDefined(P.assetId))
177+ then throw("WAVES tokens only at the moment")
178+ else {
179+ let Y = toBase58String(O.caller.bytes)
180+ let V = q(p)
181+ let X = z(p)
182+ if ((V > P.amount))
183+ then throw("purchase amount cannot be less than item price")
184+ else if ((P.amount > V))
185+ then throw("purchase amount cannot be higher than item price")
186+ else if ((X == a))
187+ then throw("supplier does not exist")
188+ else WriteSet([DataEntry(r(Y, p), (t(Y, p) + 1)), DataEntry(A(X), (C(X) + P.amount))])
189+ }
190+ }
191+
192+
193+
194+@Callable(O)
195+func voteCommit (p,Z) = {
196+ let s = toBase58String(O.caller.bytes)
197+ let aa = G(p)
198+ let ab = K(p)
199+ if ((aa >= b))
176200 then throw("reached max num of voters")
177- else if ((D(p, s) != a))
201+ else if ((E(p, s) != a))
178202 then throw("user has already participated")
179- else if ((x(p) == a))
203+ else if ((y(p) == a))
180204 then throw("item does not exist")
181- else if (if ((Z != a))
182- then (Z != d)
205+ else if (if ((ab != a))
206+ then (ab != d)
183207 else false)
184208 then throw("voting is not possible")
185- else WriteSet([DataEntry(C(p, s), X), DataEntry(E(p), (Y + 1)), DataEntry(I(p), if ((Y == b))
209+ else WriteSet([DataEntry(D(p, s), Z), DataEntry(F(p), (aa + 1)), DataEntry(J(p), if ((aa == b))
186210 then e
187211 else d)])
188212 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = "none"
55
66 let b = 3
77
88 let c = 2
99
1010 let d = "voting"
1111
1212 let e = "reveal"
1313
1414 let f = "featured"
1515
1616 let g = "delisted"
1717
1818 func h (i) = {
1919 let j = {
2020 let k = getInteger(this, i)
2121 if ($isInstanceOf(k, "Int"))
2222 then {
2323 let l = k
2424 l
2525 }
2626 else 0
2727 }
2828 j
2929 }
3030
3131
3232 func m (i) = {
3333 let n = {
3434 let k = getString(this, i)
3535 if ($isInstanceOf(k, "String"))
3636 then {
3737 let l = k
3838 l
3939 }
4040 else a
4141 }
4242 n
4343 }
4444
4545
4646 func o (p) = (p + "_price")
4747
4848
4949 func q (p) = h(o(p))
5050
5151
5252 func r (s,p) = (((p + "_") + s) + "_cnt")
5353
5454
55-func t (u,v) = ("item_" + toBase58String(sha256(toBytes((u + v)))))
55+func t (s,p) = h(r(s, p))
5656
5757
58-func w (p) = (p + "_data")
58+func u (v,w) = ("item_" + toBase58String(sha256(toBytes((v + w)))))
5959
6060
61-func x (p) = (p + "_owner")
61+func x (p) = (p + "_data")
6262
6363
64-func y (p) = m(x(p))
64+func y (p) = (p + "_owner")
6565
6666
67-func z (A) = (A + "_balance")
67+func z (p) = m(y(p))
6868
6969
70-func B (A) = h(z(A))
70+func A (B) = (B + "_balance")
7171
7272
73-func C (p,s) = (((p + "_") + s) + "_commit")
73+func C (B) = h(A(B))
7474
7575
76-func D (p,s) = m(C(p, s))
76+func D (p,s) = (((p + "_") + s) + "_commit")
7777
7878
79-func E (p) = (p + "_comctn")
79+func E (p,s) = m(D(p, s))
8080
8181
82-func F (p) = h(E(p))
82+func F (p) = (p + "_comctn")
8383
8484
85-func G (p,s) = (((p + "_") + s) + "_reveal")
85+func G (p) = h(F(p))
8686
8787
88-func H (p,s) = m(G(p, s))
88+func H (p,s) = (((p + "_") + s) + "_reveal")
8989
9090
91-func I (p) = (p + "_status")
91+func I (p,s) = m(H(p, s))
9292
9393
94-func J (p) = m(I(p))
94+func J (p) = (p + "_status")
9595
9696
97-func K (p,L) = ((p + "_res:") + L)
97+func K (p) = m(J(p))
9898
9999
100-func M (p,L) = h(K(p, L))
100+func L (p,M) = ((p + "_res:") + M)
101101
102102
103-@Callable(N)
103+func N (p,M) = h(L(p, M))
104+
105+
106+@Callable(O)
104107 func deposit () = {
105- let O = extract(N.payment)
106- if (isDefined(O.assetId))
108+ let P = extract(O.payment)
109+ if (isDefined(P.assetId))
107110 then throw("can hold waves only at the moment")
108111 else {
109- let P = toBase58String(N.caller.bytes)
110- let Q = {
111- let k = getInteger(this, P)
112+ let Q = toBase58String(O.caller.bytes)
113+ let R = {
114+ let k = getInteger(this, Q)
112115 if ($isInstanceOf(k, "Int"))
113116 then {
114117 let l = k
115118 l
116119 }
117120 else 0
118121 }
119- let R = {
120- let k = getString(this, ("wl_sts_" + P))
122+ let S = {
123+ let k = getString(this, ("wl_sts_" + Q))
121124 if ($isInstanceOf(k, "String"))
122125 then {
123126 let l = k
124127 l
125128 }
126129 else throw("User has not been whitelisted")
127130 }
128- let S = (Q + O.amount)
129- WriteSet([DataEntry(P, S)])
131+ let T = (R + P.amount)
132+ WriteSet([DataEntry(Q, T)])
130133 }
131134 }
132135
133136
134137
135-@Callable(N)
136-func withdraw (T) = {
137- let P = toBase58String(N.caller.bytes)
138- let Q = {
139- let k = getInteger(this, P)
138+@Callable(O)
139+func withdraw (U) = {
140+ let Q = toBase58String(O.caller.bytes)
141+ let R = {
142+ let k = getInteger(this, Q)
140143 if ($isInstanceOf(k, "Int"))
141144 then {
142145 let l = k
143146 l
144147 }
145148 else 0
146149 }
147- let S = (Q - T)
148- if ((0 > T))
150+ let T = (R - U)
151+ if ((0 > U))
149152 then throw("Can't withdraw negative amount")
150- else if ((0 > S))
153+ else if ((0 > T))
151154 then throw("Not enough balance")
152- else ScriptResult(WriteSet([DataEntry(P, S)]), TransferSet([ScriptTransfer(N.caller, T, unit)]))
155+ else ScriptResult(WriteSet([DataEntry(Q, T)]), TransferSet([ScriptTransfer(O.caller, U, unit)]))
153156 }
154157
155158
156159
157-@Callable(N)
158-func addItem (v,U,V) = {
159- let W = toBase58String(N.caller.bytes)
160- let p = t(W, v)
161- if ((0 >= U))
160+@Callable(O)
161+func addItem (w,V,W) = {
162+ let X = toBase58String(O.caller.bytes)
163+ let p = u(X, w)
164+ if ((0 >= V))
162165 then throw("purchase amount cannot be less than item price")
163- else if ((y(p) != a))
166+ else if ((z(p) != a))
164167 then throw("an item is already exist")
165- else WriteSet([DataEntry(x(p), W), DataEntry(o(p), U), DataEntry(w(p), V)])
168+ else WriteSet([DataEntry(y(p), X), DataEntry(o(p), V), DataEntry(x(p), W)])
166169 }
167170
168171
169172
170-@Callable(N)
171-func voteCommit (p,X) = {
172- let s = toBase58String(N.caller.bytes)
173- let Y = F(p)
174- let Z = J(p)
175- if ((Y >= b))
173+@Callable(O)
174+func purchase (p) = {
175+ let P = extract(O.payment)
176+ if (isDefined(P.assetId))
177+ then throw("WAVES tokens only at the moment")
178+ else {
179+ let Y = toBase58String(O.caller.bytes)
180+ let V = q(p)
181+ let X = z(p)
182+ if ((V > P.amount))
183+ then throw("purchase amount cannot be less than item price")
184+ else if ((P.amount > V))
185+ then throw("purchase amount cannot be higher than item price")
186+ else if ((X == a))
187+ then throw("supplier does not exist")
188+ else WriteSet([DataEntry(r(Y, p), (t(Y, p) + 1)), DataEntry(A(X), (C(X) + P.amount))])
189+ }
190+ }
191+
192+
193+
194+@Callable(O)
195+func voteCommit (p,Z) = {
196+ let s = toBase58String(O.caller.bytes)
197+ let aa = G(p)
198+ let ab = K(p)
199+ if ((aa >= b))
176200 then throw("reached max num of voters")
177- else if ((D(p, s) != a))
201+ else if ((E(p, s) != a))
178202 then throw("user has already participated")
179- else if ((x(p) == a))
203+ else if ((y(p) == a))
180204 then throw("item does not exist")
181- else if (if ((Z != a))
182- then (Z != d)
205+ else if (if ((ab != a))
206+ then (ab != d)
183207 else false)
184208 then throw("voting is not possible")
185- else WriteSet([DataEntry(C(p, s), X), DataEntry(E(p), (Y + 1)), DataEntry(I(p), if ((Y == b))
209+ else WriteSet([DataEntry(D(p, s), Z), DataEntry(F(p), (aa + 1)), DataEntry(J(p), if ((aa == b))
186210 then e
187211 else d)])
188212 }
189213
190214

github/deemru/w8io/169f3d6 
81.13 ms