150 | | - | |
---|
151 | | - | func aa () = "%s__calculator" |
---|
152 | | - | |
---|
153 | | - | |
---|
154 | | - | func ab () = "%s__proxyTreasury" |
---|
155 | | - | |
---|
156 | | - | |
---|
157 | | - | func ac () = "%s__child" |
---|
158 | | - | |
---|
159 | | - | |
---|
160 | | - | func ad () = "%s__blockProcessingReward" |
---|
161 | | - | |
---|
162 | | - | |
---|
163 | | - | func ae () = "%s__nextBlockToProcess" |
---|
164 | | - | |
---|
165 | | - | |
---|
166 | | - | func af () = "%s__lpAssetId" |
---|
167 | | - | |
---|
168 | | - | |
---|
169 | | - | let ag = { |
---|
170 | | - | let v = getString(this, aa()) |
---|
171 | | - | if ($isInstanceOf(v, "String")) |
---|
172 | | - | then { |
---|
173 | | - | let e = v |
---|
174 | | - | addressFromString(e) |
---|
175 | | - | } |
---|
176 | | - | else if ($isInstanceOf(v, "Unit")) |
---|
177 | | - | then unit |
---|
178 | | - | else throw("Match error") |
---|
179 | | - | } |
---|
180 | | - | |
---|
181 | | - | let ah = valueOrErrorMessage(ag, d("invalid calculator address")) |
---|
182 | | - | |
---|
183 | | - | let ai = { |
---|
184 | | - | let v = getString(this, ab()) |
---|
185 | | - | if ($isInstanceOf(v, "String")) |
---|
186 | | - | then { |
---|
187 | | - | let e = v |
---|
188 | | - | addressFromString(e) |
---|
189 | | - | } |
---|
190 | | - | else if ($isInstanceOf(v, "Unit")) |
---|
191 | | - | then unit |
---|
192 | | - | else throw("Match error") |
---|
193 | | - | } |
---|
194 | | - | |
---|
195 | | - | let aj = valueOrErrorMessage(ai, d("invalid proxy treasury address")) |
---|
196 | | - | |
---|
197 | | - | func ak () = "%s__config" |
---|
198 | | - | |
---|
199 | | - | |
---|
200 | | - | func al () = "contract_children" |
---|
201 | | - | |
---|
202 | | - | |
---|
203 | | - | func am () = "contract_voting_result" |
---|
204 | | - | |
---|
205 | | - | |
---|
206 | | - | func an (x,l) = ((("proposal_allow_broadcast_" + toString(x)) + "_") + toBase58String(l)) |
---|
207 | | - | |
---|
208 | | - | |
---|
209 | | - | func ao (ap,aq) = makeString(["investor", toString(ap), toString(aq)], "_") |
---|
210 | | - | |
---|
211 | | - | |
---|
212 | | - | let ar = { |
---|
213 | | - | let v = getString(this, ak()) |
---|
214 | | - | if ($isInstanceOf(v, "String")) |
---|
215 | | - | then { |
---|
216 | | - | let e = v |
---|
217 | | - | addressFromString(e) |
---|
218 | | - | } |
---|
219 | | - | else if ($isInstanceOf(v, "Unit")) |
---|
220 | | - | then unit |
---|
221 | | - | else throw("Match error") |
---|
222 | | - | } |
---|
223 | | - | |
---|
224 | | - | let as = valueOrErrorMessage(ar, d("invalid config address")) |
---|
225 | | - | |
---|
226 | | - | let at = { |
---|
227 | | - | let v = ar |
---|
228 | | - | if ($isInstanceOf(v, "Address")) |
---|
229 | | - | then { |
---|
230 | | - | let z = v |
---|
231 | | - | let au = getString(z, am()) |
---|
232 | | - | if ($isInstanceOf(au, "String")) |
---|
233 | | - | then { |
---|
234 | | - | let e = au |
---|
235 | | - | addressFromString(e) |
---|
236 | | - | } |
---|
237 | | - | else if ($isInstanceOf(au, "Unit")) |
---|
238 | | - | then unit |
---|
239 | | - | else throw("Match error") |
---|
240 | | - | } |
---|
241 | | - | else if ($isInstanceOf(v, "Unit")) |
---|
242 | | - | then unit |
---|
243 | | - | else throw("Match error") |
---|
244 | | - | } |
---|
245 | | - | |
---|
246 | | - | let av = valueOrErrorMessage(at, d("invalid voting result address")) |
---|
247 | | - | |
---|
248 | | - | let aw = { |
---|
249 | | - | let v = ar |
---|
250 | | - | if ($isInstanceOf(v, "Address")) |
---|
251 | | - | then { |
---|
252 | | - | let z = v |
---|
253 | | - | let au = getString(z, al()) |
---|
254 | | - | if ($isInstanceOf(au, "String")) |
---|
255 | | - | then { |
---|
256 | | - | let e = au |
---|
257 | | - | addressFromString(e) |
---|
258 | | - | } |
---|
259 | | - | else if ($isInstanceOf(au, "Unit")) |
---|
260 | | - | then unit |
---|
261 | | - | else throw("Match error") |
---|
262 | | - | } |
---|
263 | | - | else if ($isInstanceOf(v, "Unit")) |
---|
264 | | - | then unit |
---|
265 | | - | else throw("Match error") |
---|
266 | | - | } |
---|
267 | | - | |
---|
268 | | - | let ax = valueOrErrorMessage(aw, d("invalid children address")) |
---|
269 | | - | |
---|
270 | | - | let ay = { |
---|
271 | | - | let v = getString(this, af()) |
---|
272 | | - | if ($isInstanceOf(v, "String")) |
---|
273 | | - | then { |
---|
274 | | - | let e = v |
---|
275 | | - | fromBase58String(e) |
---|
276 | | - | } |
---|
277 | | - | else if ($isInstanceOf(v, "Unit")) |
---|
278 | | - | then unit |
---|
279 | | - | else throw("Match error") |
---|
280 | | - | } |
---|
281 | | - | |
---|
282 | | - | let az = valueOrErrorMessage(ay, d("invalid lpAssetId")) |
---|
283 | | - | |
---|
284 | | - | func aA (aB,x) = if ((aB.caller == x)) |
---|
285 | | - | then true |
---|
286 | | - | else f("permission denied") |
---|
287 | | - | |
---|
288 | | - | |
---|
289 | | - | func aC (aB) = aA(aB, this) |
---|
290 | | - | |
---|
291 | | - | |
---|
292 | | - | func aD (aB) = aA(aB, ah) |
---|
293 | | - | |
---|
294 | | - | |
---|
295 | | - | @Callable(aB) |
---|
296 | | - | func stringEntry (R,aE) = if (aD(aB)) |
---|
297 | | - | then $Tuple2([StringEntry(R, aE)], R) |
---|
298 | | - | else $Tuple2(nil, unit) |
---|
299 | | - | |
---|
300 | | - | |
---|
301 | | - | |
---|
302 | | - | @Callable(aB) |
---|
303 | | - | func integerEntry (R,aE) = if (aD(aB)) |
---|
304 | | - | then $Tuple2([IntegerEntry(R, aE)], R) |
---|
305 | | - | else $Tuple2(nil, unit) |
---|
306 | | - | |
---|
307 | | - | |
---|
308 | | - | |
---|
309 | | - | @Callable(aB) |
---|
310 | | - | func booleanEntry (R,aE) = if (aD(aB)) |
---|
311 | | - | then $Tuple2([BooleanEntry(R, aE)], R) |
---|
312 | | - | else $Tuple2(nil, unit) |
---|
313 | | - | |
---|
314 | | - | |
---|
315 | | - | |
---|
316 | | - | @Callable(aB) |
---|
317 | | - | func binaryEntry (R,aE) = if (aD(aB)) |
---|
318 | | - | then $Tuple2([BinaryEntry(R, aE)], R) |
---|
319 | | - | else $Tuple2(nil, unit) |
---|
320 | | - | |
---|
321 | | - | |
---|
322 | | - | |
---|
323 | | - | @Callable(aB) |
---|
324 | | - | func deleteEntry (R) = if (aD(aB)) |
---|
325 | | - | then $Tuple2([DeleteEntry(R)], R) |
---|
326 | | - | else $Tuple2(nil, unit) |
---|
327 | | - | |
---|
328 | | - | |
---|
329 | | - | |
---|
330 | | - | @Callable(aB) |
---|
331 | | - | func reissue (aF) = if (aD(aB)) |
---|
332 | | - | then $Tuple2([Reissue(az, aF, true)], aF) |
---|
333 | | - | else $Tuple2(nil, unit) |
---|
334 | | - | |
---|
335 | | - | |
---|
336 | | - | |
---|
337 | | - | @Callable(aB) |
---|
338 | | - | func burn (aF) = if (aD(aB)) |
---|
339 | | - | then $Tuple2([Burn(az, aF)], aF) |
---|
340 | | - | else $Tuple2(nil, unit) |
---|
341 | | - | |
---|
342 | | - | |
---|
343 | | - | |
---|
344 | | - | @Callable(aB) |
---|
345 | | - | func transferAsset (aG,aF,aH) = if (aD(aB)) |
---|
346 | | - | then $Tuple2([ScriptTransfer(Address(aG), aF, aH)], aF) |
---|
347 | | - | else $Tuple2(nil, unit) |
---|
348 | | - | |
---|
349 | | - | |
---|
350 | | - | |
---|
351 | | - | @Callable(aB) |
---|
352 | | - | func transferAssets (aG,aI,aJ) = if (aD(aB)) |
---|
353 | | - | then { |
---|
354 | | - | func aK (aL,aM) = { |
---|
355 | | - | let aN = aL |
---|
356 | | - | let aO = aN._1 |
---|
357 | | - | let aP = aN._2 |
---|
358 | | - | let aQ = ScriptTransfer(Address(aG), parseIntValue(aJ[aP]), g(aI[aP])) |
---|
359 | | - | let aR = (aO :+ aQ) |
---|
360 | | - | $Tuple2(aR, (aP + 1)) |
---|
361 | | - | } |
---|
362 | | - | |
---|
363 | | - | let aS = { |
---|
364 | | - | let G = aI |
---|
365 | | - | let H = size(G) |
---|
366 | | - | let I = $Tuple2(nil, 0) |
---|
367 | | - | func J (K,L) = if ((L >= H)) |
---|
368 | | - | then K |
---|
369 | | - | else aK(K, G[L]) |
---|
370 | | - | |
---|
371 | | - | func M (K,L) = if ((L >= H)) |
---|
372 | | - | then K |
---|
373 | | - | else throw("List size exceeds 10") |
---|
374 | | - | |
---|
375 | | - | M(J(J(J(J(J(J(J(J(J(J(I, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) |
---|
376 | | - | } |
---|
377 | | - | let aT = aS._1 |
---|
378 | | - | let aU = aS._2 |
---|
379 | | - | $Tuple2(aT, unit) |
---|
380 | | - | } |
---|
381 | | - | else $Tuple2(nil, unit) |
---|
382 | | - | |
---|
383 | | - | |
---|
384 | | - | |
---|
385 | | - | @Callable(aB) |
---|
386 | | - | func transferWaves (aG,aF) = if (aD(aB)) |
---|
387 | | - | then $Tuple2([ScriptTransfer(Address(aG), aF, unit)], aF) |
---|
388 | | - | else $Tuple2(nil, unit) |
---|
389 | | - | |
---|
390 | | - | |
---|
391 | | - | |
---|
392 | | - | @Callable(aB) |
---|
393 | | - | func transferFromProxyTreasury (aV,aW) = if (aD(aB)) |
---|
394 | | - | then $Tuple2(nil, invoke(aj, "transferWaves", [aV, aW], nil)) |
---|
395 | | - | else $Tuple2(nil, unit) |
---|
396 | | - | |
---|
397 | | - | |
---|
398 | | - | |
---|
399 | | - | @Callable(aB) |
---|
400 | | - | func finalize (aX,aY,aZ) = $Tuple2(nil, reentrantInvoke(ah, "finalize", [aB.caller.bytes, aX, aY, aZ], aB.payments)) |
---|
401 | | - | |
---|
402 | | - | |
---|
403 | | - | |
---|
404 | | - | @Callable(aB) |
---|
405 | | - | func finalizeREADONLY (aX,aY,aZ) = $Tuple2(nil, reentrantInvoke(ah, "finalizeREADONLY", [aX, aY, aZ], nil)) |
---|
406 | | - | |
---|
407 | | - | |
---|
408 | | - | |
---|
409 | | - | @Callable(aB) |
---|
410 | | - | func claimLP () = $Tuple2(nil, reentrantInvoke(ah, "claimLP", [aB.caller.bytes], aB.payments)) |
---|
411 | | - | |
---|
412 | | - | |
---|
413 | | - | |
---|
414 | | - | @Callable(aB) |
---|
415 | | - | func claimCollateral (ba) = $Tuple2(nil, reentrantInvoke(ah, "claimCollateral", [aB.caller.bytes, ba], aB.payments)) |
---|
416 | | - | |
---|
417 | | - | |
---|
418 | | - | |
---|
419 | | - | @Callable(aB) |
---|
420 | | - | func claimCollateralBulk (bb) = $Tuple2(nil, reentrantInvoke(ah, "claimCollateralBulk", [aB.caller.bytes, bb], aB.payments)) |
---|
421 | | - | |
---|
422 | | - | |
---|
423 | | - | |
---|
424 | | - | @Callable(aB) |
---|
425 | | - | func invest () = $Tuple2(nil, reentrantInvoke(ah, "invest", [aB.caller.bytes], aB.payments)) |
---|
426 | | - | |
---|
427 | | - | |
---|
428 | | - | |
---|
429 | | - | @Callable(aB) |
---|
430 | | - | func withdraw () = $Tuple2(nil, reentrantInvoke(ah, "withdraw", [aB.caller.bytes], aB.payments)) |
---|
431 | | - | |
---|
432 | | - | |
---|
433 | | - | |
---|
434 | | - | @Callable(aB) |
---|
435 | | - | func cancelWithdraw (ba) = $Tuple2(nil, reentrantInvoke(ah, "cancelWithdraw", [aB.caller.bytes, fromBase58String(ba)], aB.payments)) |
---|
436 | | - | |
---|
437 | | - | |
---|
438 | | - | |
---|
439 | | - | @Callable(aB) |
---|
440 | | - | func processBlocks () = $Tuple2(nil, reentrantInvoke(ah, "processBlocks", [aB.caller.bytes], aB.payments)) |
---|
441 | | - | |
---|
442 | | - | |
---|
443 | | - | |
---|
444 | | - | @Callable(aB) |
---|
445 | | - | func claimCollateralREADONLY (aq,ba) = $Tuple2(nil, reentrantInvoke(ah, "claimCollateralREADONLY", [fromBase58String(aq), ba], nil)) |
---|
446 | | - | |
---|
447 | | - | |
---|
448 | | - | |
---|
449 | | - | @Callable(aB) |
---|
450 | | - | func claimCollateralBulkREADONLY (aq,bb) = $Tuple2(nil, reentrantInvoke(ah, "claimCollateralBulkREADONLY", [fromBase58String(aq), bb], nil)) |
---|
451 | | - | |
---|
452 | | - | |
---|
453 | | - | |
---|
454 | | - | @Callable(aB) |
---|
455 | | - | func voteForTxId (l) = { |
---|
456 | | - | let U = toBase58String(aB.caller.bytes) |
---|
457 | | - | let D = k(l) |
---|
458 | | - | let B = [StringEntry(q(), l)] |
---|
459 | | - | let bc = getString(this, q()) |
---|
460 | | - | let Y = [if ((size(fromBase58String(l)) == j)) |
---|
461 | | - | then true |
---|
462 | | - | else f((l + " is not valid txId")), if (if ((bc == unit)) |
---|
463 | | - | then true |
---|
464 | | - | else (value(bc) != l)) |
---|
465 | | - | then true |
---|
466 | | - | else f((l + " is already allowed"))] |
---|
467 | | - | if ((Y == Y)) |
---|
468 | | - | then T(U, D, i, B) |
---|
469 | | - | else throw("Strict value is not equal to itself.") |
---|
470 | | - | } |
---|
471 | | - | |
---|
472 | | - | |
---|
473 | | - | @Verifier(bd) |
---|
474 | | - | func be () = { |
---|
475 | | - | let bf = { |
---|
476 | | - | let v = at |
---|
477 | | - | if ($isInstanceOf(v, "Address")) |
---|
478 | | - | then { |
---|
479 | | - | let bg = v |
---|
480 | | - | valueOrElse(getBoolean(bg, an(this, bd.id)), false) |
---|
481 | | - | } |
---|
482 | | - | else false |
---|
483 | | - | } |
---|
484 | | - | let bh = (bd.id == fromBase58String(valueOrElse(getString(this, q()), ""))) |
---|
485 | | - | let bi = if ((size(u()) >= i)) |
---|
486 | | - | then false |
---|
487 | | - | else sigVerify(bd.bodyBytes, bd.proofs[0], bd.senderPublicKey) |
---|
488 | | - | if (if (bf) |
---|
489 | | - | then true |
---|
490 | | - | else bh) |
---|
491 | | - | then true |
---|
492 | | - | else bi |
---|
493 | | - | } |
---|