tx · 81Nksj98bimSK1gdTmn1KKwcjKmXzZSzoGUW8Tvvhnz2

3N2QJSJSX3wZxm24Xof72Y7ZAzaoHyoE4gR:  -0.01400000 Waves

2019.06.26 21:17 [559447] smart account 3N2QJSJSX3wZxm24Xof72Y7ZAzaoHyoE4gR > SELF 0.00000000 Waves

{ "type": 13, "id": "81Nksj98bimSK1gdTmn1KKwcjKmXzZSzoGUW8Tvvhnz2", "fee": 1400000, "feeAssetId": null, "timestamp": 1561573094787, "version": 1, "sender": "3N2QJSJSX3wZxm24Xof72Y7ZAzaoHyoE4gR", "senderPublicKey": "Cv9LR5ykMEzksK9vuNfn6PsvKBEqhr55yYw9upXwwNAj", "proofs": [ "CoyrP17Jk9LhkwVrjC7mzAZVXB4JX6MhYFoRgNqaW59oa2WwEpk4sVvcTHhLGzX8BzthT48xCVEG63bazsBPMf9" ], "script": "base64:AAIDAAAAAAAAAAAAAAAdAAAAAAROT05FAgAAAARub25lAAAAAAZWT1RFUlMAAAAAAAAAAAMAAAAABlFVT1JVTQAAAAAAAAAAAgAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAAAAAAhGRUFUVVJFRAIAAAAIZmVhdHVyZWQAAAAACERFTElTVEVEAgAAAAhkZWxpc3RlZAEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQUAAAAETk9ORQU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VSUwkAAAIAAAABAgAAABlyZWFjaGVkIG1heCBudW0gb2Ygdm90ZXJzAwkBAAAAAiE9AAAAAgkBAAAADmdldFZhbHVlQ29tbWl0AAAAAgUAAAAEaXRlbQUAAAAEdXNlcgUAAAAETk9ORQkAAAIAAAABAgAAAB11c2VyIGhhcyBhbHJlYWR5IHBhcnRpY2lwYXRlZAMJAAAAAAAAAgkBAAAAEmdldEtleUl0ZW1TdXBwbGllcgAAAAEFAAAABGl0ZW0FAAAABE5PTkUJAAACAAAAAQIAAAATaXRlbSBkb2VzIG5vdCBleGlzdAMDCQEAAAACIT0AAAACBQAAAAZzdGF0dXMFAAAABE5PTkUJAQAAAAIhPQAAAAIFAAAABnN0YXR1cwUAAAAGVk9USU5HBwkAAAIAAAABAgAAABZ2b3RpbmcgaXMgbm90IHBvc3NpYmxlCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAMZ2V0S2V5Q29tbWl0AAAAAgUAAAAEaXRlbQUAAAAEdXNlcgUAAAAEaGFzaAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEmdldEtleUNvbW1pdHNDb3VudAAAAAEFAAAABGl0ZW0JAABkAAAAAgUAAAAHY29tbWl0cwAAAAAAAAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEGdldEtleUl0ZW1TdGF0dXMAAAABBQAAAARpdGVtAwkAAAAAAAACBQAAAAdjb21taXRzBQAAAAZWT1RFUlMFAAAABlJFVkVBTAUAAAAGVk9USU5HBQAAAANuaWwAAAAAkZA6aQ==", "chainId": 84, "height": 559447, "spentComplexity": 0 } View: original | compacted Prev: 34KxSpQhQx98HiEYWmwMpRmexuoR5rMVK9krFVT7EPt8 Next: CNVFXrfFHRcNAog6P1TpDnmQYenFpqYvonqm9v5hkS2b 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) = (j + "_price")
46+func o (p) = (p + "_price")
3547
3648
37-func k (j) = b(i(j))
49+func q (p) = h(o(p))
3850
3951
40-func l (m,j) = (((j + "_") + m) + "_cnt")
52+func r (s,p) = (((p + "_") + s) + "_cnt")
4153
4254
43-func n (m,j) = b(l(m, j))
55+func t (s,p) = h(r(s, p))
4456
4557
46-func o (p,q) = ("item_" + toBase58String(sha256(toBytes((p + q)))))
58+func u (v,w) = ("item_" + toBase58String(sha256(toBytes((v + w)))))
4759
4860
49-func r (j) = (j + "_data")
61+func x (p) = (p + "_data")
5062
5163
52-func s (j) = (j + "_owner")
64+func y (p) = (p + "_owner")
5365
5466
55-func t (j) = g(s(j))
67+func z (p) = m(y(p))
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 purchase (j) = {
66- let y = extract(x.payment)
67- if (isDefined(y.assetId))
76+func D (p,s) = (((p + "_") + s) + "_commit")
77+
78+
79+func E (p,s) = m(D(p, s))
80+
81+
82+func F (p) = (p + "_comcnt")
83+
84+
85+func G (p) = h(F(p))
86+
87+
88+func H (p,s) = (((p + "_") + s) + "_reveal")
89+
90+
91+func I (p,s) = m(H(p, s))
92+
93+
94+func J (p) = (p + "_status")
95+
96+
97+func K (p) = m(J(p))
98+
99+
100+func L (p,M) = ((p + "_res:") + M)
101+
102+
103+func N (p,M) = h(L(p, M))
104+
105+
106+@Callable(O)
107+func purchase (p) = {
108+ let P = extract(O.payment)
109+ if (isDefined(P.assetId))
68110 then throw("can use WAVES only at the moment")
69111 else {
70- let z = toBase58String(x.caller.bytes)
71- let A = k(j)
72- let B = t(j)
73- if ((A > y.amount))
112+ let Q = toBase58String(O.caller.bytes)
113+ let R = q(p)
114+ let S = z(p)
115+ if ((R > P.amount))
74116 then throw("purchase amount cannot be less than item price")
75- else if ((y.amount > A))
117+ else if ((P.amount > R))
76118 then throw("purchase amount cannot be higher than item price")
77- else if ((B == a))
119+ else if ((S == a))
78120 then throw("supplier does not exist")
79- else WriteSet([DataEntry(l(z, j), (n(z, j) + 1)), DataEntry(u(B), (w(B) + y.amount))])
121+ else WriteSet([DataEntry(r(Q, p), (t(Q, p) + 1)), DataEntry(A(S), (C(S) + P.amount))])
80122 }
81123 }
82124
83125
84126
85-@Callable(x)
86-func addItem (q,A,C) = {
87- let B = toBase58String(x.caller.bytes)
88- let j = o(B, q)
89- if ((0 >= A))
127+@Callable(O)
128+func addItem (w,R,T) = {
129+ let S = toBase58String(O.caller.bytes)
130+ let p = u(S, w)
131+ if ((0 >= R))
90132 then throw("purchase amount cannot be less than item price")
91- else if ((t(j) != a))
133+ else if ((z(p) != a))
92134 then throw("an item already exist")
93- else WriteSet([DataEntry(s(j), B), DataEntry(i(j), A), DataEntry(r(j), C)])
135+ else WriteSet([DataEntry(y(p), S), DataEntry(o(p), R), DataEntry(x(p), T)])
94136 }
95137
96138
97139
98-@Callable(x)
140+@Callable(O)
99141 func withdraw () = {
100- let B = toBase58String(x.caller.bytes)
101- let D = w(B)
102- if ((0 >= D))
142+ let S = toBase58String(O.caller.bytes)
143+ let U = C(S)
144+ if ((0 >= U))
103145 then throw("insufficient balance")
104- else ScriptResult(WriteSet([DataEntry(u(B), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(B), D, unit)]))
146+ else ScriptResult(WriteSet([DataEntry(A(S), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(S), U, unit)]))
147+ }
148+
149+
150+
151+@Callable(O)
152+func voteCommit (p,V) = {
153+ let s = toBase58String(O.caller.bytes)
154+ let W = G(p)
155+ let X = K(p)
156+ if ((W >= b))
157+ then throw("reached max num of voters")
158+ else if ((E(p, s) != a))
159+ then throw("user has already participated")
160+ else if ((y(p) == a))
161+ then throw("item does 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(p, s), V), DataEntry(F(p), (W + 1)), DataEntry(J(p), 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) = (j + "_price")
46+func o (p) = (p + "_price")
3547
3648
37-func k (j) = b(i(j))
49+func q (p) = h(o(p))
3850
3951
40-func l (m,j) = (((j + "_") + m) + "_cnt")
52+func r (s,p) = (((p + "_") + s) + "_cnt")
4153
4254
43-func n (m,j) = b(l(m, j))
55+func t (s,p) = h(r(s, p))
4456
4557
46-func o (p,q) = ("item_" + toBase58String(sha256(toBytes((p + q)))))
58+func u (v,w) = ("item_" + toBase58String(sha256(toBytes((v + w)))))
4759
4860
49-func r (j) = (j + "_data")
61+func x (p) = (p + "_data")
5062
5163
52-func s (j) = (j + "_owner")
64+func y (p) = (p + "_owner")
5365
5466
55-func t (j) = g(s(j))
67+func z (p) = m(y(p))
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 purchase (j) = {
66- let y = extract(x.payment)
67- if (isDefined(y.assetId))
76+func D (p,s) = (((p + "_") + s) + "_commit")
77+
78+
79+func E (p,s) = m(D(p, s))
80+
81+
82+func F (p) = (p + "_comcnt")
83+
84+
85+func G (p) = h(F(p))
86+
87+
88+func H (p,s) = (((p + "_") + s) + "_reveal")
89+
90+
91+func I (p,s) = m(H(p, s))
92+
93+
94+func J (p) = (p + "_status")
95+
96+
97+func K (p) = m(J(p))
98+
99+
100+func L (p,M) = ((p + "_res:") + M)
101+
102+
103+func N (p,M) = h(L(p, M))
104+
105+
106+@Callable(O)
107+func purchase (p) = {
108+ let P = extract(O.payment)
109+ if (isDefined(P.assetId))
68110 then throw("can use WAVES only at the moment")
69111 else {
70- let z = toBase58String(x.caller.bytes)
71- let A = k(j)
72- let B = t(j)
73- if ((A > y.amount))
112+ let Q = toBase58String(O.caller.bytes)
113+ let R = q(p)
114+ let S = z(p)
115+ if ((R > P.amount))
74116 then throw("purchase amount cannot be less than item price")
75- else if ((y.amount > A))
117+ else if ((P.amount > R))
76118 then throw("purchase amount cannot be higher than item price")
77- else if ((B == a))
119+ else if ((S == a))
78120 then throw("supplier does not exist")
79- else WriteSet([DataEntry(l(z, j), (n(z, j) + 1)), DataEntry(u(B), (w(B) + y.amount))])
121+ else WriteSet([DataEntry(r(Q, p), (t(Q, p) + 1)), DataEntry(A(S), (C(S) + P.amount))])
80122 }
81123 }
82124
83125
84126
85-@Callable(x)
86-func addItem (q,A,C) = {
87- let B = toBase58String(x.caller.bytes)
88- let j = o(B, q)
89- if ((0 >= A))
127+@Callable(O)
128+func addItem (w,R,T) = {
129+ let S = toBase58String(O.caller.bytes)
130+ let p = u(S, w)
131+ if ((0 >= R))
90132 then throw("purchase amount cannot be less than item price")
91- else if ((t(j) != a))
133+ else if ((z(p) != a))
92134 then throw("an item already exist")
93- else WriteSet([DataEntry(s(j), B), DataEntry(i(j), A), DataEntry(r(j), C)])
135+ else WriteSet([DataEntry(y(p), S), DataEntry(o(p), R), DataEntry(x(p), T)])
94136 }
95137
96138
97139
98-@Callable(x)
140+@Callable(O)
99141 func withdraw () = {
100- let B = toBase58String(x.caller.bytes)
101- let D = w(B)
102- if ((0 >= D))
142+ let S = toBase58String(O.caller.bytes)
143+ let U = C(S)
144+ if ((0 >= U))
103145 then throw("insufficient balance")
104- else ScriptResult(WriteSet([DataEntry(u(B), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(B), D, unit)]))
146+ else ScriptResult(WriteSet([DataEntry(A(S), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(S), U, unit)]))
147+ }
148+
149+
150+
151+@Callable(O)
152+func voteCommit (p,V) = {
153+ let s = toBase58String(O.caller.bytes)
154+ let W = G(p)
155+ let X = K(p)
156+ if ((W >= b))
157+ then throw("reached max num of voters")
158+ else if ((E(p, s) != a))
159+ then throw("user has already participated")
160+ else if ((y(p) == a))
161+ then throw("item does 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(p, s), V), DataEntry(F(p), (W + 1)), DataEntry(J(p), if ((W == b))
167+ then e
168+ else d)])
105169 }
106170
107171

github/deemru/w8io/169f3d6 
165.36 ms