1 | | - | {-# STDLIB_VERSION 6 #-} |
---|
2 | | - | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | | - | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let a = 8 |
---|
5 | | - | |
---|
6 | | - | let b = 100000000 |
---|
7 | | - | |
---|
8 | | - | let c = 18 |
---|
9 | | - | |
---|
10 | | - | let d = toBigInt(1000000000000000000) |
---|
11 | | - | |
---|
12 | | - | let e = b |
---|
13 | | - | |
---|
14 | | - | let f = "GWXvirtualPOOL" |
---|
15 | | - | |
---|
16 | | - | let g = "POOLS_LP" |
---|
17 | | - | |
---|
18 | | - | let h = 2000000 |
---|
19 | | - | |
---|
20 | | - | let i = "WAVES" |
---|
21 | | - | |
---|
22 | | - | let j = ((100 * 1000) * 1000) |
---|
23 | | - | |
---|
24 | | - | let k = "__" |
---|
25 | | - | |
---|
26 | | - | let l = "" |
---|
27 | | - | |
---|
28 | | - | let m = 1 |
---|
29 | | - | |
---|
30 | | - | let n = 2 |
---|
31 | | - | |
---|
32 | | - | let o = 3 |
---|
33 | | - | |
---|
34 | | - | let p = 4 |
---|
35 | | - | |
---|
36 | | - | let q = 1 |
---|
37 | | - | |
---|
38 | | - | let r = 2 |
---|
39 | | - | |
---|
40 | | - | let s = 3 |
---|
41 | | - | |
---|
42 | | - | let t = 1 |
---|
43 | | - | |
---|
44 | | - | let u = 2 |
---|
45 | | - | |
---|
46 | | - | let v = 3 |
---|
47 | | - | |
---|
48 | | - | let w = 4 |
---|
49 | | - | |
---|
50 | | - | let x = 5 |
---|
51 | | - | |
---|
52 | | - | let y = 6 |
---|
53 | | - | |
---|
54 | | - | let z = 7 |
---|
55 | | - | |
---|
56 | | - | let A = 8 |
---|
57 | | - | |
---|
58 | | - | let B = 9 |
---|
59 | | - | |
---|
60 | | - | let C = 10 |
---|
61 | | - | |
---|
62 | | - | let D = 11 |
---|
63 | | - | |
---|
64 | | - | let E = "WX_EMISSION" |
---|
65 | | - | |
---|
66 | | - | let F = [E] |
---|
67 | | - | |
---|
68 | | - | func G () = "%s__allowedLpScriptHash" |
---|
69 | | - | |
---|
70 | | - | |
---|
71 | | - | func H () = "%s__allowedLpStableScriptHash" |
---|
72 | | - | |
---|
73 | | - | |
---|
74 | | - | func I () = "%s__allowedLpStableAddonScriptHash" |
---|
75 | | - | |
---|
76 | | - | |
---|
77 | | - | func J () = "%s__swapContract" |
---|
78 | | - | |
---|
79 | | - | |
---|
80 | | - | func K () = "%s__factoryConfig" |
---|
81 | | - | |
---|
82 | | - | |
---|
83 | | - | func L () = "%s__lpTokensList" |
---|
84 | | - | |
---|
85 | | - | |
---|
86 | | - | func M () = "%s%s__pool__scriptHash" |
---|
87 | | - | |
---|
88 | | - | |
---|
89 | | - | func N () = "%s%s__matcher__publicKey" |
---|
90 | | - | |
---|
91 | | - | |
---|
92 | | - | func O () = "%s__legacyFactoryContract" |
---|
93 | | - | |
---|
94 | | - | |
---|
95 | | - | func P () = "%s__legacyPools" |
---|
96 | | - | |
---|
97 | | - | |
---|
98 | | - | func Q () = "%s__managerPublicKey" |
---|
99 | | - | |
---|
100 | | - | |
---|
101 | | - | func R () = "%s__pendingManagerPublicKey" |
---|
102 | | - | |
---|
103 | | - | |
---|
104 | | - | func S () = "%s__adminPubKeys" |
---|
105 | | - | |
---|
106 | | - | |
---|
107 | | - | func T () = "%s__assetsStoreContract" |
---|
108 | | - | |
---|
109 | | - | |
---|
110 | | - | func U () = "%s__votingEmissionContract" |
---|
111 | | - | |
---|
112 | | - | |
---|
113 | | - | func V () = makeString(["%s", "priceAssets"], k) |
---|
114 | | - | |
---|
115 | | - | |
---|
116 | | - | func W () = "%s__priceDecimals" |
---|
117 | | - | |
---|
118 | | - | |
---|
119 | | - | func X () = "%s__shutdown" |
---|
120 | | - | |
---|
121 | | - | |
---|
122 | | - | func Y () = "%s__nextInternalAssetId" |
---|
123 | | - | |
---|
124 | | - | |
---|
125 | | - | func Z (aa) = ("%s%s__poolWeight__" + aa) |
---|
126 | | - | |
---|
127 | | - | |
---|
128 | | - | func ab (aa,ac) = ((("%s%s__poolWeight__" + aa) + "__") + toString(ac)) |
---|
129 | | - | |
---|
130 | | - | |
---|
131 | | - | func ad (ae) = ("%s%s%d__mappings__internal2baseAssetId__" + toString(ae)) |
---|
132 | | - | |
---|
133 | | - | |
---|
134 | | - | func af (ag) = ("%s%s%s__mappings__baseAsset2internalId__" + ag) |
---|
135 | | - | |
---|
136 | | - | |
---|
137 | | - | func ah (ai,aj) = (((("%d%d%s__" + ai) + "__") + aj) + "__config") |
---|
138 | | - | |
---|
139 | | - | |
---|
140 | | - | func ak (al) = { |
---|
141 | | - | let am = al |
---|
142 | | - | let ai = am._1 |
---|
143 | | - | let aj = am._2 |
---|
144 | | - | makeString(["%d%d%s", toString(ai), toString(aj), "oneTokenOperationsDisabled"], k) |
---|
145 | | - | } |
---|
146 | | - | |
---|
147 | | - | |
---|
148 | | - | func an () = makeString(["%s", "oneTokenOperationsDisabled"], k) |
---|
149 | | - | |
---|
150 | | - | |
---|
151 | | - | func ao (ap) = (("%s%s%s__" + ap) + "__mappings__lpAsset2Pool") |
---|
152 | | - | |
---|
153 | | - | |
---|
154 | | - | func aq (ar,as) = (((("%d%d%s%s__" + ar) + "__") + as) + "__mappings__PoolAssets2LpAsset") |
---|
155 | | - | |
---|
156 | | - | |
---|
157 | | - | func at (aa) = ("%s%s__spread__" + aa) |
---|
158 | | - | |
---|
159 | | - | |
---|
160 | | - | func au (av) = (("%s%s%s__" + av) + "__mappings__poolContract2PoolAssets") |
---|
161 | | - | |
---|
162 | | - | |
---|
163 | | - | func aw (ar,as) = (((("%d%d%s%s__" + toString(ar)) + "__") + toString(as)) + "__mappings__poolAssets2PoolContract") |
---|
164 | | - | |
---|
165 | | - | |
---|
166 | | - | func ax (av) = (("%s%s%s__" + av) + "__mappings__poolContract2LpAsset") |
---|
167 | | - | |
---|
168 | | - | |
---|
169 | | - | func ay (ap) = (("%s%s%s__" + ap) + "__mappings__lpAsset2PoolContract") |
---|
170 | | - | |
---|
171 | | - | |
---|
172 | | - | func az (aA,aB) = ((("%s%s%s__wxEmission__" + aA) + "__") + aB) |
---|
173 | | - | |
---|
174 | | - | |
---|
175 | | - | func aC (aa) = ("%s%s__inFee__" + aa) |
---|
176 | | - | |
---|
177 | | - | |
---|
178 | | - | func aD () = "%s__inFeeDefault" |
---|
179 | | - | |
---|
180 | | - | |
---|
181 | | - | func aE (aa) = ("%s%s__outFee__" + aa) |
---|
182 | | - | |
---|
183 | | - | |
---|
184 | | - | func aF () = "%s__outFeeDefault" |
---|
185 | | - | |
---|
186 | | - | |
---|
187 | | - | func aG (aH) = valueOrErrorMessage(getString(this, aH), ("No data for this.key=" + aH)) |
---|
188 | | - | |
---|
189 | | - | |
---|
190 | | - | func aI (aH) = valueOrErrorMessage(getBoolean(this, aH), ("No data for this.key=" + aH)) |
---|
191 | | - | |
---|
192 | | - | |
---|
193 | | - | func aJ (aH) = valueOrErrorMessage(getInteger(this, aH), ("No data for this.key=" + aH)) |
---|
194 | | - | |
---|
195 | | - | |
---|
196 | | - | func aK (aL) = if ((aL == i)) |
---|
197 | | - | then unit |
---|
198 | | - | else fromBase58String(aL) |
---|
199 | | - | |
---|
200 | | - | |
---|
201 | | - | let aM = 1 |
---|
202 | | - | |
---|
203 | | - | let aN = 2 |
---|
204 | | - | |
---|
205 | | - | let aO = 3 |
---|
206 | | - | |
---|
207 | | - | let aP = 4 |
---|
208 | | - | |
---|
209 | | - | let aQ = 5 |
---|
210 | | - | |
---|
211 | | - | let aR = 6 |
---|
212 | | - | |
---|
213 | | - | let aS = 7 |
---|
214 | | - | |
---|
215 | | - | let aT = 8 |
---|
216 | | - | |
---|
217 | | - | let aU = 9 |
---|
218 | | - | |
---|
219 | | - | let aV = 10 |
---|
220 | | - | |
---|
221 | | - | let aW = 11 |
---|
222 | | - | |
---|
223 | | - | func aX (aY) = addressFromStringValue(aY[aN]) |
---|
224 | | - | |
---|
225 | | - | |
---|
226 | | - | func aZ (aY) = addressFromStringValue(aY[aQ]) |
---|
227 | | - | |
---|
228 | | - | |
---|
229 | | - | func ba (aY) = addressFromStringValue(aY[aM]) |
---|
230 | | - | |
---|
231 | | - | |
---|
232 | | - | func bb (aY) = addressFromStringValue(aY[aV]) |
---|
233 | | - | |
---|
234 | | - | |
---|
235 | | - | func bc () = { |
---|
236 | | - | let bd = getString(V()) |
---|
237 | | - | if ($isInstanceOf(bd, "String")) |
---|
238 | | - | then { |
---|
239 | | - | let be = bd |
---|
240 | | - | if ((size(be) == 0)) |
---|
241 | | - | then nil |
---|
242 | | - | else split(be, k) |
---|
243 | | - | } |
---|
244 | | - | else nil |
---|
245 | | - | } |
---|
246 | | - | |
---|
247 | | - | |
---|
248 | | - | func bf () = { |
---|
249 | | - | let bd = getString(Q()) |
---|
250 | | - | if ($isInstanceOf(bd, "String")) |
---|
251 | | - | then { |
---|
252 | | - | let be = bd |
---|
253 | | - | fromBase58String(be) |
---|
254 | | - | } |
---|
255 | | - | else if ($isInstanceOf(bd, "Unit")) |
---|
256 | | - | then unit |
---|
257 | | - | else throw("Match error") |
---|
258 | | - | } |
---|
259 | | - | |
---|
260 | | - | |
---|
261 | | - | func bg () = { |
---|
262 | | - | let bd = getString(R()) |
---|
263 | | - | if ($isInstanceOf(bd, "String")) |
---|
264 | | - | then { |
---|
265 | | - | let be = bd |
---|
266 | | - | fromBase58String(be) |
---|
267 | | - | } |
---|
268 | | - | else if ($isInstanceOf(bd, "Unit")) |
---|
269 | | - | then unit |
---|
270 | | - | else throw("Match error") |
---|
271 | | - | } |
---|
272 | | - | |
---|
273 | | - | |
---|
274 | | - | let bh = throw("Permission denied") |
---|
275 | | - | |
---|
276 | | - | let bi = throw("Test error here") |
---|
277 | | - | |
---|
278 | | - | func bj (bk) = if ((bk.caller == this)) |
---|
279 | | - | then true |
---|
280 | | - | else bh |
---|
281 | | - | |
---|
282 | | - | |
---|
283 | | - | func bl (bk) = { |
---|
284 | | - | let bd = bf() |
---|
285 | | - | if ($isInstanceOf(bd, "ByteVector")) |
---|
286 | | - | then { |
---|
287 | | - | let bm = bd |
---|
288 | | - | if ((bk.callerPublicKey == bm)) |
---|
289 | | - | then true |
---|
290 | | - | else bh |
---|
291 | | - | } |
---|
292 | | - | else if ($isInstanceOf(bd, "Unit")) |
---|
293 | | - | then bj(bk) |
---|
294 | | - | else throw("Match error") |
---|
295 | | - | } |
---|
296 | | - | |
---|
297 | | - | |
---|
298 | | - | func bn (bo,bp,bq,br,bs,bt,bu,bv,bw,bx,by) = makeString(["%s%s%s%s%s%s%s%s%s%s%s", bo, bp, bq, br, bs, bt, bu, bv, bw, bx, by], k) |
---|
299 | | - | |
---|
300 | | - | |
---|
301 | | - | func bz (bo,bp,bq,br,bs,bt,bu) = makeString(["%s%s%s%s%s%s", bo, bp, bq, br, bs, bt, bu], k) |
---|
302 | | - | |
---|
303 | | - | |
---|
304 | | - | func bA (aa,bB,bC,bD,bE,bF,bG,bH,bI,bJ,bK) = makeString(["%s%d%s%s%s%d%d%d%d%d%s", aa, bB, bC, bD, bE, toString(bF), toString(bG), toString(bH), toString(bI), toString(bJ), bK], k) |
---|
305 | | - | |
---|
306 | | - | |
---|
307 | | - | func bL (bM,bN) = makeString(["%d%d", toString(bM), toString(bN)], k) |
---|
308 | | - | |
---|
309 | | - | |
---|
310 | | - | func bO (aa) = { |
---|
311 | | - | let bP = split(aG(au(aa)), k) |
---|
312 | | - | let ai = bP[1] |
---|
313 | | - | let aj = bP[2] |
---|
314 | | - | split(aG(ah(ai, aj)), k) |
---|
315 | | - | } |
---|
316 | | - | |
---|
317 | | - | |
---|
318 | | - | func bQ (bR,bS) = { |
---|
319 | | - | let bT = valueOrElse(getInteger(this, af(bR)), 0) |
---|
320 | | - | let bU = valueOrElse(getInteger(this, Y()), 0) |
---|
321 | | - | let bV = if ((bT == 0)) |
---|
322 | | - | then { |
---|
323 | | - | let bW = (bU + bS) |
---|
324 | | - | $Tuple3(bW, [IntegerEntry(Y(), bW), IntegerEntry(af(bR), bW), StringEntry(ad(bW), bR)], true) |
---|
325 | | - | } |
---|
326 | | - | else $Tuple3(bT, nil, false) |
---|
327 | | - | bV |
---|
328 | | - | } |
---|
329 | | - | |
---|
330 | | - | |
---|
331 | | - | func bX (bk) = { |
---|
332 | | - | let bY = split(valueOrElse(getString(S()), l), k) |
---|
333 | | - | if (containsElement(bY, toBase58String(bk.callerPublicKey))) |
---|
334 | | - | then true |
---|
335 | | - | else { |
---|
336 | | - | let bZ = bl(bk) |
---|
337 | | - | if ((bZ == bZ)) |
---|
338 | | - | then true |
---|
339 | | - | else throw("Strict value is not equal to itself.") |
---|
340 | | - | } |
---|
341 | | - | } |
---|
342 | | - | |
---|
343 | | - | |
---|
344 | | - | func ca (aH,cb,cc) = valueOrElse(getInteger(this, aH), valueOrElse(getInteger(this, cb), cc)) |
---|
345 | | - | |
---|
346 | | - | |
---|
347 | | - | func cd (aA,aB) = { |
---|
348 | | - | let ai = getInteger(af(aA)) |
---|
349 | | - | let aj = getInteger(af(aB)) |
---|
350 | | - | if (if ((ai == unit)) |
---|
351 | | - | then true |
---|
352 | | - | else (aj == unit)) |
---|
353 | | - | then false |
---|
354 | | - | else { |
---|
355 | | - | let ce = toString(value(ai)) |
---|
356 | | - | let cf = toString(value(aj)) |
---|
357 | | - | let cg = getString(ah(ce, cf)) |
---|
358 | | - | let ch = getString(ah(cf, ce)) |
---|
359 | | - | let ci = if ((cg != unit)) |
---|
360 | | - | then true |
---|
361 | | - | else (ch != unit) |
---|
362 | | - | ci |
---|
363 | | - | } |
---|
364 | | - | } |
---|
365 | | - | |
---|
366 | | - | |
---|
367 | | - | @Callable(bk) |
---|
368 | | - | func getSwapContractREADONLY () = $Tuple2(nil, aG(J())) |
---|
369 | | - | |
---|
370 | | - | |
---|
371 | | - | |
---|
372 | | - | @Callable(bk) |
---|
373 | | - | func getLpAssetFromPoolAssetsREADONLY (cj,ck) = if (if ((cj == "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS")) |
---|
374 | | - | then (ck == "WAVES") |
---|
375 | | - | else false) |
---|
376 | | - | then $Tuple2(nil, unit) |
---|
377 | | - | else { |
---|
378 | | - | let cl = value(getInteger(this, af(cj))) |
---|
379 | | - | let cm = value(getInteger(this, af(ck))) |
---|
380 | | - | let cn = getString(this, aq(toString(cl), toString(cm))) |
---|
381 | | - | let co = if ((cn == unit)) |
---|
382 | | - | then unit |
---|
383 | | - | else drop(value(cn), 4) |
---|
384 | | - | $Tuple2(nil, co) |
---|
385 | | - | } |
---|
386 | | - | |
---|
387 | | - | |
---|
388 | | - | |
---|
389 | | - | @Callable(bk) |
---|
390 | | - | func getPoolAddressFromLpAssetREADONLY (cp) = $Tuple2(nil, valueOrElse(getString(this, ay(cp)), "")) |
---|
391 | | - | |
---|
392 | | - | |
---|
393 | | - | |
---|
394 | | - | @Callable(bk) |
---|
395 | | - | func constructor (cq,cr,bq,br,bs,bt,cs,ct) = { |
---|
396 | | - | let cu = bl(bk) |
---|
397 | | - | if ((cu == cu)) |
---|
398 | | - | then [StringEntry(K(), bz(cq, cr, bq, br, bs, bt, cs)), IntegerEntry(W(), ct)] |
---|
399 | | - | else throw("Strict value is not equal to itself.") |
---|
400 | | - | } |
---|
401 | | - | |
---|
402 | | - | |
---|
403 | | - | |
---|
404 | | - | @Callable(bk) |
---|
405 | | - | func constructorV2 (cv) = { |
---|
406 | | - | let cu = bl(bk) |
---|
407 | | - | if ((cu == cu)) |
---|
408 | | - | then { |
---|
409 | | - | let cw = addressFromPublicKey(fromBase58String(cv)) |
---|
410 | | - | if ((cw == cw)) |
---|
411 | | - | then [StringEntry(N(), cv)] |
---|
412 | | - | else throw("Strict value is not equal to itself.") |
---|
413 | | - | } |
---|
414 | | - | else throw("Strict value is not equal to itself.") |
---|
415 | | - | } |
---|
416 | | - | |
---|
417 | | - | |
---|
418 | | - | |
---|
419 | | - | @Callable(bk) |
---|
420 | | - | func constructorV3 (bv,bw,bx,by) = { |
---|
421 | | - | let cu = bl(bk) |
---|
422 | | - | if ((cu == cu)) |
---|
423 | | - | then { |
---|
424 | | - | let aY = split(aG(K()), k) |
---|
425 | | - | [StringEntry(K(), bn(aY[1], aY[2], aY[3], aY[4], aY[5], aY[6], aY[7], bv, bw, bx, by))] |
---|
426 | | - | } |
---|
427 | | - | else throw("Strict value is not equal to itself.") |
---|
428 | | - | } |
---|
429 | | - | |
---|
430 | | - | |
---|
431 | | - | |
---|
432 | | - | @Callable(bk) |
---|
433 | | - | func constructorV4 (cx,cy) = { |
---|
434 | | - | let cu = bl(bk) |
---|
435 | | - | if ((cu == cu)) |
---|
436 | | - | then [StringEntry(O(), cx), StringEntry(P(), makeString(cy, k))] |
---|
437 | | - | else throw("Strict value is not equal to itself.") |
---|
438 | | - | } |
---|
439 | | - | |
---|
440 | | - | |
---|
441 | | - | |
---|
442 | | - | @Callable(bk) |
---|
443 | | - | func constructorV5 (cz) = { |
---|
444 | | - | let cu = bl(bk) |
---|
445 | | - | if ((cu == cu)) |
---|
446 | | - | then [StringEntry(T(), cz)] |
---|
447 | | - | else throw("Strict value is not equal to itself.") |
---|
448 | | - | } |
---|
449 | | - | |
---|
450 | | - | |
---|
451 | | - | |
---|
452 | | - | @Callable(bk) |
---|
453 | | - | func constructorV6 (cA,cB) = { |
---|
454 | | - | let cC = [bl(bk), if ((addressFromString(cA) != unit)) |
---|
455 | | - | then true |
---|
456 | | - | else "invalid voting emission contract address"] |
---|
457 | | - | if ((cC == cC)) |
---|
458 | | - | then [StringEntry(U(), cA), StringEntry(V(), makeString(cB, k))] |
---|
459 | | - | else throw("Strict value is not equal to itself.") |
---|
460 | | - | } |
---|
461 | | - | |
---|
462 | | - | |
---|
463 | | - | |
---|
464 | | - | @Callable(bk) |
---|
465 | | - | func setManager (cD) = { |
---|
466 | | - | let cu = bl(bk) |
---|
467 | | - | if ((cu == cu)) |
---|
468 | | - | then { |
---|
469 | | - | let cE = fromBase58String(cD) |
---|
470 | | - | if ((cE == cE)) |
---|
471 | | - | then [StringEntry(R(), cD)] |
---|
472 | | - | else throw("Strict value is not equal to itself.") |
---|
473 | | - | } |
---|
474 | | - | else throw("Strict value is not equal to itself.") |
---|
475 | | - | } |
---|
476 | | - | |
---|
477 | | - | |
---|
478 | | - | |
---|
479 | | - | @Callable(bk) |
---|
480 | | - | func confirmManager () = { |
---|
481 | | - | let cF = bg() |
---|
482 | | - | let cG = if (isDefined(cF)) |
---|
483 | | - | then true |
---|
484 | | - | else throw("No pending manager") |
---|
485 | | - | if ((cG == cG)) |
---|
486 | | - | then { |
---|
487 | | - | let cH = if ((bk.callerPublicKey == value(cF))) |
---|
488 | | - | then true |
---|
489 | | - | else throw("You are not pending manager") |
---|
490 | | - | if ((cH == cH)) |
---|
491 | | - | then [StringEntry(Q(), toBase58String(value(cF))), DeleteEntry(R())] |
---|
492 | | - | else throw("Strict value is not equal to itself.") |
---|
493 | | - | } |
---|
494 | | - | else throw("Strict value is not equal to itself.") |
---|
495 | | - | } |
---|
496 | | - | |
---|
497 | | - | |
---|
498 | | - | |
---|
499 | | - | @Callable(bk) |
---|
500 | | - | func setAdmins (cI) = { |
---|
501 | | - | let cu = bl(bk) |
---|
502 | | - | if ((cu == cu)) |
---|
503 | | - | then [StringEntry(S(), makeString(cI, k))] |
---|
504 | | - | else throw("Strict value is not equal to itself.") |
---|
505 | | - | } |
---|
506 | | - | |
---|
507 | | - | |
---|
508 | | - | |
---|
509 | | - | @Callable(bk) |
---|
510 | | - | func activateNewPool (aa,bD,bE,cJ,cK,cL,bK,cM) = { |
---|
511 | | - | let cu = bX(bk) |
---|
512 | | - | if ((cu == cu)) |
---|
513 | | - | then if (isDefined(getString(au(aa)))) |
---|
514 | | - | then throw((("Pool address " + aa) + " already registered.")) |
---|
515 | | - | else { |
---|
516 | | - | let cN = bQ(bD, 1) |
---|
517 | | - | let cO = cN._1 |
---|
518 | | - | let cP = bQ(bE, if (cN._3) |
---|
519 | | - | then 2 |
---|
520 | | - | else 1) |
---|
521 | | - | let cQ = cP._1 |
---|
522 | | - | let cR = valueOrErrorMessage(scriptHash(addressFromStringValue(aa)), ("No script has been found on pool account " + aa)) |
---|
523 | | - | let cS = getBinaryValue(M()) |
---|
524 | | - | let cT = cd(bD, bE) |
---|
525 | | - | if (cT) |
---|
526 | | - | then throw((((("Pool " + bD) + "/") + bE) + " has already been activated.")) |
---|
527 | | - | else { |
---|
528 | | - | let cU = value(getString(this, ah(toString(cO), toString(cQ)))) |
---|
529 | | - | let cV = if ((bD == "WAVES")) |
---|
530 | | - | then j |
---|
531 | | - | else pow(10, 0, value(assetInfo(fromBase58String(bD))).decimals, 0, 0, DOWN) |
---|
532 | | - | let cW = if ((bE == "WAVES")) |
---|
533 | | - | then j |
---|
534 | | - | else pow(10, 0, value(assetInfo(fromBase58String(bE))).decimals, 0, 0, DOWN) |
---|
535 | | - | let cX = Issue(cJ, cK, 1, 8, true) |
---|
536 | | - | let bC = calculateAssetId(cX) |
---|
537 | | - | let cY = toBase58String(bC) |
---|
538 | | - | let cZ = invoke(addressFromStringValue(aa), "activate", [bD, bE], nil) |
---|
539 | | - | if ((cZ == cZ)) |
---|
540 | | - | then if ((cZ != "success")) |
---|
541 | | - | then throw("Pool initialisation error happened.") |
---|
542 | | - | else { |
---|
543 | | - | let cz = addressFromStringValue(aG(T())) |
---|
544 | | - | let da = invoke(cz, "createOrUpdate", [cY, cJ, false], nil) |
---|
545 | | - | if ((da == da)) |
---|
546 | | - | then { |
---|
547 | | - | let db = invoke(cz, "addLabel", [cY, g], nil) |
---|
548 | | - | if ((db == db)) |
---|
549 | | - | then { |
---|
550 | | - | let dc = invoke(cz, "setLogo", [cY, cM], nil) |
---|
551 | | - | if ((dc == dc)) |
---|
552 | | - | then { |
---|
553 | | - | let dd = invoke(cz, "addAssetsLink", [bD, bE, cY], nil) |
---|
554 | | - | if ((dd == dd)) |
---|
555 | | - | then { |
---|
556 | | - | let de = invoke(cz, "increaseAssetPoolsNumber", [bD], nil) |
---|
557 | | - | if ((de == de)) |
---|
558 | | - | then $Tuple2(((cN._2 ++ cP._2) ++ [cX, Burn(bC, 1), StringEntry(ah(toString(cO), toString(cQ)), bA(aa, toString(m), cY, bD, bE, cV, cW, cO, cQ, j, bK)), StringEntry(ao(cY), bL(cO, cQ)), StringEntry(aq(toString(cO), toString(cQ)), ("%s__" + cY)), StringEntry(au(aa), bL(cO, cQ)), StringEntry(aw(cO, cQ), aa), StringEntry(ay(cY), aa), StringEntry(ax(aa), cY), IntegerEntry(Z(aa), cL), IntegerEntry(at(aa), h)]), cY) |
---|
559 | | - | else throw("Strict value is not equal to itself.") |
---|
560 | | - | } |
---|
561 | | - | else throw("Strict value is not equal to itself.") |
---|
562 | | - | } |
---|
563 | | - | else throw("Strict value is not equal to itself.") |
---|
564 | | - | } |
---|
565 | | - | else throw("Strict value is not equal to itself.") |
---|
566 | | - | } |
---|
567 | | - | else throw("Strict value is not equal to itself.") |
---|
568 | | - | } |
---|
569 | | - | else throw("Strict value is not equal to itself.") |
---|
570 | | - | } |
---|
571 | | - | } |
---|
572 | | - | else throw("Strict value is not equal to itself.") |
---|
573 | | - | } |
---|
574 | | - | |
---|
575 | | - | |
---|
576 | | - | |
---|
577 | | - | @Callable(bk) |
---|
578 | | - | func managePool (aa,df) = { |
---|
579 | | - | let cu = bl(bk) |
---|
580 | | - | if ((cu == cu)) |
---|
581 | | - | then { |
---|
582 | | - | let dg = bO(aa) |
---|
583 | | - | let bB = dg[u] |
---|
584 | | - | let cY = dg[v] |
---|
585 | | - | let bD = dg[w] |
---|
586 | | - | let bE = dg[x] |
---|
587 | | - | let cV = parseIntValue(dg[y]) |
---|
588 | | - | let cW = parseIntValue(dg[z]) |
---|
589 | | - | let cO = parseIntValue(dg[A]) |
---|
590 | | - | let cQ = parseIntValue(dg[B]) |
---|
591 | | - | let dh = parseIntValue(dg[C]) |
---|
592 | | - | let bK = dg[D] |
---|
593 | | - | [StringEntry(ah(toString(cO), toString(cQ)), bA(aa, toString(df), cY, bD, bE, cV, cW, cO, cQ, dh, bK))] |
---|
594 | | - | } |
---|
595 | | - | else throw("Strict value is not equal to itself.") |
---|
596 | | - | } |
---|
597 | | - | |
---|
598 | | - | |
---|
599 | | - | |
---|
600 | | - | @Callable(bk) |
---|
601 | | - | func emit (di) = { |
---|
602 | | - | let dj = bk.caller |
---|
603 | | - | let dk = bk.originCaller |
---|
604 | | - | let dl = valueOrErrorMessage(getString(ax(toString(dj))), "Invalid LP address called me.") |
---|
605 | | - | let dm = fromBase58String(dl) |
---|
606 | | - | let cy = split(valueOrElse(getString(P()), l), k) |
---|
607 | | - | let cx = addressFromStringValue(valueOrErrorMessage(getString(O()), "Legacy factory contract does not exists.")) |
---|
608 | | - | if ((0 >= di)) |
---|
609 | | - | then nil |
---|
610 | | - | else if (containsElement(cy, toString(dj))) |
---|
611 | | - | then $Tuple2(nil, cx) |
---|
612 | | - | else $Tuple2([Reissue(dm, di, true), ScriptTransfer(bk.caller, di, dm)], "success") |
---|
613 | | - | } |
---|
614 | | - | |
---|
615 | | - | |
---|
616 | | - | |
---|
617 | | - | @Callable(bk) |
---|
618 | | - | func burn (dn) = { |
---|
619 | | - | let dj = bk.caller |
---|
620 | | - | let dk = bk.originCaller |
---|
621 | | - | let do = value(bk.payments[0]) |
---|
622 | | - | let dp = value(do.amount) |
---|
623 | | - | let dq = toBase58String(value(do.assetId)) |
---|
624 | | - | let dr = valueOrErrorMessage(getString(ax(toString(dj))), "Invalid LP address called me.") |
---|
625 | | - | if ((dq != dr)) |
---|
626 | | - | then throw("Invalid asset passed.") |
---|
627 | | - | else if ((dn != dp)) |
---|
628 | | - | then throw("Invalid amount passed.") |
---|
629 | | - | else { |
---|
630 | | - | let dm = fromBase58String(dr) |
---|
631 | | - | $Tuple2([Burn(dm, dn)], "success") |
---|
632 | | - | } |
---|
633 | | - | } |
---|
634 | | - | |
---|
635 | | - | |
---|
636 | | - | |
---|
637 | | - | @Callable(bk) |
---|
638 | | - | func modifyWeight (bC,ds) = { |
---|
639 | | - | let cu = if ((toBase58String(bk.caller.bytes) == valueOrElse(getString(this, U()), ""))) |
---|
640 | | - | then true |
---|
641 | | - | else bl(bk) |
---|
642 | | - | if ((cu == cu)) |
---|
643 | | - | then { |
---|
644 | | - | let av = aG(ay(bC)) |
---|
645 | | - | let dt = Z(av) |
---|
646 | | - | let du = Z(f) |
---|
647 | | - | let dv = valueOrElse(getInteger(du), 0) |
---|
648 | | - | let cL = valueOrElse(getInteger(dt), 0) |
---|
649 | | - | let dw = ds |
---|
650 | | - | let aY = split(aG(K()), k) |
---|
651 | | - | let cq = ba(aY) |
---|
652 | | - | let dx = invoke(cq, "onModifyWeight", [bC, av], nil) |
---|
653 | | - | if ((dx == dx)) |
---|
654 | | - | then { |
---|
655 | | - | let dy = if ((dv == 0)) |
---|
656 | | - | then nil |
---|
657 | | - | else [IntegerEntry(du, 0)] |
---|
658 | | - | let dz = ab(av, 0) |
---|
659 | | - | let dA = getInteger(dz) |
---|
660 | | - | let dB = if ((dA == unit)) |
---|
661 | | - | then nil |
---|
662 | | - | else [DeleteEntry(dz)] |
---|
663 | | - | (([IntegerEntry(dt, dw)] ++ dy) ++ dB) |
---|
664 | | - | } |
---|
665 | | - | else throw("Strict value is not equal to itself.") |
---|
666 | | - | } |
---|
667 | | - | else throw("Strict value is not equal to itself.") |
---|
668 | | - | } |
---|
669 | | - | |
---|
670 | | - | |
---|
671 | | - | |
---|
672 | | - | @Callable(bk) |
---|
673 | | - | func modifyWeights (dC,dD,dE,dF) = { |
---|
674 | | - | let cu = bl(bk) |
---|
675 | | - | if ((cu == cu)) |
---|
676 | | - | then { |
---|
677 | | - | let dG = ((5 * e) / 100) |
---|
678 | | - | let dH = ((5 * e) / 100) |
---|
679 | | - | let dI = ((5 * e) / 100) |
---|
680 | | - | let aY = split(aG(K()), k) |
---|
681 | | - | let dJ = ba(aY) |
---|
682 | | - | let dK = bb(aY) |
---|
683 | | - | let dL = Z(dC) |
---|
684 | | - | let dM = Z(dD) |
---|
685 | | - | let dN = Z(dE) |
---|
686 | | - | let dO = Z(dF) |
---|
687 | | - | let dP = aJ(dL) |
---|
688 | | - | let dQ = aJ(dM) |
---|
689 | | - | let dR = (dP - dI) |
---|
690 | | - | let dS = (dQ - dI) |
---|
691 | | - | if ((0 >= dR)) |
---|
692 | | - | then throw(("invalid btcWeightNew: " + toString(dR))) |
---|
693 | | - | else if ((0 >= dS)) |
---|
694 | | - | then throw(("invalid ethWeightNew: " + toString(dS))) |
---|
695 | | - | else { |
---|
696 | | - | let dT = aG(ax(dC)) |
---|
697 | | - | let dU = aG(ax(dD)) |
---|
698 | | - | let dV = aG(ax(dE)) |
---|
699 | | - | let dW = aG(ax(dF)) |
---|
700 | | - | let dX = invoke(dJ, "onModifyWeight", [dT, dC], nil) |
---|
701 | | - | if ((dX == dX)) |
---|
702 | | - | then { |
---|
703 | | - | let dY = invoke(dJ, "onModifyWeight", [dU, dD], nil) |
---|
704 | | - | if ((dY == dY)) |
---|
705 | | - | then { |
---|
706 | | - | let dZ = invoke(dJ, "onModifyWeight", [dV, dE], nil) |
---|
707 | | - | if ((dZ == dZ)) |
---|
708 | | - | then { |
---|
709 | | - | let ea = invoke(dJ, "onModifyWeight", [dW, dF], nil) |
---|
710 | | - | if ((ea == ea)) |
---|
711 | | - | then [IntegerEntry(dL, dR), IntegerEntry(dM, dS), IntegerEntry(dN, dG), IntegerEntry(dO, dH), IntegerEntry(ab(dC, 0), dP), IntegerEntry(ab(dD, 0), dQ), IntegerEntry(ab(dE, 0), dG), IntegerEntry(ab(dF, 0), dH)] |
---|
712 | | - | else throw("Strict value is not equal to itself.") |
---|
713 | | - | } |
---|
714 | | - | else throw("Strict value is not equal to itself.") |
---|
715 | | - | } |
---|
716 | | - | else throw("Strict value is not equal to itself.") |
---|
717 | | - | } |
---|
718 | | - | else throw("Strict value is not equal to itself.") |
---|
719 | | - | } |
---|
720 | | - | } |
---|
721 | | - | else throw("Strict value is not equal to itself.") |
---|
722 | | - | } |
---|
723 | | - | |
---|
724 | | - | |
---|
725 | | - | |
---|
726 | | - | @Callable(bk) |
---|
727 | | - | func checkWxEmissionPoolLabel (aA,aB) = { |
---|
728 | | - | let eb = { |
---|
729 | | - | let bd = getBoolean(az(aA, aB)) |
---|
730 | | - | if ($isInstanceOf(bd, "Boolean")) |
---|
731 | | - | then { |
---|
732 | | - | let ec = bd |
---|
733 | | - | ec |
---|
734 | | - | } |
---|
735 | | - | else false |
---|
736 | | - | } |
---|
737 | | - | $Tuple2(nil, eb) |
---|
738 | | - | } |
---|
739 | | - | |
---|
740 | | - | |
---|
741 | | - | |
---|
742 | | - | @Callable(bk) |
---|
743 | | - | func setWxEmissionPoolLabel (aA,aB) = { |
---|
744 | | - | let cu = bX(bk) |
---|
745 | | - | if ((cu == cu)) |
---|
746 | | - | then $Tuple2([BooleanEntry(az(aA, aB), true)], unit) |
---|
747 | | - | else throw("Strict value is not equal to itself.") |
---|
748 | | - | } |
---|
749 | | - | |
---|
750 | | - | |
---|
751 | | - | |
---|
752 | | - | @Callable(bk) |
---|
753 | | - | func deleteWxEmissionPoolLabel (aA,aB) = { |
---|
754 | | - | let cu = if (bj(bk)) |
---|
755 | | - | then true |
---|
756 | | - | else bX(bk) |
---|
757 | | - | if ((cu == cu)) |
---|
758 | | - | then $Tuple2([DeleteEntry(az(aA, aB))], unit) |
---|
759 | | - | else throw("Strict value is not equal to itself.") |
---|
760 | | - | } |
---|
761 | | - | |
---|
762 | | - | |
---|
763 | | - | |
---|
764 | | - | @Callable(bk) |
---|
765 | | - | func onVerificationLoss (ed) = { |
---|
766 | | - | let cu = if ((toBase58String(bk.caller.bytes) == valueOrElse(getString(this, T()), ""))) |
---|
767 | | - | then true |
---|
768 | | - | else bl(bk) |
---|
769 | | - | if ((cu == cu)) |
---|
770 | | - | then { |
---|
771 | | - | let cB = bc() |
---|
772 | | - | let ee = if ((size(cB) > 0)) |
---|
773 | | - | then true |
---|
774 | | - | else throw("invalid price assets") |
---|
775 | | - | if ((ee == ee)) |
---|
776 | | - | then { |
---|
777 | | - | func ef (eg,eh) = { |
---|
778 | | - | let ei = invoke(this, "deleteWxEmissionPoolLabel", [ed, eh], nil) |
---|
779 | | - | if ((ei == ei)) |
---|
780 | | - | then unit |
---|
781 | | - | else throw("Strict value is not equal to itself.") |
---|
782 | | - | } |
---|
783 | | - | |
---|
784 | | - | let ej = { |
---|
785 | | - | let ek = cB |
---|
786 | | - | let el = size(ek) |
---|
787 | | - | let em = unit |
---|
788 | | - | func en (eo,ep) = if ((ep >= el)) |
---|
789 | | - | then eo |
---|
790 | | - | else ef(eo, ek[ep]) |
---|
791 | | - | |
---|
792 | | - | func eq (eo,ep) = if ((ep >= el)) |
---|
793 | | - | then eo |
---|
794 | | - | else throw("List size exceeds 2") |
---|
795 | | - | |
---|
796 | | - | eq(en(en(em, 0), 1), 2) |
---|
797 | | - | } |
---|
798 | | - | if ((ej == ej)) |
---|
799 | | - | then $Tuple2(nil, unit) |
---|
800 | | - | else throw("Strict value is not equal to itself.") |
---|
801 | | - | } |
---|
802 | | - | else throw("Strict value is not equal to itself.") |
---|
803 | | - | } |
---|
804 | | - | else throw("Strict value is not equal to itself.") |
---|
805 | | - | } |
---|
806 | | - | |
---|
807 | | - | |
---|
808 | | - | |
---|
809 | | - | @Callable(bk) |
---|
810 | | - | func isPoolOneTokenOperationsDisabledREADONLY (aa) = { |
---|
811 | | - | let dg = bO(aa) |
---|
812 | | - | let al = $Tuple2(parseIntValue(dg[A]), parseIntValue(dg[B])) |
---|
813 | | - | let er = valueOrElse(getBoolean(ak(al)), false) |
---|
814 | | - | let es = valueOrElse(getBoolean(an()), false) |
---|
815 | | - | $Tuple2(nil, if (es) |
---|
816 | | - | then true |
---|
817 | | - | else er) |
---|
818 | | - | } |
---|
819 | | - | |
---|
820 | | - | |
---|
821 | | - | |
---|
822 | | - | @Callable(bk) |
---|
823 | | - | func getInFeeREADONLY (aa) = { |
---|
824 | | - | let et = ca(aC(aa), aD(), 0) |
---|
825 | | - | $Tuple2(nil, et) |
---|
826 | | - | } |
---|
827 | | - | |
---|
828 | | - | |
---|
829 | | - | |
---|
830 | | - | @Callable(bk) |
---|
831 | | - | func getOutFeeREADONLY (aa) = { |
---|
832 | | - | let et = ca(aE(aa), aF(), fraction(10, b, 10000)) |
---|
833 | | - | $Tuple2(nil, et) |
---|
834 | | - | } |
---|
835 | | - | |
---|
836 | | - | |
---|
837 | | - | |
---|
838 | | - | @Callable(bk) |
---|
839 | | - | func poolInfoREADONLY (eu,ev) = { |
---|
840 | | - | let ew = getInteger(this, af(eu)) |
---|
841 | | - | let ex = getInteger(this, af(ev)) |
---|
842 | | - | let ey = getString(this, aw(value(ew), value(ex))) |
---|
843 | | - | let ez = getString(this, ax(value(ey))) |
---|
844 | | - | let cT = if (if (isDefined(ew)) |
---|
845 | | - | then isDefined(ex) |
---|
846 | | - | else false) |
---|
847 | | - | then isDefined(ey) |
---|
848 | | - | else false |
---|
849 | | - | let eA = if (cT) |
---|
850 | | - | then $Tuple2(addressFromStringValue(value(ey)), aK(value(ez))) |
---|
851 | | - | else unit |
---|
852 | | - | $Tuple2(nil, eA) |
---|
853 | | - | } |
---|
854 | | - | |
---|
855 | | - | |
---|
856 | | - | |
---|
857 | | - | @Callable(bk) |
---|
858 | | - | func getPoolStatusREADONLY (aa) = { |
---|
859 | | - | let bP = split(aG(au(aa)), k) |
---|
860 | | - | let ai = bP[1] |
---|
861 | | - | let aj = bP[2] |
---|
862 | | - | let cg = split(aG(ah(ai, aj)), k) |
---|
863 | | - | $Tuple2(nil, parseIntValue(cg[u])) |
---|
864 | | - | } |
---|
865 | | - | |
---|
866 | | - | |
---|
867 | | - | |
---|
868 | | - | @Callable(bk) |
---|
869 | | - | func getPoolConfigREADONLY (aa) = { |
---|
870 | | - | let bP = split(aG(au(aa)), k) |
---|
871 | | - | let ai = bP[1] |
---|
872 | | - | let aj = bP[2] |
---|
873 | | - | let cg = split(aG(ah(ai, aj)), k) |
---|
874 | | - | $Tuple2(nil, cg) |
---|
875 | | - | } |
---|
876 | | - | |
---|
877 | | - | |
---|
878 | | - | |
---|
879 | | - | @Callable(bk) |
---|
880 | | - | func getPoolConfigByLpAssetId (cY) = { |
---|
881 | | - | let bP = split(aG(ao(cY)), k) |
---|
882 | | - | let ai = bP[1] |
---|
883 | | - | let aj = bP[2] |
---|
884 | | - | let cg = split(aG(ah(ai, aj)), k) |
---|
885 | | - | $Tuple2(nil, cg) |
---|
886 | | - | } |
---|
887 | | - | |
---|
888 | | - | |
---|
889 | | - | |
---|
890 | | - | @Callable(bk) |
---|
891 | | - | func poolExistsREADONLY (aA,aB) = $Tuple2(nil, cd(aA, aB)) |
---|
892 | | - | |
---|
893 | | - | |
---|
894 | | - | @Verifier(eB) |
---|
895 | | - | func eC () = { |
---|
896 | | - | let eD = { |
---|
897 | | - | let bd = bf() |
---|
898 | | - | if ($isInstanceOf(bd, "ByteVector")) |
---|
899 | | - | then { |
---|
900 | | - | let bm = bd |
---|
901 | | - | bm |
---|
902 | | - | } |
---|
903 | | - | else if ($isInstanceOf(bd, "Unit")) |
---|
904 | | - | then eB.senderPublicKey |
---|
905 | | - | else throw("Match error") |
---|
906 | | - | } |
---|
907 | | - | sigVerify(eB.bodyBytes, eB.proofs[0], eD) |
---|
908 | | - | } |
---|
909 | | - | |
---|
| 1 | + | # no script |
---|