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 = "__" |
---|
13 | | - | |
---|
14 | | - | let f = b |
---|
15 | | - | |
---|
16 | | - | let g = toBigInt(0) |
---|
17 | | - | |
---|
18 | | - | let h = 1 |
---|
19 | | - | |
---|
20 | | - | let i = 2 |
---|
21 | | - | |
---|
22 | | - | let j = 3 |
---|
23 | | - | |
---|
24 | | - | let k = 4 |
---|
25 | | - | |
---|
26 | | - | let l = 5 |
---|
27 | | - | |
---|
28 | | - | let m = 6 |
---|
29 | | - | |
---|
30 | | - | let n = 7 |
---|
31 | | - | |
---|
32 | | - | let o = 8 |
---|
33 | | - | |
---|
34 | | - | let p = 9 |
---|
35 | | - | |
---|
36 | | - | let q = 10 |
---|
37 | | - | |
---|
38 | | - | func r (s) = valueOrErrorMessage(getString(s), (("mandatory this." + s) + " is not defined")) |
---|
39 | | - | |
---|
40 | | - | |
---|
41 | | - | func t (u,s) = valueOrErrorMessage(getString(u, s), (((("mandatory " + toString(u)) + ".") + s) + " is not defined")) |
---|
42 | | - | |
---|
43 | | - | |
---|
44 | | - | func v (u,s) = valueOrElse(getInteger(u, s), 0) |
---|
45 | | - | |
---|
46 | | - | |
---|
47 | | - | func w (u,s) = valueOrErrorMessage(getInteger(u, s), (("mandatory this." + s) + " is not defined")) |
---|
48 | | - | |
---|
49 | | - | |
---|
50 | | - | func x (y) = { |
---|
51 | | - | let z = y |
---|
52 | | - | if ($isInstanceOf(z, "List[Any]")) |
---|
53 | | - | then { |
---|
54 | | - | let A = z |
---|
55 | | - | A |
---|
56 | | - | } |
---|
57 | | - | else throw("fail to cast into List[Any]") |
---|
58 | | - | } |
---|
59 | | - | |
---|
60 | | - | |
---|
61 | | - | func B (y) = { |
---|
62 | | - | let z = y |
---|
63 | | - | if ($isInstanceOf(z, "Int")) |
---|
64 | | - | then { |
---|
65 | | - | let C = z |
---|
66 | | - | C |
---|
67 | | - | } |
---|
68 | | - | else throw("fail to cast into Int") |
---|
69 | | - | } |
---|
70 | | - | |
---|
71 | | - | |
---|
72 | | - | func D (y) = { |
---|
73 | | - | let z = y |
---|
74 | | - | if ($isInstanceOf(z, "String")) |
---|
75 | | - | then { |
---|
76 | | - | let E = z |
---|
77 | | - | E |
---|
78 | | - | } |
---|
79 | | - | else throw("fail to cast into String") |
---|
80 | | - | } |
---|
81 | | - | |
---|
82 | | - | |
---|
83 | | - | func F () = "%s%s__config__factoryAddress" |
---|
84 | | - | |
---|
85 | | - | |
---|
86 | | - | func G () = "%s__managerPublicKey" |
---|
87 | | - | |
---|
88 | | - | |
---|
89 | | - | func H () = "%s__pendingManagerPublicKey" |
---|
90 | | - | |
---|
91 | | - | |
---|
92 | | - | let I = 1 |
---|
93 | | - | |
---|
94 | | - | let J = 2 |
---|
95 | | - | |
---|
96 | | - | let K = 3 |
---|
97 | | - | |
---|
98 | | - | let L = 4 |
---|
99 | | - | |
---|
100 | | - | let M = 5 |
---|
101 | | - | |
---|
102 | | - | let N = 6 |
---|
103 | | - | |
---|
104 | | - | let O = 7 |
---|
105 | | - | |
---|
106 | | - | let P = 8 |
---|
107 | | - | |
---|
108 | | - | func Q () = "%s__factoryConfig" |
---|
109 | | - | |
---|
110 | | - | |
---|
111 | | - | func R (S) = makeString(["%s%s%s", S, "mappings__lpAsset2PoolContract"], e) |
---|
112 | | - | |
---|
113 | | - | |
---|
114 | | - | func T () = "%s__lpTokensList" |
---|
115 | | - | |
---|
116 | | - | |
---|
117 | | - | func U (S) = makeString(["%s%s%s", S, "mappings__lpAsset2PoolContract"], e) |
---|
118 | | - | |
---|
119 | | - | |
---|
120 | | - | func V (W) = makeString(["%s%s", "poolWeight", W], e) |
---|
121 | | - | |
---|
122 | | - | |
---|
123 | | - | func X () = addressFromStringValue(r(F())) |
---|
124 | | - | |
---|
125 | | - | |
---|
126 | | - | func Y () = split(valueOrElse(getString(X(), T()), ""), e) |
---|
127 | | - | |
---|
128 | | - | |
---|
129 | | - | func Z (aa) = split(t(aa, Q()), e) |
---|
130 | | - | |
---|
131 | | - | |
---|
132 | | - | func ab (ac) = addressFromStringValue(ac[J]) |
---|
133 | | - | |
---|
134 | | - | |
---|
135 | | - | func ad (ac) = addressFromStringValue(ac[M]) |
---|
136 | | - | |
---|
137 | | - | |
---|
138 | | - | func ae (ac) = addressFromStringValue(ac[I]) |
---|
139 | | - | |
---|
140 | | - | |
---|
141 | | - | func af (ac) = addressFromStringValue(ac[P]) |
---|
142 | | - | |
---|
143 | | - | |
---|
144 | | - | func ag () = "%s__config" |
---|
145 | | - | |
---|
146 | | - | |
---|
147 | | - | func ah () = "%s%s__stats__activeTotalLocked" |
---|
148 | | - | |
---|
149 | | - | |
---|
150 | | - | func ai () = "%s%s__stats__locksDurationSumInBlocks" |
---|
151 | | - | |
---|
152 | | - | |
---|
153 | | - | func aj () = "%s%s__stats__locksCount" |
---|
154 | | - | |
---|
155 | | - | |
---|
156 | | - | func ak () = "%s%s__stats__activeUsersCount" |
---|
157 | | - | |
---|
158 | | - | |
---|
159 | | - | func al (am) = makeString(["%s%s%s__mapping__user2num", am], e) |
---|
160 | | - | |
---|
161 | | - | |
---|
162 | | - | func an (ao) = makeString(["%s%s%s__mapping__num2user", ao], e) |
---|
163 | | - | |
---|
164 | | - | |
---|
165 | | - | func ap (aq) = makeString(["%s%d%s__paramByUserNum", aq, "amount"], e) |
---|
166 | | - | |
---|
167 | | - | |
---|
168 | | - | func ar (aq) = makeString(["%s%d%s__paramByUserNum", aq, "start"], e) |
---|
169 | | - | |
---|
170 | | - | |
---|
171 | | - | func as (aq) = makeString(["%s%d%s__paramByUserNum", aq, "duration"], e) |
---|
172 | | - | |
---|
173 | | - | |
---|
174 | | - | func at (aq) = makeString(["%s%d%s__paramByUserNum", aq, "k"], e) |
---|
175 | | - | |
---|
176 | | - | |
---|
177 | | - | func au (aq) = makeString(["%s%d%s__paramByUserNum", aq, "b"], e) |
---|
178 | | - | |
---|
179 | | - | |
---|
180 | | - | func av (aq,aw) = makeString(["%s%d%s%d__paramByPeriod", aq, "k", aw], e) |
---|
181 | | - | |
---|
182 | | - | |
---|
183 | | - | func ax (aq,aw) = makeString(["%s%d%s%d__paramByPeriod", aq, "b", aw], e) |
---|
184 | | - | |
---|
185 | | - | |
---|
186 | | - | func ay (aq) = makeString(["%s%d__userBoostEmissionLastInt", aq], e) |
---|
187 | | - | |
---|
188 | | - | |
---|
189 | | - | func az (aq) = makeString(["%s%d__maxBoostInt", aq], e) |
---|
190 | | - | |
---|
191 | | - | |
---|
192 | | - | func aA () = "%s%s__maxBoostInt__total" |
---|
193 | | - | |
---|
194 | | - | |
---|
195 | | - | func aB (aq) = makeString(["%s%d__userBoostAvaliableToClaimTotal", aq], e) |
---|
196 | | - | |
---|
197 | | - | |
---|
198 | | - | func aC (aq) = makeString(["%s%d__userBoostClaimed", aq], e) |
---|
199 | | - | |
---|
200 | | - | |
---|
201 | | - | func aD () = "%s%s__gwxCached__total" |
---|
202 | | - | |
---|
203 | | - | |
---|
204 | | - | func aE (aF,aG) = makeString(["%s%s%s__staked", aF, aG], e) |
---|
205 | | - | |
---|
206 | | - | |
---|
207 | | - | func aH (aG) = ("%s%s%s__staked__total__" + aG) |
---|
208 | | - | |
---|
209 | | - | |
---|
210 | | - | func aI (aG,aF) = makeString(["%s%s%s__claimed", aF, aG], e) |
---|
211 | | - | |
---|
212 | | - | |
---|
213 | | - | func aJ (aG,aF) = makeString(["%s%s%s__claimedMinReward", aF, aG], e) |
---|
214 | | - | |
---|
215 | | - | |
---|
216 | | - | func aK (aG,aF) = makeString(["%s%s%s__claimedBoostReward", aF, aG], e) |
---|
217 | | - | |
---|
218 | | - | |
---|
219 | | - | func aL (aM,s) = valueOrElse(getInteger(aM, s), 0) |
---|
220 | | - | |
---|
221 | | - | |
---|
222 | | - | func aN () = "%s%s__ratePerBlock__current" |
---|
223 | | - | |
---|
224 | | - | |
---|
225 | | - | func aO () = "%s%s__ratePerBlockMax__current" |
---|
226 | | - | |
---|
227 | | - | |
---|
228 | | - | func aP () = "%s%s__emission__startBlock" |
---|
229 | | - | |
---|
230 | | - | |
---|
231 | | - | func aQ () = "%s%s__emission__duration" |
---|
232 | | - | |
---|
233 | | - | |
---|
234 | | - | func aR () = "%s%s__emission__endBlock" |
---|
235 | | - | |
---|
236 | | - | |
---|
237 | | - | func aS () = "%s__addonAddr" |
---|
238 | | - | |
---|
239 | | - | |
---|
240 | | - | let aT = X() |
---|
241 | | - | |
---|
242 | | - | let aU = Z(aT) |
---|
243 | | - | |
---|
244 | | - | let aV = ad(aU) |
---|
245 | | - | |
---|
246 | | - | let aM = ae(aU) |
---|
247 | | - | |
---|
248 | | - | let aW = af(aU) |
---|
249 | | - | |
---|
250 | | - | let aX = ab(aU) |
---|
251 | | - | |
---|
252 | | - | func aY (aZ) = { |
---|
253 | | - | let ba = invoke(aT, "getInFeeREADONLY", [toString(aZ)], nil) |
---|
254 | | - | if ($isInstanceOf(ba, "Int")) |
---|
255 | | - | then ba |
---|
256 | | - | else throw(($getType(ba) + " couldn't be cast to Int")) |
---|
257 | | - | } |
---|
258 | | - | |
---|
259 | | - | |
---|
260 | | - | func bb (aZ) = { |
---|
261 | | - | let ba = invoke(aT, "getOutFeeREADONLY", [toString(aZ)], nil) |
---|
262 | | - | if ($isInstanceOf(ba, "Int")) |
---|
263 | | - | then ba |
---|
264 | | - | else throw(($getType(ba) + " couldn't be cast to Int")) |
---|
265 | | - | } |
---|
266 | | - | |
---|
267 | | - | |
---|
268 | | - | func bc (bd) = { |
---|
269 | | - | let be = t(aT, U(bd)) |
---|
270 | | - | let bf = b |
---|
271 | | - | let bg = getIntegerValue(aT, V(be)) |
---|
272 | | - | let bh = w(aV, aN()) |
---|
273 | | - | let bi = w(aV, aO()) |
---|
274 | | - | let bj = 3 |
---|
275 | | - | let bk = (fraction(bh, bg, bf) / bj) |
---|
276 | | - | let bl = fraction(bi, bg, bf) |
---|
277 | | - | let bm = (bj * b) |
---|
278 | | - | let bn = v(aM, aH(bd)) |
---|
279 | | - | [bk, bm, bn] |
---|
280 | | - | } |
---|
281 | | - | |
---|
282 | | - | |
---|
283 | | - | func bo (bp,bq,br) = { |
---|
284 | | - | let bs = fraction(bq, b, br) |
---|
285 | | - | let bt = fraction(bp, bs, b) |
---|
286 | | - | [bt] |
---|
287 | | - | } |
---|
288 | | - | |
---|
289 | | - | |
---|
290 | | - | func bu (bv,s,bw) = if ((bw == "string")) |
---|
291 | | - | then getStringValue(bv, s) |
---|
292 | | - | else if ((bw == "integer")) |
---|
293 | | - | then toString(getIntegerValue(bv, s)) |
---|
294 | | - | else if ((bw == "boolean")) |
---|
295 | | - | then toString(getBooleanValue(bv, s)) |
---|
296 | | - | else throw("unknown type. expected string/integer/boolean") |
---|
297 | | - | |
---|
298 | | - | |
---|
299 | | - | func bx () = { |
---|
300 | | - | let z = getString(G()) |
---|
301 | | - | if ($isInstanceOf(z, "String")) |
---|
302 | | - | then { |
---|
303 | | - | let by = z |
---|
304 | | - | fromBase58String(by) |
---|
305 | | - | } |
---|
306 | | - | else if ($isInstanceOf(z, "Unit")) |
---|
307 | | - | then unit |
---|
308 | | - | else throw("Match error") |
---|
309 | | - | } |
---|
310 | | - | |
---|
311 | | - | |
---|
312 | | - | func bz () = { |
---|
313 | | - | let z = getString(H()) |
---|
314 | | - | if ($isInstanceOf(z, "String")) |
---|
315 | | - | then { |
---|
316 | | - | let by = z |
---|
317 | | - | fromBase58String(by) |
---|
318 | | - | } |
---|
319 | | - | else if ($isInstanceOf(z, "Unit")) |
---|
320 | | - | then unit |
---|
321 | | - | else throw("Match error") |
---|
322 | | - | } |
---|
323 | | - | |
---|
324 | | - | |
---|
325 | | - | func bA (bB) = { |
---|
326 | | - | let bC = throw("Permission denied") |
---|
327 | | - | let z = bx() |
---|
328 | | - | if ($isInstanceOf(z, "ByteVector")) |
---|
329 | | - | then { |
---|
330 | | - | let bD = z |
---|
331 | | - | if ((bB.callerPublicKey == bD)) |
---|
332 | | - | then true |
---|
333 | | - | else bC |
---|
334 | | - | } |
---|
335 | | - | else if ($isInstanceOf(z, "Unit")) |
---|
336 | | - | then if ((bB.caller == this)) |
---|
337 | | - | then true |
---|
338 | | - | else bC |
---|
339 | | - | else throw("Match error") |
---|
340 | | - | } |
---|
341 | | - | |
---|
342 | | - | |
---|
343 | | - | @Callable(bB) |
---|
344 | | - | func constructor (bE) = { |
---|
345 | | - | let bF = bA(bB) |
---|
346 | | - | if ((bF == bF)) |
---|
347 | | - | then [StringEntry(F(), bE)] |
---|
348 | | - | else throw("Strict value is not equal to itself.") |
---|
349 | | - | } |
---|
350 | | - | |
---|
351 | | - | |
---|
352 | | - | |
---|
353 | | - | @Callable(bB) |
---|
354 | | - | func currentRewardRateREADONLY (bd) = { |
---|
355 | | - | let bG = bc(bd) |
---|
356 | | - | let bh = bG[0] |
---|
357 | | - | let bm = bG[1] |
---|
358 | | - | let bn = bG[2] |
---|
359 | | - | $Tuple2(nil, makeString(["%d%d%d", toString(bh), toString(bm), toString(bn)], e)) |
---|
360 | | - | } |
---|
361 | | - | |
---|
362 | | - | |
---|
363 | | - | |
---|
364 | | - | @Callable(bB) |
---|
365 | | - | func currentUserRewardRateREADONLY (bd,am) = { |
---|
366 | | - | let bG = bc(bd) |
---|
367 | | - | let bh = bG[0] |
---|
368 | | - | let bm = bG[1] |
---|
369 | | - | let bn = bG[2] |
---|
370 | | - | let bH = v(aM, aE(am, bd)) |
---|
371 | | - | let bI = split(D(invoke(aM, "claimWxREADONLY", [bd, am], nil)), e) |
---|
372 | | - | let bJ = valueOrErrorMessage(parseInt(bI[5]), "couldn't parse minRewardPart") |
---|
373 | | - | let bK = valueOrErrorMessage(parseInt(bI[6]), "couldn't parse boostRewardPart") |
---|
374 | | - | let bL = bI[7] |
---|
375 | | - | let bM = if ((bK == 0)) |
---|
376 | | - | then (1 * b) |
---|
377 | | - | else fraction((bJ + bK), b, bJ) |
---|
378 | | - | $Tuple2(nil, makeString(["%d%d%d%d%d%s", toString(bh), toString(bm), toString(bn), toString(bH), toString(bM), bL], e)) |
---|
379 | | - | } |
---|
380 | | - | |
---|
381 | | - | |
---|
382 | | - | |
---|
383 | | - | @Callable(bB) |
---|
384 | | - | func calcBoostBulkInternalREADONLY (bN,bO,bP,bQ,bR,bS,bT) = if ((bN == size(bO))) |
---|
385 | | - | then $Tuple2(nil, bT) |
---|
386 | | - | else { |
---|
387 | | - | let bU = bO[bN] |
---|
388 | | - | let bV = bP[bN] |
---|
389 | | - | let bW = bQ[bN] |
---|
390 | | - | let bX = bR[bN] |
---|
391 | | - | let bY = { |
---|
392 | | - | let ba = invoke(this, "calcBoostREADONLY", [bU, bV, bW, bX, bS], nil) |
---|
393 | | - | if ($isInstanceOf(ba, "String")) |
---|
394 | | - | then ba |
---|
395 | | - | else throw(($getType(ba) + " couldn't be cast to String")) |
---|
396 | | - | } |
---|
397 | | - | let bZ = (bT :+ bY) |
---|
398 | | - | let ca = { |
---|
399 | | - | let ba = invoke(this, "calcBoostBulkInternalREADONLY", [(bN + 1), bO, bP, bQ, bR, bS, bZ], nil) |
---|
400 | | - | if ($isInstanceOf(ba, "List[Any]")) |
---|
401 | | - | then ba |
---|
402 | | - | else throw(($getType(ba) + " couldn't be cast to List[Any]")) |
---|
403 | | - | } |
---|
404 | | - | if ((ca == ca)) |
---|
405 | | - | then $Tuple2(nil, ca) |
---|
406 | | - | else throw("Strict value is not equal to itself.") |
---|
407 | | - | } |
---|
408 | | - | |
---|
409 | | - | |
---|
410 | | - | |
---|
411 | | - | @Callable(bB) |
---|
412 | | - | func calcBoostBulkREADONLY (bU,bV,bW,bX,bS) = { |
---|
413 | | - | let bZ = invoke(this, "calcBoostBulkInternalREADONLY", [0, bU, bV, bW, bX, bS, nil], nil) |
---|
414 | | - | $Tuple2(nil, bZ) |
---|
415 | | - | } |
---|
416 | | - | |
---|
417 | | - | |
---|
418 | | - | |
---|
419 | | - | @Callable(bB) |
---|
420 | | - | func calcBoostREADONLY (bU,bV,bW,bX,bS) = { |
---|
421 | | - | let cb = aW |
---|
422 | | - | let cc = "empty" |
---|
423 | | - | let cd = parseIntValue(split(t(aX, ag()), e)[4]) |
---|
424 | | - | let aG = if ((bX == "")) |
---|
425 | | - | then cc |
---|
426 | | - | else bX |
---|
427 | | - | let aF = if ((bS == "")) |
---|
428 | | - | then cc |
---|
429 | | - | else bS |
---|
430 | | - | let ce = valueOrElse(getString(aX, al(bS)), cc) |
---|
431 | | - | let cf = valueOrElse(getInteger(aX, ap(ce)), 0) |
---|
432 | | - | let cg = valueOrElse(getInteger(aX, ar(ce)), height) |
---|
433 | | - | let bq = valueOrElse(getInteger(aX, as(ce)), 0) |
---|
434 | | - | let ch = (cg + bq) |
---|
435 | | - | let ci = max([(ch - height), 0]) |
---|
436 | | - | let cj = (cf + bU) |
---|
437 | | - | let ck = min([(ci + bV), cd]) |
---|
438 | | - | let cl = B(x(invoke(aX, "gwxUserInfoREADONLY", [aF], nil))[0]) |
---|
439 | | - | let cm = bo(cj, ck, cd)[0] |
---|
440 | | - | let cn = x(invoke(cb, "calcGwxParamsREADONLY", [cm, height, ck], nil)) |
---|
441 | | - | let co = (cm - cl) |
---|
442 | | - | let cp = B(cn[0]) |
---|
443 | | - | let cq = B(cn[1]) |
---|
444 | | - | let aw = toString(B(cn[2])) |
---|
445 | | - | let cr = aA() |
---|
446 | | - | let cs = ((cm * ck) / 2) |
---|
447 | | - | let ct = v(aX, cr) |
---|
448 | | - | let cu = { |
---|
449 | | - | let ba = invoke(aX, "getTotalCachedGwxREADONLY", nil, nil) |
---|
450 | | - | if ($isInstanceOf(ba, "Int")) |
---|
451 | | - | then ba |
---|
452 | | - | else throw(($getType(ba) + " couldn't be cast to Int")) |
---|
453 | | - | } |
---|
454 | | - | let cv = 1000 |
---|
455 | | - | let cw = (w(aV, aN()) * cv) |
---|
456 | | - | let cx = aE(aF, aG) |
---|
457 | | - | let cy = aH(aG) |
---|
458 | | - | let cz = aL(aM, cx) |
---|
459 | | - | let cA = aL(aM, cy) |
---|
460 | | - | let cB = (cz + bW) |
---|
461 | | - | let cC = (cA + bW) |
---|
462 | | - | let bg = if ((aG != cc)) |
---|
463 | | - | then { |
---|
464 | | - | let be = valueOrErrorMessage(getString(aT, R(aG)), ("unsupported lp asset " + aG)) |
---|
465 | | - | getIntegerValue(aT, V(be)) |
---|
466 | | - | } |
---|
467 | | - | else 0 |
---|
468 | | - | let cD = fraction(cw, bg, (f * 3)) |
---|
469 | | - | let cE = if ((cC != 0)) |
---|
470 | | - | then fraction(cD, b, cC) |
---|
471 | | - | else 0 |
---|
472 | | - | let cF = fraction(cE, cB, b) |
---|
473 | | - | let cG = (cD * 2) |
---|
474 | | - | let cH = fraction(cm, cG, (cu + co)) |
---|
475 | | - | let cI = min([cH, (cF * 2)]) |
---|
476 | | - | let cJ = if ((cF == 0)) |
---|
477 | | - | then (1 * b) |
---|
478 | | - | else fraction((cI + cF), b, cF) |
---|
479 | | - | $Tuple2(nil, makeString(["%d%d%s", toString(cm), toString(cJ), "d"], e)) |
---|
480 | | - | } |
---|
481 | | - | |
---|
482 | | - | |
---|
483 | | - | |
---|
484 | | - | @Callable(bB) |
---|
485 | | - | func wxEmissionStatsREADONLY () = { |
---|
486 | | - | let cK = toString(b) |
---|
487 | | - | let cL = "1" |
---|
488 | | - | let bh = w(aV, aN()) |
---|
489 | | - | let cM = w(aV, aP()) |
---|
490 | | - | let cN = if ((cM > height)) |
---|
491 | | - | then 0 |
---|
492 | | - | else (height - cM) |
---|
493 | | - | let cO = (1440 * 365) |
---|
494 | | - | let cP = (201000000 * b) |
---|
495 | | - | let cQ = if ((cN > cO)) |
---|
496 | | - | then cP |
---|
497 | | - | else fraction(cP, cN, cO) |
---|
498 | | - | let cR = ((bh * cN) + cQ) |
---|
499 | | - | let cS = v(aX, ah()) |
---|
500 | | - | let cT = v(aX, ai()) |
---|
501 | | - | let cU = v(aX, aj()) |
---|
502 | | - | $Tuple2(nil, makeString(["%d%d%d%d", toString(cR), toString(cS), toString(cT), toString(cU)], e)) |
---|
503 | | - | } |
---|
504 | | - | |
---|
505 | | - | |
---|
506 | | - | |
---|
507 | | - | @Callable(bB) |
---|
508 | | - | func poolStatsREADONLY (cV) = { |
---|
509 | | - | let aZ = addressFromStringValue(t(aT, U(cV))) |
---|
510 | | - | let cW = { |
---|
511 | | - | let ba = invoke(aT, "getPoolStatusREADONLY", [toString(aZ)], nil) |
---|
512 | | - | if ($isInstanceOf(ba, "Int")) |
---|
513 | | - | then ba |
---|
514 | | - | else throw(($getType(ba) + " couldn't be cast to Int")) |
---|
515 | | - | } |
---|
516 | | - | let cX = "%d%d%d%d%d%d%d%d%d%s" |
---|
517 | | - | if ((cW == 4)) |
---|
518 | | - | then $Tuple2(nil, makeString([cX, toString(0), toString(0), toString(0), toString(0), toString(0), toString(0), toString(0), toString(0), toString(0), toString(false)], e)) |
---|
519 | | - | else { |
---|
520 | | - | let cY = x(invoke(aZ, "getPoolConfigWrapperREADONLY", nil, nil)) |
---|
521 | | - | let bd = fromBase58String(D(cY[j])) |
---|
522 | | - | let cZ = D(cY[k]) |
---|
523 | | - | let da = D(cY[l]) |
---|
524 | | - | let db = D(cY[o]) |
---|
525 | | - | let dc = D(cY[p]) |
---|
526 | | - | let dd = parseIntValue(D(cY[m])) |
---|
527 | | - | let de = parseIntValue(D(cY[n])) |
---|
528 | | - | let df = valueOrErrorMessage(assetInfo(bd), (("Asset " + toBase58String(bd)) + " doesn't exist")).quantity |
---|
529 | | - | let dg = B(invoke(aZ, "getAccBalanceWrapperREADONLY", [cZ], nil)) |
---|
530 | | - | let dh = B(invoke(aZ, "getAccBalanceWrapperREADONLY", [da], nil)) |
---|
531 | | - | let di = if ((df == 0)) |
---|
532 | | - | then [toString(g), toString(g), toString(g)] |
---|
533 | | - | else x(invoke(aZ, "calcPricesWrapperREADONLY", [dg, dh, df], nil)) |
---|
534 | | - | let dj = 0 |
---|
535 | | - | let dk = B(invoke(aZ, "fromX18WrapperREADONLY", [di[1], b], nil)) |
---|
536 | | - | let dl = B(invoke(aZ, "fromX18WrapperREADONLY", [di[2], b], nil)) |
---|
537 | | - | let bg = getIntegerValue(aT, V(toString(aZ))) |
---|
538 | | - | let dm = aY(aZ) |
---|
539 | | - | let dn = bb(aZ) |
---|
540 | | - | let do = { |
---|
541 | | - | let ba = invoke(aT, "isPoolOneTokenOperationsDisabledREADONLY", [toString(aZ)], nil) |
---|
542 | | - | if ($isInstanceOf(ba, "Boolean")) |
---|
543 | | - | then ba |
---|
544 | | - | else throw(($getType(ba) + " couldn't be cast to Boolean")) |
---|
545 | | - | } |
---|
546 | | - | let dp = !(do) |
---|
547 | | - | $Tuple2(nil, makeString([cX, toString(dg), toString(dh), toString(df), toString(dj), toString(dk), toString(dl), toString(bg), toString(dm), toString(dn), toString(dp)], e)) |
---|
548 | | - | } |
---|
549 | | - | } |
---|
550 | | - | |
---|
551 | | - | |
---|
552 | | - | |
---|
553 | | - | @Callable(bB) |
---|
554 | | - | func poolEvaluatePutByAmountAssetREADONLY (cV,dq) = { |
---|
555 | | - | let aZ = addressFromStringValue(t(aT, U(cV))) |
---|
556 | | - | let cY = x(invoke(aZ, "getPoolConfigWrapperREADONLY", nil, nil)) |
---|
557 | | - | let bd = fromBase58String(D(cY[j])) |
---|
558 | | - | let dr = D(cY[k]) |
---|
559 | | - | let ds = fromBase58String(dr) |
---|
560 | | - | let dt = D(cY[l]) |
---|
561 | | - | let du = fromBase58String(dt) |
---|
562 | | - | let dd = parseIntValue(D(cY[m])) |
---|
563 | | - | let de = parseIntValue(D(cY[n])) |
---|
564 | | - | let dv = D(cY[i]) |
---|
565 | | - | let df = valueOrErrorMessage(assetInfo(bd), (("Asset " + toBase58String(bd)) + " doesn't exist")).quantity |
---|
566 | | - | let dg = B(invoke(aZ, "getAccBalanceWrapperREADONLY", [dr], nil)) |
---|
567 | | - | let dh = B(invoke(aZ, "getAccBalanceWrapperREADONLY", [dt], nil)) |
---|
568 | | - | let dw = parseBigIntValue(D(invoke(aZ, "toX18WrapperREADONLY", [dg, dd], nil))) |
---|
569 | | - | let dx = parseBigIntValue(D(invoke(aZ, "toX18WrapperREADONLY", [dh, de], nil))) |
---|
570 | | - | let dy = if ((df == 0)) |
---|
571 | | - | then g |
---|
572 | | - | else parseBigIntValue(D(invoke(aZ, "calcPriceBigIntWrapperREADONLY", [toString(dx), toString(dw)], nil))) |
---|
573 | | - | let dj = B(invoke(aZ, "fromX18WrapperREADONLY", [toString(dy), b], nil)) |
---|
574 | | - | let dz = parseBigIntValue(D(invoke(aZ, "toX18WrapperREADONLY", [dq, dd], nil))) |
---|
575 | | - | let dA = fraction(dz, dy, d) |
---|
576 | | - | let dB = B(invoke(aZ, "fromX18WrapperREADONLY", [toString(dA), de], nil)) |
---|
577 | | - | let bZ = invoke(aZ, "estimatePutOperationWrapperREADONLY", ["", 500000, dq, ds, dB, du, "", true, false], nil) |
---|
578 | | - | let dC = { |
---|
579 | | - | let z = bZ |
---|
580 | | - | if (if (if ($isInstanceOf(z._1, "Int")) |
---|
581 | | - | then if ($isInstanceOf(z._3, "Int")) |
---|
582 | | - | then if ($isInstanceOf(z._4, "Int")) |
---|
583 | | - | then if ($isInstanceOf(z._5, "Int")) |
---|
584 | | - | then $isInstanceOf(z._6, "Int") |
---|
585 | | - | else false |
---|
586 | | - | else false |
---|
587 | | - | else false |
---|
588 | | - | else false) |
---|
589 | | - | then (size(z) == 13) |
---|
590 | | - | else false) |
---|
591 | | - | then { |
---|
592 | | - | let dD = z._1 |
---|
593 | | - | let dE = z._3 |
---|
594 | | - | let dF = z._4 |
---|
595 | | - | let dG = z._5 |
---|
596 | | - | let dH = z._6 |
---|
597 | | - | $Tuple5(dD, dE, dF, dG, dH) |
---|
598 | | - | } |
---|
599 | | - | else throw("Couldn't cast types") |
---|
600 | | - | } |
---|
601 | | - | let dD = dC._1 |
---|
602 | | - | let dE = dC._2 |
---|
603 | | - | let dF = dC._3 |
---|
604 | | - | let dG = dC._4 |
---|
605 | | - | let dH = dC._5 |
---|
606 | | - | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(dD), toString(dj), toString(dF), toString(dG), toString(dH), dv, toString(dq), toString(dB)], e)) |
---|
607 | | - | } |
---|
608 | | - | |
---|
609 | | - | |
---|
610 | | - | |
---|
611 | | - | @Callable(bB) |
---|
612 | | - | func poolEvaluatePutByPriceAssetREADONLY (cV,dB) = { |
---|
613 | | - | let aZ = addressFromStringValue(t(aT, U(cV))) |
---|
614 | | - | let cY = x(invoke(aZ, "getPoolConfigWrapperREADONLY", nil, nil)) |
---|
615 | | - | let bd = fromBase58String(D(cY[j])) |
---|
616 | | - | let dr = D(cY[k]) |
---|
617 | | - | let ds = fromBase58String(dr) |
---|
618 | | - | let dt = D(cY[l]) |
---|
619 | | - | let du = fromBase58String(dt) |
---|
620 | | - | let dd = parseIntValue(D(cY[m])) |
---|
621 | | - | let de = parseIntValue(D(cY[n])) |
---|
622 | | - | let dv = D(cY[i]) |
---|
623 | | - | let df = valueOrErrorMessage(assetInfo(bd), (("Asset " + toBase58String(bd)) + " doesn't exist")).quantity |
---|
624 | | - | let dI = B(invoke(aZ, "getAccBalanceWrapperREADONLY", [dr], nil)) |
---|
625 | | - | let dJ = B(invoke(aZ, "getAccBalanceWrapperREADONLY", [dt], nil)) |
---|
626 | | - | let dK = parseBigIntValue(D(invoke(aZ, "toX18WrapperREADONLY", [dI, dd], nil))) |
---|
627 | | - | let dL = parseBigIntValue(D(invoke(aZ, "toX18WrapperREADONLY", [dJ, de], nil))) |
---|
628 | | - | let dy = if ((df == 0)) |
---|
629 | | - | then g |
---|
630 | | - | else parseBigIntValue(D(invoke(aZ, "calcPriceBigIntWrapperREADONLY", [toString(dL), toString(dK)], nil))) |
---|
631 | | - | let dj = B(invoke(aZ, "fromX18WrapperREADONLY", [toString(dy), b], nil)) |
---|
632 | | - | let dA = parseBigIntValue(D(invoke(aZ, "toX18WrapperREADONLY", [dB, de], nil))) |
---|
633 | | - | let dz = fraction(dA, d, dy) |
---|
634 | | - | let dq = B(invoke(aZ, "fromX18WrapperREADONLY", [toString(dz), dd], nil)) |
---|
635 | | - | let bZ = invoke(aZ, "estimatePutOperationWrapperREADONLY", ["", 500000, dq, ds, dB, du, "", true, false], nil) |
---|
636 | | - | let dM = { |
---|
637 | | - | let z = bZ |
---|
638 | | - | if (if (if ($isInstanceOf(z._1, "Int")) |
---|
639 | | - | then if ($isInstanceOf(z._3, "Int")) |
---|
640 | | - | then if ($isInstanceOf(z._4, "Int")) |
---|
641 | | - | then if ($isInstanceOf(z._5, "Int")) |
---|
642 | | - | then $isInstanceOf(z._6, "Int") |
---|
643 | | - | else false |
---|
644 | | - | else false |
---|
645 | | - | else false |
---|
646 | | - | else false) |
---|
647 | | - | then (size(z) == 13) |
---|
648 | | - | else false) |
---|
649 | | - | then { |
---|
650 | | - | let dD = z._1 |
---|
651 | | - | let dE = z._3 |
---|
652 | | - | let dF = z._4 |
---|
653 | | - | let dG = z._5 |
---|
654 | | - | let dH = z._6 |
---|
655 | | - | $Tuple5(dD, dE, dF, dG, dH) |
---|
656 | | - | } |
---|
657 | | - | else throw("Couldn't cast types") |
---|
658 | | - | } |
---|
659 | | - | let dD = dM._1 |
---|
660 | | - | let dE = dM._2 |
---|
661 | | - | let dF = dM._3 |
---|
662 | | - | let dG = dM._4 |
---|
663 | | - | let dH = dM._5 |
---|
664 | | - | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(dD), toString(dj), toString(dF), toString(dG), toString(dH), dv, toString(dq), toString(dB)], e)) |
---|
665 | | - | } |
---|
666 | | - | |
---|
667 | | - | |
---|
668 | | - | |
---|
669 | | - | @Callable(bB) |
---|
670 | | - | func poolEvaluateGetREADONLY (dN,dO) = { |
---|
671 | | - | let aZ = addressFromStringValue(t(aT, U(dN))) |
---|
672 | | - | let bZ = invoke(aZ, "estimateGetOperationWrapperREADONLY", ["", dN, dO, toString(aZ)], nil) |
---|
673 | | - | let dP = { |
---|
674 | | - | let z = bZ |
---|
675 | | - | if (if (if ($isInstanceOf(z._1, "Int")) |
---|
676 | | - | then if ($isInstanceOf(z._2, "Int")) |
---|
677 | | - | then if ($isInstanceOf(z._5, "Int")) |
---|
678 | | - | then if ($isInstanceOf(z._6, "Int")) |
---|
679 | | - | then if ($isInstanceOf(z._7, "Int")) |
---|
680 | | - | then if ($isInstanceOf(z._8, "String")) |
---|
681 | | - | then $isInstanceOf(z._9, "String") |
---|
682 | | - | else false |
---|
683 | | - | else false |
---|
684 | | - | else false |
---|
685 | | - | else false |
---|
686 | | - | else false |
---|
687 | | - | else false) |
---|
688 | | - | then (size(z) == 10) |
---|
689 | | - | else false) |
---|
690 | | - | then { |
---|
691 | | - | let dQ = z._1 |
---|
692 | | - | let dR = z._2 |
---|
693 | | - | let dF = z._5 |
---|
694 | | - | let dG = z._6 |
---|
695 | | - | let dH = z._7 |
---|
696 | | - | let dj = z._8 |
---|
697 | | - | let dv = z._9 |
---|
698 | | - | $Tuple7(dQ, dR, dF, dG, dH, dj, dv) |
---|
699 | | - | } |
---|
700 | | - | else throw("Couldn't cast types") |
---|
701 | | - | } |
---|
702 | | - | let dQ = dP._1 |
---|
703 | | - | let dR = dP._2 |
---|
704 | | - | let dF = dP._3 |
---|
705 | | - | let dG = dP._4 |
---|
706 | | - | let dH = dP._5 |
---|
707 | | - | let dj = dP._6 |
---|
708 | | - | let dv = dP._7 |
---|
709 | | - | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(dQ), toString(dR), toString(dF), toString(dG), toString(dH), dj, dv], e)) |
---|
710 | | - | } |
---|
711 | | - | |
---|
712 | | - | |
---|
713 | | - | |
---|
714 | | - | @Callable(bB) |
---|
715 | | - | func gwxUserInfoREADONLY (am) = { |
---|
716 | | - | let dS = x(invoke(aX, "gwxUserInfoREADONLY", [am], nil)) |
---|
717 | | - | let dT = B(dS[0]) |
---|
718 | | - | $Tuple2(nil, makeString(["%d", toString(dT)], e)) |
---|
719 | | - | } |
---|
720 | | - | |
---|
721 | | - | |
---|
722 | | - | |
---|
723 | | - | @Callable(bB) |
---|
724 | | - | func unstakeAndGetOneTknV2 (aZ,dU,dV,dW) = { |
---|
725 | | - | let ca = invoke(addressFromStringValue(aZ), "unstakeAndGetOneTknV2", [dU, dV, dW], nil) |
---|
726 | | - | if ((ca == ca)) |
---|
727 | | - | then $Tuple2(nil, unit) |
---|
728 | | - | else throw("Strict value is not equal to itself.") |
---|
729 | | - | } |
---|
730 | | - | |
---|
731 | | - | |
---|
732 | | - | |
---|
733 | | - | @Callable(bB) |
---|
734 | | - | func getKeysBulkInternal (bN,dX,bT) = if ((bN == size(dX))) |
---|
735 | | - | then $Tuple2(nil, bT) |
---|
736 | | - | else { |
---|
737 | | - | let cp = split(dX[bN], "++") |
---|
738 | | - | let bv = addressFromStringValue(cp[0]) |
---|
739 | | - | let s = cp[1] |
---|
740 | | - | let bw = cp[2] |
---|
741 | | - | let y = bu(bv, s, bw) |
---|
742 | | - | let bZ = (bT :+ y) |
---|
743 | | - | let ca = invoke(this, "getKeysBulkInternal", [(bN + 1), dX, bZ], nil) |
---|
744 | | - | if ((ca == ca)) |
---|
745 | | - | then $Tuple2(nil, ca) |
---|
746 | | - | else throw("Strict value is not equal to itself.") |
---|
747 | | - | } |
---|
748 | | - | |
---|
749 | | - | |
---|
750 | | - | |
---|
751 | | - | @Callable(bB) |
---|
752 | | - | func getKeysBulk (dX) = { |
---|
753 | | - | let bZ = invoke(this, "getKeysBulkInternal", [0, dX, nil], nil) |
---|
754 | | - | $Tuple2(nil, bZ) |
---|
755 | | - | } |
---|
756 | | - | |
---|
757 | | - | |
---|
758 | | - | |
---|
759 | | - | @Callable(bB) |
---|
760 | | - | func setManager (dY) = { |
---|
761 | | - | let bF = bA(bB) |
---|
762 | | - | if ((bF == bF)) |
---|
763 | | - | then { |
---|
764 | | - | let dZ = fromBase58String(dY) |
---|
765 | | - | if ((dZ == dZ)) |
---|
766 | | - | then [StringEntry(H(), dY)] |
---|
767 | | - | else throw("Strict value is not equal to itself.") |
---|
768 | | - | } |
---|
769 | | - | else throw("Strict value is not equal to itself.") |
---|
770 | | - | } |
---|
771 | | - | |
---|
772 | | - | |
---|
773 | | - | |
---|
774 | | - | @Callable(bB) |
---|
775 | | - | func confirmManager () = { |
---|
776 | | - | let ea = bz() |
---|
777 | | - | let eb = if (isDefined(ea)) |
---|
778 | | - | then true |
---|
779 | | - | else throw("No pending manager") |
---|
780 | | - | if ((eb == eb)) |
---|
781 | | - | then { |
---|
782 | | - | let ec = if ((bB.callerPublicKey == value(ea))) |
---|
783 | | - | then true |
---|
784 | | - | else throw("You are not pending manager") |
---|
785 | | - | if ((ec == ec)) |
---|
786 | | - | then [StringEntry(G(), toBase58String(value(ea))), DeleteEntry(H())] |
---|
787 | | - | else throw("Strict value is not equal to itself.") |
---|
788 | | - | } |
---|
789 | | - | else throw("Strict value is not equal to itself.") |
---|
790 | | - | } |
---|
791 | | - | |
---|
792 | | - | |
---|
793 | | - | @Verifier(ed) |
---|
794 | | - | func ee () = { |
---|
795 | | - | let ef = { |
---|
796 | | - | let z = bx() |
---|
797 | | - | if ($isInstanceOf(z, "ByteVector")) |
---|
798 | | - | then { |
---|
799 | | - | let bD = z |
---|
800 | | - | bD |
---|
801 | | - | } |
---|
802 | | - | else if ($isInstanceOf(z, "Unit")) |
---|
803 | | - | then ed.senderPublicKey |
---|
804 | | - | else throw("Match error") |
---|
805 | | - | } |
---|
806 | | - | sigVerify(ed.bodyBytes, ed.proofs[0], ef) |
---|
807 | | - | } |
---|
808 | | - | |
---|
| 1 | + | # no script |
---|