tx · 5t2LunkPoAgmFJigRe7LPM96qWBkVv9MpFZfspx2qPZk

3N7JoxehscqKiXcuQ1iEQ6pEv6mZvnYS9mC:  -0.01400000 Waves

2019.07.20 07:54 [593772] smart account 3N7JoxehscqKiXcuQ1iEQ6pEv6mZvnYS9mC > SELF 0.00000000 Waves

{ "type": 13, "id": "5t2LunkPoAgmFJigRe7LPM96qWBkVv9MpFZfspx2qPZk", "fee": 1400000, "feeAssetId": null, "timestamp": 1563598515976, "version": 1, "sender": "3N7JoxehscqKiXcuQ1iEQ6pEv6mZvnYS9mC", "senderPublicKey": "JDxkwPYhkU5rnVfdAuA1TbJzA7QCMhHjS4Dz2zP48Z8j", "proofs": [ "2imgpFKXNwZQz6ueYpCRnRey2bUb5J4NdiZ3hshgeW5kHc1UvywWR5T4ZtUoo7XfwsMkB5NhVjjvarcpX5AAKRRw" ], "script": "base64:AAIDAAAAAAAAAAAAAAAdAAAAAAROT05FAgAAAARub25lAAAAAAZWT1RFUlMAAAAAAAAAAAMAAAAABlFVT1JVTQAAAAAAAAAAAgAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAAAAAAhGRUFUVVJFRAIAAAAIZmVhdHVyZWQAAAAACERFTElTVEVEAgAAAAhkZWxpc3RlZAEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQUAAAAETk9OR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BtYXhpbXVtIG9mIHZvdGVycwMJAQAAAAIhPQAAAAIJAQAAAA5nZXRWYWx1ZUNvbW1pdAAAAAIFAAAABGl0ZW0FAAAABHVzZXIFAAAABE5PTkUJAAACAAAAAQIAAAAddXNlciBoYXMgYWxyZWFkeSBwYXJ0aWNpcGF0ZWQDCQAAAAAAAAIJAQAAABJnZXRLZXlJdGVtU3VwcGxpZXIAAAABBQAAAARpdGVtBQAAAAROT05FCQAAAgAAAAECAAAAE2l0ZW0gZG9zZSBub3QgZXhpc3QDAwkBAAAAAiE9AAAAAgUAAAAGc3RhdHVzBQAAAAROT05FCQEAAAACIT0AAAACBQAAAAZzdGF0dXMFAAAABlZPVElORwcJAAACAAAAAQIAAAAWdm90aW5nIGlzIG5vdCBwb3NzaWJsZQkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAADGdldEtleUNvbW1pdAAAAAIFAAAABGl0ZW0FAAAABHVzZXIFAAAABGhhc2gJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABJnZXRLZXlDb21taXRzQ291bnQAAAABBQAAAARpdGVtCQAAZAAAAAIFAAAAB2NvbW1pdHMAAAAAAAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABBnZXRLZXlJdGVtU3RhdHVzAAAAAQUAAAAEaXRlbQMJAAAAAAAAAgUAAAAHY29tbWl0cwUAAAAGVk9URVJTBQAAAAZSRVZFQUwFAAAABlZPVElORwUAAAADbmlsAAAAAJdtsU0=", "chainId": 84, "height": 593772, "spentComplexity": 0 } View: original | compacted Prev: 5DiREqLLmaBWeaB2fZf5gcVKHtCFFn75AL6wVAafJDdT Next: Bg3vpHUYG1bET3vmVQtw6fNFXcp31Jn3Bmf3c9PYjGnH Diff:
OldNewDifferences
33 {-# CONTENT_TYPE DAPP #-}
44 let a = "none"
55
6-func b (c) = {
7- let d = {
8- let e = getInteger(this, c)
9- if ($isInstanceOf(e, "Int"))
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+func h (i) = {
19+ let j = {
20+ let k = getInteger(this, i)
21+ if ($isInstanceOf(k, "Int"))
1022 then {
11- let f = e
12- f
23+ let l = k
24+ l
1325 }
1426 else 0
1527 }
16- d
28+ j
1729 }
1830
1931
20-func g (c) = {
21- let h = {
22- let e = getString(this, c)
23- if ($isInstanceOf(e, "String"))
32+func m (i) = {
33+ let n = {
34+ let k = getString(this, i)
35+ if ($isInstanceOf(k, "String"))
2436 then {
25- let f = e
26- f
37+ let l = k
38+ l
2739 }
2840 else a
2941 }
30- h
42+ n
3143 }
3244
3345
34-func i (j,k) = (((k + "_") + j) + "_cnt")
46+func o (p,q) = (((q + "_") + p) + "_cnt")
3547
3648
37-func l (j,k) = b(i(j, k))
49+func r (p,q) = h(o(p, q))
3850
3951
40-func m (n,o) = ("item_" + toBase58String(sha256(toBytes((n + o)))))
52+func s (t,u) = ("item_" + toBase58String(sha256(toBytes((t + u)))))
4153
4254
43-func p (k) = (k + "_data")
55+func v (q) = (q + "_data")
4456
4557
46-func q (k) = (k + "_owner")
58+func w (q) = (q + "_owner")
4759
4860
49-func r (k) = (k + "_price")
61+func x (q) = (q + "_price")
5062
5163
52-func s (k) = b(r(k))
64+func y (q) = h(x(q))
5365
5466
55-func t (k) = g(q(k))
67+func z (q) = m(w(q))
5668
5769
58-func u (v) = (v + "_balance")
70+func A (B) = (B + "_balance")
5971
6072
61-func w (v) = b(u(v))
73+func C (B) = h(A(B))
6274
6375
64-@Callable(x)
65-func addItem (o,y,z) = {
66- let A = toBase58String(x.caller.bytes)
67- let k = m(A, o)
68- if ((0 >= y))
76+func D (q,p) = (((q + "_") + p) + "_commit")
77+
78+
79+func E (q,p) = m(D(q, p))
80+
81+
82+func F (q) = (q + "_itmcnt")
83+
84+
85+func G (q) = h(F(q))
86+
87+
88+func H (q,p) = (((q + "_") + p) + "_reveal")
89+
90+
91+func I (q,p) = m(H(q, p))
92+
93+
94+func J (q) = (q + "_status")
95+
96+
97+func K (q) = m(J(q))
98+
99+
100+func L (q,M) = ((q + "_res:") + M)
101+
102+
103+func N (q,M) = h(L(q, M))
104+
105+
106+@Callable(O)
107+func addItem (u,P,Q) = {
108+ let R = toBase58String(O.caller.bytes)
109+ let q = s(R, u)
110+ if ((0 >= P))
69111 then throw("purchase amount cannot be less than item price")
70- else if ((t(k) != a))
112+ else if ((z(q) != a))
71113 then throw("an item is already exist")
72- else WriteSet([DataEntry(q(k), A), DataEntry(r(k), y), DataEntry(p(k), z)])
114+ else WriteSet([DataEntry(w(q), R), DataEntry(x(q), P), DataEntry(v(q), Q)])
73115 }
74116
75117
76118
77-@Callable(x)
78-func purchase (k) = {
79- let B = extract(x.payment)
80- if (isDefined(B.assetId))
119+@Callable(O)
120+func purchase (q) = {
121+ let S = extract(O.payment)
122+ if (isDefined(S.assetId))
81123 then throw("WAVES tokens only at moment")
82124 else {
83- let C = toBase58String(x.caller.bytes)
84- let y = s(k)
85- let A = t(k)
86- if ((y > B.amount))
125+ let T = toBase58String(O.caller.bytes)
126+ let P = y(q)
127+ let R = z(q)
128+ if ((P > S.amount))
87129 then throw("purchase amout cannot be less than item price")
88- else if ((B.amount > y))
130+ else if ((S.amount > P))
89131 then throw("purchase amount cannot be higher than item price")
90- else if ((A == a))
132+ else if ((R == a))
91133 then throw("supplier dose not exist")
92- else WriteSet([DataEntry(i(C, k), (l(C, k) + 1)), DataEntry(u(A), (w(A) + B.amount))])
134+ else WriteSet([DataEntry(o(T, q), (r(T, q) + 1)), DataEntry(A(R), (C(R) + S.amount))])
93135 }
94136 }
95137
96138
97139
98-@Callable(x)
140+@Callable(O)
99141 func withdraw () = {
100- let A = toBase58String(x.caller.bytes)
101- let D = w(A)
102- if ((0 >= D))
142+ let R = toBase58String(O.caller.bytes)
143+ let U = C(R)
144+ if ((0 >= U))
103145 then throw("insufficient balance")
104- else ScriptResult(WriteSet([DataEntry(u(A), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(A), D, unit)]))
146+ else ScriptResult(WriteSet([DataEntry(A(R), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(R), U, unit)]))
147+ }
148+
149+
150+
151+@Callable(O)
152+func voteCommit (q,V) = {
153+ let p = toBase58String(O.caller.bytes)
154+ let W = G(q)
155+ let X = K(q)
156+ if ((W >= b))
157+ then throw("reach maximum of voters")
158+ else if ((E(q, p) != a))
159+ then throw("user has already participated")
160+ else if ((w(q) == a))
161+ then throw("item dose not exist")
162+ else if (if ((X != a))
163+ then (X != d)
164+ else false)
165+ then throw("voting is not possible")
166+ else WriteSet([DataEntry(D(q, p), V), DataEntry(F(q), (W + 1)), DataEntry(J(q), if ((W == b))
167+ then e
168+ else d)])
105169 }
106170
107171
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = "none"
55
6-func b (c) = {
7- let d = {
8- let e = getInteger(this, c)
9- if ($isInstanceOf(e, "Int"))
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+func h (i) = {
19+ let j = {
20+ let k = getInteger(this, i)
21+ if ($isInstanceOf(k, "Int"))
1022 then {
11- let f = e
12- f
23+ let l = k
24+ l
1325 }
1426 else 0
1527 }
16- d
28+ j
1729 }
1830
1931
20-func g (c) = {
21- let h = {
22- let e = getString(this, c)
23- if ($isInstanceOf(e, "String"))
32+func m (i) = {
33+ let n = {
34+ let k = getString(this, i)
35+ if ($isInstanceOf(k, "String"))
2436 then {
25- let f = e
26- f
37+ let l = k
38+ l
2739 }
2840 else a
2941 }
30- h
42+ n
3143 }
3244
3345
34-func i (j,k) = (((k + "_") + j) + "_cnt")
46+func o (p,q) = (((q + "_") + p) + "_cnt")
3547
3648
37-func l (j,k) = b(i(j, k))
49+func r (p,q) = h(o(p, q))
3850
3951
40-func m (n,o) = ("item_" + toBase58String(sha256(toBytes((n + o)))))
52+func s (t,u) = ("item_" + toBase58String(sha256(toBytes((t + u)))))
4153
4254
43-func p (k) = (k + "_data")
55+func v (q) = (q + "_data")
4456
4557
46-func q (k) = (k + "_owner")
58+func w (q) = (q + "_owner")
4759
4860
49-func r (k) = (k + "_price")
61+func x (q) = (q + "_price")
5062
5163
52-func s (k) = b(r(k))
64+func y (q) = h(x(q))
5365
5466
55-func t (k) = g(q(k))
67+func z (q) = m(w(q))
5668
5769
58-func u (v) = (v + "_balance")
70+func A (B) = (B + "_balance")
5971
6072
61-func w (v) = b(u(v))
73+func C (B) = h(A(B))
6274
6375
64-@Callable(x)
65-func addItem (o,y,z) = {
66- let A = toBase58String(x.caller.bytes)
67- let k = m(A, o)
68- if ((0 >= y))
76+func D (q,p) = (((q + "_") + p) + "_commit")
77+
78+
79+func E (q,p) = m(D(q, p))
80+
81+
82+func F (q) = (q + "_itmcnt")
83+
84+
85+func G (q) = h(F(q))
86+
87+
88+func H (q,p) = (((q + "_") + p) + "_reveal")
89+
90+
91+func I (q,p) = m(H(q, p))
92+
93+
94+func J (q) = (q + "_status")
95+
96+
97+func K (q) = m(J(q))
98+
99+
100+func L (q,M) = ((q + "_res:") + M)
101+
102+
103+func N (q,M) = h(L(q, M))
104+
105+
106+@Callable(O)
107+func addItem (u,P,Q) = {
108+ let R = toBase58String(O.caller.bytes)
109+ let q = s(R, u)
110+ if ((0 >= P))
69111 then throw("purchase amount cannot be less than item price")
70- else if ((t(k) != a))
112+ else if ((z(q) != a))
71113 then throw("an item is already exist")
72- else WriteSet([DataEntry(q(k), A), DataEntry(r(k), y), DataEntry(p(k), z)])
114+ else WriteSet([DataEntry(w(q), R), DataEntry(x(q), P), DataEntry(v(q), Q)])
73115 }
74116
75117
76118
77-@Callable(x)
78-func purchase (k) = {
79- let B = extract(x.payment)
80- if (isDefined(B.assetId))
119+@Callable(O)
120+func purchase (q) = {
121+ let S = extract(O.payment)
122+ if (isDefined(S.assetId))
81123 then throw("WAVES tokens only at moment")
82124 else {
83- let C = toBase58String(x.caller.bytes)
84- let y = s(k)
85- let A = t(k)
86- if ((y > B.amount))
125+ let T = toBase58String(O.caller.bytes)
126+ let P = y(q)
127+ let R = z(q)
128+ if ((P > S.amount))
87129 then throw("purchase amout cannot be less than item price")
88- else if ((B.amount > y))
130+ else if ((S.amount > P))
89131 then throw("purchase amount cannot be higher than item price")
90- else if ((A == a))
132+ else if ((R == a))
91133 then throw("supplier dose not exist")
92- else WriteSet([DataEntry(i(C, k), (l(C, k) + 1)), DataEntry(u(A), (w(A) + B.amount))])
134+ else WriteSet([DataEntry(o(T, q), (r(T, q) + 1)), DataEntry(A(R), (C(R) + S.amount))])
93135 }
94136 }
95137
96138
97139
98-@Callable(x)
140+@Callable(O)
99141 func withdraw () = {
100- let A = toBase58String(x.caller.bytes)
101- let D = w(A)
102- if ((0 >= D))
142+ let R = toBase58String(O.caller.bytes)
143+ let U = C(R)
144+ if ((0 >= U))
103145 then throw("insufficient balance")
104- else ScriptResult(WriteSet([DataEntry(u(A), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(A), D, unit)]))
146+ else ScriptResult(WriteSet([DataEntry(A(R), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(R), U, unit)]))
147+ }
148+
149+
150+
151+@Callable(O)
152+func voteCommit (q,V) = {
153+ let p = toBase58String(O.caller.bytes)
154+ let W = G(q)
155+ let X = K(q)
156+ if ((W >= b))
157+ then throw("reach maximum of voters")
158+ else if ((E(q, p) != a))
159+ then throw("user has already participated")
160+ else if ((w(q) == a))
161+ then throw("item dose not exist")
162+ else if (if ((X != a))
163+ then (X != d)
164+ else false)
165+ then throw("voting is not possible")
166+ else WriteSet([DataEntry(D(q, p), V), DataEntry(F(q), (W + 1)), DataEntry(J(q), if ((W == b))
167+ then e
168+ else d)])
105169 }
106170
107171

github/deemru/w8io/169f3d6 
51.03 ms