tx · Gb1D7zUb68USY97WKFr9dxeTMMFq2q6HjMtznbkhYudt 3MssRJsCtoAhkL5kNjxowQupbXVkfsK2d1J: -0.01400000 Waves 2020.10.08 14:31 [1211533] smart account 3MssRJsCtoAhkL5kNjxowQupbXVkfsK2d1J > SELF 0.00000000 Waves
{ "type": 13, "id": "Gb1D7zUb68USY97WKFr9dxeTMMFq2q6HjMtznbkhYudt", "fee": 1400000, "feeAssetId": null, "timestamp": 1602156724304, "version": 1, "sender": "3MssRJsCtoAhkL5kNjxowQupbXVkfsK2d1J", "senderPublicKey": "6ykraGjmEJoiMGV9H8exLDGexkih6SbTzGnZi7CFSd3D", "proofs": [ "4EnVDnZWYDBAnUvuacaTHkkMYX5jpZeRhnU4Yj5RYU5Yux9jiQ2BbUBq19nhoFpVwvGoao2STtdgd1vmqnRcAHQu" ], "script": "base64:AAIEAAAAAAAAAAsIAhIDCgEIEgASAAAAAAYAAAAABk5TQlRpZAkAAlkAAAABCQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQdAAAAAgUAAAAEdGhpcwIAAAAGTlNCVGlkAgAAACBOU0JUaWQgaXMgbm90IHNwZWNpZmllZCBpbiBzdGF0ZQAAAAAJaGVpZ2h0RW5kCQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQaAAAAAgUAAAAEdGhpcwIAAAAKaGVpZ2h0X2VuZAIAAAAkaGVpZ2h0X2VuZCBpcyBub3Qgc3BlY2lmaWVkIGluIHN0YXRlAAAAAAxhc3NldHNTdHJpbmcJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAR0aGlzAgAAABBhdmFpbGFibGVfYXNzZXRzAgAAACVBc3NldHMgbGlzdCBpcyBub3Qgc3BlY2lmaWVkIGluIHN0YXRlAAAAAAZhc3NldHMJAAS1AAAAAgUAAAAMYXNzZXRzU3RyaW5nAgAAAAEsAQAAAA5rZXlVc2VyQmFsYW5jZQAAAAEAAAAIdXN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Y2UFAAAABk5TQlRpZAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAAOdXNlckJhbGFuY2VLZXkAAAAAAAAAAAAFAAAAA25pbAAAAABevDVV", "chainId": 84, "height": 1211533, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Ffe4EsshJ73Zv75BkcYFc9D2Jrrj1Lmubts9MTFEfpHW Next: GA6ogJJSQQbB5E648Pbeu6JNXNf1qHYuR4wkzsZgZDUS Diff:
Old | New | Differences | |
---|---|---|---|
5 | 5 | ||
6 | 6 | let b = valueOrErrorMessage(getInteger(this, "height_end"), "height_end is not specified in state") | |
7 | 7 | ||
8 | - | func c (d) = makeString(["balance", toString(d)], "_") | |
8 | + | let c = valueOrErrorMessage(getString(this, "available_assets"), "Assets list is not specified in state") | |
9 | + | ||
10 | + | let d = split(c, ",") | |
11 | + | ||
12 | + | func e (f) = makeString(["balance", toString(f)], "_") | |
9 | 13 | ||
10 | 14 | ||
11 | - | @Callable(e) | |
12 | - | func castVote (f) = { | |
13 | - | let g = makeString(["vote", f], "_") | |
14 | - | let h = c(e.caller) | |
15 | - | let i = value(e.payments[0]) | |
16 | - | let j = i.assetId | |
17 | - | let k = i.amount | |
18 | - | let l = valueOrElse(getInteger(this, g), 0) | |
19 | - | let m = valueOrElse(getInteger(this, h), 0) | |
20 | - | if ((j != a)) | |
21 | - | then throw("incorrect assets") | |
22 | - | else if ((height >= b)) | |
23 | - | then throw("vote finished") | |
24 | - | else [IntegerEntry(g, (l + k)), IntegerEntry(h, (m + k))] | |
15 | + | func g (f,h) = makeString(["vote", f, h], "_") | |
16 | + | ||
17 | + | ||
18 | + | @Callable(i) | |
19 | + | func castVote (h) = if ((containsElement(d, h) == false)) | |
20 | + | then throw("Incorrect vote!") | |
21 | + | else { | |
22 | + | let j = makeString(["vote", h], "_") | |
23 | + | let k = g(toString(i.caller), h) | |
24 | + | let l = e(i.caller) | |
25 | + | let m = value(i.payments[0]) | |
26 | + | let n = m.assetId | |
27 | + | let o = m.amount | |
28 | + | let p = valueOrElse(getInteger(this, j), 0) | |
29 | + | let q = valueOrElse(getInteger(this, l), 0) | |
30 | + | let r = valueOrElse(getInteger(this, k), 0) | |
31 | + | if ((n != a)) | |
32 | + | then throw("incorrect assets") | |
33 | + | else if ((height >= b)) | |
34 | + | then throw("vote finished") | |
35 | + | else [IntegerEntry(j, (p + o)), IntegerEntry(l, (q + o)), IntegerEntry(k, (r + o))] | |
36 | + | } | |
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | @Callable(i) | |
41 | + | func cancelVote () = { | |
42 | + | let l = e(i.caller) | |
43 | + | let q = valueOrElse(getInteger(this, l), 0) | |
44 | + | if ((q == 0)) | |
45 | + | then nil | |
46 | + | else { | |
47 | + | func s (t,u) = { | |
48 | + | let v = makeString(["vote", u], "_") | |
49 | + | let w = g(toString(i.caller), u) | |
50 | + | let x = valueOrElse(getInteger(this, v), 0) | |
51 | + | let y = valueOrElse(getInteger(this, w), 0) | |
52 | + | if ((x == 0)) | |
53 | + | then t | |
54 | + | else ((t :+ IntegerEntry(v, (x - y))) :+ IntegerEntry(w, 0)) | |
55 | + | } | |
56 | + | ||
57 | + | ({ | |
58 | + | let z = d | |
59 | + | let A = size(z) | |
60 | + | let B = [IntegerEntry(l, 0)] | |
61 | + | if ((A == 0)) | |
62 | + | then B | |
63 | + | else { | |
64 | + | let C = s(B, z[0]) | |
65 | + | if ((A == 1)) | |
66 | + | then C | |
67 | + | else { | |
68 | + | let D = s(C, z[1]) | |
69 | + | if ((A == 2)) | |
70 | + | then D | |
71 | + | else { | |
72 | + | let E = s(D, z[2]) | |
73 | + | if ((A == 3)) | |
74 | + | then E | |
75 | + | else { | |
76 | + | let F = s(E, z[3]) | |
77 | + | if ((A == 4)) | |
78 | + | then F | |
79 | + | else { | |
80 | + | let G = s(F, z[4]) | |
81 | + | if ((A == 5)) | |
82 | + | then G | |
83 | + | else { | |
84 | + | let H = s(G, z[5]) | |
85 | + | if ((A == 6)) | |
86 | + | then H | |
87 | + | else { | |
88 | + | let I = s(H, z[6]) | |
89 | + | if ((A == 7)) | |
90 | + | then I | |
91 | + | else { | |
92 | + | let J = s(I, z[7]) | |
93 | + | if ((A == 8)) | |
94 | + | then J | |
95 | + | else { | |
96 | + | let K = s(J, z[8]) | |
97 | + | if ((A == 9)) | |
98 | + | then K | |
99 | + | else { | |
100 | + | let L = s(K, z[9]) | |
101 | + | if ((A == 10)) | |
102 | + | then L | |
103 | + | else { | |
104 | + | let M = s(L, z[10]) | |
105 | + | if ((A == 11)) | |
106 | + | then M | |
107 | + | else { | |
108 | + | let N = s(M, z[11]) | |
109 | + | if ((A == 12)) | |
110 | + | then N | |
111 | + | else { | |
112 | + | let O = s(N, z[12]) | |
113 | + | if ((A == 13)) | |
114 | + | then O | |
115 | + | else { | |
116 | + | let P = s(O, z[13]) | |
117 | + | if ((A == 14)) | |
118 | + | then P | |
119 | + | else { | |
120 | + | let Q = s(P, z[14]) | |
121 | + | if ((A == 15)) | |
122 | + | then Q | |
123 | + | else { | |
124 | + | let R = s(Q, z[15]) | |
125 | + | if ((A == 16)) | |
126 | + | then R | |
127 | + | else { | |
128 | + | let S = s(R, z[16]) | |
129 | + | if ((A == 17)) | |
130 | + | then S | |
131 | + | else { | |
132 | + | let T = s(S, z[17]) | |
133 | + | if ((A == 18)) | |
134 | + | then T | |
135 | + | else { | |
136 | + | let U = s(T, z[18]) | |
137 | + | if ((A == 19)) | |
138 | + | then U | |
139 | + | else { | |
140 | + | let V = s(U, z[19]) | |
141 | + | if ((A == 20)) | |
142 | + | then V | |
143 | + | else { | |
144 | + | let W = s(V, z[20]) | |
145 | + | throw("List size exceed 20") | |
146 | + | } | |
147 | + | } | |
148 | + | } | |
149 | + | } | |
150 | + | } | |
151 | + | } | |
152 | + | } | |
153 | + | } | |
154 | + | } | |
155 | + | } | |
156 | + | } | |
157 | + | } | |
158 | + | } | |
159 | + | } | |
160 | + | } | |
161 | + | } | |
162 | + | } | |
163 | + | } | |
164 | + | } | |
165 | + | } | |
166 | + | } | |
167 | + | } :+ ScriptTransfer(i.caller, q, a)) | |
168 | + | } | |
25 | 169 | } | |
26 | 170 | ||
27 | 171 | ||
28 | 172 | ||
29 | - | @Callable( | |
173 | + | @Callable(i) | |
30 | 174 | func withdraw () = { | |
31 | - | let | |
175 | + | let l = e(i.caller) | |
32 | 176 | if ((b > height)) | |
33 | 177 | then throw("vote in process") | |
34 | 178 | else { | |
35 | - | let | |
36 | - | if ((0 >= | |
179 | + | let X = valueOrElse(getInteger(this, l), 0) | |
180 | + | if ((0 >= X)) | |
37 | 181 | then throw("balance is empty") | |
38 | - | else [ScriptTransfer( | |
182 | + | else [ScriptTransfer(i.caller, X, a), IntegerEntry(l, 0)] | |
39 | 183 | } | |
40 | 184 | } | |
41 | 185 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = fromBase58String(valueOrErrorMessage(getString(this, "NSBTid"), "NSBTid is not specified in state")) | |
5 | 5 | ||
6 | 6 | let b = valueOrErrorMessage(getInteger(this, "height_end"), "height_end is not specified in state") | |
7 | 7 | ||
8 | - | func c (d) = makeString(["balance", toString(d)], "_") | |
8 | + | let c = valueOrErrorMessage(getString(this, "available_assets"), "Assets list is not specified in state") | |
9 | + | ||
10 | + | let d = split(c, ",") | |
11 | + | ||
12 | + | func e (f) = makeString(["balance", toString(f)], "_") | |
9 | 13 | ||
10 | 14 | ||
11 | - | @Callable(e) | |
12 | - | func castVote (f) = { | |
13 | - | let g = makeString(["vote", f], "_") | |
14 | - | let h = c(e.caller) | |
15 | - | let i = value(e.payments[0]) | |
16 | - | let j = i.assetId | |
17 | - | let k = i.amount | |
18 | - | let l = valueOrElse(getInteger(this, g), 0) | |
19 | - | let m = valueOrElse(getInteger(this, h), 0) | |
20 | - | if ((j != a)) | |
21 | - | then throw("incorrect assets") | |
22 | - | else if ((height >= b)) | |
23 | - | then throw("vote finished") | |
24 | - | else [IntegerEntry(g, (l + k)), IntegerEntry(h, (m + k))] | |
15 | + | func g (f,h) = makeString(["vote", f, h], "_") | |
16 | + | ||
17 | + | ||
18 | + | @Callable(i) | |
19 | + | func castVote (h) = if ((containsElement(d, h) == false)) | |
20 | + | then throw("Incorrect vote!") | |
21 | + | else { | |
22 | + | let j = makeString(["vote", h], "_") | |
23 | + | let k = g(toString(i.caller), h) | |
24 | + | let l = e(i.caller) | |
25 | + | let m = value(i.payments[0]) | |
26 | + | let n = m.assetId | |
27 | + | let o = m.amount | |
28 | + | let p = valueOrElse(getInteger(this, j), 0) | |
29 | + | let q = valueOrElse(getInteger(this, l), 0) | |
30 | + | let r = valueOrElse(getInteger(this, k), 0) | |
31 | + | if ((n != a)) | |
32 | + | then throw("incorrect assets") | |
33 | + | else if ((height >= b)) | |
34 | + | then throw("vote finished") | |
35 | + | else [IntegerEntry(j, (p + o)), IntegerEntry(l, (q + o)), IntegerEntry(k, (r + o))] | |
36 | + | } | |
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | @Callable(i) | |
41 | + | func cancelVote () = { | |
42 | + | let l = e(i.caller) | |
43 | + | let q = valueOrElse(getInteger(this, l), 0) | |
44 | + | if ((q == 0)) | |
45 | + | then nil | |
46 | + | else { | |
47 | + | func s (t,u) = { | |
48 | + | let v = makeString(["vote", u], "_") | |
49 | + | let w = g(toString(i.caller), u) | |
50 | + | let x = valueOrElse(getInteger(this, v), 0) | |
51 | + | let y = valueOrElse(getInteger(this, w), 0) | |
52 | + | if ((x == 0)) | |
53 | + | then t | |
54 | + | else ((t :+ IntegerEntry(v, (x - y))) :+ IntegerEntry(w, 0)) | |
55 | + | } | |
56 | + | ||
57 | + | ({ | |
58 | + | let z = d | |
59 | + | let A = size(z) | |
60 | + | let B = [IntegerEntry(l, 0)] | |
61 | + | if ((A == 0)) | |
62 | + | then B | |
63 | + | else { | |
64 | + | let C = s(B, z[0]) | |
65 | + | if ((A == 1)) | |
66 | + | then C | |
67 | + | else { | |
68 | + | let D = s(C, z[1]) | |
69 | + | if ((A == 2)) | |
70 | + | then D | |
71 | + | else { | |
72 | + | let E = s(D, z[2]) | |
73 | + | if ((A == 3)) | |
74 | + | then E | |
75 | + | else { | |
76 | + | let F = s(E, z[3]) | |
77 | + | if ((A == 4)) | |
78 | + | then F | |
79 | + | else { | |
80 | + | let G = s(F, z[4]) | |
81 | + | if ((A == 5)) | |
82 | + | then G | |
83 | + | else { | |
84 | + | let H = s(G, z[5]) | |
85 | + | if ((A == 6)) | |
86 | + | then H | |
87 | + | else { | |
88 | + | let I = s(H, z[6]) | |
89 | + | if ((A == 7)) | |
90 | + | then I | |
91 | + | else { | |
92 | + | let J = s(I, z[7]) | |
93 | + | if ((A == 8)) | |
94 | + | then J | |
95 | + | else { | |
96 | + | let K = s(J, z[8]) | |
97 | + | if ((A == 9)) | |
98 | + | then K | |
99 | + | else { | |
100 | + | let L = s(K, z[9]) | |
101 | + | if ((A == 10)) | |
102 | + | then L | |
103 | + | else { | |
104 | + | let M = s(L, z[10]) | |
105 | + | if ((A == 11)) | |
106 | + | then M | |
107 | + | else { | |
108 | + | let N = s(M, z[11]) | |
109 | + | if ((A == 12)) | |
110 | + | then N | |
111 | + | else { | |
112 | + | let O = s(N, z[12]) | |
113 | + | if ((A == 13)) | |
114 | + | then O | |
115 | + | else { | |
116 | + | let P = s(O, z[13]) | |
117 | + | if ((A == 14)) | |
118 | + | then P | |
119 | + | else { | |
120 | + | let Q = s(P, z[14]) | |
121 | + | if ((A == 15)) | |
122 | + | then Q | |
123 | + | else { | |
124 | + | let R = s(Q, z[15]) | |
125 | + | if ((A == 16)) | |
126 | + | then R | |
127 | + | else { | |
128 | + | let S = s(R, z[16]) | |
129 | + | if ((A == 17)) | |
130 | + | then S | |
131 | + | else { | |
132 | + | let T = s(S, z[17]) | |
133 | + | if ((A == 18)) | |
134 | + | then T | |
135 | + | else { | |
136 | + | let U = s(T, z[18]) | |
137 | + | if ((A == 19)) | |
138 | + | then U | |
139 | + | else { | |
140 | + | let V = s(U, z[19]) | |
141 | + | if ((A == 20)) | |
142 | + | then V | |
143 | + | else { | |
144 | + | let W = s(V, z[20]) | |
145 | + | throw("List size exceed 20") | |
146 | + | } | |
147 | + | } | |
148 | + | } | |
149 | + | } | |
150 | + | } | |
151 | + | } | |
152 | + | } | |
153 | + | } | |
154 | + | } | |
155 | + | } | |
156 | + | } | |
157 | + | } | |
158 | + | } | |
159 | + | } | |
160 | + | } | |
161 | + | } | |
162 | + | } | |
163 | + | } | |
164 | + | } | |
165 | + | } | |
166 | + | } | |
167 | + | } :+ ScriptTransfer(i.caller, q, a)) | |
168 | + | } | |
25 | 169 | } | |
26 | 170 | ||
27 | 171 | ||
28 | 172 | ||
29 | - | @Callable( | |
173 | + | @Callable(i) | |
30 | 174 | func withdraw () = { | |
31 | - | let | |
175 | + | let l = e(i.caller) | |
32 | 176 | if ((b > height)) | |
33 | 177 | then throw("vote in process") | |
34 | 178 | else { | |
35 | - | let | |
36 | - | if ((0 >= | |
179 | + | let X = valueOrElse(getInteger(this, l), 0) | |
180 | + | if ((0 >= X)) | |
37 | 181 | then throw("balance is empty") | |
38 | - | else [ScriptTransfer( | |
182 | + | else [ScriptTransfer(i.caller, X, a), IntegerEntry(l, 0)] | |
39 | 183 | } | |
40 | 184 | } | |
41 | 185 | ||
42 | 186 |
github/deemru/w8io/169f3d6 40.00 ms ◑