8 | | - | let c = toBigInt(1000000000000000000) |
---|
9 | | - | |
---|
10 | | - | let d = toBigInt(0) |
---|
11 | | - | |
---|
12 | | - | let e = toBigInt(1) |
---|
13 | | - | |
---|
14 | | - | let f = toBigInt((a - ((a * 1) / a))) |
---|
15 | | - | |
---|
16 | | - | let g = "100" |
---|
17 | | - | |
---|
18 | | - | let h = "1" |
---|
19 | | - | |
---|
20 | | - | let i = "__" |
---|
21 | | - | |
---|
22 | | - | let j = "" |
---|
23 | | - | |
---|
24 | | - | let k = 1 |
---|
25 | | - | |
---|
26 | | - | let l = 2 |
---|
27 | | - | |
---|
28 | | - | let m = 3 |
---|
29 | | - | |
---|
30 | | - | let n = 4 |
---|
31 | | - | |
---|
32 | | - | let o = 1 |
---|
33 | | - | |
---|
34 | | - | let p = 2 |
---|
35 | | - | |
---|
36 | | - | let q = 3 |
---|
37 | | - | |
---|
38 | | - | let r = 4 |
---|
39 | | - | |
---|
40 | | - | let s = 5 |
---|
41 | | - | |
---|
42 | | - | let t = 6 |
---|
43 | | - | |
---|
44 | | - | let u = 7 |
---|
45 | | - | |
---|
46 | | - | let v = 8 |
---|
47 | | - | |
---|
48 | | - | let w = 9 |
---|
49 | | - | |
---|
50 | | - | let x = 1 |
---|
51 | | - | |
---|
52 | | - | let y = 7 |
---|
53 | | - | |
---|
54 | | - | let z = 10 |
---|
55 | | - | |
---|
56 | | - | let A = "%s__delay" |
---|
57 | | - | |
---|
58 | | - | func B (C,D) = fraction(toBigInt(C), c, toBigInt(D)) |
---|
59 | | - | |
---|
60 | | - | |
---|
61 | | - | func E (F,G) = toInt(fraction(F, toBigInt(G), c)) |
---|
62 | | - | |
---|
63 | | - | |
---|
64 | | - | func H (I,J,K) = fraction(I, J, K) |
---|
65 | | - | |
---|
66 | | - | |
---|
67 | | - | func L (F) = if ((d > F)) |
---|
68 | | - | then -(F) |
---|
69 | | - | else F |
---|
70 | | - | |
---|
71 | | - | |
---|
72 | | - | func M () = "%s__factoryContract" |
---|
73 | | - | |
---|
74 | | - | |
---|
75 | | - | func N () = "%s__managerPublicKey" |
---|
76 | | - | |
---|
77 | | - | |
---|
78 | | - | func O () = "%s__pendingManagerPublicKey" |
---|
79 | | - | |
---|
80 | | - | |
---|
81 | | - | func P () = "%s%s__price__last" |
---|
82 | | - | |
---|
83 | | - | |
---|
84 | | - | func Q (R,S) = makeString(["%s%s%d%d__price__history", toString(R), toString(S)], i) |
---|
85 | | - | |
---|
86 | | - | |
---|
87 | | - | func T (U,V) = ((("%s%s%s__P__" + U) + "__") + V) |
---|
88 | | - | |
---|
89 | | - | |
---|
90 | | - | func W (U,V) = ((("%s%s%s__G__" + U) + "__") + V) |
---|
91 | | - | |
---|
92 | | - | |
---|
93 | | - | func X () = "%s__amountAsset" |
---|
94 | | - | |
---|
95 | | - | |
---|
96 | | - | func Y () = "%s__priceAsset" |
---|
97 | | - | |
---|
98 | | - | |
---|
99 | | - | func Z () = "%s__amp" |
---|
100 | | - | |
---|
101 | | - | |
---|
102 | | - | func aa () = "%s__addonAddr" |
---|
103 | | - | |
---|
104 | | - | |
---|
105 | | - | func ab (ac) = makeString(["%s%s__lastGetOneTknCall", ac], i) |
---|
106 | | - | |
---|
107 | | - | |
---|
108 | | - | func ad (ac) = makeString(["%s%s__lastPutOneTknCall", ac], i) |
---|
109 | | - | |
---|
110 | | - | |
---|
111 | | - | func ae () = "%s__factoryConfig" |
---|
112 | | - | |
---|
113 | | - | |
---|
114 | | - | func af () = "%s%s__matcher__publicKey" |
---|
115 | | - | |
---|
116 | | - | |
---|
117 | | - | func ag (ah,ai) = (((("%d%d%s__" + ah) + "__") + ai) + "__config") |
---|
118 | | - | |
---|
119 | | - | |
---|
120 | | - | func aj (ak) = ("%s%s%s__mappings__baseAsset2internalId__" + ak) |
---|
121 | | - | |
---|
122 | | - | |
---|
123 | | - | func al () = "%s__shutdown" |
---|
124 | | - | |
---|
125 | | - | |
---|
126 | | - | func am () = "%s__allowedLpStableScriptHash" |
---|
127 | | - | |
---|
128 | | - | |
---|
129 | | - | func an (ao,ap,aq) = throw(((((("Failed: ordValid=" + toString(ao)) + " sndrValid=") + toString(ap)) + " mtchrValid=") + toString(aq))) |
---|
130 | | - | |
---|
131 | | - | |
---|
132 | | - | func ar (F) = { |
---|
133 | | - | let as = F |
---|
134 | | - | if ($isInstanceOf(as, "String")) |
---|
135 | | - | then { |
---|
136 | | - | let at = as |
---|
137 | | - | at |
---|
138 | | - | } |
---|
139 | | - | else throw("fail cast to String") |
---|
140 | | - | } |
---|
141 | | - | |
---|
142 | | - | |
---|
143 | | - | func au (av,aw) = valueOrErrorMessage(getString(av, aw), makeString(["mandatory ", toString(av), ".", aw, " not defined"], "")) |
---|
144 | | - | |
---|
145 | | - | |
---|
146 | | - | func ax (av,aw) = valueOrErrorMessage(getInteger(av, aw), makeString(["mandatory ", toString(av), ".", aw, " not defined"], "")) |
---|
147 | | - | |
---|
148 | | - | |
---|
149 | | - | let ay = addressFromStringValue(au(this, M())) |
---|
150 | | - | |
---|
151 | | - | let az = au(this, Z()) |
---|
152 | | - | |
---|
153 | | - | func aA () = valueOrElse(getBoolean(ay, al()), false) |
---|
154 | | - | |
---|
155 | | - | |
---|
156 | | - | func aB () = fromBase58String(au(ay, af())) |
---|
157 | | - | |
---|
158 | | - | |
---|
159 | | - | func aC () = { |
---|
160 | | - | let aD = au(this, X()) |
---|
161 | | - | let aE = au(this, Y()) |
---|
162 | | - | let aF = ax(ay, aj(aE)) |
---|
163 | | - | let ah = ax(ay, aj(aD)) |
---|
164 | | - | split(au(ay, ag(toString(ah), toString(aF))), i) |
---|
165 | | - | } |
---|
166 | | - | |
---|
167 | | - | |
---|
168 | | - | func aG () = split(au(ay, ae()), i) |
---|
169 | | - | |
---|
170 | | - | |
---|
171 | | - | func aH (aI,aJ,aK,aL,aM,aN,aO,aP,aQ,aR) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(aI), toString(aJ), toString(aK), toString(aL), toString(aM), toString(aN), toString(aO), toString(aP), toString(aQ), toString(aR)], i) |
---|
172 | | - | |
---|
173 | | - | |
---|
174 | | - | func aS (aT,aU,aV,aL,aO,aP) = makeString(["%d%d%d%d%d%d", toString(aT), toString(aU), toString(aV), toString(aL), toString(aO), toString(aP)], i) |
---|
175 | | - | |
---|
176 | | - | |
---|
177 | | - | func aW (aX) = if ((aX == "WAVES")) |
---|
178 | | - | then wavesBalance(this).available |
---|
179 | | - | else assetBalance(this, fromBase58String(aX)) |
---|
180 | | - | |
---|
181 | | - | |
---|
182 | | - | func aY (aZ,ba) = fraction(aZ, c, ba) |
---|
183 | | - | |
---|
184 | | - | |
---|
185 | | - | func bb (bc,bd,be) = { |
---|
186 | | - | let bf = fraction((bc - bd), b, bd) |
---|
187 | | - | let bg = ((be - L(bf)) > d) |
---|
188 | | - | if (!(bg)) |
---|
189 | | - | then throw(("Big slpg: " + toString(bf))) |
---|
190 | | - | else $Tuple2(bg, min([bc, bd])) |
---|
191 | | - | } |
---|
192 | | - | |
---|
193 | | - | |
---|
194 | | - | func bh (bi,bj,bk) = { |
---|
195 | | - | let bf = fraction(bj, b, bi) |
---|
196 | | - | let bl = (bk > bf) |
---|
197 | | - | if (if (bl) |
---|
198 | | - | then true |
---|
199 | | - | else (bj > bi)) |
---|
200 | | - | then throw(((((((toString(bj) + " ") + toString(bi)) + " ") + toString(bf)) + " ") + toString(bk))) |
---|
201 | | - | else bl |
---|
202 | | - | } |
---|
203 | | - | |
---|
204 | | - | |
---|
205 | | - | func bm (bn,bo,bp,bq) = { |
---|
206 | | - | let br = B(bp, bn) |
---|
207 | | - | let bs = B(bq, bo) |
---|
208 | | - | aY(bs, br) |
---|
209 | | - | } |
---|
210 | | - | |
---|
211 | | - | |
---|
212 | | - | func bt (bp,bq,bu) = { |
---|
213 | | - | let bv = aC() |
---|
214 | | - | let bw = parseIntValue(bv[t]) |
---|
215 | | - | let bx = parseIntValue(bv[u]) |
---|
216 | | - | let by = bm(bw, bx, bp, bq) |
---|
217 | | - | let ba = B(bp, bw) |
---|
218 | | - | let aZ = B(bq, bx) |
---|
219 | | - | let bz = B(bu, a) |
---|
220 | | - | let bA = aY(ba, bz) |
---|
221 | | - | let bB = aY(aZ, bz) |
---|
222 | | - | [by, bA, bB] |
---|
223 | | - | } |
---|
224 | | - | |
---|
225 | | - | |
---|
226 | | - | func bC (bp,bq,bu) = { |
---|
227 | | - | let bD = bt(bp, bq, bu) |
---|
228 | | - | [E(bD[0], a), E(bD[1], a), E(bD[2], a)] |
---|
229 | | - | } |
---|
230 | | - | |
---|
231 | | - | |
---|
232 | | - | func bE (bF,bG,bH,bI) = { |
---|
233 | | - | let bv = aC() |
---|
234 | | - | let bJ = bv[q] |
---|
235 | | - | let bK = bv[r] |
---|
236 | | - | let bL = bv[s] |
---|
237 | | - | let bM = parseIntValue(bv[t]) |
---|
238 | | - | let bN = parseIntValue(bv[u]) |
---|
239 | | - | let bO = bv[p] |
---|
240 | | - | let bP = valueOrErrorMessage(assetInfo(fromBase58String(bJ)), "Wrong LP id").quantity |
---|
241 | | - | if ((bJ != bG)) |
---|
242 | | - | then throw("Wrong pmt asset") |
---|
243 | | - | else { |
---|
244 | | - | let bQ = aW(bK) |
---|
245 | | - | let bR = B(bQ, bM) |
---|
246 | | - | let bS = aW(bL) |
---|
247 | | - | let bT = B(bS, bN) |
---|
248 | | - | let bU = aY(bT, bR) |
---|
249 | | - | let bV = E(bU, a) |
---|
250 | | - | let bW = B(bH, a) |
---|
251 | | - | let bX = B(bP, a) |
---|
252 | | - | let bY = fraction(bR, bW, bX) |
---|
253 | | - | let bZ = fraction(bT, bW, bX) |
---|
254 | | - | let ca = E(bY, bM) |
---|
255 | | - | let cb = E(bZ, bN) |
---|
256 | | - | let cc = if ((bF == "")) |
---|
257 | | - | then nil |
---|
258 | | - | else [ScriptTransfer(bI, ca, if ((bK == "WAVES")) |
---|
259 | | - | then unit |
---|
260 | | - | else fromBase58String(bK)), ScriptTransfer(bI, cb, if ((bL == "WAVES")) |
---|
261 | | - | then unit |
---|
262 | | - | else fromBase58String(bL)), StringEntry(W(toString(bI), bF), aS(ca, cb, bH, bV, height, lastBlock.timestamp)), IntegerEntry(P(), bV), IntegerEntry(Q(height, lastBlock.timestamp), bV)] |
---|
263 | | - | $Tuple10(ca, cb, bK, bL, bQ, bS, bP, bU, bO, cc) |
---|
264 | | - | } |
---|
265 | | - | } |
---|
266 | | - | |
---|
267 | | - | |
---|
268 | | - | func cd (bF,be,ce,cf,cg,ch,bI,ci,cj,ck,cl,cm) = { |
---|
269 | | - | let bv = aC() |
---|
270 | | - | let bJ = fromBase58String(bv[q]) |
---|
271 | | - | let cn = bv[r] |
---|
272 | | - | let co = bv[s] |
---|
273 | | - | let cp = bv[v] |
---|
274 | | - | let cq = bv[w] |
---|
275 | | - | let cr = parseIntValue(bv[t]) |
---|
276 | | - | let cs = parseIntValue(bv[u]) |
---|
277 | | - | let bO = bv[p] |
---|
278 | | - | let ct = valueOrErrorMessage(assetInfo(bJ), "Wr lp as").quantity |
---|
279 | | - | let bQ = if (ci) |
---|
280 | | - | then aW(cn) |
---|
281 | | - | else if (if (ck) |
---|
282 | | - | then (cm == cn) |
---|
283 | | - | else false) |
---|
284 | | - | then (aW(cn) - cl) |
---|
285 | | - | else if (ck) |
---|
286 | | - | then aW(cn) |
---|
287 | | - | else (aW(cn) - ce) |
---|
288 | | - | let bS = if (ci) |
---|
289 | | - | then aW(co) |
---|
290 | | - | else if (if (ck) |
---|
291 | | - | then (cm == co) |
---|
292 | | - | else false) |
---|
293 | | - | then (aW(co) - cl) |
---|
294 | | - | else if (ck) |
---|
295 | | - | then aW(co) |
---|
296 | | - | else (aW(co) - cg) |
---|
297 | | - | let cu = B(ce, cr) |
---|
298 | | - | let cv = B(cg, cs) |
---|
299 | | - | let cw = aY(cv, cu) |
---|
300 | | - | let bR = B(bQ, cr) |
---|
301 | | - | let bT = B(bS, cs) |
---|
302 | | - | let cx = if ((ct == 0)) |
---|
303 | | - | then { |
---|
304 | | - | let bU = d |
---|
305 | | - | let cy = d |
---|
306 | | - | let bz = pow((cu * cv), 0, toBigInt(5), 1, 0, DOWN) |
---|
307 | | - | $Tuple5(E(bz, a), E(cu, cr), E(cv, cs), aY((bT + cv), (bR + cu)), cy) |
---|
308 | | - | } |
---|
309 | | - | else { |
---|
310 | | - | let bU = aY(bT, bR) |
---|
311 | | - | let cz = fraction(L((bU - cw)), c, bU) |
---|
312 | | - | let cy = B(be, a) |
---|
313 | | - | if (if ((bU != d)) |
---|
314 | | - | then (cz > cy) |
---|
315 | | - | else false) |
---|
316 | | - | then throw(((("Price slippage " + toString(cz)) + " > ") + toString(cy))) |
---|
317 | | - | else { |
---|
318 | | - | let cA = B(ct, a) |
---|
319 | | - | let cB = fraction(cu, bU, c) |
---|
320 | | - | let cC = fraction(cv, c, bU) |
---|
321 | | - | let cD = if ((cB > cv)) |
---|
322 | | - | then $Tuple2(cC, cv) |
---|
323 | | - | else $Tuple2(cu, cB) |
---|
324 | | - | let cE = cD._1 |
---|
325 | | - | let cF = cD._2 |
---|
326 | | - | let bz = fraction(cA, cF, bT) |
---|
327 | | - | $Tuple5(E(bz, a), E(cE, cr), E(cF, cs), bU, cy) |
---|
328 | | - | } |
---|
329 | | - | } |
---|
330 | | - | let cG = cx._1 |
---|
331 | | - | let cH = cx._2 |
---|
332 | | - | let cI = cx._3 |
---|
333 | | - | let bV = E(cx._4, a) |
---|
334 | | - | let cJ = E(cx._5, a) |
---|
335 | | - | if ((0 >= cG)) |
---|
336 | | - | then throw("LP <= 0") |
---|
337 | | - | else { |
---|
338 | | - | let cK = if (!(cj)) |
---|
339 | | - | then 0 |
---|
340 | | - | else cG |
---|
341 | | - | let cL = (ce - cH) |
---|
342 | | - | let cM = (cg - cI) |
---|
343 | | - | let cN = if (if (ck) |
---|
344 | | - | then (cm == cn) |
---|
345 | | - | else false) |
---|
346 | | - | then $Tuple2(cl, 0) |
---|
347 | | - | else if (if (ck) |
---|
348 | | - | then (cm == co) |
---|
349 | | - | else false) |
---|
350 | | - | then $Tuple2(0, cl) |
---|
351 | | - | else $Tuple2(cH, cI) |
---|
352 | | - | let cO = cN._1 |
---|
353 | | - | let cP = cN._2 |
---|
354 | | - | let cQ = [IntegerEntry(P(), bV), IntegerEntry(Q(height, lastBlock.timestamp), bV), StringEntry(T(bI, bF), aH(cO, cP, cK, bV, be, cJ, height, lastBlock.timestamp, cL, cM))] |
---|
355 | | - | $Tuple13(cG, cK, bV, bQ, bS, ct, bJ, bO, cQ, cL, cM, cf, ch) |
---|
356 | | - | } |
---|
357 | | - | } |
---|
358 | | - | |
---|
359 | | - | |
---|
360 | | - | func cR (cS) = { |
---|
361 | | - | let bv = aC() |
---|
362 | | - | let cT = bv[r] |
---|
363 | | - | let cU = bv[s] |
---|
364 | | - | let bO = parseIntValue(bv[p]) |
---|
365 | | - | let bw = parseIntValue(bv[t]) |
---|
366 | | - | let bx = parseIntValue(bv[u]) |
---|
367 | | - | let cV = aW(cT) |
---|
368 | | - | let cW = aW(cU) |
---|
369 | | - | let bU = if ((cS.orderType == Buy)) |
---|
370 | | - | then bm(bw, bx, (cV + cS.amount), cW) |
---|
371 | | - | else bm(bw, bx, (cV - cS.amount), cW) |
---|
372 | | - | let bV = E(bU, a) |
---|
373 | | - | if (if (if (aA()) |
---|
374 | | - | then true |
---|
375 | | - | else (bO == m)) |
---|
376 | | - | then true |
---|
377 | | - | else (bO == n)) |
---|
378 | | - | then throw("Admin blocked") |
---|
379 | | - | else { |
---|
380 | | - | let cX = cS.assetPair.amountAsset |
---|
381 | | - | let cY = if ((cX == unit)) |
---|
382 | | - | then "WAVES" |
---|
383 | | - | else toBase58String(value(cX)) |
---|
384 | | - | let cZ = cS.assetPair.priceAsset |
---|
385 | | - | let da = if ((cZ == unit)) |
---|
386 | | - | then "WAVES" |
---|
387 | | - | else toBase58String(value(cZ)) |
---|
388 | | - | if (if ((cY != cT)) |
---|
389 | | - | then true |
---|
390 | | - | else (da != cU)) |
---|
391 | | - | then throw("Wr assets") |
---|
392 | | - | else { |
---|
393 | | - | let db = cS.price |
---|
394 | | - | let cs = fraction(a, bx, bw) |
---|
395 | | - | let dc = H(db, a, cs) |
---|
396 | | - | let dd = if ((cS.orderType == Buy)) |
---|
397 | | - | then (bV >= dc) |
---|
398 | | - | else (dc >= bV) |
---|
399 | | - | true |
---|
400 | | - | } |
---|
401 | | - | } |
---|
402 | | - | } |
---|
403 | | - | |
---|
404 | | - | |
---|
405 | | - | func de (df) = if ((size(df.payments) != 1)) |
---|
406 | | - | then throw("1 pmnt exp") |
---|
407 | | - | else { |
---|
408 | | - | let dg = value(df.payments[0]) |
---|
409 | | - | let bG = value(dg.assetId) |
---|
410 | | - | let cl = dg.amount |
---|
411 | | - | let cx = bE(toBase58String(df.transactionId), toBase58String(bG), cl, df.caller) |
---|
412 | | - | let ca = cx._1 |
---|
413 | | - | let cb = cx._2 |
---|
414 | | - | let bO = parseIntValue(cx._9) |
---|
415 | | - | let cc = cx._10 |
---|
416 | | - | if (if (aA()) |
---|
417 | | - | then true |
---|
418 | | - | else (bO == n)) |
---|
419 | | - | then throw(("Admin blocked: " + toString(bO))) |
---|
420 | | - | else $Tuple5(ca, cb, cl, bG, cc) |
---|
421 | | - | } |
---|
422 | | - | |
---|
423 | | - | |
---|
424 | | - | func dh (ac,V,di,dj,be,cj,ck,cl,cm) = { |
---|
425 | | - | let cx = cd(V, be, value(di).amount, value(di).assetId, value(dj).amount, value(dj).assetId, ac, false, cj, ck, cl, cm) |
---|
426 | | - | let bO = parseIntValue(cx._8) |
---|
427 | | - | if (if (if (aA()) |
---|
428 | | - | then true |
---|
429 | | - | else (bO == l)) |
---|
430 | | - | then true |
---|
431 | | - | else (bO == n)) |
---|
432 | | - | then throw(("Blocked:" + toString(bO))) |
---|
433 | | - | else cx |
---|
434 | | - | } |
---|
435 | | - | |
---|
436 | | - | |
---|
437 | | - | func dk () = { |
---|
438 | | - | let as = getString(N()) |
---|
439 | | - | if ($isInstanceOf(as, "String")) |
---|
440 | | - | then { |
---|
441 | | - | let dl = as |
---|
442 | | - | fromBase58String(dl) |
---|
443 | | - | } |
---|
444 | | - | else if ($isInstanceOf(as, "Unit")) |
---|
445 | | - | then unit |
---|
446 | | - | else throw("Match error") |
---|
447 | | - | } |
---|
448 | | - | |
---|
449 | | - | |
---|
450 | | - | func dm () = { |
---|
451 | | - | let as = getString(O()) |
---|
452 | | - | if ($isInstanceOf(as, "String")) |
---|
453 | | - | then { |
---|
454 | | - | let dl = as |
---|
455 | | - | fromBase58String(dl) |
---|
456 | | - | } |
---|
457 | | - | else if ($isInstanceOf(as, "Unit")) |
---|
458 | | - | then unit |
---|
459 | | - | else throw("Match error") |
---|
460 | | - | } |
---|
461 | | - | |
---|
462 | | - | |
---|
463 | | - | let dn = throw("Permission denied") |
---|
464 | | - | |
---|
465 | | - | func do (df) = { |
---|
466 | | - | let as = dk() |
---|
467 | | - | if ($isInstanceOf(as, "ByteVector")) |
---|
468 | | - | then { |
---|
469 | | - | let dp = as |
---|
470 | | - | if ((df.callerPublicKey == dp)) |
---|
471 | | - | then true |
---|
472 | | - | else dn |
---|
473 | | - | } |
---|
474 | | - | else if ($isInstanceOf(as, "Unit")) |
---|
475 | | - | then if ((df.caller == this)) |
---|
476 | | - | then true |
---|
477 | | - | else dn |
---|
478 | | - | else throw("Match error") |
---|
479 | | - | } |
---|
480 | | - | |
---|
481 | | - | |
---|
482 | | - | @Callable(df) |
---|
483 | | - | func constructor (M) = { |
---|
484 | | - | let dq = do(df) |
---|
485 | | - | if ((dq == dq)) |
---|
486 | | - | then [StringEntry(M(), M)] |
---|
487 | | - | else throw("Strict value is not equal to itself.") |
---|
488 | | - | } |
---|
489 | | - | |
---|
490 | | - | |
---|
491 | | - | |
---|
492 | | - | @Callable(df) |
---|
493 | | - | func setManager (dr) = { |
---|
494 | | - | let dq = do(df) |
---|
495 | | - | if ((dq == dq)) |
---|
496 | | - | then { |
---|
497 | | - | let ds = fromBase58String(dr) |
---|
498 | | - | if ((ds == ds)) |
---|
499 | | - | then [StringEntry(O(), dr)] |
---|
500 | | - | else throw("Strict value is not equal to itself.") |
---|
501 | | - | } |
---|
502 | | - | else throw("Strict value is not equal to itself.") |
---|
503 | | - | } |
---|
504 | | - | |
---|
505 | | - | |
---|
506 | | - | |
---|
507 | | - | @Callable(df) |
---|
508 | | - | func confirmManager () = { |
---|
509 | | - | let bD = dm() |
---|
510 | | - | let dt = if (isDefined(bD)) |
---|
511 | | - | then true |
---|
512 | | - | else throw("No pending manager") |
---|
513 | | - | if ((dt == dt)) |
---|
514 | | - | then { |
---|
515 | | - | let du = if ((df.callerPublicKey == value(bD))) |
---|
516 | | - | then true |
---|
517 | | - | else throw("You are not pending manager") |
---|
518 | | - | if ((du == du)) |
---|
519 | | - | then [StringEntry(N(), toBase58String(value(bD))), DeleteEntry(O())] |
---|
520 | | - | else throw("Strict value is not equal to itself.") |
---|
521 | | - | } |
---|
522 | | - | else throw("Strict value is not equal to itself.") |
---|
523 | | - | } |
---|
524 | | - | |
---|
525 | | - | |
---|
526 | | - | |
---|
527 | | - | @Callable(df) |
---|
528 | | - | func put (dv,dw) = { |
---|
529 | | - | let dx = aG() |
---|
530 | | - | let dy = valueOrErrorMessage(addressFromString(dx[x]), "Wr st addr") |
---|
531 | | - | let dz = valueOrErrorMessage(addressFromString(dx[y]), "Wr sl addr") |
---|
532 | | - | if ((0 > dv)) |
---|
533 | | - | then throw("Wrong slippage") |
---|
534 | | - | else if ((size(df.payments) != 2)) |
---|
535 | | - | then throw("2 pmnts expd") |
---|
536 | | - | else { |
---|
537 | | - | let dA = dh(toString(df.caller), toBase58String(df.transactionId), AttachedPayment(value(df.payments[0]).assetId, value(df.payments[0]).amount), df.payments[1], dv, true, false, 0, "") |
---|
538 | | - | let cK = dA._2 |
---|
539 | | - | let dB = dA._7 |
---|
540 | | - | let cc = dA._9 |
---|
541 | | - | let cL = dA._10 |
---|
542 | | - | let cM = dA._11 |
---|
543 | | - | let bK = dA._12 |
---|
544 | | - | let bL = dA._13 |
---|
545 | | - | let cx = invoke(ay, "emit", [cK], nil) |
---|
546 | | - | if ((cx == cx)) |
---|
547 | | - | then { |
---|
548 | | - | let dC = { |
---|
549 | | - | let as = cx |
---|
550 | | - | if ($isInstanceOf(as, "Address")) |
---|
551 | | - | then { |
---|
552 | | - | let dD = as |
---|
553 | | - | invoke(dD, "emit", [cK], nil) |
---|
554 | | - | } |
---|
555 | | - | else unit |
---|
556 | | - | } |
---|
557 | | - | if ((dC == dC)) |
---|
558 | | - | then { |
---|
559 | | - | let dE = if ((cL > 0)) |
---|
560 | | - | then invoke(dz, "put", nil, [AttachedPayment(bK, cL)]) |
---|
561 | | - | else nil |
---|
562 | | - | if ((dE == dE)) |
---|
563 | | - | then { |
---|
564 | | - | let dF = if ((cM > 0)) |
---|
565 | | - | then invoke(dz, "put", nil, [AttachedPayment(bL, cM)]) |
---|
566 | | - | else nil |
---|
567 | | - | if ((dF == dF)) |
---|
568 | | - | then { |
---|
569 | | - | let dG = if (dw) |
---|
570 | | - | then { |
---|
571 | | - | let dH = invoke(dy, "stake", nil, [AttachedPayment(dB, cK)]) |
---|
572 | | - | if ((dH == dH)) |
---|
573 | | - | then nil |
---|
574 | | - | else throw("Strict value is not equal to itself.") |
---|
575 | | - | } |
---|
576 | | - | else [ScriptTransfer(df.caller, cK, dB)] |
---|
577 | | - | (cc ++ dG) |
---|
578 | | - | } |
---|
579 | | - | else throw("Strict value is not equal to itself.") |
---|
580 | | - | } |
---|
581 | | - | else throw("Strict value is not equal to itself.") |
---|
582 | | - | } |
---|
583 | | - | else throw("Strict value is not equal to itself.") |
---|
584 | | - | } |
---|
585 | | - | else throw("Strict value is not equal to itself.") |
---|
586 | | - | } |
---|
587 | | - | } |
---|
588 | | - | |
---|
589 | | - | |
---|
590 | | - | |
---|
591 | | - | @Callable(df) |
---|
592 | | - | func putOneTkn (dI,dJ,dK,be,dw) = { |
---|
593 | | - | let bv = aG() |
---|
594 | | - | let dy = valueOrErrorMessage(addressFromString(bv[x]), "Wr st addr") |
---|
595 | | - | let dz = valueOrErrorMessage(addressFromString(bv[y]), "Wr sl addr") |
---|
596 | | - | let dL = valueOrErrorMessage(addressFromString(bv[z]), "Wr gwx addr") |
---|
597 | | - | let dM = aC() |
---|
598 | | - | let bK = dM[r] |
---|
599 | | - | let bL = dM[s] |
---|
600 | | - | let bM = parseIntValue(dM[t]) |
---|
601 | | - | let bN = parseIntValue(dM[u]) |
---|
602 | | - | let dN = valueOrElse(getString(this, aa()), "") |
---|
603 | | - | let bI = if ((dN == toString(df.caller))) |
---|
604 | | - | then df.originCaller |
---|
605 | | - | else df.caller |
---|
606 | | - | let dO = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(aa()), "no addons")), "addon address in not valid") |
---|
607 | | - | let dP = reentrantInvoke(dO, "ensureCanPutOneTkn", [toString(bI)], nil) |
---|
608 | | - | if ((dP == dP)) |
---|
609 | | - | then if (if (if (if ((0 >= be)) |
---|
610 | | - | then true |
---|
611 | | - | else (0 >= dI)) |
---|
612 | | - | then true |
---|
613 | | - | else (0 >= dJ)) |
---|
614 | | - | then true |
---|
615 | | - | else (0 >= dK)) |
---|
616 | | - | then throw("Wrong params") |
---|
617 | | - | else if ((size(df.payments) != 1)) |
---|
618 | | - | then throw("1 pmnt expd") |
---|
619 | | - | else { |
---|
620 | | - | let dg = value(df.payments[0]) |
---|
621 | | - | let bG = toBase58String(value(dg.assetId)) |
---|
622 | | - | let cl = dg.amount |
---|
623 | | - | if ((10000000 > cl)) |
---|
624 | | - | then throw("Wrong pmt amt") |
---|
625 | | - | else { |
---|
626 | | - | let bQ = aW(bK) |
---|
627 | | - | let bS = aW(bL) |
---|
628 | | - | let dQ = if ((bG == bK)) |
---|
629 | | - | then if (if ((cl > bQ)) |
---|
630 | | - | then true |
---|
631 | | - | else (dI > cl)) |
---|
632 | | - | then throw("invalid payment amount") |
---|
633 | | - | else $Tuple6((bQ - cl), bS, (cl - dI), dJ, 0, 0) |
---|
634 | | - | else if ((bG == bL)) |
---|
635 | | - | then if (if ((cl > bS)) |
---|
636 | | - | then true |
---|
637 | | - | else (dJ > cl)) |
---|
638 | | - | then throw("invalid payment amount") |
---|
639 | | - | else $Tuple6(bQ, (bS - cl), 0, 0, (cl - dJ), dI) |
---|
640 | | - | else throw("wrong pmtAssetId") |
---|
641 | | - | let dR = dQ._1 |
---|
642 | | - | let dS = dQ._2 |
---|
643 | | - | let dT = dQ._3 |
---|
644 | | - | let dU = dQ._4 |
---|
645 | | - | let dV = dQ._5 |
---|
646 | | - | let dW = dQ._6 |
---|
647 | | - | let bj = invoke(dL, "calcD", [toString(dR), toString(dS), az, g, h], nil) |
---|
648 | | - | let bi = invoke(dL, "calcD", [toString(toBigInt(((dR + dT) - dW))), toString(toBigInt(((dS + dV) - dU))), az, g, h], nil) |
---|
649 | | - | let dX = bh(parseBigIntValue(ar(bi)), parseBigIntValue(ar(bj)), f) |
---|
650 | | - | if ((dX == dX)) |
---|
651 | | - | then { |
---|
652 | | - | let dY = dh(toString(df.caller), toBase58String(df.transactionId), AttachedPayment(fromBase58String(bK), dI), AttachedPayment(fromBase58String(bL), dJ), be, true, true, cl, bG) |
---|
653 | | - | let dZ = dY._2 |
---|
654 | | - | let dB = dY._7 |
---|
655 | | - | let cc = dY._9 |
---|
656 | | - | let cL = dY._10 |
---|
657 | | - | let cM = dY._11 |
---|
658 | | - | let ea = bb(toBigInt(dZ), toBigInt(dK), toBigInt(be)) |
---|
659 | | - | let cK = toInt(ea._2) |
---|
660 | | - | let dA = invoke(ay, "emit", [cK], nil) |
---|
661 | | - | if ((dA == dA)) |
---|
662 | | - | then { |
---|
663 | | - | let dC = { |
---|
664 | | - | let as = dA |
---|
665 | | - | if ($isInstanceOf(as, "Address")) |
---|
666 | | - | then { |
---|
667 | | - | let dD = as |
---|
668 | | - | invoke(dD, "emit", [cK], nil) |
---|
669 | | - | } |
---|
670 | | - | else unit |
---|
671 | | - | } |
---|
672 | | - | if ((dC == dC)) |
---|
673 | | - | then { |
---|
674 | | - | let dE = if ((cL > 0)) |
---|
675 | | - | then invoke(dz, "put", nil, [AttachedPayment(fromBase58String(bK), cL)]) |
---|
676 | | - | else nil |
---|
677 | | - | if ((dE == dE)) |
---|
678 | | - | then { |
---|
679 | | - | let dF = if ((cM > 0)) |
---|
680 | | - | then invoke(dz, "put", nil, [AttachedPayment(fromBase58String(bL), cM)]) |
---|
681 | | - | else nil |
---|
682 | | - | if ((dF == dF)) |
---|
683 | | - | then { |
---|
684 | | - | let dG = if (dw) |
---|
685 | | - | then { |
---|
686 | | - | let dH = invoke(dy, "stake", nil, [AttachedPayment(dB, cK)]) |
---|
687 | | - | if ((dH == dH)) |
---|
688 | | - | then nil |
---|
689 | | - | else throw("Strict value is not equal to itself.") |
---|
690 | | - | } |
---|
691 | | - | else [ScriptTransfer(df.caller, cK, dB)] |
---|
692 | | - | (cc ++ dG) |
---|
693 | | - | } |
---|
694 | | - | else throw("Strict value is not equal to itself.") |
---|
695 | | - | } |
---|
696 | | - | else throw("Strict value is not equal to itself.") |
---|
697 | | - | } |
---|
698 | | - | else throw("Strict value is not equal to itself.") |
---|
699 | | - | } |
---|
700 | | - | else throw("Strict value is not equal to itself.") |
---|
701 | | - | } |
---|
702 | | - | else throw("Strict value is not equal to itself.") |
---|
703 | | - | } |
---|
704 | | - | } |
---|
705 | | - | else throw("Strict value is not equal to itself.") |
---|
706 | | - | } |
---|
707 | | - | |
---|
708 | | - | |
---|
709 | | - | |
---|
710 | | - | @Callable(df) |
---|
711 | | - | func putForFree (eb) = if ((0 > eb)) |
---|
712 | | - | then throw("Wrong slpg") |
---|
713 | | - | else if ((size(df.payments) != 2)) |
---|
714 | | - | then throw("2 pmnts expd") |
---|
715 | | - | else { |
---|
716 | | - | let dY = dh(toString(df.caller), toBase58String(df.transactionId), AttachedPayment(value(df.payments[0]).assetId, value(df.payments[0]).amount), df.payments[1], eb, false, false, 0, "") |
---|
717 | | - | dY._9 |
---|
718 | | - | } |
---|
719 | | - | |
---|
720 | | - | |
---|
721 | | - | |
---|
722 | | - | @Callable(df) |
---|
723 | | - | func get () = { |
---|
724 | | - | let cx = de(df) |
---|
725 | | - | let ec = cx._1 |
---|
726 | | - | let cb = cx._2 |
---|
727 | | - | let cl = cx._3 |
---|
728 | | - | let bG = cx._4 |
---|
729 | | - | let cc = cx._5 |
---|
730 | | - | let ed = invoke(ay, "burn", [cl], [AttachedPayment(bG, cl)]) |
---|
731 | | - | if ((ed == ed)) |
---|
732 | | - | then cc |
---|
733 | | - | else throw("Strict value is not equal to itself.") |
---|
734 | | - | } |
---|
735 | | - | |
---|
736 | | - | |
---|
737 | | - | |
---|
738 | | - | @Callable(df) |
---|
739 | | - | func getOneTkn (ee,ef,eg,eh,be) = if ((size(df.payments) != 1)) |
---|
740 | | - | then throw("1 pmnt expd") |
---|
741 | | - | else { |
---|
742 | | - | let bv = aC() |
---|
743 | | - | let bJ = bv[q] |
---|
744 | | - | let bK = bv[r] |
---|
745 | | - | let bL = bv[s] |
---|
746 | | - | let bM = parseIntValue(bv[t]) |
---|
747 | | - | let bN = parseIntValue(bv[u]) |
---|
748 | | - | let bO = bv[p] |
---|
749 | | - | let dx = aG() |
---|
750 | | - | let dL = valueOrErrorMessage(addressFromString(dx[z]), "Wr sl addr") |
---|
751 | | - | let dg = value(df.payments[0]) |
---|
752 | | - | let dN = valueOrElse(getString(this, aa()), "") |
---|
753 | | - | let bI = if ((dN == toString(df.caller))) |
---|
754 | | - | then df.originCaller |
---|
755 | | - | else df.caller |
---|
756 | | - | let bF = toBase58String(df.transactionId) |
---|
757 | | - | let bG = value(dg.assetId) |
---|
758 | | - | let cl = dg.amount |
---|
759 | | - | let dO = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(aa()), "no addons")), "addon address in not valid") |
---|
760 | | - | let dP = reentrantInvoke(dO, "ensureCanGetOneTkn", [toString(bI)], nil) |
---|
761 | | - | if ((dP == dP)) |
---|
762 | | - | then if ((1000000000 > cl)) |
---|
763 | | - | then throw("Min pmt 10 LP") |
---|
764 | | - | else if (if (if ((0 > be)) |
---|
765 | | - | then true |
---|
766 | | - | else (0 > ee)) |
---|
767 | | - | then true |
---|
768 | | - | else (0 > eg)) |
---|
769 | | - | then throw("Wrong params") |
---|
770 | | - | else if ((bJ != toBase58String(bG))) |
---|
771 | | - | then throw("Wrong LP") |
---|
772 | | - | else { |
---|
773 | | - | let cx = bE(toBase58String(df.transactionId), toBase58String(bG), cl, df.caller) |
---|
774 | | - | let ei = cx._1 |
---|
775 | | - | let ej = cx._2 |
---|
776 | | - | let bQ = aW(bK) |
---|
777 | | - | let bS = aW(bL) |
---|
778 | | - | let ek = if ((eh == bK)) |
---|
779 | | - | then $Tuple7((bQ - ei), (bS - ej), ee, ej, 0, 0, (ei + ee)) |
---|
780 | | - | else if ((eh == bL)) |
---|
781 | | - | then $Tuple7((bQ - ei), (bS - ej), 0, 0, ee, ei, (ej + ee)) |
---|
782 | | - | else throw("wrong outAssetId") |
---|
783 | | - | let dR = ek._1 |
---|
784 | | - | let dS = ek._2 |
---|
785 | | - | let dT = ek._3 |
---|
786 | | - | let dU = ek._4 |
---|
787 | | - | let dV = ek._5 |
---|
788 | | - | let dW = ek._6 |
---|
789 | | - | let el = ek._7 |
---|
790 | | - | if (if ((0 > dT)) |
---|
791 | | - | then true |
---|
792 | | - | else (0 > dV)) |
---|
793 | | - | then throw("Wrong calc") |
---|
794 | | - | else { |
---|
795 | | - | let bj = invoke(dL, "calcD", [toString(dR), toString(dS), az, g, h], nil) |
---|
796 | | - | let bi = invoke(dL, "calcD", [toString(((dR - dT) + dW)), toString(((dS + dU) - dV)), az, g, h], nil) |
---|
797 | | - | let dX = bh(parseBigIntValue(ar(bi)), parseBigIntValue(ar(bj)), f) |
---|
798 | | - | if ((dX == dX)) |
---|
799 | | - | then { |
---|
800 | | - | let em = bb(toBigInt(el), toBigInt(eg), toBigInt(be)) |
---|
801 | | - | if ((em == em)) |
---|
802 | | - | then { |
---|
803 | | - | let en = if ((eh == bK)) |
---|
804 | | - | then $Tuple2(toInt(em._2), 0) |
---|
805 | | - | else $Tuple2(0, toInt(em._2)) |
---|
806 | | - | let eo = en._1 |
---|
807 | | - | let ep = en._2 |
---|
808 | | - | let eq = aY(B(bS, bN), B(bQ, bM)) |
---|
809 | | - | let er = E(eq, a) |
---|
810 | | - | let cc = [ScriptTransfer(bI, (eo + ep), if ((eh == "WAVES")) |
---|
811 | | - | then unit |
---|
812 | | - | else fromBase58String(eh)), StringEntry(W(toString(bI), bF), aS(eo, ep, cl, er, height, lastBlock.timestamp)), IntegerEntry(P(), er), IntegerEntry(Q(height, lastBlock.timestamp), er)] |
---|
813 | | - | if ((cc == cc)) |
---|
814 | | - | then { |
---|
815 | | - | let es = invoke(ay, "burn", [cl], [AttachedPayment(bG, cl)]) |
---|
816 | | - | if ((es == es)) |
---|
817 | | - | then cc |
---|
818 | | - | else throw("Strict value is not equal to itself.") |
---|
819 | | - | } |
---|
820 | | - | else throw("Strict value is not equal to itself.") |
---|
821 | | - | } |
---|
822 | | - | else throw("Strict value is not equal to itself.") |
---|
823 | | - | } |
---|
824 | | - | else throw("Strict value is not equal to itself.") |
---|
825 | | - | } |
---|
826 | | - | } |
---|
827 | | - | else throw("Strict value is not equal to itself.") |
---|
828 | | - | } |
---|
829 | | - | |
---|
830 | | - | |
---|
831 | | - | |
---|
832 | | - | @Callable(df) |
---|
833 | | - | func getNoLess (et,eu) = { |
---|
834 | | - | let cx = de(df) |
---|
835 | | - | let ca = cx._1 |
---|
836 | | - | let cb = cx._2 |
---|
837 | | - | let cl = cx._3 |
---|
838 | | - | let bG = cx._4 |
---|
839 | | - | let cc = cx._5 |
---|
840 | | - | if ((et > ca)) |
---|
841 | | - | then throw(((("Failed: " + toString(ca)) + " < ") + toString(et))) |
---|
842 | | - | else if ((eu > cb)) |
---|
843 | | - | then throw(((("Failed: " + toString(cb)) + " < ") + toString(eu))) |
---|
844 | | - | else { |
---|
845 | | - | let ev = invoke(ay, "burn", [cl], [AttachedPayment(bG, cl)]) |
---|
846 | | - | if ((ev == ev)) |
---|
847 | | - | then cc |
---|
848 | | - | else throw("Strict value is not equal to itself.") |
---|
849 | | - | } |
---|
850 | | - | } |
---|
851 | | - | |
---|
852 | | - | |
---|
853 | | - | |
---|
854 | | - | @Callable(df) |
---|
855 | | - | func unstakeAndGet (ew) = { |
---|
856 | | - | let ex = if ((size(df.payments) != 0)) |
---|
857 | | - | then throw("No pmnts expd") |
---|
858 | | - | else true |
---|
859 | | - | if ((ex == ex)) |
---|
860 | | - | then { |
---|
861 | | - | let bv = aC() |
---|
862 | | - | let ey = aG() |
---|
863 | | - | let dB = fromBase58String(bv[q]) |
---|
864 | | - | let ez = valueOrErrorMessage(addressFromString(ey[x]), "Wr st addr") |
---|
865 | | - | let eA = invoke(ez, "unstake", [toBase58String(dB), ew], nil) |
---|
866 | | - | if ((eA == eA)) |
---|
867 | | - | then { |
---|
868 | | - | let cx = bE(toBase58String(df.transactionId), toBase58String(dB), ew, df.caller) |
---|
869 | | - | let bO = parseIntValue(cx._9) |
---|
870 | | - | let cc = cx._10 |
---|
871 | | - | let eB = if (if (aA()) |
---|
872 | | - | then true |
---|
873 | | - | else (bO == n)) |
---|
874 | | - | then throw(("Blocked: " + toString(bO))) |
---|
875 | | - | else true |
---|
876 | | - | if ((eB == eB)) |
---|
877 | | - | then { |
---|
878 | | - | let eC = invoke(ay, "burn", [ew], [AttachedPayment(dB, ew)]) |
---|
879 | | - | if ((eC == eC)) |
---|
880 | | - | then cc |
---|
881 | | - | else throw("Strict value is not equal to itself.") |
---|
882 | | - | } |
---|
883 | | - | else throw("Strict value is not equal to itself.") |
---|
884 | | - | } |
---|
885 | | - | else throw("Strict value is not equal to itself.") |
---|
886 | | - | } |
---|
887 | | - | else throw("Strict value is not equal to itself.") |
---|
888 | | - | } |
---|
889 | | - | |
---|
890 | | - | |
---|
891 | | - | |
---|
892 | | - | @Callable(df) |
---|
893 | | - | func activate (eD,eE) = if ((toString(df.caller) != toString(ay))) |
---|
894 | | - | then throw("denied") |
---|
895 | | - | else $Tuple2([StringEntry(X(), eD), StringEntry(Y(), eE)], "success") |
---|
896 | | - | |
---|
897 | | - | |
---|
898 | | - | |
---|
899 | | - | @Callable(df) |
---|
900 | | - | func setS (eF,eB) = if ((toString(df.caller) != au(this, aa()))) |
---|
901 | | - | then dn |
---|
902 | | - | else [StringEntry(eF, eB)] |
---|
903 | | - | |
---|
904 | | - | |
---|
905 | | - | |
---|
906 | | - | @Callable(df) |
---|
907 | | - | func setI (eF,eB) = if ((toString(df.caller) != au(this, aa()))) |
---|
908 | | - | then dn |
---|
909 | | - | else [IntegerEntry(eF, eB)] |
---|
910 | | - | |
---|
911 | | - | |
---|
912 | | - | |
---|
913 | | - | @Callable(df) |
---|
914 | | - | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, aC()) |
---|
915 | | - | |
---|
916 | | - | |
---|
917 | | - | |
---|
918 | | - | @Callable(df) |
---|
919 | | - | func getAccBalanceWrapperREADONLY (aX) = $Tuple2(nil, aW(aX)) |
---|
920 | | - | |
---|
921 | | - | |
---|
922 | | - | |
---|
923 | | - | @Callable(df) |
---|
924 | | - | func calcPricesWrapperREADONLY (bp,bq,bu) = { |
---|
925 | | - | let eG = bt(bp, bq, bu) |
---|
926 | | - | $Tuple2(nil, [toString(eG[0]), toString(eG[1]), toString(eG[2])]) |
---|
927 | | - | } |
---|
928 | | - | |
---|
929 | | - | |
---|
930 | | - | |
---|
931 | | - | @Callable(df) |
---|
932 | | - | func fromX18WrapperREADONLY (F,eH) = $Tuple2(nil, E(parseBigIntValue(F), eH)) |
---|
933 | | - | |
---|
934 | | - | |
---|
935 | | - | |
---|
936 | | - | @Callable(df) |
---|
937 | | - | func toX18WrapperREADONLY (C,D) = $Tuple2(nil, toString(B(C, D))) |
---|
938 | | - | |
---|
939 | | - | |
---|
940 | | - | |
---|
941 | | - | @Callable(df) |
---|
942 | | - | func calcPriceBigIntWrapperREADONLY (aZ,ba) = $Tuple2(nil, toString(aY(parseBigIntValue(aZ), parseBigIntValue(ba)))) |
---|
943 | | - | |
---|
944 | | - | |
---|
945 | | - | |
---|
946 | | - | @Callable(df) |
---|
947 | | - | func estimatePutOperationWrapperREADONLY (bF,be,ce,cf,cg,ch,eI,ci,cj) = $Tuple2(nil, cd(bF, be, ce, cf, cg, ch, eI, ci, cj, false, 0, "")) |
---|
948 | | - | |
---|
949 | | - | |
---|
950 | | - | |
---|
951 | | - | @Callable(df) |
---|
952 | | - | func estimateGetOperationWrapperREADONLY (bF,eJ,bH,eI) = { |
---|
953 | | - | let cx = bE(bF, eJ, bH, addressFromStringValue(eI)) |
---|
954 | | - | $Tuple2(nil, $Tuple10(cx._1, cx._2, cx._3, cx._4, cx._5, cx._6, cx._7, toString(cx._8), cx._9, cx._10)) |
---|
955 | | - | } |
---|
956 | | - | |
---|
957 | | - | |
---|
958 | | - | @Verifier(eK) |
---|
959 | | - | func eL () = { |
---|
960 | | - | let eM = { |
---|
961 | | - | let as = dk() |
---|
962 | | - | if ($isInstanceOf(as, "ByteVector")) |
---|
963 | | - | then { |
---|
964 | | - | let dp = as |
---|
965 | | - | dp |
---|
966 | | - | } |
---|
967 | | - | else if ($isInstanceOf(as, "Unit")) |
---|
968 | | - | then eK.senderPublicKey |
---|
969 | | - | else throw("Match error") |
---|
970 | | - | } |
---|
971 | | - | let as = eK |
---|
972 | | - | if ($isInstanceOf(as, "Order")) |
---|
973 | | - | then { |
---|
974 | | - | let cS = as |
---|
975 | | - | let eN = aB() |
---|
976 | | - | let eO = cR(cS) |
---|
977 | | - | let eP = sigVerify(cS.bodyBytes, cS.proofs[0], cS.senderPublicKey) |
---|
978 | | - | let eQ = sigVerify(cS.bodyBytes, cS.proofs[1], eN) |
---|
979 | | - | if (if (if (eO) |
---|
980 | | - | then eP |
---|
981 | | - | else false) |
---|
982 | | - | then eQ |
---|
983 | | - | else false) |
---|
984 | | - | then true |
---|
985 | | - | else an(eO, eP, eQ) |
---|
986 | | - | } |
---|
987 | | - | else if ($isInstanceOf(as, "SetScriptTransaction")) |
---|
988 | | - | then { |
---|
989 | | - | let dl = as |
---|
990 | | - | let eR = blake2b256(value(dl.script)) |
---|
991 | | - | let eS = fromBase64String(value(getString(ay, am()))) |
---|
992 | | - | let eT = scriptHash(this) |
---|
993 | | - | if (if ((eS == eR)) |
---|
994 | | - | then (eT != eR) |
---|
995 | | - | else false) |
---|
996 | | - | then true |
---|
997 | | - | else sigVerify(eK.bodyBytes, eK.proofs[0], eM) |
---|
998 | | - | } |
---|
999 | | - | else sigVerify(eK.bodyBytes, eK.proofs[0], eM) |
---|
1000 | | - | } |
---|