tx · CNTjhZwZmZzjkGbP8beSx8qrgYJH9B4QsWEiPJy9gAZq

3NAH9wsZ5Gr1LW7eZTnbbFAGL3omhKK7YWK:  -0.01000000 Waves

2022.04.30 21:55 [2031579] smart account 3NAH9wsZ5Gr1LW7eZTnbbFAGL3omhKK7YWK > SELF 0.00000000 Waves

{ "type": 13, "id": "CNTjhZwZmZzjkGbP8beSx8qrgYJH9B4QsWEiPJy9gAZq", "fee": 1000000, "feeAssetId": null, "timestamp": 1651344932843, "version": 2, "chainId": 84, "sender": "3NAH9wsZ5Gr1LW7eZTnbbFAGL3omhKK7YWK", "senderPublicKey": "EdiZKeSSzmoYqkk6ce532zc65KcUXi9HckEuP7sWPHmW", "proofs": [ "3yjxto7Jjbpmacx6GcYkBsQHF3sbr6ER2uhdU77nvKRkKiwb2qyfLVVR2pVvW2Dp27wthP45hq6AhRiQWFsAMteB" ], "script": "base64:AAIDAAAAAAAAABYIARIFCgMIAQgSAwoBCBIAEgQKAggIAAAAHQAAAAAETk9ORQIAAAAEbm9uZQAAAAAGVk9URVJTAAAAAAAAAAADAAAAAAZRVU9SVU0AAAAAAAAAAAIAAAAABlZPVElORwIAAAAGdm90aW5nAAAAAAZSRVZFQUwCAAAABnJldmVhbAAAAAAIRkVBVFVSRUQCAAAACGZlYXR1cmVkAAAAAAhERUxJU1RFRAIAAAAIZGVsaXN0ZWQBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWE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AAZwAAAAIFAAAAB2NvbW1pdHMFAAAABlZPVEVSUwkAAAIAAAABAgAAABlyZWFjaGVkIG1heCBudW0gb2Ygdm90ZXJzAwkBAAAAAiE9AAAAAgkBAAAADmdldFZhbHVlQ29tbWl0AAAAAgUAAAAEaXRlbQUAAAAEdXNlcgUAAAAETk9ORQkAAAIAAAABAgAAAB11c2VyIGhhcyBhbHJlYWR5IHBhcnRpY2lwYXRlZAMJAAAAAAAAAgkBAAAAEmdldEtleUl0ZW1TdXBwbGllcgAAAAEFAAAABGl0ZW0FAAAABE5PTkUJAAACAAAAAQIAAAAUaXRlbSBkb2VzIG5vdCBleGlzdHMDAwkBAAAAAiE9AAAAAgUAAAAGc3RhdHVzBQAAAAROT05FCQEAAAACIT0AAAACBQAAAAZzdGF0dXMFAAAABlZPVElORwcJAAACAAAAAQIAAAAWdm90aW5nIGlzIG5vdCBwb3NzaWJsZQkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAADGdldEtleUNvbW1pdAAAAAIFAAAABGl0ZW0FAAAABHVzZXIFAAAABGhhc2gJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABJnZXRLZXlDb21taXRzQ291bnQAAAABBQAAAARpdGVtCQAAZAAAAAIFAAAAB2NvbW1pdHMAAAAAAAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABBnZXRLZXlJdGVtU3RhdHVzAAAAAQUAAAAEaXRlbQMJAAAAAAAAAgUAAAAHY29tbWl0cwUAAAAGVk9URVJTBQAAAAZSRVZFQUwFAAAABlZPVElORwUAAAADbmlsAAAAAI0nSNk=", "height": 2031579, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6bhfg1Zw3sTXnMNvKizW8XAc4duAUc3QJDXc7vJW5ZAX Next: Adtgczxn1wXLkVUDPXjc4QLwNPvgjHa78hpCT225QUoA 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 addItem (q,y,z) = {
66- let A = toBase58String(x.caller.bytes)
67- let j = o(A, q)
68- if ((0 >= y))
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 addItem (w,P,Q) = {
108+ let R = toBase58String(O.caller.bytes)
109+ let p = u(R, w)
110+ if ((0 >= P))
69111 then throw("purchase amount cannot be less thanitem price")
70- else if ((t(j) != a))
112+ else if ((z(p) != a))
71113 then throw("an item is already exist")
72- else WriteSet([DataEntry(s(j), A), DataEntry(i(j), y), DataEntry(r(j), z)])
114+ else WriteSet([DataEntry(y(p), R), DataEntry(o(p), P), DataEntry(x(p), Q)])
73115 }
74116
75117
76118
77-@Callable(x)
78-func purchase (j) = {
79- let B = extract(x.payment)
80- if (isDefined(B.assetId))
119+@Callable(O)
120+func purchase (p) = {
121+ let S = extract(O.payment)
122+ if (isDefined(S.assetId))
81123 then throw("can use WAVES only at the moment")
82124 else {
83- let C = toBase58String(x.caller.bytes)
84- let y = k(j)
85- let A = t(j)
86- if ((y > B.amount))
125+ let T = toBase58String(O.caller.bytes)
126+ let P = q(p)
127+ let R = z(p)
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 does not exist")
92- else WriteSet([DataEntry(l(C, j), (n(C, j) + 1)), DataEntry(u(A), (w(A) + B.amount))])
134+ else WriteSet([DataEntry(r(T, p), (t(T, p) + 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 (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 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(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 addItem (q,y,z) = {
66- let A = toBase58String(x.caller.bytes)
67- let j = o(A, q)
68- if ((0 >= y))
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 addItem (w,P,Q) = {
108+ let R = toBase58String(O.caller.bytes)
109+ let p = u(R, w)
110+ if ((0 >= P))
69111 then throw("purchase amount cannot be less thanitem price")
70- else if ((t(j) != a))
112+ else if ((z(p) != a))
71113 then throw("an item is already exist")
72- else WriteSet([DataEntry(s(j), A), DataEntry(i(j), y), DataEntry(r(j), z)])
114+ else WriteSet([DataEntry(y(p), R), DataEntry(o(p), P), DataEntry(x(p), Q)])
73115 }
74116
75117
76118
77-@Callable(x)
78-func purchase (j) = {
79- let B = extract(x.payment)
80- if (isDefined(B.assetId))
119+@Callable(O)
120+func purchase (p) = {
121+ let S = extract(O.payment)
122+ if (isDefined(S.assetId))
81123 then throw("can use WAVES only at the moment")
82124 else {
83- let C = toBase58String(x.caller.bytes)
84- let y = k(j)
85- let A = t(j)
86- if ((y > B.amount))
125+ let T = toBase58String(O.caller.bytes)
126+ let P = q(p)
127+ let R = z(p)
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 does not exist")
92- else WriteSet([DataEntry(l(C, j), (n(C, j) + 1)), DataEntry(u(A), (w(A) + B.amount))])
134+ else WriteSet([DataEntry(r(T, p), (t(T, p) + 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 (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 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(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/026f985 
51.39 ms