tx · HneYaxY5kQ5AcxHTqRmfH1avhNSsPk7m2sr4Hn7GFYiW 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq: -0.01300000 Waves 2023.02.10 18:09 [2443699] smart account 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq > SELF 0.00000000 Waves
{ "type": 13, "id": "HneYaxY5kQ5AcxHTqRmfH1avhNSsPk7m2sr4Hn7GFYiW", "fee": 1300000, "feeAssetId": null, "timestamp": 1676041823163, "version": 2, "chainId": 84, "sender": "3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq", "senderPublicKey": "2u2wYYcVBQv43Cc71zkhHPPitkqgg6dqTZ3nUMvYJ1uq", "proofs": [ "3pvzyDNzXAES7h3bSPmF3iLAEsyzxFDzbwiYzGrbf7JCT8BMBv53w1MZw5EJUGEkDGJA4DLdn5FfQqUUgkmgyxiM" ], "script": "base64:BgIXCAISBQoDAQgIEgUKAwEICBIDCgEIEgAWAANTRVACAl9fAAhmZWVTY2FsZQkAtgIBAIDC1y8BD2dldFN0cmluZ09yRmFpbAEDa2V5CQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJ0IAgUEdGhpcwUDa2V5CQCsAgICFU5vIGRhdGEgZm9yIHRoaXMua2V5PQUDa2V5AAxwb29sRGlzYWJsZWQJAAIBAg1Qb29sIGRpc2FibGVkAAxwb29sTm90RXhpc3QJAAIBAhFQb29sIGlzIG5vdCBleGlzdAAOc2xpcHBhZ2VUb29CaWcJAAIBAhNTbGlwcGFnZSBpcyB0b28gYmlnARNrZXlNYW5hZ2VyUHVibGljS2V5AAIUJXNfX21hbmFnZXJQdWJsaWNLZXkBGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS2V5AAIbJXNfX3BlbmRpbmdNYW5hZ2VyUHVibGljS2V5AQJmYwACEyVzX19mYWN0b3J5Q29udHJhY3QAD2ZhY3RvcnlDb250cmFjdAkBEUBleHRyTmF0aXZlKDEwNjIpAQkBD2dldFN0cmluZ09yR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AAAUPdGFyZ2V0UHVibGljS2V5C1hT6A==", "height": 2443699, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9vnSnznJu69UUXtsX2NnvoyBFyoFBCVV8ctQMf9STgLm Next: Ex3yP4fpy6K8gL1QAdsxKbXPJ9BvbET2VWDKGewvBKrA Diff:
Old | New | Differences | |
---|---|---|---|
170 | 170 | func swap (ab,J,ac) = { | |
171 | 171 | let ad = value(C.payments[0]) | |
172 | 172 | let I = if ((ad.assetId == unit)) | |
173 | - | then | |
174 | - | else value(ad.assetId) | |
173 | + | then "WAVES" | |
174 | + | else toBase58String(value(ad.assetId)) | |
175 | 175 | let H = value(ad.amount) | |
176 | 176 | let K = value(getInteger(l())) | |
177 | 177 | let L = fraction(toBigInt(H), toBigInt(K), b) | |
190 | 190 | if ((ae == ae)) | |
191 | 191 | then { | |
192 | 192 | let R = { | |
193 | - | let W = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [ | |
193 | + | let W = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [I, J], nil) | |
194 | 194 | if ($isInstanceOf(W, "String")) | |
195 | 195 | then W | |
196 | 196 | else unit | |
197 | 197 | } | |
198 | 198 | let S = { | |
199 | - | let W = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [J, | |
199 | + | let W = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [J, I], nil) | |
200 | 200 | if ($isInstanceOf(W, "String")) | |
201 | 201 | then W | |
202 | 202 | else unit | |
238 | 238 | if ((Y == Y)) | |
239 | 239 | then { | |
240 | 240 | let Z = addressFromStringValue(V) | |
241 | - | let ag = { | |
242 | - | let W = invoke(Z, "calculateAmountOutForSwapAndSendTokens", [toInt(Q), U, ab, ac], [AttachedPayment(I, toInt(Q))]) | |
241 | + | let ag = if ((I == "WAVES")) | |
242 | + | then unit | |
243 | + | else fromBase58String(I) | |
244 | + | let ah = { | |
245 | + | let W = invoke(Z, "calculateAmountOutForSwapAndSendTokens", [toInt(Q), U, ab, ac], [AttachedPayment(ag, toInt(Q))]) | |
243 | 246 | if ($isInstanceOf(W, "Int")) | |
244 | 247 | then W | |
245 | 248 | else throw(($getType(W) + " couldn't be cast to Int")) | |
246 | 249 | } | |
247 | - | $Tuple2([ScriptTransfer(q, toInt(O), | |
250 | + | $Tuple2([ScriptTransfer(q, toInt(O), ag), ScriptTransfer(Z, toInt(P), ag)], ah) | |
248 | 251 | } | |
249 | 252 | else throw("Strict value is not equal to itself.") | |
250 | 253 | } | |
254 | 257 | ||
255 | 258 | ||
256 | 259 | @Callable(C) | |
257 | - | func setManager ( | |
258 | - | let | |
259 | - | if (( | |
260 | + | func setManager (ai) = { | |
261 | + | let aj = E(C) | |
262 | + | if ((aj == aj)) | |
260 | 263 | then { | |
261 | - | let | |
262 | - | if (( | |
263 | - | then [StringEntry(i(), | |
264 | + | let ak = fromBase58String(ai) | |
265 | + | if ((ak == ak)) | |
266 | + | then [StringEntry(i(), ai)] | |
264 | 267 | else throw("Strict value is not equal to itself.") | |
265 | 268 | } | |
266 | 269 | else throw("Strict value is not equal to itself.") | |
270 | 273 | ||
271 | 274 | @Callable(C) | |
272 | 275 | func confirmManager () = { | |
273 | - | let | |
274 | - | let | |
276 | + | let al = A() | |
277 | + | let am = if (isDefined(al)) | |
275 | 278 | then true | |
276 | 279 | else throw("no pending manager") | |
277 | - | if (( | |
280 | + | if ((am == am)) | |
278 | 281 | then { | |
279 | - | let | |
282 | + | let an = if ((C.callerPublicKey == value(al))) | |
280 | 283 | then true | |
281 | 284 | else throw("you are not pending manager") | |
282 | - | if (( | |
283 | - | then [StringEntry(h(), toBase58String(value( | |
285 | + | if ((an == an)) | |
286 | + | then [StringEntry(h(), toBase58String(value(al))), DeleteEntry(i())] | |
284 | 287 | else throw("Strict value is not equal to itself.") | |
285 | 288 | } | |
286 | 289 | else throw("Strict value is not equal to itself.") | |
287 | 290 | } | |
288 | 291 | ||
289 | 292 | ||
290 | - | @Verifier( | |
291 | - | func | |
292 | - | let | |
293 | + | @Verifier(ao) | |
294 | + | func ap () = { | |
295 | + | let aq = { | |
293 | 296 | let t = y() | |
294 | 297 | if ($isInstanceOf(t, "ByteVector")) | |
295 | 298 | then { | |
297 | 300 | D | |
298 | 301 | } | |
299 | 302 | else if ($isInstanceOf(t, "Unit")) | |
300 | - | then | |
303 | + | then ao.senderPublicKey | |
301 | 304 | else throw("Match error") | |
302 | 305 | } | |
303 | - | sigVerify( | |
306 | + | sigVerify(ao.bodyBytes, ao.proofs[0], aq) | |
304 | 307 | } | |
305 | 308 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "__" | |
5 | 5 | ||
6 | 6 | let b = toBigInt(100000000) | |
7 | 7 | ||
8 | 8 | func c (d) = valueOrErrorMessage(getString(this, d), ("No data for this.key=" + d)) | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | let e = throw("Pool disabled") | |
12 | 12 | ||
13 | 13 | let f = throw("Pool is not exist") | |
14 | 14 | ||
15 | 15 | let g = throw("Slippage is too big") | |
16 | 16 | ||
17 | 17 | func h () = "%s__managerPublicKey" | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func i () = "%s__pendingManagerPublicKey" | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func j () = "%s__factoryContract" | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | let k = addressFromStringValue(c(j())) | |
27 | 27 | ||
28 | 28 | func l () = makeString(["%s", "protocolFee"], a) | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func m () = makeString(["%s", "poolFee"], a) | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func n (o,d) = valueOrErrorMessage(getString(o, d), makeString(["mandatory ", toString(o), ".", d, " is not defined"], "")) | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | let p = "%s__feeCollectorAddress" | |
38 | 38 | ||
39 | 39 | let q = addressFromStringValue(n(k, p)) | |
40 | 40 | ||
41 | 41 | func r (s) = { | |
42 | 42 | let t = s | |
43 | 43 | if ($isInstanceOf(t, "Int")) | |
44 | 44 | then { | |
45 | 45 | let u = t | |
46 | 46 | u | |
47 | 47 | } | |
48 | 48 | else throw("fail to cast into Int") | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func v (w,x) = makeString(["%d%d", toString(w), toString(x)], a) | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func y () = { | |
56 | 56 | let t = getString(h()) | |
57 | 57 | if ($isInstanceOf(t, "String")) | |
58 | 58 | then { | |
59 | 59 | let z = t | |
60 | 60 | fromBase58String(z) | |
61 | 61 | } | |
62 | 62 | else if ($isInstanceOf(t, "Unit")) | |
63 | 63 | then unit | |
64 | 64 | else throw("Match error") | |
65 | 65 | } | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func A () = { | |
69 | 69 | let t = getString(i()) | |
70 | 70 | if ($isInstanceOf(t, "String")) | |
71 | 71 | then { | |
72 | 72 | let z = t | |
73 | 73 | fromBase58String(z) | |
74 | 74 | } | |
75 | 75 | else if ($isInstanceOf(t, "Unit")) | |
76 | 76 | then unit | |
77 | 77 | else throw("Match error") | |
78 | 78 | } | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func B (C) = { | |
82 | 82 | let t = y() | |
83 | 83 | if ($isInstanceOf(t, "ByteVector")) | |
84 | 84 | then { | |
85 | 85 | let D = t | |
86 | 86 | (C.callerPublicKey == D) | |
87 | 87 | } | |
88 | 88 | else if ($isInstanceOf(t, "Unit")) | |
89 | 89 | then (C.caller == this) | |
90 | 90 | else throw("Match error") | |
91 | 91 | } | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func E (C) = if (B(C)) | |
95 | 95 | then true | |
96 | 96 | else throw("permission denied") | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func F (G) = if ((G == "WAVES")) | |
100 | 100 | then wavesBalance(this).available | |
101 | 101 | else assetBalance(this, fromBase58String(G)) | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | @Callable(C) | |
105 | 105 | func swapCalculateREADONLY (H,I,J) = { | |
106 | 106 | let K = value(getInteger(l())) | |
107 | 107 | let L = fraction(toBigInt(H), toBigInt(K), b) | |
108 | 108 | let M = value(getInteger(m())) | |
109 | 109 | let N = fraction(toBigInt(H), toBigInt(M), b) | |
110 | 110 | let O = if ((toInt(L) == 0)) | |
111 | 111 | then toBigInt(1) | |
112 | 112 | else L | |
113 | 113 | let P = if ((toInt(N) == 0)) | |
114 | 114 | then toBigInt(1) | |
115 | 115 | else N | |
116 | 116 | let Q = ((toBigInt(H) - O) - N) | |
117 | 117 | let R = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [I, J], nil) | |
118 | 118 | let S = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [J, I], nil) | |
119 | 119 | let T = if ((R != unit)) | |
120 | 120 | then { | |
121 | 121 | let U = false | |
122 | 122 | let V = { | |
123 | 123 | let W = invoke(k, "getPoolAddressFromLpAssetREADONLY", [R], nil) | |
124 | 124 | if ($isInstanceOf(W, "String")) | |
125 | 125 | then W | |
126 | 126 | else throw(($getType(W) + " couldn't be cast to String")) | |
127 | 127 | } | |
128 | 128 | $Tuple2(U, V) | |
129 | 129 | } | |
130 | 130 | else if ((S != unit)) | |
131 | 131 | then { | |
132 | 132 | let U = true | |
133 | 133 | let V = { | |
134 | 134 | let W = invoke(k, "getPoolAddressFromLpAssetREADONLY", [S], nil) | |
135 | 135 | if ($isInstanceOf(W, "String")) | |
136 | 136 | then W | |
137 | 137 | else throw(($getType(W) + " couldn't be cast to String")) | |
138 | 138 | } | |
139 | 139 | $Tuple2(U, V) | |
140 | 140 | } | |
141 | 141 | else f | |
142 | 142 | let U = T._1 | |
143 | 143 | let V = T._2 | |
144 | 144 | let X = { | |
145 | 145 | let W = invoke(k, "getPoolStatusREADONLY", [V], nil) | |
146 | 146 | if ($isInstanceOf(W, "Int")) | |
147 | 147 | then W | |
148 | 148 | else throw(($getType(W) + " couldn't be cast to Int")) | |
149 | 149 | } | |
150 | 150 | let Y = if ((X == 1)) | |
151 | 151 | then true | |
152 | 152 | else e | |
153 | 153 | if ((Y == Y)) | |
154 | 154 | then { | |
155 | 155 | let Z = addressFromStringValue(valueOrElse(V, "")) | |
156 | 156 | let aa = { | |
157 | 157 | let W = invoke(Z, "calculateAmountOutForSwapREADONLY", [toInt(Q), U], nil) | |
158 | 158 | if ($isInstanceOf(W, "Int")) | |
159 | 159 | then W | |
160 | 160 | else throw(($getType(W) + " couldn't be cast to Int")) | |
161 | 161 | } | |
162 | 162 | $Tuple2(nil, aa) | |
163 | 163 | } | |
164 | 164 | else throw("Strict value is not equal to itself.") | |
165 | 165 | } | |
166 | 166 | ||
167 | 167 | ||
168 | 168 | ||
169 | 169 | @Callable(C) | |
170 | 170 | func swap (ab,J,ac) = { | |
171 | 171 | let ad = value(C.payments[0]) | |
172 | 172 | let I = if ((ad.assetId == unit)) | |
173 | - | then | |
174 | - | else value(ad.assetId) | |
173 | + | then "WAVES" | |
174 | + | else toBase58String(value(ad.assetId)) | |
175 | 175 | let H = value(ad.amount) | |
176 | 176 | let K = value(getInteger(l())) | |
177 | 177 | let L = fraction(toBigInt(H), toBigInt(K), b) | |
178 | 178 | let M = value(getInteger(m())) | |
179 | 179 | let N = fraction(toBigInt(H), toBigInt(M), b) | |
180 | 180 | let O = if ((toInt(L) == 0)) | |
181 | 181 | then toBigInt(1) | |
182 | 182 | else L | |
183 | 183 | let P = if ((toInt(N) == 0)) | |
184 | 184 | then toBigInt(1) | |
185 | 185 | else N | |
186 | 186 | let Q = ((toBigInt(H) - O) - N) | |
187 | 187 | let ae = [if ((size(C.payments) == 1)) | |
188 | 188 | then true | |
189 | 189 | else throw("exactly 1 payment are expected")] | |
190 | 190 | if ((ae == ae)) | |
191 | 191 | then { | |
192 | 192 | let R = { | |
193 | - | let W = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [ | |
193 | + | let W = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [I, J], nil) | |
194 | 194 | if ($isInstanceOf(W, "String")) | |
195 | 195 | then W | |
196 | 196 | else unit | |
197 | 197 | } | |
198 | 198 | let S = { | |
199 | - | let W = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [J, | |
199 | + | let W = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [J, I], nil) | |
200 | 200 | if ($isInstanceOf(W, "String")) | |
201 | 201 | then W | |
202 | 202 | else unit | |
203 | 203 | } | |
204 | 204 | let af = if ((R != unit)) | |
205 | 205 | then { | |
206 | 206 | let U = false | |
207 | 207 | let V = { | |
208 | 208 | let W = invoke(k, "getPoolAddressFromLpAssetREADONLY", [value(R)], nil) | |
209 | 209 | if ($isInstanceOf(W, "String")) | |
210 | 210 | then W | |
211 | 211 | else throw(($getType(W) + " couldn't be cast to String")) | |
212 | 212 | } | |
213 | 213 | $Tuple2(U, V) | |
214 | 214 | } | |
215 | 215 | else if ((S != unit)) | |
216 | 216 | then { | |
217 | 217 | let U = true | |
218 | 218 | let V = { | |
219 | 219 | let W = invoke(k, "getPoolAddressFromLpAssetREADONLY", [value(S)], nil) | |
220 | 220 | if ($isInstanceOf(W, "String")) | |
221 | 221 | then W | |
222 | 222 | else throw(($getType(W) + " couldn't be cast to String")) | |
223 | 223 | } | |
224 | 224 | $Tuple2(U, V) | |
225 | 225 | } | |
226 | 226 | else f | |
227 | 227 | let U = af._1 | |
228 | 228 | let V = af._2 | |
229 | 229 | let X = { | |
230 | 230 | let W = invoke(k, "getPoolStatusREADONLY", [V], nil) | |
231 | 231 | if ($isInstanceOf(W, "Int")) | |
232 | 232 | then W | |
233 | 233 | else throw(($getType(W) + " couldn't be cast to Int")) | |
234 | 234 | } | |
235 | 235 | let Y = if ((X == 1)) | |
236 | 236 | then true | |
237 | 237 | else e | |
238 | 238 | if ((Y == Y)) | |
239 | 239 | then { | |
240 | 240 | let Z = addressFromStringValue(V) | |
241 | - | let ag = { | |
242 | - | let W = invoke(Z, "calculateAmountOutForSwapAndSendTokens", [toInt(Q), U, ab, ac], [AttachedPayment(I, toInt(Q))]) | |
241 | + | let ag = if ((I == "WAVES")) | |
242 | + | then unit | |
243 | + | else fromBase58String(I) | |
244 | + | let ah = { | |
245 | + | let W = invoke(Z, "calculateAmountOutForSwapAndSendTokens", [toInt(Q), U, ab, ac], [AttachedPayment(ag, toInt(Q))]) | |
243 | 246 | if ($isInstanceOf(W, "Int")) | |
244 | 247 | then W | |
245 | 248 | else throw(($getType(W) + " couldn't be cast to Int")) | |
246 | 249 | } | |
247 | - | $Tuple2([ScriptTransfer(q, toInt(O), | |
250 | + | $Tuple2([ScriptTransfer(q, toInt(O), ag), ScriptTransfer(Z, toInt(P), ag)], ah) | |
248 | 251 | } | |
249 | 252 | else throw("Strict value is not equal to itself.") | |
250 | 253 | } | |
251 | 254 | else throw("Strict value is not equal to itself.") | |
252 | 255 | } | |
253 | 256 | ||
254 | 257 | ||
255 | 258 | ||
256 | 259 | @Callable(C) | |
257 | - | func setManager ( | |
258 | - | let | |
259 | - | if (( | |
260 | + | func setManager (ai) = { | |
261 | + | let aj = E(C) | |
262 | + | if ((aj == aj)) | |
260 | 263 | then { | |
261 | - | let | |
262 | - | if (( | |
263 | - | then [StringEntry(i(), | |
264 | + | let ak = fromBase58String(ai) | |
265 | + | if ((ak == ak)) | |
266 | + | then [StringEntry(i(), ai)] | |
264 | 267 | else throw("Strict value is not equal to itself.") | |
265 | 268 | } | |
266 | 269 | else throw("Strict value is not equal to itself.") | |
267 | 270 | } | |
268 | 271 | ||
269 | 272 | ||
270 | 273 | ||
271 | 274 | @Callable(C) | |
272 | 275 | func confirmManager () = { | |
273 | - | let | |
274 | - | let | |
276 | + | let al = A() | |
277 | + | let am = if (isDefined(al)) | |
275 | 278 | then true | |
276 | 279 | else throw("no pending manager") | |
277 | - | if (( | |
280 | + | if ((am == am)) | |
278 | 281 | then { | |
279 | - | let | |
282 | + | let an = if ((C.callerPublicKey == value(al))) | |
280 | 283 | then true | |
281 | 284 | else throw("you are not pending manager") | |
282 | - | if (( | |
283 | - | then [StringEntry(h(), toBase58String(value( | |
285 | + | if ((an == an)) | |
286 | + | then [StringEntry(h(), toBase58String(value(al))), DeleteEntry(i())] | |
284 | 287 | else throw("Strict value is not equal to itself.") | |
285 | 288 | } | |
286 | 289 | else throw("Strict value is not equal to itself.") | |
287 | 290 | } | |
288 | 291 | ||
289 | 292 | ||
290 | - | @Verifier( | |
291 | - | func | |
292 | - | let | |
293 | + | @Verifier(ao) | |
294 | + | func ap () = { | |
295 | + | let aq = { | |
293 | 296 | let t = y() | |
294 | 297 | if ($isInstanceOf(t, "ByteVector")) | |
295 | 298 | then { | |
296 | 299 | let D = t | |
297 | 300 | D | |
298 | 301 | } | |
299 | 302 | else if ($isInstanceOf(t, "Unit")) | |
300 | - | then | |
303 | + | then ao.senderPublicKey | |
301 | 304 | else throw("Match error") | |
302 | 305 | } | |
303 | - | sigVerify( | |
306 | + | sigVerify(ao.bodyBytes, ao.proofs[0], aq) | |
304 | 307 | } | |
305 | 308 |
github/deemru/w8io/169f3d6 41.93 ms ◑