tx · 5E3iA3mmGDQhoFLTmV5ChfParNXddyYRwFcU8ji6Pi8K

3Mrik3RqY2jPfkkG7R7UiHLBXGGa3jfMpyT:  -0.01400000 Waves

2019.08.28 00:27 [650142] smart account 3Mrik3RqY2jPfkkG7R7UiHLBXGGa3jfMpyT > SELF 0.00000000 Waves

{ "type": 13, "id": "5E3iA3mmGDQhoFLTmV5ChfParNXddyYRwFcU8ji6Pi8K", "fee": 1400000, "feeAssetId": null, "timestamp": 1566941242074, "version": 1, "sender": "3Mrik3RqY2jPfkkG7R7UiHLBXGGa3jfMpyT", "senderPublicKey": "Di8Ucr8vDr6jZNa27iAQxGMYEW9WSuF6MCBaM3fe9coP", "proofs": [ "59JNTQfAGQpDiohuHHMgwuMuZkRLmthJ2Yum2TFZHZ4U6JgXP5qFCN2vQFJnPzE8UHNKJPLk6EAnPYRsKcxErMov" ], "script": "base64:AAIDAAAAAAAAAAAAAAAdAAAAAAROT05FAgAAAARub25lAAAAAAZWT1RFUlMAAAAAAAAAAAMAAAAABlFVT1JVTQAAAAAAAAAAAgAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAAAAAAhGRUFUVVJFRAIAAAAIZmVhdHVyZWQAAAAACERFTElTVEVEAgAAAAhkZWxpc3RlZAEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQUAAAAETk9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Vk9URVJTCQAAAgAAAAECAAAAHHJlYWNoZWQgbWF4IG51bWJlciBvZiB2b3RlcnMDCQEAAAACIT0AAAACCQEAAAAOZ2V0VmFsdWVDb21taXQAAAACBQAAAARpdGVtBQAAAAR1c2VyBQAAAAROT05FCQAAAgAAAAECAAAAHXVzZXIgaGFzIHBhcnRpY2lwYXRlZCBhbHJlYWR5AwkAAAAAAAACCQEAAAASZ2V0S2V5SXRlbVN1cHBsaWVyAAAAAQUAAAAEaXRlbQUAAAAETk9ORQkAAAIAAAABAgAAABNpdGVtIGRvZXNuJ3QgZXhpc3RzAwMJAQAAAAIhPQAAAAIFAAAABnN0YXR1cwUAAAAETk9ORQkBAAAAAiE9AAAAAgUAAAAGc3RhdHVzBQAAAAZWT1RJTkcHCQAAAgAAAAECAAAAFnZvdGluZyBpcyBub3QgcG9zc2libGUJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAAxnZXRLZXlDb21taXQAAAACBQAAAARpdGVtBQAAAAR1c2VyBQAAAARoYXNoCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAARZ2V0S2V5Q29tbWl0Q291bnQAAAABBQAAAARpdGVtCQAAZAAAAAIFAAAAB2NvbW1pdHMAAAAAAAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABBnZXRLZXlJdGVtU3RhdHVzAAAAAQUAAAAEaXRlbQMJAAAAAAAAAgUAAAAHY29tbWl0cwkAAGUAAAACBQAAAAZWT1RFUlMAAAAAAAAAAAEFAAAABlJFVkVBTAUAAAAGVk9USU5HBQAAAANuaWwAAAAALK7foQ==", "chainId": 84, "height": 650142, "spentComplexity": 0 } View: original | compacted Prev: 2KTtPtvqHXAVTPviVruN7Qjkc8DkubBjAWKJnM9xb5Ve Next: 8eP6mHWecBPbeTfkeMpKTWCUnK5veAg1z2j1HzbTrFiH 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) = ("item_" + toBase58String(sha256(toBytes((j + k)))))
46+func o (p,q) = ("item_" + toBase58String(sha256(toBytes((p + q)))))
3547
3648
37-func l (m) = (m + "_price")
49+func r (s) = (s + "_price")
3850
3951
40-func n (m) = (m + "_data")
52+func t (s) = (s + "_data")
4153
4254
43-func o (m) = (m + "_owner")
55+func u (s) = (s + "_owner")
4456
4557
46-func p (q) = (q + "_balance")
58+func v (w) = (w + "_balance")
4759
4860
49-func r (s,m) = (((m + "_") + s) + "_cnt")
61+func x (y,s) = (((s + "_") + y) + "_cnt")
5062
5163
52-func t (m) = b(l(m))
64+func z (s,y) = (((s + "_") + y) + "_commit")
5365
5466
55-func u (m) = g(o(m))
67+func A (s) = (s + "_comcnt")
5668
5769
58-func v (q) = b(p(q))
70+func B (s,y) = (((s + "_") + y) + "_reveal")
5971
6072
61-func w (s,m) = b(r(s, m))
73+func C (s) = (s + "_status")
6274
6375
64-@Callable(x)
65-func addItem (k,y,z) = {
66- let A = toBase58String(x.caller.bytes)
67- let m = i(A, k)
68- if ((0 >= y))
76+func D (s,E) = ((s + "_res:") + E)
77+
78+
79+func F (s) = h(r(s))
80+
81+
82+func G (s) = m(u(s))
83+
84+
85+func H (w) = h(v(w))
86+
87+
88+func I (y,s) = h(x(y, s))
89+
90+
91+func J (s,y) = m(z(s, y))
92+
93+
94+func K (s) = h(A(s))
95+
96+
97+func L (s,y) = m(B(s, y))
98+
99+
100+func M (s) = m(C(s))
101+
102+
103+func N (s,E) = h(D(s, E))
104+
105+
106+@Callable(O)
107+func addItem (q,P,Q) = {
108+ let R = toBase58String(O.caller.bytes)
109+ let s = o(R, q)
110+ if ((0 >= P))
69111 then throw("Purchase amount cannot be less than or equal 0")
70- else if ((u(m) != a))
112+ else if ((G(s) != a))
71113 then throw("Item exists already")
72- else WriteSet([DataEntry(o(m), A), DataEntry(l(m), y), DataEntry(n(m), z)])
114+ else WriteSet([DataEntry(u(s), R), DataEntry(r(s), P), DataEntry(t(s), Q)])
73115 }
74116
75117
76118
77-@Callable(x)
78-func purchase (m) = {
79- let B = extract(x.payment)
80- if (isDefined(B.assetId))
119+@Callable(O)
120+func purchase (s) = {
121+ let S = extract(O.payment)
122+ if (isDefined(S.assetId))
81123 then throw("WAVES only at the moment")
82124 else {
83- let C = toBase58String(x.caller.bytes)
84- let y = t(m)
85- let A = u(m)
86- if ((y > B.amount))
125+ let T = toBase58String(O.caller.bytes)
126+ let P = F(s)
127+ let R = G(s)
128+ if ((P > S.amount))
87129 then throw("purchase amount 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 doesn't exists")
92- else WriteSet([DataEntry(r(C, m), (w(C, m) + 1)), DataEntry(p(A), (v(A) + B.amount))])
134+ else WriteSet([DataEntry(x(T, s), (I(T, s) + 1)), DataEntry(v(R), (H(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 = v(A)
102- if ((0 >= D))
142+ let R = toBase58String(O.caller.bytes)
143+ let U = H(R)
144+ if ((0 >= U))
103145 then throw("insufficient funds")
104- else ScriptResult(WriteSet([DataEntry(p(A), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(A), D, unit)]))
146+ else ScriptResult(WriteSet([DataEntry(v(R), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(R), U, unit)]))
147+ }
148+
149+
150+
151+@Callable(O)
152+func voteCommit (s,V) = {
153+ let y = toBase58String(O.caller.bytes)
154+ let W = K(s)
155+ let X = M(s)
156+ if ((W == b))
157+ then throw("reached max number of voters")
158+ else if ((J(s, y) != a))
159+ then throw("user has participated already")
160+ else if ((u(s) == a))
161+ then throw("item doesn't exists")
162+ else if (if ((X != a))
163+ then (X != d)
164+ else false)
165+ then throw("voting is not possible")
166+ else WriteSet([DataEntry(z(s, y), V), DataEntry(A(s), (W + 1)), DataEntry(C(s), if ((W == (b - 1)))
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) = ("item_" + toBase58String(sha256(toBytes((j + k)))))
46+func o (p,q) = ("item_" + toBase58String(sha256(toBytes((p + q)))))
3547
3648
37-func l (m) = (m + "_price")
49+func r (s) = (s + "_price")
3850
3951
40-func n (m) = (m + "_data")
52+func t (s) = (s + "_data")
4153
4254
43-func o (m) = (m + "_owner")
55+func u (s) = (s + "_owner")
4456
4557
46-func p (q) = (q + "_balance")
58+func v (w) = (w + "_balance")
4759
4860
49-func r (s,m) = (((m + "_") + s) + "_cnt")
61+func x (y,s) = (((s + "_") + y) + "_cnt")
5062
5163
52-func t (m) = b(l(m))
64+func z (s,y) = (((s + "_") + y) + "_commit")
5365
5466
55-func u (m) = g(o(m))
67+func A (s) = (s + "_comcnt")
5668
5769
58-func v (q) = b(p(q))
70+func B (s,y) = (((s + "_") + y) + "_reveal")
5971
6072
61-func w (s,m) = b(r(s, m))
73+func C (s) = (s + "_status")
6274
6375
64-@Callable(x)
65-func addItem (k,y,z) = {
66- let A = toBase58String(x.caller.bytes)
67- let m = i(A, k)
68- if ((0 >= y))
76+func D (s,E) = ((s + "_res:") + E)
77+
78+
79+func F (s) = h(r(s))
80+
81+
82+func G (s) = m(u(s))
83+
84+
85+func H (w) = h(v(w))
86+
87+
88+func I (y,s) = h(x(y, s))
89+
90+
91+func J (s,y) = m(z(s, y))
92+
93+
94+func K (s) = h(A(s))
95+
96+
97+func L (s,y) = m(B(s, y))
98+
99+
100+func M (s) = m(C(s))
101+
102+
103+func N (s,E) = h(D(s, E))
104+
105+
106+@Callable(O)
107+func addItem (q,P,Q) = {
108+ let R = toBase58String(O.caller.bytes)
109+ let s = o(R, q)
110+ if ((0 >= P))
69111 then throw("Purchase amount cannot be less than or equal 0")
70- else if ((u(m) != a))
112+ else if ((G(s) != a))
71113 then throw("Item exists already")
72- else WriteSet([DataEntry(o(m), A), DataEntry(l(m), y), DataEntry(n(m), z)])
114+ else WriteSet([DataEntry(u(s), R), DataEntry(r(s), P), DataEntry(t(s), Q)])
73115 }
74116
75117
76118
77-@Callable(x)
78-func purchase (m) = {
79- let B = extract(x.payment)
80- if (isDefined(B.assetId))
119+@Callable(O)
120+func purchase (s) = {
121+ let S = extract(O.payment)
122+ if (isDefined(S.assetId))
81123 then throw("WAVES only at the moment")
82124 else {
83- let C = toBase58String(x.caller.bytes)
84- let y = t(m)
85- let A = u(m)
86- if ((y > B.amount))
125+ let T = toBase58String(O.caller.bytes)
126+ let P = F(s)
127+ let R = G(s)
128+ if ((P > S.amount))
87129 then throw("purchase amount 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 doesn't exists")
92- else WriteSet([DataEntry(r(C, m), (w(C, m) + 1)), DataEntry(p(A), (v(A) + B.amount))])
134+ else WriteSet([DataEntry(x(T, s), (I(T, s) + 1)), DataEntry(v(R), (H(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 = v(A)
102- if ((0 >= D))
142+ let R = toBase58String(O.caller.bytes)
143+ let U = H(R)
144+ if ((0 >= U))
103145 then throw("insufficient funds")
104- else ScriptResult(WriteSet([DataEntry(p(A), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(A), D, unit)]))
146+ else ScriptResult(WriteSet([DataEntry(v(R), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(R), U, unit)]))
147+ }
148+
149+
150+
151+@Callable(O)
152+func voteCommit (s,V) = {
153+ let y = toBase58String(O.caller.bytes)
154+ let W = K(s)
155+ let X = M(s)
156+ if ((W == b))
157+ then throw("reached max number of voters")
158+ else if ((J(s, y) != a))
159+ then throw("user has participated already")
160+ else if ((u(s) == a))
161+ then throw("item doesn't exists")
162+ else if (if ((X != a))
163+ then (X != d)
164+ else false)
165+ then throw("voting is not possible")
166+ else WriteSet([DataEntry(z(s, y), V), DataEntry(A(s), (W + 1)), DataEntry(C(s), if ((W == (b - 1)))
167+ then e
168+ else d)])
105169 }
106170
107171

github/deemru/w8io/026f985 
52.01 ms