tx · Gt8czhHGAEVx2AXzEXDg1eGJZ4Eygpggf7EM6zuNmYLX 3N8X6wT7GZLavL2ayUQzwRD2kRFRSDyhkKS: -0.01000000 Waves 2021.07.07 14:44 [1603142] smart account 3N8X6wT7GZLavL2ayUQzwRD2kRFRSDyhkKS > SELF 0.00000000 Waves
{ "type": 13, "id": "Gt8czhHGAEVx2AXzEXDg1eGJZ4Eygpggf7EM6zuNmYLX", "fee": 1000000, "feeAssetId": null, "timestamp": 1625658286409, "version": 2, "chainId": 84, "sender": "3N8X6wT7GZLavL2ayUQzwRD2kRFRSDyhkKS", "senderPublicKey": "7DT6yPGiY3eZiSytDKBx5ToZcjhem3SyxdX6Zz9fsMED", "proofs": [ "382DSoJHYEUofefkqKYFgymwJcCncYYHC2oT9E744eMnf2afq7C8M1ct64ZgY48cBzVqXRsQrGTBQRB4km8FDSJ7" ], "script": "base64:AAIFAAAAAAAAA9QIAhIFCgMIAQgSAwoBCBIAEgQKAggIEgUKAwgICBoKCgJhMRIETk9ORRoUCgJhMhIOZ2V0TnVtYmVyQnlLZXkaCQoCYTMSA2tleRoJCgJhNBIDbnVtGg0KAmE1EgckbWF0Y2gwGgcKAmE2EgFhGhEKAmE3EgtnZXRTdHJCeUtleRoJCgJhOBIDc3RyGhUKAmE5Eg9nZXRLZXlJdGVtUHJpY2UaCgoCYjESBGl0ZW0aFwoCYjISEWdldFZhbHVlSXRlbVByaWNlGhsKAmIzEhVnZXRLZXlVc2VySXRlbUNvdW50ZXIaCgoCYjQSBHVzZXIaHQoCYjUSF2dldFZhbHVlVXNlckl0ZW1Db3VudGVyGhAKAmI2EgpnZXRLZXlJdGVtGg4KAmI3EghzdXBwbGllchoLCgJiOBIFdGl0bGUaFAoCYjkSDmdldEtleUl0ZW1EYXRhGhgKAmMxEhJnZXRLZXlJdGVtU3VwcGxpZXIaGgoCYzISFGdldFZhbHVlSXRlbVN1cHBsaWVyGhsKAmMzEhVnZXRLZXlCYWxhbmNlU3VwcGxpZXIaDQoC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UzBQAAAAJmNwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQEAAAACZDkAAAABBQAAAAJiMQMJAABnAAAAAgUAAAACZjcFAAAAAmM3BQAAAAJlMwUAAAACYzkFAAAAA25pbAAAAABINCkL", "height": 1603142, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CxJDMt1pswwB5qoGmjnEmz5Ms1a9LmLechpxUmxRBkHJ Next: BHv4ThBwR6kcmZS9QrRxDDsDBb8CP9SPhmJeDJxE7zAH Diff:
Old | New | Differences | |
---|---|---|---|
179 | 179 | then throw("max num of voters hasnt reached yet") | |
180 | 180 | else if ((I(j, m) != a)) | |
181 | 181 | then throw("user has already participated") | |
182 | - | else if (if (( | |
183 | - | then ( | |
182 | + | else if (if ((X != z)) | |
183 | + | then (X != A) | |
184 | 184 | else false) | |
185 | - | then throw("wrong vote") | |
186 | - | else [StringEntry(H(j, m), M), IntegerEntry(L(j, M), Z), StringEntry(J(j), if ((Z >= y)) | |
187 | - | then M | |
188 | - | else A)] | |
185 | + | then throw("wrong status") | |
186 | + | else if (if ((M != B)) | |
187 | + | then (M != C) | |
188 | + | else false) | |
189 | + | then throw("wrong vote") | |
190 | + | else if (if ((X == B)) | |
191 | + | then true | |
192 | + | else (X == C)) | |
193 | + | then throw("vote has finished") | |
194 | + | else [StringEntry(H(j, m), M), IntegerEntry(L(j, M), Z), StringEntry(J(j), if ((Z >= y)) | |
195 | + | then M | |
196 | + | else A)] | |
189 | 197 | } | |
190 | 198 | ||
191 | 199 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "none" | |
5 | 5 | ||
6 | 6 | func b (c) = { | |
7 | 7 | let d = { | |
8 | 8 | let e = getInteger(this, c) | |
9 | 9 | if ($isInstanceOf(e, "Int")) | |
10 | 10 | then { | |
11 | 11 | let f = e | |
12 | 12 | f | |
13 | 13 | } | |
14 | 14 | else 0 | |
15 | 15 | } | |
16 | 16 | d | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func g (c) = { | |
21 | 21 | let h = { | |
22 | 22 | let e = getString(this, c) | |
23 | 23 | if ($isInstanceOf(e, "String")) | |
24 | 24 | then { | |
25 | 25 | let f = e | |
26 | 26 | f | |
27 | 27 | } | |
28 | 28 | else a | |
29 | 29 | } | |
30 | 30 | h | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func i (j) = (j + "_price") | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func k (j) = b(i(j)) | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func l (m,j) = (((j + "_") + m) + "_cnt") | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func n (m,j) = b(l(m, j)) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func o (p,q) = ("item_" + toBase58String(sha256(toBytes((p + q))))) | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func r (j) = (j + "_data") | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func s (j) = (j + "_owner") | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func t (j) = g(s(j)) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func u (v) = (v + "_balance") | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func w (v) = b(u(v)) | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | let x = 3 | |
65 | 65 | ||
66 | 66 | let y = 2 | |
67 | 67 | ||
68 | 68 | let z = "voting" | |
69 | 69 | ||
70 | 70 | let A = "reveal" | |
71 | 71 | ||
72 | 72 | let B = "featured" | |
73 | 73 | ||
74 | 74 | let C = "delisted" | |
75 | 75 | ||
76 | 76 | func D (j,m) = (((j + "_") + m) + "_commit") | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func E (j,m) = g(D(j, m)) | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func F (j) = (j + "_comcnt") | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func G (j) = b(F(j)) | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func H (j,m) = (((j + "_") + m) + "_reveal") | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func I (j,m) = g(H(j, m)) | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func J (j) = (j + "_status") | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func K (j) = g(J(j)) | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func L (j,M) = ((j + "_res:") + M) | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func N (j,M) = b(L(j, M)) | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | @Callable(O) | |
107 | 107 | func addItem (q,P,Q) = { | |
108 | 108 | let R = toBase58String(O.caller.bytes) | |
109 | 109 | let j = o(R, q) | |
110 | 110 | if ((0 >= P)) | |
111 | 111 | then throw("Purchase amount cannot be less than item price") | |
112 | 112 | else if ((t(j) != a)) | |
113 | 113 | then throw("an item already exists") | |
114 | 114 | else [StringEntry(s(j), R), IntegerEntry(i(j), P), StringEntry(r(j), Q)] | |
115 | 115 | } | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | ||
119 | 119 | @Callable(O) | |
120 | 120 | func purchase (j) = { | |
121 | 121 | let S = O.payments[0] | |
122 | 122 | if (isDefined(S.assetId)) | |
123 | 123 | then throw("WAVES ONLY HHEUAWHEUAS") | |
124 | 124 | else { | |
125 | 125 | let T = toBase58String(O.caller.bytes) | |
126 | 126 | let P = k(j) | |
127 | 127 | let R = t(j) | |
128 | 128 | if ((P > S.amount)) | |
129 | 129 | then throw("Purchase amount cannot be less than item price") | |
130 | 130 | else if ((R == a)) | |
131 | 131 | then throw("Supplier does not exist") | |
132 | 132 | else [IntegerEntry(l(T, j), (n(T, j) + 1)), IntegerEntry(u(R), (w(R) + S.amount))] | |
133 | 133 | } | |
134 | 134 | } | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | ||
138 | 138 | @Callable(O) | |
139 | 139 | func withdraw () = { | |
140 | 140 | let R = toBase58String(O.caller.bytes) | |
141 | 141 | let U = w(R) | |
142 | 142 | if ((0 >= U)) | |
143 | 143 | then throw("insuficient balance") | |
144 | 144 | else [IntegerEntry(u(R), 0), ScriptTransfer(addressFromStringValue(R), U, unit)] | |
145 | 145 | } | |
146 | 146 | ||
147 | 147 | ||
148 | 148 | ||
149 | 149 | @Callable(O) | |
150 | 150 | func voteCommit (j,V) = { | |
151 | 151 | let m = toBase58String(O.caller.bytes) | |
152 | 152 | let W = G(j) | |
153 | 153 | let X = K(j) | |
154 | 154 | if ((W >= x)) | |
155 | 155 | then throw("Reached max num of voters") | |
156 | 156 | else if ((E(j, m) != a)) | |
157 | 157 | then throw("b1") | |
158 | 158 | else if ((s(j) == a)) | |
159 | 159 | then throw("b2") | |
160 | 160 | else if (if ((X != a)) | |
161 | 161 | then (X != z) | |
162 | 162 | else false) | |
163 | 163 | then throw("b3") | |
164 | 164 | else [StringEntry(D(j, m), V), IntegerEntry(F(j), (W + 1)), StringEntry(J(j), if ((W == x)) | |
165 | 165 | then A | |
166 | 166 | else z)] | |
167 | 167 | } | |
168 | 168 | ||
169 | 169 | ||
170 | 170 | ||
171 | 171 | @Callable(O) | |
172 | 172 | func voteReveal (j,M,Y) = { | |
173 | 173 | let m = toBase58String(O.caller.bytes) | |
174 | 174 | let X = K(j) | |
175 | 175 | let Z = (N(j, M) + 1) | |
176 | 176 | if ((toBase58String(sha256(toBytes((M + Y)))) != E(j, m))) | |
177 | 177 | then throw("Reveal data is not valid") | |
178 | 178 | else if ((x > G(j))) | |
179 | 179 | then throw("max num of voters hasnt reached yet") | |
180 | 180 | else if ((I(j, m) != a)) | |
181 | 181 | then throw("user has already participated") | |
182 | - | else if (if (( | |
183 | - | then ( | |
182 | + | else if (if ((X != z)) | |
183 | + | then (X != A) | |
184 | 184 | else false) | |
185 | - | then throw("wrong vote") | |
186 | - | else [StringEntry(H(j, m), M), IntegerEntry(L(j, M), Z), StringEntry(J(j), if ((Z >= y)) | |
187 | - | then M | |
188 | - | else A)] | |
185 | + | then throw("wrong status") | |
186 | + | else if (if ((M != B)) | |
187 | + | then (M != C) | |
188 | + | else false) | |
189 | + | then throw("wrong vote") | |
190 | + | else if (if ((X == B)) | |
191 | + | then true | |
192 | + | else (X == C)) | |
193 | + | then throw("vote has finished") | |
194 | + | else [StringEntry(H(j, m), M), IntegerEntry(L(j, M), Z), StringEntry(J(j), if ((Z >= y)) | |
195 | + | then M | |
196 | + | else A)] | |
189 | 197 | } | |
190 | 198 | ||
191 | 199 |
github/deemru/w8io/026f985 32.79 ms ◑