tx · DLjrR2vLeenXbj8E4QgH17CRKUmoXPhgb72462z7ya4a 3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS: -0.03600000 Waves 2023.05.04 12:36 [2562839] smart account 3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS > SELF 0.00000000 Waves
{ "type": 13, "id": "DLjrR2vLeenXbj8E4QgH17CRKUmoXPhgb72462z7ya4a", "fee": 3600000, "feeAssetId": null, "timestamp": 1683192976834, "version": 2, "chainId": 84, "sender": "3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS", "senderPublicKey": "HP8sssVq1866F7CaPQJwgFrt6fsqhQjKwM84cL1wjD2a", "proofs": [ "atf6Qzz5iFUKVAwBbTh6iBfcq5TeY3wtD4EgYVcMVm7UpdvtjPJuQsUsiXU1oEzsU2m6NmUXs8zaQtMeTqZQLD6" ], "script": "base64:BgJbCAISBQoDCAEIEgMKAQgSBQoDCAEIEgMKAQgSBAoCCAESAwoBCBIOCgwICAgBBBEYGBEBARgSCgoICAgIAQQIARgSDgoMCAgIAQQYGBgYGAEYEggKBggIAQEBAVAAB1NGX1BPT0wCAlNGAAdXWF9QT09MAgJXWAAPQ0FQX0ZFRV9OT19MT0FOAgljYXBOb0xvYW4ADENBUF9GRUVfTE9BTgIHY2FwTG9hbgAHQ0FQX0ZFRQIDY2FwAAhMT0FOX0ZFRQIEbG9hbgALTk9fTE9BTl9GRUUCBm5vTG9hbgAGU0NBTEU4AIDC1y8AB1NDQUxFMTAAgMivoCUACkZFRV9TQ0FMRTYAwIQ9ABRrU0ZQb29sQUFzc2V0QmFsYW5jZQIPQV9hc3NldF9iYWxhbmNlABRrU0ZQb29sQkFzc2V0QmFsYW5jZQIPQl9hc3NldF9iYWxhbmNlAA9rU0ZQb29sQUFzc2V0SWQCCkFfYXNzZXRfaWQAD2tTRlBvb2xCQXNzZXRJZAIKQl9hc3NldF9pZAAOa1NGUG9vbFNoYXJlSWQCDnNoYXJlX2Fzc2V0X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MgJfMwQEYkJhbAgFDSR0MDM0NjQ4MzQ3NDICXzQEB3NoYXJlSWQIBQ0kdDAzNDY0ODM0NzQyAl81CQDMCAIJAQxJbnRlZ2VyRW50cnkCCQCsAgIFCHBvb2xBZGRyBRVrQXhseUluRmVlV2l0aG91dExvYW4FC2luRmVlTm9Mb2FuCQDMCAIJAQxJbnRlZ2VyRW50cnkCCQCsAgIFCHBvb2xBZGRyBRJrQXhseUluRmVlV2l0aExvYW4FCWluRmVlTG9hbgkAzAgCCQEMSW50ZWdlckVudHJ5AgkArAICBQhwb29sQWRkcgURa0F4bHlOb0xvYW5DYXBGZWUFDGNhcEZlZU5vTG9hbgkAzAgCCQEMSW50ZWdlckVudHJ5AgkArAICBQhwb29sQWRkcgUTa0F4bHlXaXRoTG9hbkNhcEZlZQUOY2FwRmVlV2l0aExvYW4JAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgUIcG9vbEFkZHIFDWtQb29sSW50ZXJlc3QAAAkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIFBWtQb29sBQhwb29sQWRkcgUEdHlwZQkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIFB3NoYXJlSWQFCmtTaGFyZVBvb2wFCHBvb2xBZGRyBQNuaWwBAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5Be0ilg==", "height": 2562839, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: D5fR9GKAFo54kJi9S7gKH27SmohD7tgNEpmujjBqCHFk Next: 5NjufpnggLyQB99Abxsr37ytDCCWaVprj3WXLYnDbhWg Diff:
Old | New | Differences | |
---|---|---|---|
8 | 8 | let CAP_FEE_NO_LOAN = "capNoLoan" | |
9 | 9 | ||
10 | 10 | let CAP_FEE_LOAN = "capLoan" | |
11 | + | ||
12 | + | let CAP_FEE = "cap" | |
11 | 13 | ||
12 | 14 | let LOAN_FEE = "loan" | |
13 | 15 | ||
28 | 30 | let kSFPoolBAssetId = "B_asset_id" | |
29 | 31 | ||
30 | 32 | let kSFPoolShareId = "share_asset_id" | |
33 | + | ||
34 | + | let kSFPoolShareSupply = "share_asset_supply" | |
31 | 35 | ||
32 | 36 | let kSFPoolFee = "commission" | |
33 | 37 | ||
64 | 68 | let kSharePool = "_pool_share_id" | |
65 | 69 | ||
66 | 70 | let kPoolCapChange = "_pool_cap_change" | |
71 | + | ||
72 | + | let kTokenLastPrice = "_last_price" | |
67 | 73 | ||
68 | 74 | let kMoneyBox = "axly_money_box" | |
69 | 75 | ||
165 | 171 | else throw("Wrong pool type") | |
166 | 172 | ||
167 | 173 | ||
174 | + | func getShareSupply (poolAddr,type,shareId) = if ((type == SF_POOL)) | |
175 | + | then valueOrErrorMessage(getInteger(poolAddr, kSFPoolShareSupply), "Can't get share asset supply") | |
176 | + | else if ((type == WX_POOL)) | |
177 | + | then valueOrErrorMessage(assetInfo(fromBase58String(shareId)), "Wrong ShareId").quantity | |
178 | + | else throw("Wrong pool type") | |
179 | + | ||
180 | + | ||
168 | 181 | func getPoolTotalShare (pool) = valueOrElse(getInteger(this, (pool + kPoolTotal)), 0) | |
169 | 182 | ||
170 | 183 | ||
223 | 236 | } | |
224 | 237 | ||
225 | 238 | ||
239 | + | func getAssetsPrice (assetIds) = { | |
240 | + | func getPrices (a,assetId) = { | |
241 | + | let assetPrice = ( let @ = invoke(priceOracleAddr, "getTWAP60", [assetId, false], nil) | |
242 | + | if ($isInstanceOf(@, "(Int, Int)")) | |
243 | + | then @ | |
244 | + | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._2 | |
245 | + | (a :+ assetPrice) | |
246 | + | } | |
247 | + | ||
248 | + | let $l = assetIds | |
249 | + | let $s = size($l) | |
250 | + | let $acc0 = nil | |
251 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
252 | + | then $a | |
253 | + | else getPrices($a, $l[$i]) | |
254 | + | ||
255 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
256 | + | then $a | |
257 | + | else throw("List size exceeds 100") | |
258 | + | ||
259 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
260 | + | } | |
261 | + | ||
262 | + | ||
263 | + | func getSharePrice (shareIds) = { | |
264 | + | func getPrices (a,shareId) = { | |
265 | + | let pool = valueOrErrorMessage(getString(this, (shareId + kSharePool)), "Can't find pool addr by share id") | |
266 | + | let poolAddr = Address(fromBase58String(pool)) | |
267 | + | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
268 | + | let $t077377802 = getPoolData(poolAddr, pType) | |
269 | + | let aId = $t077377802._1 | |
270 | + | let bId = $t077377802._2 | |
271 | + | let aBalance = $t077377802._3 | |
272 | + | let bBalance = $t077377802._4 | |
273 | + | let dPriceA = ( let @ = invoke(priceOracleAddr, "getTWAP60", [aId, false], nil) | |
274 | + | if ($isInstanceOf(@, "(Int, Int)")) | |
275 | + | then @ | |
276 | + | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._2 | |
277 | + | let dPriceB = ( let @ = invoke(priceOracleAddr, "getTWAP60", [bId, false], nil) | |
278 | + | if ($isInstanceOf(@, "(Int, Int)")) | |
279 | + | then @ | |
280 | + | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._2 | |
281 | + | let shareSupply = getShareSupply(poolAddr, pType, shareId) | |
282 | + | let APrecision = pow(10, 0, getAssetDecimals(aId), 0, 0, DOWN) | |
283 | + | let BPrecision = pow(10, 0, getAssetDecimals(bId), 0, 0, DOWN) | |
284 | + | let sharePrecision = pow(10, 0, getAssetDecimals(shareId), 0, 0, DOWN) | |
285 | + | let sum = (fraction(aBalance, dPriceA, APrecision) + fraction(bBalance, dPriceB, BPrecision)) | |
286 | + | let sharePrice = fraction(sum, sharePrecision, shareSupply) | |
287 | + | (a :+ sharePrice) | |
288 | + | } | |
289 | + | ||
290 | + | let $l = shareIds | |
291 | + | let $s = size($l) | |
292 | + | let $acc0 = nil | |
293 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
294 | + | then $a | |
295 | + | else getPrices($a, $l[$i]) | |
296 | + | ||
297 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
298 | + | then $a | |
299 | + | else throw("List size exceeds 50") | |
300 | + | ||
301 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50) | |
302 | + | } | |
303 | + | ||
304 | + | ||
305 | + | func getCursEntries (aId,bId,shareId) = { | |
306 | + | let assetsPrices = getAssetsPrice([aId, bId]) | |
307 | + | let sharePrice = getSharePrice([shareId]) | |
308 | + | [IntegerEntry((aId + kTokenLastPrice), assetsPrices[0]), IntegerEntry((bId + kTokenLastPrice), assetsPrices[1]), IntegerEntry((shareId + kTokenLastPrice), sharePrice[0])] | |
309 | + | } | |
310 | + | ||
311 | + | ||
226 | 312 | func replenishSwopFi (pool,feeType,pmtA,pmtAssetA,pmtB,pmtAssetB,balA,balB,shareId) = { | |
227 | 313 | let shareBalanceBefore = accountBalance(fromBase58String(shareId)) | |
228 | 314 | if ((shareBalanceBefore == shareBalanceBefore)) | |
230 | 316 | let poolAddr = Address(fromBase58String(pool)) | |
231 | 317 | let ratioA = fraction(SCALE8, pmtA, balA) | |
232 | 318 | let ratioB = fraction(SCALE8, pmtB, balB) | |
233 | - | let $ | |
319 | + | let $t093079599 = if ((ratioB > ratioA)) | |
234 | 320 | then { | |
235 | 321 | let pmt = fraction(balB, ratioA, SCALE8, CEILING) | |
236 | 322 | $Tuple4(pmtA, pmt, (pmtB - pmt), pmtAssetB) | |
239 | 325 | let pmt = fraction(balA, ratioB, SCALE8, CEILING) | |
240 | 326 | $Tuple4(pmt, pmtB, (pmtA - pmt), pmtAssetA) | |
241 | 327 | } | |
242 | - | let pmtAmountA = $ | |
243 | - | let pmtAmountB = $ | |
244 | - | let change = $ | |
245 | - | let changeAssetId = $ | |
328 | + | let pmtAmountA = $t093079599._1 | |
329 | + | let pmtAmountB = $t093079599._2 | |
330 | + | let change = $t093079599._3 | |
331 | + | let changeAssetId = $t093079599._4 | |
246 | 332 | let inv1 = if (if ((pmtAmountA > 0)) | |
247 | 333 | then (pmtAmountB > 0) | |
248 | 334 | else false) | |
264 | 350 | then { | |
265 | 351 | let shareBalanceAfter = accountBalance(fromBase58String(shareId)) | |
266 | 352 | let totalStaked = (shareBalanceAfter - shareBalanceBefore) | |
267 | - | let axlyFeeAmount = fraction(totalStaked, getAxlyFee(pool, feeType), FEE_SCALE6) | |
353 | + | let axlyFeeAmount = if ((feeType == CAP_FEE)) | |
354 | + | then fraction(totalStaked, getAxlyFee(pool, feeType), FEE_SCALE6) | |
355 | + | else fraction(totalStaked, getAxlyFee(pool, feeType), FEE_SCALE6) | |
268 | 356 | let userShareForStake = (totalStaked - axlyFeeAmount) | |
269 | 357 | if ((0 >= userShareForStake)) | |
270 | 358 | then throw("amount of staked sharetokens must be > 0") | |
285 | 373 | ||
286 | 374 | func replenishWX (pool,feeType,pmtA,pmtAssetA,pmtB,pmtAssetB,shareId) = { | |
287 | 375 | let poolAddr = Address(fromBase58String(pool)) | |
288 | - | let $ | |
376 | + | let $t01116412013 = if (if ((pmtA > 0)) | |
289 | 377 | then (pmtB > 0) | |
290 | 378 | else false) | |
291 | 379 | then { | |
326 | 414 | else if ((pmtB > 0)) | |
327 | 415 | then $Tuple4(pmtA, pmtB, pmtB, pmtAssetB) | |
328 | 416 | else throw("pmts must be > 0") | |
329 | - | let pmtAmountA = $ | |
330 | - | let pmtAmountB = $ | |
331 | - | let change = $ | |
332 | - | let changeAssetId = $ | |
417 | + | let pmtAmountA = $t01116412013._1 | |
418 | + | let pmtAmountB = $t01116412013._2 | |
419 | + | let change = $t01116412013._3 | |
420 | + | let changeAssetId = $t01116412013._4 | |
333 | 421 | let shareBalanceBefore = accountBalance(fromBase58String(shareId)) | |
334 | 422 | if ((shareBalanceBefore == shareBalanceBefore)) | |
335 | 423 | then { | |
373 | 461 | ||
374 | 462 | ||
375 | 463 | func replenishByType (type,pool,feeType,pmtA,AId,pmtB,BId,balA,balB,shareId) = if ((type == SF_POOL)) | |
376 | - | then replenishSwopFi(pool, | |
464 | + | then replenishSwopFi(pool, feeType, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
377 | 465 | else if ((type == WX_POOL)) | |
378 | - | then replenishWX(pool, | |
466 | + | then replenishWX(pool, feeType, pmtA, AId, pmtB, BId, shareId) | |
379 | 467 | else throw("Wrong pool type") | |
380 | 468 | ||
381 | 469 | ||
461 | 549 | ||
462 | 550 | func capitalize (pool,pType,tokenId,tokenAmount) = { | |
463 | 551 | let poolAddr = Address(fromBase58String(pool)) | |
464 | - | let $ | |
465 | - | let AId = $ | |
466 | - | let BId = $ | |
467 | - | let balA = $ | |
468 | - | let balB = $ | |
469 | - | let shareId = $ | |
470 | - | let $ | |
552 | + | let $t01697517054 = getPoolData(poolAddr, pType) | |
553 | + | let AId = $t01697517054._1 | |
554 | + | let BId = $t01697517054._2 | |
555 | + | let balA = $t01697517054._3 | |
556 | + | let balB = $t01697517054._4 | |
557 | + | let shareId = $t01697517054._5 | |
558 | + | let $t01705717137 = if ((tokenId == AId)) | |
471 | 559 | then $Tuple2(tokenAmount, 0) | |
472 | 560 | else $Tuple2(0, tokenAmount) | |
473 | - | let pmtA = $ | |
474 | - | let pmtB = $ | |
475 | - | let $ | |
476 | - | let stakedAmount = $ | |
477 | - | let axlyFee = $ | |
561 | + | let pmtA = $t01705717137._1 | |
562 | + | let pmtB = $t01705717137._2 | |
563 | + | let $t01714017250 = replenishByType(pType, pool, CAP_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
564 | + | let stakedAmount = $t01714017250._1 | |
565 | + | let axlyFee = $t01714017250._2 | |
478 | 566 | let curPoolInterest = valueOrElse(getInteger(this, (pool + kPoolInterest)), 0) | |
479 | 567 | let totalShareAmount = getPoolTotalShare(pool) | |
480 | 568 | let newInterest = (curPoolInterest + fraction(stakedAmount, SCALE10, totalShareAmount)) | |
481 | - | [IntegerEntry((pool + kPoolInterest), newInterest), ScriptTransfer(moneyBox, axlyFee, fromBase58String(shareId))] | |
569 | + | ([IntegerEntry((pool + kPoolInterest), newInterest), ScriptTransfer(moneyBox, axlyFee, fromBase58String(shareId))] ++ getCursEntries(AId, BId, shareId)) | |
482 | 570 | } | |
483 | 571 | ||
484 | 572 | ||
487 | 575 | let feeScale6 = 1000000 | |
488 | 576 | let fee = getIntegerValue(poolAddr, kSFPoolFee) | |
489 | 577 | let amntGetNoFee = fraction(amountTokenToGet, feeScale6, (feeScale6 - fee)) | |
490 | - | let $ | |
578 | + | let $t01798018268 = if ((assetTokenToGet == assetIdA)) | |
491 | 579 | then { | |
492 | 580 | let amountToPay = fraction(balA, amntGetNoFee, (balB - amntGetNoFee)) | |
493 | 581 | $Tuple2(amountToPay, assetIdB) | |
496 | 584 | let amountToPay = fraction(balB, amntGetNoFee, (balA - amntGetNoFee)) | |
497 | 585 | $Tuple2(amountToPay, assetIdA) | |
498 | 586 | } | |
499 | - | let amountToPay = $ | |
500 | - | let assetToPay = $ | |
587 | + | let amountToPay = $t01798018268._1 | |
588 | + | let assetToPay = $t01798018268._2 | |
501 | 589 | invoke(poolAddr, "callFunction", ["exchange", ["1"]], [AttachedPayment(assetIdFromStr(assetToPay), amountToPay)]) | |
502 | 590 | } | |
503 | 591 | ||
507 | 595 | let prFee = getIntegerValue(wxSwapContract, "%s__protocolFee") | |
508 | 596 | let pFee = getIntegerValue(wxSwapContract, "%s__poolFee") | |
509 | 597 | let feeScale = toBigInt(100000000) | |
510 | - | let $ | |
598 | + | let $t01874719055 = if ((assetTokenToGet == assetIdA)) | |
511 | 599 | then { | |
512 | 600 | let amountToPay = fraction(balA, amountTokenToGet, (balB - amountTokenToGet)) | |
513 | 601 | $Tuple2(amountToPay, assetIdB) | |
516 | 604 | let amountToPay = fraction(balB, amountTokenToGet, (balA - amountTokenToGet)) | |
517 | 605 | $Tuple2(amountToPay, assetIdA) | |
518 | 606 | } | |
519 | - | let amountToPay = $ | |
520 | - | let assetToPay = $ | |
607 | + | let amountToPay = $t01874719055._1 | |
608 | + | let assetToPay = $t01874719055._2 | |
521 | 609 | let amountToPayWithFee = toInt(fraction(toBigInt(amountToPay), feeScale, (feeScale - toBigInt((prFee + pFee))))) | |
522 | 610 | invoke(wxSwapContract, "swap", [1, assetTokenToGet, toString(this)], [AttachedPayment(assetIdFromStr(assetToPay), amountToPayWithFee)]) | |
523 | 611 | } | |
531 | 619 | func withdrawAmountCalc (pool,userCanWithdraw,debt,borrowAsset) = { | |
532 | 620 | let poolAddr = Address(fromBase58String(pool)) | |
533 | 621 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
534 | - | let $t01760417671 = getPoolData(poolAddr, pType) | |
535 | - | let assetIdA = $t01760417671._1 | |
536 | - | let assetIdB = $t01760417671._2 | |
537 | - | let balA = $t01760417671._3 | |
538 | - | let balB = $t01760417671._4 | |
622 | + | let $t01992019996 = getPoolData(poolAddr, pType) | |
623 | + | let assetIdA = $t01992019996._1 | |
624 | + | let assetIdB = $t01992019996._2 | |
625 | + | let balA = $t01992019996._3 | |
626 | + | let balB = $t01992019996._4 | |
627 | + | let shareId = $t01992019996._5 | |
539 | 628 | let cBalABefore = accountBalance(assetIdFromStr(assetIdA)) | |
540 | 629 | if ((cBalABefore == cBalABefore)) | |
541 | 630 | then { | |
551 | 640 | then { | |
552 | 641 | let cBalAAfter = accountBalance(assetIdFromStr(assetIdA)) | |
553 | 642 | let cBalBAfter = accountBalance(assetIdFromStr(assetIdB)) | |
554 | - | let $ | |
555 | - | let tokensAmountA = $ | |
556 | - | let tokensAmountB = $ | |
557 | - | let $ | |
643 | + | let $t02050820597 = $Tuple2((cBalAAfter - cBalABefore), (cBalBAfter - cBalBBefore)) | |
644 | + | let tokensAmountA = $t02050820597._1 | |
645 | + | let tokensAmountB = $t02050820597._2 | |
646 | + | let $t02060021296 = if ((debt > 0)) | |
558 | 647 | then { | |
559 | 648 | let amountToGetEx = if (if ((borrowAsset == assetIdA)) | |
560 | 649 | then (debt > tokensAmountA) | |
577 | 666 | else throw("Strict value is not equal to itself.") | |
578 | 667 | } | |
579 | 668 | else $Tuple2(tokensAmountA, tokensAmountB) | |
580 | - | let toUserAmountA = $ | |
581 | - | let toUserAmountB = $ | |
582 | - | $ | |
669 | + | let toUserAmountA = $t02060021296._1 | |
670 | + | let toUserAmountB = $t02060021296._2 | |
671 | + | $Tuple7(toUserAmountA, assetIdA, toUserAmountB, assetIdB, cBalAAfter, cBalBAfter, shareId) | |
583 | 672 | } | |
584 | 673 | else throw("Strict value is not equal to itself.") | |
585 | 674 | } | |
607 | 696 | ||
608 | 697 | ||
609 | 698 | @Callable(i) | |
610 | - | func getAssetPrice (assetId) = $Tuple2(nil, (let @ = invoke(priceOracleAddr, "getTWAP60", [assetId, false], nil) | |
611 | - | if ($isInstanceOf(@, "(Int, Int)")) | |
612 | - | then @ | |
613 | - | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._2) | |
614 | - | ||
615 | - | ||
616 | - | ||
617 | - | @Callable(i) | |
618 | - | func getSharePrice (shareId) = { | |
619 | - | let pool = valueOrErrorMessage(getString(this, (shareId + kSharePool)), "Can't find pool addr by share id") | |
620 | - | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
621 | - | let $t02006620136 = getPoolData(Address(fromBase58String(pool)), pType) | |
622 | - | let aId = $t02006620136._1 | |
623 | - | let bId = $t02006620136._2 | |
624 | - | let dPriceA = ( let @ = invoke(priceOracleAddr, "getTWAP60", [aId, false], nil) | |
625 | - | if ($isInstanceOf(@, "(Int, Int)")) | |
626 | - | then @ | |
627 | - | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._2 | |
628 | - | let dPriceB = ( let @ = invoke(priceOracleAddr, "getTWAP60", [bId, false], nil) | |
629 | - | if ($isInstanceOf(@, "(Int, Int)")) | |
630 | - | then @ | |
631 | - | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._2 | |
632 | - | $Tuple2(nil, (dPriceA + dPriceB)) | |
633 | - | } | |
634 | - | ||
635 | - | ||
636 | - | ||
637 | - | @Callable(i) | |
638 | 699 | func replenishEVALONLY (pool,leverage,borrowAssetId) = if (if ((100 > leverage)) | |
639 | 700 | then true | |
640 | 701 | else (leverage > 300)) | |
641 | 702 | then throw("Leverage can't be <100 and >300") | |
642 | 703 | else { | |
643 | 704 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
644 | - | let $ | |
645 | - | let AId = $ | |
646 | - | let BId = $ | |
647 | - | let balA = $ | |
648 | - | let balB = $ | |
649 | - | let shareId = $ | |
650 | - | let $ | |
705 | + | let $t02228422374 = getPoolData(Address(fromBase58String(pool)), pType) | |
706 | + | let AId = $t02228422374._1 | |
707 | + | let BId = $t02228422374._2 | |
708 | + | let balA = $t02228422374._3 | |
709 | + | let balB = $t02228422374._4 | |
710 | + | let shareId = $t02228422374._5 | |
711 | + | let $t02237723014 = if ((size(i.payments) == 2)) | |
651 | 712 | then if ((assetIdToStr(i.payments[0].assetId) != AId)) | |
652 | 713 | then throw("Wrong payment asset A") | |
653 | 714 | else if ((assetIdToStr(i.payments[1].assetId) != BId)) | |
660 | 721 | then $Tuple4(0, AId, i.payments[0].amount, BId) | |
661 | 722 | else throw("Wrong payment") | |
662 | 723 | else throw("One or two payments expected") | |
663 | - | let pmtA = $ | |
664 | - | let pmtAssetA = $ | |
665 | - | let pmtB = $ | |
666 | - | let pmtAssetB = $ | |
667 | - | let $ | |
724 | + | let pmtA = $t02237723014._1 | |
725 | + | let pmtAssetA = $t02237723014._2 | |
726 | + | let pmtB = $t02237723014._3 | |
727 | + | let pmtAssetB = $t02237723014._4 | |
728 | + | let $t02301724468 = if ((leverage > 100)) | |
668 | 729 | then { | |
669 | 730 | let dPriceA = ( let @ = invoke(priceOracleAddr, "getTWAP60", [pmtAssetA, false], nil) | |
670 | 731 | if ($isInstanceOf(@, "(Int, Int)")) | |
694 | 755 | else throw("Strict value is not equal to itself.") | |
695 | 756 | } | |
696 | 757 | else $Tuple2(replenishByType(pType, pool, NO_LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId)._1, 0) | |
697 | - | let userStaked = $ | |
698 | - | let borrowAmount = $ | |
699 | - | let $ | |
700 | - | if (($ | |
758 | + | let userStaked = $t02301724468._1 | |
759 | + | let borrowAmount = $t02301724468._2 | |
760 | + | let $t02447224639 = withdrawAmountCalc(pool, userStaked, borrowAmount, borrowAssetId) | |
761 | + | if (($t02447224639 == $t02447224639)) | |
701 | 762 | then { | |
702 | - | let userGetBBeforeRepay = $ | |
703 | - | let userGetABeforeRepay = $ | |
704 | - | let assetIdB = $ | |
705 | - | let toUserAmountB = $ | |
706 | - | let assetIdA = $ | |
707 | - | let toUserAmountA = $ | |
708 | - | let $ | |
709 | - | let AIdAfter = $ | |
710 | - | let BIdAfter = $ | |
711 | - | let balAAfter = $ | |
712 | - | let balBAfter = $ | |
713 | - | let shareIdAfter = $ | |
763 | + | let userGetBBeforeRepay = $t02447224639._6 | |
764 | + | let userGetABeforeRepay = $t02447224639._5 | |
765 | + | let assetIdB = $t02447224639._4 | |
766 | + | let toUserAmountB = $t02447224639._3 | |
767 | + | let assetIdA = $t02447224639._2 | |
768 | + | let toUserAmountA = $t02447224639._1 | |
769 | + | let $t02464224757 = getPoolData(Address(fromBase58String(pool)), pType) | |
770 | + | let AIdAfter = $t02464224757._1 | |
771 | + | let BIdAfter = $t02464224757._2 | |
772 | + | let balAAfter = $t02464224757._3 | |
773 | + | let balBAfter = $t02464224757._4 | |
774 | + | let shareIdAfter = $t02464224757._5 | |
714 | 775 | let ratioBefore = fraction(balB, SCALE8, balA) | |
715 | 776 | let ratioAfter = fraction(balBAfter, SCALE8, balAAfter) | |
716 | 777 | let impact = (SCALE8 - fraction(ratioBefore, SCALE8, ratioAfter)) | |
726 | 787 | ||
727 | 788 | @Callable(i) | |
728 | 789 | func replenishFromLandEVALONLY (requestId) = { | |
729 | - | let $ | |
730 | - | let user = $ | |
731 | - | let pool = $ | |
732 | - | let pmtA = $ | |
733 | - | let AId = $ | |
734 | - | let pmtB = $ | |
735 | - | let BId = $ | |
736 | - | let balA = $ | |
737 | - | let balB = $ | |
738 | - | let shareId = $ | |
739 | - | let bwAsset = $ | |
740 | - | let bwAmount = $ | |
790 | + | let $t02512725231 = parseRequest(requestId) | |
791 | + | let user = $t02512725231._1 | |
792 | + | let pool = $t02512725231._2 | |
793 | + | let pmtA = $t02512725231._3 | |
794 | + | let AId = $t02512725231._4 | |
795 | + | let pmtB = $t02512725231._5 | |
796 | + | let BId = $t02512725231._6 | |
797 | + | let balA = $t02512725231._7 | |
798 | + | let balB = $t02512725231._8 | |
799 | + | let shareId = $t02512725231._9 | |
800 | + | let bwAsset = $t02512725231._10 | |
801 | + | let bwAmount = $t02512725231._11 | |
741 | 802 | if ((size(i.payments) != 1)) | |
742 | 803 | then throw("Wrong payment size") | |
743 | 804 | else if (if ((assetIdToStr(i.payments[0].assetId) != bwAsset)) | |
745 | 806 | else (i.payments[0].amount != bwAmount)) | |
746 | 807 | then throw("Wrong payment") | |
747 | 808 | else { | |
748 | - | let $ | |
809 | + | let $t02542125545 = if ((AId == bwAsset)) | |
749 | 810 | then $Tuple2((pmtA + i.payments[0].amount), pmtB) | |
750 | 811 | else $Tuple2(pmtA, (pmtB + i.payments[0].amount)) | |
751 | - | let pmtAllA = $ | |
752 | - | let pmtAllB = $ | |
812 | + | let pmtAllA = $t02542125545._1 | |
813 | + | let pmtAllB = $t02542125545._2 | |
753 | 814 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
754 | - | let $ | |
755 | - | let userStaked = $ | |
756 | - | let axlyFee = $ | |
815 | + | let $t02562725736 = replenishByType(pType, pool, LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
816 | + | let userStaked = $t02562725736._1 | |
817 | + | let axlyFee = $t02562725736._2 | |
757 | 818 | $Tuple2([IntegerEntry("EVALONLY_STAKEDAMOUNT", userStaked)], userStaked) | |
758 | 819 | } | |
759 | 820 | } | |
767 | 828 | then throw("Leverage can't be <100 and >300") | |
768 | 829 | else { | |
769 | 830 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
770 | - | let $ | |
771 | - | let AId = $ | |
772 | - | let BId = $ | |
773 | - | let balA = $ | |
774 | - | let balB = $ | |
775 | - | let shareId = $ | |
776 | - | let $ | |
831 | + | let $t02611326203 = getPoolData(Address(fromBase58String(pool)), pType) | |
832 | + | let AId = $t02611326203._1 | |
833 | + | let BId = $t02611326203._2 | |
834 | + | let balA = $t02611326203._3 | |
835 | + | let balB = $t02611326203._4 | |
836 | + | let shareId = $t02611326203._5 | |
837 | + | let $t02620626843 = if ((size(i.payments) == 2)) | |
777 | 838 | then if ((assetIdToStr(i.payments[0].assetId) != AId)) | |
778 | 839 | then throw("Wrong payment asset A") | |
779 | 840 | else if ((assetIdToStr(i.payments[1].assetId) != BId)) | |
786 | 847 | then $Tuple4(0, AId, i.payments[0].amount, BId) | |
787 | 848 | else throw("Wrong payment") | |
788 | 849 | else throw("One or two payments expected") | |
789 | - | let pmtA = $ | |
790 | - | let pmtAssetA = $ | |
791 | - | let pmtB = $ | |
792 | - | let pmtAssetB = $ | |
850 | + | let pmtA = $t02620626843._1 | |
851 | + | let pmtAssetA = $t02620626843._2 | |
852 | + | let pmtB = $t02620626843._3 | |
853 | + | let pmtAssetB = $t02620626843._4 | |
793 | 854 | let newPosNum = getNewUserPositionNumber(pool, toString(i.caller)) | |
794 | 855 | if ((leverage > 100)) | |
795 | 856 | then { | |
821 | 882 | else throw("Strict value is not equal to itself.") | |
822 | 883 | } | |
823 | 884 | else { | |
824 | - | let $ | |
825 | - | let userStaked = $ | |
826 | - | let axlyFee = $ | |
827 | - | replenishEntries(pool, toString(i.caller), userStaked, axlyFee, newPosNum, shareId, pType) | |
885 | + | let $t02814028252 = replenishByType(pType, pool, NO_LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
886 | + | let userStaked = $t02814028252._1 | |
887 | + | let axlyFee = $t02814028252._2 | |
888 | + | (replenishEntries(pool, toString(i.caller), userStaked, axlyFee, newPosNum, shareId, pType) ++ getCursEntries(AId, BId, shareId)) | |
828 | 889 | } | |
829 | 890 | } | |
830 | 891 | ||
832 | 893 | ||
833 | 894 | @Callable(i) | |
834 | 895 | func replenishFromLand (requestId) = { | |
835 | - | let $ | |
836 | - | let user = $ | |
837 | - | let pool = $ | |
838 | - | let pmtA = $ | |
839 | - | let AId = $ | |
840 | - | let pmtB = $ | |
841 | - | let BId = $ | |
842 | - | let balA = $ | |
843 | - | let balB = $ | |
844 | - | let shareId = $ | |
845 | - | let bwAsset = $ | |
846 | - | let bwAmount = $ | |
896 | + | let $t02845628560 = parseRequest(requestId) | |
897 | + | let user = $t02845628560._1 | |
898 | + | let pool = $t02845628560._2 | |
899 | + | let pmtA = $t02845628560._3 | |
900 | + | let AId = $t02845628560._4 | |
901 | + | let pmtB = $t02845628560._5 | |
902 | + | let BId = $t02845628560._6 | |
903 | + | let balA = $t02845628560._7 | |
904 | + | let balB = $t02845628560._8 | |
905 | + | let shareId = $t02845628560._9 | |
906 | + | let bwAsset = $t02845628560._10 | |
907 | + | let bwAmount = $t02845628560._11 | |
847 | 908 | if ((size(i.payments) != 1)) | |
848 | 909 | then throw("Wrong payment size") | |
849 | 910 | else if (if ((assetIdToStr(i.payments[0].assetId) != bwAsset)) | |
851 | 912 | else (i.payments[0].amount != bwAmount)) | |
852 | 913 | then throw("Wrong payment") | |
853 | 914 | else { | |
854 | - | let $ | |
915 | + | let $t02875028874 = if ((AId == bwAsset)) | |
855 | 916 | then $Tuple2((pmtA + i.payments[0].amount), pmtB) | |
856 | 917 | else $Tuple2(pmtA, (pmtB + i.payments[0].amount)) | |
857 | - | let pmtAllA = $ | |
858 | - | let pmtAllB = $ | |
918 | + | let pmtAllA = $t02875028874._1 | |
919 | + | let pmtAllB = $t02875028874._2 | |
859 | 920 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
860 | - | let $ | |
861 | - | let userStaked = $ | |
862 | - | let axlyFee = $ | |
921 | + | let $t02895629065 = replenishByType(pType, pool, LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
922 | + | let userStaked = $t02895629065._1 | |
923 | + | let axlyFee = $t02895629065._2 | |
863 | 924 | let posNum = getNewUserPositionNumber(pool, toString(i.caller)) | |
864 | 925 | let borrowEntries = [IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAmount), bwAmount), StringEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAssetId), bwAsset)] | |
865 | 926 | let entries = replenishEntries(pool, user, userStaked, axlyFee, posNum, shareId, pType) | |
866 | - | $Tuple2(((entries ++ borrowEntries) :+ DeleteEntry((requestId + kRequestId))), userStaked) | |
927 | + | $Tuple2((((entries ++ getCursEntries(AId, BId, shareId)) ++ borrowEntries) :+ DeleteEntry((requestId + kRequestId))), userStaked) | |
867 | 928 | } | |
868 | 929 | } | |
869 | 930 | ||
888 | 949 | else throw(($getType(@) + " couldn't be cast to Int")) | |
889 | 950 | } | |
890 | 951 | else 0 | |
891 | - | let $ | |
892 | - | if (($ | |
952 | + | let $t03054430697 = withdrawAmountCalc(pool, userCanWithdraw, debt, borrowAsset) | |
953 | + | if (($t03054430697 == $t03054430697)) | |
893 | 954 | then { | |
894 | - | let assetIdB = $t02880228922._4 | |
895 | - | let toUserAmountB = $t02880228922._3 | |
896 | - | let assetIdA = $t02880228922._2 | |
897 | - | let toUserAmountA = $t02880228922._1 | |
955 | + | let shareId = $t03054430697._7 | |
956 | + | let cBalBAfter = $t03054430697._6 | |
957 | + | let cBalAAfter = $t03054430697._5 | |
958 | + | let assetIdB = $t03054430697._4 | |
959 | + | let toUserAmountB = $t03054430697._3 | |
960 | + | let assetIdA = $t03054430697._2 | |
961 | + | let toUserAmountA = $t03054430697._1 | |
898 | 962 | let closeDbtInv = if ((debt > 0)) | |
899 | 963 | then invoke(getLendSrvAddr(), "repayFor", [((user + "_") + toString(posId))], [AttachedPayment(assetIdFromStr(borrowAsset), debt)]) | |
900 | 964 | else 0 | |
901 | 965 | if ((closeDbtInv == closeDbtInv)) | |
902 | - | then [DeleteEntry((((((pool + "_") + user) + "_") + toString(posId)) + kUserPosition)), DeleteEntry((((((pool + "_") + user) + "_") + toString(posId)) + kUserPositionInterest)), IntegerEntry((pool + kPoolTotal), (poolTotalShare - userCanWithdraw)), ScriptTransfer(userAddr, toUserAmountA, assetIdFromStr(assetIdA)), ScriptTransfer(userAddr, toUserAmountB, assetIdFromStr(assetIdB))] | |
966 | + | then ([DeleteEntry((((((pool + "_") + user) + "_") + toString(posId)) + kUserPosition)), DeleteEntry((((((pool + "_") + user) + "_") + toString(posId)) + kUserPositionInterest)), IntegerEntry((pool + kPoolTotal), (poolTotalShare - userCanWithdraw)), ScriptTransfer(userAddr, toUserAmountA, assetIdFromStr(assetIdA)), ScriptTransfer(userAddr, toUserAmountB, assetIdFromStr(assetIdB))] ++ getCursEntries(assetIdA, assetIdB, shareId)) | |
903 | 967 | else throw("Strict value is not equal to itself.") | |
904 | 968 | } | |
905 | 969 | else throw("Strict value is not equal to itself.") | |
917 | 981 | ||
918 | 982 | @Callable(i) | |
919 | 983 | func capitalizeExKeeper (pool,type,tokenToId,amountToExchange,claim,amountsIn,addresses,assetsToReceive,estReceived,slippageTolerance,minReceived,options) = { | |
920 | - | let $ | |
984 | + | let $t03204132235 = if (claim) | |
921 | 985 | then claimFarmed(type, pool) | |
922 | 986 | else { | |
923 | 987 | let claimedAsset = if ((type == SF_POOL)) | |
925 | 989 | else WXID | |
926 | 990 | $Tuple2(amountToExchange, claimedAsset) | |
927 | 991 | } | |
928 | - | let claimedAmount = $ | |
929 | - | let claimedAsset = $ | |
992 | + | let claimedAmount = $t03204132235._1 | |
993 | + | let claimedAsset = $t03204132235._2 | |
930 | 994 | let exchangedAmount = exchangeKeeper(tokenToId, amountToExchange, claimedAsset, amountsIn, addresses, assetsToReceive, estReceived, slippageTolerance, minReceived, options) | |
931 | 995 | let change = (claimedAmount - amountToExchange) | |
932 | 996 | let changeEntry = if ((change > 0)) | |
939 | 1003 | ||
940 | 1004 | @Callable(i) | |
941 | 1005 | func capitalizeExPazzle (pool,type,tokenToId,amountToExchange,claim,routesStr,minToReceive,options) = { | |
942 | - | let $ | |
1006 | + | let $t03289233086 = if (claim) | |
943 | 1007 | then claimFarmed(type, pool) | |
944 | 1008 | else { | |
945 | 1009 | let claimedAsset = if ((type == SF_POOL)) | |
947 | 1011 | else WXID | |
948 | 1012 | $Tuple2(amountToExchange, claimedAsset) | |
949 | 1013 | } | |
950 | - | let claimedAmount = $ | |
951 | - | let claimedAsset = $ | |
1014 | + | let claimedAmount = $t03289233086._1 | |
1015 | + | let claimedAsset = $t03289233086._2 | |
952 | 1016 | let exchangedAmount = exchangePazzle(tokenToId, amountToExchange, claimedAsset, routesStr, minToReceive, options) | |
953 | 1017 | let change = (claimedAmount - amountToExchange) | |
954 | 1018 | let changeEntry = if ((change > 0)) | |
961 | 1025 | ||
962 | 1026 | @Callable(i) | |
963 | 1027 | func capitalizeExSwopFi (pool,type,tokenToId,amountToExchange,claim,exchangers,exchangersType,args1,args2,routingAssetsKeys,minAmountToReceive,options) = { | |
964 | - | let $ | |
1028 | + | let $t03380934003 = if (claim) | |
965 | 1029 | then claimFarmed(type, pool) | |
966 | 1030 | else { | |
967 | 1031 | let claimedAsset = if ((type == SF_POOL)) | |
969 | 1033 | else WXID | |
970 | 1034 | $Tuple2(amountToExchange, claimedAsset) | |
971 | 1035 | } | |
972 | - | let claimedAmount = $ | |
973 | - | let claimedAsset = $ | |
1036 | + | let claimedAmount = $t03380934003._1 | |
1037 | + | let claimedAsset = $t03380934003._2 | |
974 | 1038 | let exchangedAmount = exchangeSwopFi(tokenToId, amountToExchange, claimedAsset, exchangers, exchangersType, args1, args2, routingAssetsKeys, minAmountToReceive, options) | |
975 | 1039 | let change = (claimedAmount - amountToExchange) | |
976 | 1040 | let changeEntry = if ((change > 0)) | |
987 | 1051 | else false) | |
988 | 1052 | then throw("Wrong type") | |
989 | 1053 | else { | |
990 | - | let $ | |
991 | - | let aId = $ | |
992 | - | let bId = $ | |
993 | - | let aBal = $ | |
994 | - | let bBal = $ | |
995 | - | let shareId = $ | |
1054 | + | let $t03464834742 = getPoolData(Address(fromBase58String(poolAddr)), type) | |
1055 | + | let aId = $t03464834742._1 | |
1056 | + | let bId = $t03464834742._2 | |
1057 | + | let aBal = $t03464834742._3 | |
1058 | + | let bBal = $t03464834742._4 | |
1059 | + | let shareId = $t03464834742._5 | |
996 | 1060 | [IntegerEntry((poolAddr + kAxlyInFeeWithoutLoan), inFeeNoLoan), IntegerEntry((poolAddr + kAxlyInFeeWithLoan), inFeeLoan), IntegerEntry((poolAddr + kAxlyNoLoanCapFee), capFeeNoLoan), IntegerEntry((poolAddr + kAxlyWithLoanCapFee), capFeeWithLoan), IntegerEntry((poolAddr + kPoolInterest), 0), StringEntry((kPool + poolAddr), type), StringEntry((shareId + kSharePool), poolAddr)] | |
997 | 1061 | } | |
998 | 1062 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SF_POOL = "SF" | |
5 | 5 | ||
6 | 6 | let WX_POOL = "WX" | |
7 | 7 | ||
8 | 8 | let CAP_FEE_NO_LOAN = "capNoLoan" | |
9 | 9 | ||
10 | 10 | let CAP_FEE_LOAN = "capLoan" | |
11 | + | ||
12 | + | let CAP_FEE = "cap" | |
11 | 13 | ||
12 | 14 | let LOAN_FEE = "loan" | |
13 | 15 | ||
14 | 16 | let NO_LOAN_FEE = "noLoan" | |
15 | 17 | ||
16 | 18 | let SCALE8 = 100000000 | |
17 | 19 | ||
18 | 20 | let SCALE10 = 10000000000 | |
19 | 21 | ||
20 | 22 | let FEE_SCALE6 = 1000000 | |
21 | 23 | ||
22 | 24 | let kSFPoolAAssetBalance = "A_asset_balance" | |
23 | 25 | ||
24 | 26 | let kSFPoolBAssetBalance = "B_asset_balance" | |
25 | 27 | ||
26 | 28 | let kSFPoolAAssetId = "A_asset_id" | |
27 | 29 | ||
28 | 30 | let kSFPoolBAssetId = "B_asset_id" | |
29 | 31 | ||
30 | 32 | let kSFPoolShareId = "share_asset_id" | |
33 | + | ||
34 | + | let kSFPoolShareSupply = "share_asset_supply" | |
31 | 35 | ||
32 | 36 | let kSFPoolFee = "commission" | |
33 | 37 | ||
34 | 38 | let kUserPosition = "_user_position" | |
35 | 39 | ||
36 | 40 | let kUserBorrowAmount = "_user_position_borrow_amount" | |
37 | 41 | ||
38 | 42 | let kUserBorrowAssetId = "_user_position_borrow_asset_id" | |
39 | 43 | ||
40 | 44 | let kUserPositionNum = "_user_position_number" | |
41 | 45 | ||
42 | 46 | let kUserPositionInterest = "_user_position_interest" | |
43 | 47 | ||
44 | 48 | let kPoolTotal = "_pool_total" | |
45 | 49 | ||
46 | 50 | let kPoolTotalLoan = "_pool_total_loan" | |
47 | 51 | ||
48 | 52 | let kPoolInterest = "_pool_interest" | |
49 | 53 | ||
50 | 54 | let kAxlyInFeeWithoutLoan = "_axly_fee_without_loan" | |
51 | 55 | ||
52 | 56 | let kAxlyInFeeWithLoan = "_axly_fee_with_loan" | |
53 | 57 | ||
54 | 58 | let kAxlyNoLoanCapFee = "_axly_fee_cap_with_loan" | |
55 | 59 | ||
56 | 60 | let kAxlyWithLoanCapFee = "_axly_fee_cap_no_loan" | |
57 | 61 | ||
58 | 62 | let kRequestId = "_request_id" | |
59 | 63 | ||
60 | 64 | let kRequestIter = "requests_iter" | |
61 | 65 | ||
62 | 66 | let kPool = "pool_" | |
63 | 67 | ||
64 | 68 | let kSharePool = "_pool_share_id" | |
65 | 69 | ||
66 | 70 | let kPoolCapChange = "_pool_cap_change" | |
71 | + | ||
72 | + | let kTokenLastPrice = "_last_price" | |
67 | 73 | ||
68 | 74 | let kMoneyBox = "axly_money_box" | |
69 | 75 | ||
70 | 76 | let kSFFarmingAddr = "swopfi_farming_addr" | |
71 | 77 | ||
72 | 78 | let kLendService = "lend_service_addr" | |
73 | 79 | ||
74 | 80 | let kPriceOracle = "price_oracle" | |
75 | 81 | ||
76 | 82 | let kExContract = "exchange_contract" | |
77 | 83 | ||
78 | 84 | let kWxSwapContract = "wx_swap_contract" | |
79 | 85 | ||
80 | 86 | let moneyBox = Address(fromBase58String(valueOrErrorMessage(getString(this, kMoneyBox), "No axly moneyBox address"))) | |
81 | 87 | ||
82 | 88 | let exContract = Address(fromBase58String(valueOrErrorMessage(getString(this, kExContract), "No exchange contract address"))) | |
83 | 89 | ||
84 | 90 | let priceOracleAddr = Address(fromBase58String(valueOrErrorMessage(getString(this, kPriceOracle), "No price oracle address"))) | |
85 | 91 | ||
86 | 92 | let wxSwapContract = Address(fromBase58String(valueOrErrorMessage(getString(this, kWxSwapContract), "No wx swap address"))) | |
87 | 93 | ||
88 | 94 | let SWOPID = base58'4W19ndijcc2CsQa9HGW2dfXKTVXhnneWWttxXrtjPmEp' | |
89 | 95 | ||
90 | 96 | let WXID = base58'EMAMLxDnv3xiz8RXg8Btj33jcEw3wLczL3JKYYmuubpc' | |
91 | 97 | ||
92 | 98 | func isSelfCall (i) = if ((i.caller == this)) | |
93 | 99 | then unit | |
94 | 100 | else throw("Only contract itself can call this function") | |
95 | 101 | ||
96 | 102 | ||
97 | 103 | func accountBalance (assetId) = match assetId { | |
98 | 104 | case id: ByteVector => | |
99 | 105 | assetBalance(this, id) | |
100 | 106 | case waves: Unit => | |
101 | 107 | wavesBalance(this).available | |
102 | 108 | case _ => | |
103 | 109 | throw("Match error") | |
104 | 110 | } | |
105 | 111 | ||
106 | 112 | ||
107 | 113 | func getSFPoolData (poolAddr) = $Tuple5(valueOrErrorMessage(getString(poolAddr, kSFPoolAAssetId), "Can't get pool A asset id"), valueOrErrorMessage(getString(poolAddr, kSFPoolBAssetId), "Can't get pool B asset id"), valueOrErrorMessage(getInteger(poolAddr, kSFPoolAAssetBalance), "Can't get pool A asset balance"), valueOrErrorMessage(getInteger(poolAddr, kSFPoolBAssetBalance), "Can't get pool B asset balance"), valueOrErrorMessage(getString(poolAddr, kSFPoolShareId), "Can't get share asset id")) | |
108 | 114 | ||
109 | 115 | ||
110 | 116 | func getWXPoolData (poolAddr) = { | |
111 | 117 | let cfg = { | |
112 | 118 | let @ = invoke(poolAddr, "getPoolConfigWrapperREADONLY", nil, nil) | |
113 | 119 | if ($isInstanceOf(@, "List[Any]")) | |
114 | 120 | then @ | |
115 | 121 | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
116 | 122 | } | |
117 | 123 | if ((cfg == cfg)) | |
118 | 124 | then { | |
119 | 125 | let aId = valueOrErrorMessage({ | |
120 | 126 | let @ = cfg[4] | |
121 | 127 | if ($isInstanceOf(@, "String")) | |
122 | 128 | then @ | |
123 | 129 | else unit | |
124 | 130 | }, "Can't get pool A asset id") | |
125 | 131 | let bId = valueOrErrorMessage({ | |
126 | 132 | let @ = cfg[5] | |
127 | 133 | if ($isInstanceOf(@, "String")) | |
128 | 134 | then @ | |
129 | 135 | else unit | |
130 | 136 | }, "Can't get pool B asset id") | |
131 | 137 | let shareId = valueOrErrorMessage({ | |
132 | 138 | let @ = cfg[3] | |
133 | 139 | if ($isInstanceOf(@, "String")) | |
134 | 140 | then @ | |
135 | 141 | else unit | |
136 | 142 | }, "Can't get pool LP asset id") | |
137 | 143 | let balA = { | |
138 | 144 | let @ = invoke(poolAddr, "getAccBalanceWrapperREADONLY", [aId], nil) | |
139 | 145 | if ($isInstanceOf(@, "Int")) | |
140 | 146 | then @ | |
141 | 147 | else throw(($getType(@) + " couldn't be cast to Int")) | |
142 | 148 | } | |
143 | 149 | if ((balA == balA)) | |
144 | 150 | then { | |
145 | 151 | let balB = { | |
146 | 152 | let @ = invoke(poolAddr, "getAccBalanceWrapperREADONLY", [bId], nil) | |
147 | 153 | if ($isInstanceOf(@, "Int")) | |
148 | 154 | then @ | |
149 | 155 | else throw(($getType(@) + " couldn't be cast to Int")) | |
150 | 156 | } | |
151 | 157 | if ((balB == balB)) | |
152 | 158 | then $Tuple5(aId, bId, balA, balB, shareId) | |
153 | 159 | else throw("Strict value is not equal to itself.") | |
154 | 160 | } | |
155 | 161 | else throw("Strict value is not equal to itself.") | |
156 | 162 | } | |
157 | 163 | else throw("Strict value is not equal to itself.") | |
158 | 164 | } | |
159 | 165 | ||
160 | 166 | ||
161 | 167 | func getPoolData (poolAddr,type) = if ((type == SF_POOL)) | |
162 | 168 | then getSFPoolData(poolAddr) | |
163 | 169 | else if ((type == WX_POOL)) | |
164 | 170 | then getWXPoolData(poolAddr) | |
165 | 171 | else throw("Wrong pool type") | |
166 | 172 | ||
167 | 173 | ||
174 | + | func getShareSupply (poolAddr,type,shareId) = if ((type == SF_POOL)) | |
175 | + | then valueOrErrorMessage(getInteger(poolAddr, kSFPoolShareSupply), "Can't get share asset supply") | |
176 | + | else if ((type == WX_POOL)) | |
177 | + | then valueOrErrorMessage(assetInfo(fromBase58String(shareId)), "Wrong ShareId").quantity | |
178 | + | else throw("Wrong pool type") | |
179 | + | ||
180 | + | ||
168 | 181 | func getPoolTotalShare (pool) = valueOrElse(getInteger(this, (pool + kPoolTotal)), 0) | |
169 | 182 | ||
170 | 183 | ||
171 | 184 | func getPoolTotalShareWithLoan (pool) = valueOrElse(getInteger(this, (pool + kPoolTotalLoan)), 0) | |
172 | 185 | ||
173 | 186 | ||
174 | 187 | func getNewUserPositionNumber (pool,user) = (valueOrElse(getInteger(this, (((pool + "_") + user) + kUserPositionNum)), 0) + 1) | |
175 | 188 | ||
176 | 189 | ||
177 | 190 | func getAxlyFee (pool,feeType) = if ((feeType == CAP_FEE_LOAN)) | |
178 | 191 | then getIntegerValue(this, (pool + kAxlyWithLoanCapFee)) | |
179 | 192 | else if ((feeType == CAP_FEE_NO_LOAN)) | |
180 | 193 | then getIntegerValue(this, (pool + kAxlyNoLoanCapFee)) | |
181 | 194 | else if ((feeType == LOAN_FEE)) | |
182 | 195 | then getIntegerValue(this, (pool + kAxlyInFeeWithLoan)) | |
183 | 196 | else if ((feeType == NO_LOAN_FEE)) | |
184 | 197 | then getIntegerValue(this, (pool + kAxlyInFeeWithoutLoan)) | |
185 | 198 | else throw("Wrong fee type") | |
186 | 199 | ||
187 | 200 | ||
188 | 201 | func getSFFarmingAddr () = Address(fromBase58String(valueOrErrorMessage(getString(this, kSFFarmingAddr), "Can't get swopfi farming addr"))) | |
189 | 202 | ||
190 | 203 | ||
191 | 204 | func getWXFarmingAddr (poolAddr) = { | |
192 | 205 | let fContract = Address(fromBase58String(valueOrErrorMessage(getString(poolAddr, "%s__factoryContract"), "Can't get WX factory contract addr"))) | |
193 | 206 | let factroyCfg = split(valueOrErrorMessage(getString(fContract, "%s__factoryConfig"), "Can't get WX factory cfg"), "__") | |
194 | 207 | Address(fromBase58String(factroyCfg[1])) | |
195 | 208 | } | |
196 | 209 | ||
197 | 210 | ||
198 | 211 | func getLendSrvAddr () = Address(fromBase58String(valueOrErrorMessage(getString(this, kLendService), "Can't get lend service addr"))) | |
199 | 212 | ||
200 | 213 | ||
201 | 214 | func assetIdToStr (assetId) = match assetId { | |
202 | 215 | case id: ByteVector => | |
203 | 216 | toBase58String(id) | |
204 | 217 | case waves: Unit => | |
205 | 218 | "WAVES" | |
206 | 219 | case _ => | |
207 | 220 | throw("Match error") | |
208 | 221 | } | |
209 | 222 | ||
210 | 223 | ||
211 | 224 | func assetIdFromStr (assetId) = if ((assetId == "WAVES")) | |
212 | 225 | then unit | |
213 | 226 | else fromBase58String(assetId) | |
214 | 227 | ||
215 | 228 | ||
216 | 229 | func getAssetDecimals (assetId) = if ((assetId == "WAVES")) | |
217 | 230 | then 8 | |
218 | 231 | else match assetInfo(fromBase58String(assetId)) { | |
219 | 232 | case asset: Asset => | |
220 | 233 | asset.decimals | |
221 | 234 | case _ => | |
222 | 235 | throw("Can't find asset") | |
223 | 236 | } | |
224 | 237 | ||
225 | 238 | ||
239 | + | func getAssetsPrice (assetIds) = { | |
240 | + | func getPrices (a,assetId) = { | |
241 | + | let assetPrice = ( let @ = invoke(priceOracleAddr, "getTWAP60", [assetId, false], nil) | |
242 | + | if ($isInstanceOf(@, "(Int, Int)")) | |
243 | + | then @ | |
244 | + | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._2 | |
245 | + | (a :+ assetPrice) | |
246 | + | } | |
247 | + | ||
248 | + | let $l = assetIds | |
249 | + | let $s = size($l) | |
250 | + | let $acc0 = nil | |
251 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
252 | + | then $a | |
253 | + | else getPrices($a, $l[$i]) | |
254 | + | ||
255 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
256 | + | then $a | |
257 | + | else throw("List size exceeds 100") | |
258 | + | ||
259 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
260 | + | } | |
261 | + | ||
262 | + | ||
263 | + | func getSharePrice (shareIds) = { | |
264 | + | func getPrices (a,shareId) = { | |
265 | + | let pool = valueOrErrorMessage(getString(this, (shareId + kSharePool)), "Can't find pool addr by share id") | |
266 | + | let poolAddr = Address(fromBase58String(pool)) | |
267 | + | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
268 | + | let $t077377802 = getPoolData(poolAddr, pType) | |
269 | + | let aId = $t077377802._1 | |
270 | + | let bId = $t077377802._2 | |
271 | + | let aBalance = $t077377802._3 | |
272 | + | let bBalance = $t077377802._4 | |
273 | + | let dPriceA = ( let @ = invoke(priceOracleAddr, "getTWAP60", [aId, false], nil) | |
274 | + | if ($isInstanceOf(@, "(Int, Int)")) | |
275 | + | then @ | |
276 | + | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._2 | |
277 | + | let dPriceB = ( let @ = invoke(priceOracleAddr, "getTWAP60", [bId, false], nil) | |
278 | + | if ($isInstanceOf(@, "(Int, Int)")) | |
279 | + | then @ | |
280 | + | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._2 | |
281 | + | let shareSupply = getShareSupply(poolAddr, pType, shareId) | |
282 | + | let APrecision = pow(10, 0, getAssetDecimals(aId), 0, 0, DOWN) | |
283 | + | let BPrecision = pow(10, 0, getAssetDecimals(bId), 0, 0, DOWN) | |
284 | + | let sharePrecision = pow(10, 0, getAssetDecimals(shareId), 0, 0, DOWN) | |
285 | + | let sum = (fraction(aBalance, dPriceA, APrecision) + fraction(bBalance, dPriceB, BPrecision)) | |
286 | + | let sharePrice = fraction(sum, sharePrecision, shareSupply) | |
287 | + | (a :+ sharePrice) | |
288 | + | } | |
289 | + | ||
290 | + | let $l = shareIds | |
291 | + | let $s = size($l) | |
292 | + | let $acc0 = nil | |
293 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
294 | + | then $a | |
295 | + | else getPrices($a, $l[$i]) | |
296 | + | ||
297 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
298 | + | then $a | |
299 | + | else throw("List size exceeds 50") | |
300 | + | ||
301 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50) | |
302 | + | } | |
303 | + | ||
304 | + | ||
305 | + | func getCursEntries (aId,bId,shareId) = { | |
306 | + | let assetsPrices = getAssetsPrice([aId, bId]) | |
307 | + | let sharePrice = getSharePrice([shareId]) | |
308 | + | [IntegerEntry((aId + kTokenLastPrice), assetsPrices[0]), IntegerEntry((bId + kTokenLastPrice), assetsPrices[1]), IntegerEntry((shareId + kTokenLastPrice), sharePrice[0])] | |
309 | + | } | |
310 | + | ||
311 | + | ||
226 | 312 | func replenishSwopFi (pool,feeType,pmtA,pmtAssetA,pmtB,pmtAssetB,balA,balB,shareId) = { | |
227 | 313 | let shareBalanceBefore = accountBalance(fromBase58String(shareId)) | |
228 | 314 | if ((shareBalanceBefore == shareBalanceBefore)) | |
229 | 315 | then { | |
230 | 316 | let poolAddr = Address(fromBase58String(pool)) | |
231 | 317 | let ratioA = fraction(SCALE8, pmtA, balA) | |
232 | 318 | let ratioB = fraction(SCALE8, pmtB, balB) | |
233 | - | let $ | |
319 | + | let $t093079599 = if ((ratioB > ratioA)) | |
234 | 320 | then { | |
235 | 321 | let pmt = fraction(balB, ratioA, SCALE8, CEILING) | |
236 | 322 | $Tuple4(pmtA, pmt, (pmtB - pmt), pmtAssetB) | |
237 | 323 | } | |
238 | 324 | else { | |
239 | 325 | let pmt = fraction(balA, ratioB, SCALE8, CEILING) | |
240 | 326 | $Tuple4(pmt, pmtB, (pmtA - pmt), pmtAssetA) | |
241 | 327 | } | |
242 | - | let pmtAmountA = $ | |
243 | - | let pmtAmountB = $ | |
244 | - | let change = $ | |
245 | - | let changeAssetId = $ | |
328 | + | let pmtAmountA = $t093079599._1 | |
329 | + | let pmtAmountB = $t093079599._2 | |
330 | + | let change = $t093079599._3 | |
331 | + | let changeAssetId = $t093079599._4 | |
246 | 332 | let inv1 = if (if ((pmtAmountA > 0)) | |
247 | 333 | then (pmtAmountB > 0) | |
248 | 334 | else false) | |
249 | 335 | then { | |
250 | 336 | let payments = [AttachedPayment(assetIdFromStr(pmtAssetA), pmtAmountA), AttachedPayment(assetIdFromStr(pmtAssetB), pmtAmountB)] | |
251 | 337 | invoke(poolAddr, "callFunction", ["replenishWithTwoTokens", ["false", "0"]], payments) | |
252 | 338 | } | |
253 | 339 | else 0 | |
254 | 340 | if ((inv1 == inv1)) | |
255 | 341 | then { | |
256 | 342 | let inv2 = if ((change > 0)) | |
257 | 343 | then { | |
258 | 344 | let payments = [AttachedPayment(assetIdFromStr(changeAssetId), change)] | |
259 | 345 | let vars = ["0", "false", "0"] | |
260 | 346 | invoke(poolAddr, "callFunction", ["replenishWithOneToken", vars], payments) | |
261 | 347 | } | |
262 | 348 | else 0 | |
263 | 349 | if ((inv2 == inv2)) | |
264 | 350 | then { | |
265 | 351 | let shareBalanceAfter = accountBalance(fromBase58String(shareId)) | |
266 | 352 | let totalStaked = (shareBalanceAfter - shareBalanceBefore) | |
267 | - | let axlyFeeAmount = fraction(totalStaked, getAxlyFee(pool, feeType), FEE_SCALE6) | |
353 | + | let axlyFeeAmount = if ((feeType == CAP_FEE)) | |
354 | + | then fraction(totalStaked, getAxlyFee(pool, feeType), FEE_SCALE6) | |
355 | + | else fraction(totalStaked, getAxlyFee(pool, feeType), FEE_SCALE6) | |
268 | 356 | let userShareForStake = (totalStaked - axlyFeeAmount) | |
269 | 357 | if ((0 >= userShareForStake)) | |
270 | 358 | then throw("amount of staked sharetokens must be > 0") | |
271 | 359 | else { | |
272 | 360 | let inv3 = invoke(getSFFarmingAddr(), "lockShareTokens", [pool, 0], [AttachedPayment(fromBase58String(shareId), userShareForStake)]) | |
273 | 361 | if ((inv3 == inv3)) | |
274 | 362 | then $Tuple2(userShareForStake, axlyFeeAmount) | |
275 | 363 | else throw("Strict value is not equal to itself.") | |
276 | 364 | } | |
277 | 365 | } | |
278 | 366 | else throw("Strict value is not equal to itself.") | |
279 | 367 | } | |
280 | 368 | else throw("Strict value is not equal to itself.") | |
281 | 369 | } | |
282 | 370 | else throw("Strict value is not equal to itself.") | |
283 | 371 | } | |
284 | 372 | ||
285 | 373 | ||
286 | 374 | func replenishWX (pool,feeType,pmtA,pmtAssetA,pmtB,pmtAssetB,shareId) = { | |
287 | 375 | let poolAddr = Address(fromBase58String(pool)) | |
288 | - | let $ | |
376 | + | let $t01116412013 = if (if ((pmtA > 0)) | |
289 | 377 | then (pmtB > 0) | |
290 | 378 | else false) | |
291 | 379 | then { | |
292 | 380 | let evalPutInA = split({ | |
293 | 381 | let @ = invoke(poolAddr, "evaluatePutByAmountAssetREADONLY", [pmtA], nil) | |
294 | 382 | if ($isInstanceOf(@, "String")) | |
295 | 383 | then @ | |
296 | 384 | else throw(($getType(@) + " couldn't be cast to String")) | |
297 | 385 | }, "__") | |
298 | 386 | if ((evalPutInA == evalPutInA)) | |
299 | 387 | then { | |
300 | 388 | let evalPutInB = split({ | |
301 | 389 | let @ = invoke(poolAddr, "evaluatePutByPriceAssetREADONLY", [pmtB], nil) | |
302 | 390 | if ($isInstanceOf(@, "String")) | |
303 | 391 | then @ | |
304 | 392 | else throw(($getType(@) + " couldn't be cast to String")) | |
305 | 393 | }, "__") | |
306 | 394 | if ((evalPutInB == evalPutInB)) | |
307 | 395 | then { | |
308 | 396 | let lpInA = parseIntValue(evalPutInA[1]) | |
309 | 397 | let lpInB = parseIntValue(evalPutInB[1]) | |
310 | 398 | if ((lpInB > lpInA)) | |
311 | 399 | then { | |
312 | 400 | let pmtInB = parseIntValue(evalPutInA[8]) | |
313 | 401 | $Tuple4(pmtA, pmtInB, (pmtB - pmtInB), pmtAssetB) | |
314 | 402 | } | |
315 | 403 | else { | |
316 | 404 | let pmtInA = parseIntValue(evalPutInB[7]) | |
317 | 405 | $Tuple4(pmtInA, pmtB, (pmtA - pmtInA), pmtAssetA) | |
318 | 406 | } | |
319 | 407 | } | |
320 | 408 | else throw("Strict value is not equal to itself.") | |
321 | 409 | } | |
322 | 410 | else throw("Strict value is not equal to itself.") | |
323 | 411 | } | |
324 | 412 | else if ((pmtA > 0)) | |
325 | 413 | then $Tuple4(pmtA, pmtB, pmtA, pmtAssetA) | |
326 | 414 | else if ((pmtB > 0)) | |
327 | 415 | then $Tuple4(pmtA, pmtB, pmtB, pmtAssetB) | |
328 | 416 | else throw("pmts must be > 0") | |
329 | - | let pmtAmountA = $ | |
330 | - | let pmtAmountB = $ | |
331 | - | let change = $ | |
332 | - | let changeAssetId = $ | |
417 | + | let pmtAmountA = $t01116412013._1 | |
418 | + | let pmtAmountB = $t01116412013._2 | |
419 | + | let change = $t01116412013._3 | |
420 | + | let changeAssetId = $t01116412013._4 | |
333 | 421 | let shareBalanceBefore = accountBalance(fromBase58String(shareId)) | |
334 | 422 | if ((shareBalanceBefore == shareBalanceBefore)) | |
335 | 423 | then { | |
336 | 424 | let inv1 = if (if ((pmtAmountA > 0)) | |
337 | 425 | then (pmtAmountB > 0) | |
338 | 426 | else false) | |
339 | 427 | then { | |
340 | 428 | let payments = [AttachedPayment(assetIdFromStr(pmtAssetA), pmtAmountA), AttachedPayment(assetIdFromStr(pmtAssetB), pmtAmountB)] | |
341 | 429 | invoke(poolAddr, "put", [1000000, false], payments) | |
342 | 430 | } | |
343 | 431 | else 0 | |
344 | 432 | if ((inv1 == inv1)) | |
345 | 433 | then { | |
346 | 434 | let inv2 = if ((change > 0)) | |
347 | 435 | then { | |
348 | 436 | let payments = [AttachedPayment(assetIdFromStr(changeAssetId), change)] | |
349 | 437 | invoke(poolAddr, "putOneTkn", [0, false], payments) | |
350 | 438 | } | |
351 | 439 | else 0 | |
352 | 440 | if ((inv2 == inv2)) | |
353 | 441 | then { | |
354 | 442 | let shareBalanceAfter = accountBalance(fromBase58String(shareId)) | |
355 | 443 | let totalStaked = (shareBalanceAfter - shareBalanceBefore) | |
356 | 444 | let axlyFeeAmount = fraction(totalStaked, getAxlyFee(pool, feeType), FEE_SCALE6) | |
357 | 445 | let userShareForStake = (totalStaked - axlyFeeAmount) | |
358 | 446 | if ((0 >= userShareForStake)) | |
359 | 447 | then throw("amount of staked sharetokens must be > 0") | |
360 | 448 | else { | |
361 | 449 | let inv3 = invoke(getWXFarmingAddr(poolAddr), "stake", nil, [AttachedPayment(fromBase58String(shareId), userShareForStake)]) | |
362 | 450 | if ((inv3 == inv3)) | |
363 | 451 | then $Tuple2(userShareForStake, axlyFeeAmount) | |
364 | 452 | else throw("Strict value is not equal to itself.") | |
365 | 453 | } | |
366 | 454 | } | |
367 | 455 | else throw("Strict value is not equal to itself.") | |
368 | 456 | } | |
369 | 457 | else throw("Strict value is not equal to itself.") | |
370 | 458 | } | |
371 | 459 | else throw("Strict value is not equal to itself.") | |
372 | 460 | } | |
373 | 461 | ||
374 | 462 | ||
375 | 463 | func replenishByType (type,pool,feeType,pmtA,AId,pmtB,BId,balA,balB,shareId) = if ((type == SF_POOL)) | |
376 | - | then replenishSwopFi(pool, | |
464 | + | then replenishSwopFi(pool, feeType, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
377 | 465 | else if ((type == WX_POOL)) | |
378 | - | then replenishWX(pool, | |
466 | + | then replenishWX(pool, feeType, pmtA, AId, pmtB, BId, shareId) | |
379 | 467 | else throw("Wrong pool type") | |
380 | 468 | ||
381 | 469 | ||
382 | 470 | func replenishEntries (pool,user,stakedAmount,axlyFeeAmount,posNum,shareId,type) = { | |
383 | 471 | let totalAmount = getPoolTotalShare(pool) | |
384 | 472 | let totalAmountLoan = getPoolTotalShareWithLoan(pool) | |
385 | 473 | let curPoolInterest = getIntegerValue(this, (pool + kPoolInterest)) | |
386 | 474 | [IntegerEntry((pool + kPoolTotal), (totalAmount + stakedAmount)), IntegerEntry((pool + kPoolTotalLoan), (totalAmountLoan + stakedAmount)), IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserPosition), stakedAmount), IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserPositionInterest), curPoolInterest), IntegerEntry((((pool + "_") + user) + kUserPositionNum), posNum), ScriptTransfer(moneyBox, axlyFeeAmount, fromBase58String(shareId))] | |
387 | 475 | } | |
388 | 476 | ||
389 | 477 | ||
390 | 478 | func claimFarmed (type,pool) = if ((type == SF_POOL)) | |
391 | 479 | then { | |
392 | 480 | let balBefore = accountBalance(SWOPID) | |
393 | 481 | if ((balBefore == balBefore)) | |
394 | 482 | then { | |
395 | 483 | let inv = invoke(getSFFarmingAddr(), "claim", [pool], nil) | |
396 | 484 | if ((inv == inv)) | |
397 | 485 | then { | |
398 | 486 | let balAfter = accountBalance(SWOPID) | |
399 | 487 | $Tuple2((balAfter - balBefore), SWOPID) | |
400 | 488 | } | |
401 | 489 | else throw("Strict value is not equal to itself.") | |
402 | 490 | } | |
403 | 491 | else throw("Strict value is not equal to itself.") | |
404 | 492 | } | |
405 | 493 | else if ((type == WX_POOL)) | |
406 | 494 | then { | |
407 | 495 | let balBefore = accountBalance(WXID) | |
408 | 496 | if ((balBefore == balBefore)) | |
409 | 497 | then { | |
410 | 498 | let inv = invoke(getWXFarmingAddr(Address(fromBase58String(pool))), "claimWX", [pool], nil) | |
411 | 499 | if ((inv == inv)) | |
412 | 500 | then { | |
413 | 501 | let balAfter = accountBalance(WXID) | |
414 | 502 | $Tuple2((balAfter - balBefore), WXID) | |
415 | 503 | } | |
416 | 504 | else throw("Strict value is not equal to itself.") | |
417 | 505 | } | |
418 | 506 | else throw("Strict value is not equal to itself.") | |
419 | 507 | } | |
420 | 508 | else throw("Wrong pool type") | |
421 | 509 | ||
422 | 510 | ||
423 | 511 | func exchangeKeeper (toToken,pmtAmount,pmtAsset,amountsIn,addresses,assetsToReceive,estReceived,slippageTolerance,minReceived,options) = { | |
424 | 512 | let tokenBalanceBefore = accountBalance(assetIdFromStr(toToken)) | |
425 | 513 | if ((tokenBalanceBefore == tokenBalanceBefore)) | |
426 | 514 | then { | |
427 | 515 | let inv = invoke(exContract, "swap", [amountsIn, addresses, assetsToReceive, estReceived, slippageTolerance, minReceived, options], [AttachedPayment(pmtAsset, pmtAmount)]) | |
428 | 516 | if ((inv == inv)) | |
429 | 517 | then (accountBalance(assetIdFromStr(toToken)) - tokenBalanceBefore) | |
430 | 518 | else throw("Strict value is not equal to itself.") | |
431 | 519 | } | |
432 | 520 | else throw("Strict value is not equal to itself.") | |
433 | 521 | } | |
434 | 522 | ||
435 | 523 | ||
436 | 524 | func exchangePazzle (toToken,pmtAmount,pmtAsset,routesStr,minToReceive,options) = { | |
437 | 525 | let tokenBalanceBefore = accountBalance(assetIdFromStr(toToken)) | |
438 | 526 | if ((tokenBalanceBefore == tokenBalanceBefore)) | |
439 | 527 | then { | |
440 | 528 | let inv = invoke(exContract, "puzzleSwap", [routesStr, minToReceive, options], [AttachedPayment(pmtAsset, pmtAmount)]) | |
441 | 529 | if ((inv == inv)) | |
442 | 530 | then (accountBalance(assetIdFromStr(toToken)) - tokenBalanceBefore) | |
443 | 531 | else throw("Strict value is not equal to itself.") | |
444 | 532 | } | |
445 | 533 | else throw("Strict value is not equal to itself.") | |
446 | 534 | } | |
447 | 535 | ||
448 | 536 | ||
449 | 537 | func exchangeSwopFi (toToken,pmtAmount,pmtAsset,exchangers,exchangersType,args1,args2,routingAssetsKeys,minAmountToReceive,options) = { | |
450 | 538 | let tokenBalanceBefore = accountBalance(assetIdFromStr(toToken)) | |
451 | 539 | if ((tokenBalanceBefore == tokenBalanceBefore)) | |
452 | 540 | then { | |
453 | 541 | let inv = invoke(exContract, "swopfiSwap", [exchangers, exchangersType, args1, args2, routingAssetsKeys, minAmountToReceive, options], [AttachedPayment(pmtAsset, pmtAmount)]) | |
454 | 542 | if ((inv == inv)) | |
455 | 543 | then (accountBalance(assetIdFromStr(toToken)) - tokenBalanceBefore) | |
456 | 544 | else throw("Strict value is not equal to itself.") | |
457 | 545 | } | |
458 | 546 | else throw("Strict value is not equal to itself.") | |
459 | 547 | } | |
460 | 548 | ||
461 | 549 | ||
462 | 550 | func capitalize (pool,pType,tokenId,tokenAmount) = { | |
463 | 551 | let poolAddr = Address(fromBase58String(pool)) | |
464 | - | let $ | |
465 | - | let AId = $ | |
466 | - | let BId = $ | |
467 | - | let balA = $ | |
468 | - | let balB = $ | |
469 | - | let shareId = $ | |
470 | - | let $ | |
552 | + | let $t01697517054 = getPoolData(poolAddr, pType) | |
553 | + | let AId = $t01697517054._1 | |
554 | + | let BId = $t01697517054._2 | |
555 | + | let balA = $t01697517054._3 | |
556 | + | let balB = $t01697517054._4 | |
557 | + | let shareId = $t01697517054._5 | |
558 | + | let $t01705717137 = if ((tokenId == AId)) | |
471 | 559 | then $Tuple2(tokenAmount, 0) | |
472 | 560 | else $Tuple2(0, tokenAmount) | |
473 | - | let pmtA = $ | |
474 | - | let pmtB = $ | |
475 | - | let $ | |
476 | - | let stakedAmount = $ | |
477 | - | let axlyFee = $ | |
561 | + | let pmtA = $t01705717137._1 | |
562 | + | let pmtB = $t01705717137._2 | |
563 | + | let $t01714017250 = replenishByType(pType, pool, CAP_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
564 | + | let stakedAmount = $t01714017250._1 | |
565 | + | let axlyFee = $t01714017250._2 | |
478 | 566 | let curPoolInterest = valueOrElse(getInteger(this, (pool + kPoolInterest)), 0) | |
479 | 567 | let totalShareAmount = getPoolTotalShare(pool) | |
480 | 568 | let newInterest = (curPoolInterest + fraction(stakedAmount, SCALE10, totalShareAmount)) | |
481 | - | [IntegerEntry((pool + kPoolInterest), newInterest), ScriptTransfer(moneyBox, axlyFee, fromBase58String(shareId))] | |
569 | + | ([IntegerEntry((pool + kPoolInterest), newInterest), ScriptTransfer(moneyBox, axlyFee, fromBase58String(shareId))] ++ getCursEntries(AId, BId, shareId)) | |
482 | 570 | } | |
483 | 571 | ||
484 | 572 | ||
485 | 573 | func exchangeDirectlySF (pool,assetIdA,assetIdB,balA,balB,amountTokenToGet,assetTokenToGet) = { | |
486 | 574 | let poolAddr = Address(fromBase58String(pool)) | |
487 | 575 | let feeScale6 = 1000000 | |
488 | 576 | let fee = getIntegerValue(poolAddr, kSFPoolFee) | |
489 | 577 | let amntGetNoFee = fraction(amountTokenToGet, feeScale6, (feeScale6 - fee)) | |
490 | - | let $ | |
578 | + | let $t01798018268 = if ((assetTokenToGet == assetIdA)) | |
491 | 579 | then { | |
492 | 580 | let amountToPay = fraction(balA, amntGetNoFee, (balB - amntGetNoFee)) | |
493 | 581 | $Tuple2(amountToPay, assetIdB) | |
494 | 582 | } | |
495 | 583 | else { | |
496 | 584 | let amountToPay = fraction(balB, amntGetNoFee, (balA - amntGetNoFee)) | |
497 | 585 | $Tuple2(amountToPay, assetIdA) | |
498 | 586 | } | |
499 | - | let amountToPay = $ | |
500 | - | let assetToPay = $ | |
587 | + | let amountToPay = $t01798018268._1 | |
588 | + | let assetToPay = $t01798018268._2 | |
501 | 589 | invoke(poolAddr, "callFunction", ["exchange", ["1"]], [AttachedPayment(assetIdFromStr(assetToPay), amountToPay)]) | |
502 | 590 | } | |
503 | 591 | ||
504 | 592 | ||
505 | 593 | func exchangeDirectlyWX (pool,assetIdA,assetIdB,balA,balB,amountTokenToGet,assetTokenToGet) = { | |
506 | 594 | let poolAddr = Address(fromBase58String(pool)) | |
507 | 595 | let prFee = getIntegerValue(wxSwapContract, "%s__protocolFee") | |
508 | 596 | let pFee = getIntegerValue(wxSwapContract, "%s__poolFee") | |
509 | 597 | let feeScale = toBigInt(100000000) | |
510 | - | let $ | |
598 | + | let $t01874719055 = if ((assetTokenToGet == assetIdA)) | |
511 | 599 | then { | |
512 | 600 | let amountToPay = fraction(balA, amountTokenToGet, (balB - amountTokenToGet)) | |
513 | 601 | $Tuple2(amountToPay, assetIdB) | |
514 | 602 | } | |
515 | 603 | else { | |
516 | 604 | let amountToPay = fraction(balB, amountTokenToGet, (balA - amountTokenToGet)) | |
517 | 605 | $Tuple2(amountToPay, assetIdA) | |
518 | 606 | } | |
519 | - | let amountToPay = $ | |
520 | - | let assetToPay = $ | |
607 | + | let amountToPay = $t01874719055._1 | |
608 | + | let assetToPay = $t01874719055._2 | |
521 | 609 | let amountToPayWithFee = toInt(fraction(toBigInt(amountToPay), feeScale, (feeScale - toBigInt((prFee + pFee))))) | |
522 | 610 | invoke(wxSwapContract, "swap", [1, assetTokenToGet, toString(this)], [AttachedPayment(assetIdFromStr(assetToPay), amountToPayWithFee)]) | |
523 | 611 | } | |
524 | 612 | ||
525 | 613 | ||
526 | 614 | func exchangeDirectly (type,pool,assetIdA,assetIdB,balA,balB,amountTokenToGet,assetTokenToGet) = if ((type == SF_POOL)) | |
527 | 615 | then exchangeDirectlySF(pool, assetIdA, assetIdB, balA, balB, amountTokenToGet, assetTokenToGet) | |
528 | 616 | else exchangeDirectlyWX(pool, assetIdA, assetIdB, balA, balB, amountTokenToGet, assetTokenToGet) | |
529 | 617 | ||
530 | 618 | ||
531 | 619 | func withdrawAmountCalc (pool,userCanWithdraw,debt,borrowAsset) = { | |
532 | 620 | let poolAddr = Address(fromBase58String(pool)) | |
533 | 621 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
534 | - | let $t01760417671 = getPoolData(poolAddr, pType) | |
535 | - | let assetIdA = $t01760417671._1 | |
536 | - | let assetIdB = $t01760417671._2 | |
537 | - | let balA = $t01760417671._3 | |
538 | - | let balB = $t01760417671._4 | |
622 | + | let $t01992019996 = getPoolData(poolAddr, pType) | |
623 | + | let assetIdA = $t01992019996._1 | |
624 | + | let assetIdB = $t01992019996._2 | |
625 | + | let balA = $t01992019996._3 | |
626 | + | let balB = $t01992019996._4 | |
627 | + | let shareId = $t01992019996._5 | |
539 | 628 | let cBalABefore = accountBalance(assetIdFromStr(assetIdA)) | |
540 | 629 | if ((cBalABefore == cBalABefore)) | |
541 | 630 | then { | |
542 | 631 | let cBalBBefore = accountBalance(assetIdFromStr(assetIdB)) | |
543 | 632 | if ((cBalBBefore == cBalBBefore)) | |
544 | 633 | then { | |
545 | 634 | let inv = if ((pType == SF_POOL)) | |
546 | 635 | then invoke(poolAddr, "callFunction", ["withdraw", [toString(userCanWithdraw)]], nil) | |
547 | 636 | else if ((pType == WX_POOL)) | |
548 | 637 | then invoke(poolAddr, "unstakeAndGet", [userCanWithdraw], nil) | |
549 | 638 | else throw("Wrong position type") | |
550 | 639 | if ((inv == inv)) | |
551 | 640 | then { | |
552 | 641 | let cBalAAfter = accountBalance(assetIdFromStr(assetIdA)) | |
553 | 642 | let cBalBAfter = accountBalance(assetIdFromStr(assetIdB)) | |
554 | - | let $ | |
555 | - | let tokensAmountA = $ | |
556 | - | let tokensAmountB = $ | |
557 | - | let $ | |
643 | + | let $t02050820597 = $Tuple2((cBalAAfter - cBalABefore), (cBalBAfter - cBalBBefore)) | |
644 | + | let tokensAmountA = $t02050820597._1 | |
645 | + | let tokensAmountB = $t02050820597._2 | |
646 | + | let $t02060021296 = if ((debt > 0)) | |
558 | 647 | then { | |
559 | 648 | let amountToGetEx = if (if ((borrowAsset == assetIdA)) | |
560 | 649 | then (debt > tokensAmountA) | |
561 | 650 | else false) | |
562 | 651 | then (debt - tokensAmountA) | |
563 | 652 | else if (if ((borrowAsset == assetIdB)) | |
564 | 653 | then (debt > tokensAmountB) | |
565 | 654 | else false) | |
566 | 655 | then (debt - tokensAmountB) | |
567 | 656 | else 0 | |
568 | 657 | let exInv = if ((amountToGetEx > 0)) | |
569 | 658 | then exchangeDirectly(pType, pool, assetIdA, assetIdB, balA, balB, amountToGetEx, borrowAsset) | |
570 | 659 | else 0 | |
571 | 660 | if ((exInv == exInv)) | |
572 | 661 | then { | |
573 | 662 | let cBalAAfterRepay = accountBalance(assetIdFromStr(assetIdA)) | |
574 | 663 | let cBalBAfterRepay = accountBalance(assetIdFromStr(assetIdB)) | |
575 | 664 | $Tuple2((cBalAAfterRepay - cBalABefore), (cBalBAfterRepay - cBalBBefore)) | |
576 | 665 | } | |
577 | 666 | else throw("Strict value is not equal to itself.") | |
578 | 667 | } | |
579 | 668 | else $Tuple2(tokensAmountA, tokensAmountB) | |
580 | - | let toUserAmountA = $ | |
581 | - | let toUserAmountB = $ | |
582 | - | $ | |
669 | + | let toUserAmountA = $t02060021296._1 | |
670 | + | let toUserAmountB = $t02060021296._2 | |
671 | + | $Tuple7(toUserAmountA, assetIdA, toUserAmountB, assetIdB, cBalAAfter, cBalBAfter, shareId) | |
583 | 672 | } | |
584 | 673 | else throw("Strict value is not equal to itself.") | |
585 | 674 | } | |
586 | 675 | else throw("Strict value is not equal to itself.") | |
587 | 676 | } | |
588 | 677 | else throw("Strict value is not equal to itself.") | |
589 | 678 | } | |
590 | 679 | ||
591 | 680 | ||
592 | 681 | func parseRequest (requestId) = { | |
593 | 682 | let request = split(valueOrErrorMessage(getString(this, (requestId + kRequestId)), ("No request with id " + requestId)), ",") | |
594 | 683 | let user = request[0] | |
595 | 684 | let pool = request[1] | |
596 | 685 | let pmtA = parseIntValue(request[2]) | |
597 | 686 | let AId = request[3] | |
598 | 687 | let pmtB = parseIntValue(request[4]) | |
599 | 688 | let BId = request[5] | |
600 | 689 | let balA = parseIntValue(request[6]) | |
601 | 690 | let balB = parseIntValue(request[7]) | |
602 | 691 | let shareId = request[8] | |
603 | 692 | let bwAsset = request[9] | |
604 | 693 | let bwAmount = parseIntValue(request[10]) | |
605 | 694 | $Tuple11(user, pool, pmtA, AId, pmtB, BId, balA, balB, shareId, bwAsset, bwAmount) | |
606 | 695 | } | |
607 | 696 | ||
608 | 697 | ||
609 | 698 | @Callable(i) | |
610 | - | func getAssetPrice (assetId) = $Tuple2(nil, (let @ = invoke(priceOracleAddr, "getTWAP60", [assetId, false], nil) | |
611 | - | if ($isInstanceOf(@, "(Int, Int)")) | |
612 | - | then @ | |
613 | - | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._2) | |
614 | - | ||
615 | - | ||
616 | - | ||
617 | - | @Callable(i) | |
618 | - | func getSharePrice (shareId) = { | |
619 | - | let pool = valueOrErrorMessage(getString(this, (shareId + kSharePool)), "Can't find pool addr by share id") | |
620 | - | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
621 | - | let $t02006620136 = getPoolData(Address(fromBase58String(pool)), pType) | |
622 | - | let aId = $t02006620136._1 | |
623 | - | let bId = $t02006620136._2 | |
624 | - | let dPriceA = ( let @ = invoke(priceOracleAddr, "getTWAP60", [aId, false], nil) | |
625 | - | if ($isInstanceOf(@, "(Int, Int)")) | |
626 | - | then @ | |
627 | - | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._2 | |
628 | - | let dPriceB = ( let @ = invoke(priceOracleAddr, "getTWAP60", [bId, false], nil) | |
629 | - | if ($isInstanceOf(@, "(Int, Int)")) | |
630 | - | then @ | |
631 | - | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._2 | |
632 | - | $Tuple2(nil, (dPriceA + dPriceB)) | |
633 | - | } | |
634 | - | ||
635 | - | ||
636 | - | ||
637 | - | @Callable(i) | |
638 | 699 | func replenishEVALONLY (pool,leverage,borrowAssetId) = if (if ((100 > leverage)) | |
639 | 700 | then true | |
640 | 701 | else (leverage > 300)) | |
641 | 702 | then throw("Leverage can't be <100 and >300") | |
642 | 703 | else { | |
643 | 704 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
644 | - | let $ | |
645 | - | let AId = $ | |
646 | - | let BId = $ | |
647 | - | let balA = $ | |
648 | - | let balB = $ | |
649 | - | let shareId = $ | |
650 | - | let $ | |
705 | + | let $t02228422374 = getPoolData(Address(fromBase58String(pool)), pType) | |
706 | + | let AId = $t02228422374._1 | |
707 | + | let BId = $t02228422374._2 | |
708 | + | let balA = $t02228422374._3 | |
709 | + | let balB = $t02228422374._4 | |
710 | + | let shareId = $t02228422374._5 | |
711 | + | let $t02237723014 = if ((size(i.payments) == 2)) | |
651 | 712 | then if ((assetIdToStr(i.payments[0].assetId) != AId)) | |
652 | 713 | then throw("Wrong payment asset A") | |
653 | 714 | else if ((assetIdToStr(i.payments[1].assetId) != BId)) | |
654 | 715 | then throw("Wrong payment asset B") | |
655 | 716 | else $Tuple4(i.payments[0].amount, AId, i.payments[1].amount, BId) | |
656 | 717 | else if ((size(i.payments) == 1)) | |
657 | 718 | then if ((assetIdToStr(i.payments[0].assetId) == AId)) | |
658 | 719 | then $Tuple4(i.payments[0].amount, AId, 0, BId) | |
659 | 720 | else if ((assetIdToStr(i.payments[0].assetId) == BId)) | |
660 | 721 | then $Tuple4(0, AId, i.payments[0].amount, BId) | |
661 | 722 | else throw("Wrong payment") | |
662 | 723 | else throw("One or two payments expected") | |
663 | - | let pmtA = $ | |
664 | - | let pmtAssetA = $ | |
665 | - | let pmtB = $ | |
666 | - | let pmtAssetB = $ | |
667 | - | let $ | |
724 | + | let pmtA = $t02237723014._1 | |
725 | + | let pmtAssetA = $t02237723014._2 | |
726 | + | let pmtB = $t02237723014._3 | |
727 | + | let pmtAssetB = $t02237723014._4 | |
728 | + | let $t02301724468 = if ((leverage > 100)) | |
668 | 729 | then { | |
669 | 730 | let dPriceA = ( let @ = invoke(priceOracleAddr, "getTWAP60", [pmtAssetA, false], nil) | |
670 | 731 | if ($isInstanceOf(@, "(Int, Int)")) | |
671 | 732 | then @ | |
672 | 733 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._2 | |
673 | 734 | let dPriceB = ( let @ = invoke(priceOracleAddr, "getTWAP60", [pmtAssetB, false], nil) | |
674 | 735 | if ($isInstanceOf(@, "(Int, Int)")) | |
675 | 736 | then @ | |
676 | 737 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._2 | |
677 | 738 | let paydInDollar = (fraction(dPriceA, pmtA, pow(10, 0, getAssetDecimals(pmtAssetA), 0, 0, DOWN)) + fraction(dPriceB, pmtB, pow(10, 0, getAssetDecimals(pmtAssetB), 0, 0, DOWN))) | |
678 | 739 | let borrowAmount = fraction(paydInDollar, (leverage - 100), 100) | |
679 | 740 | let request = makeString([toString(i.caller), pool, toString(pmtA), pmtAssetA, toString(pmtB), pmtAssetB, toString(balA), toString(balB), shareId, borrowAssetId, toString(borrowAmount), toString(1)], ",") | |
680 | 741 | let newRequestId = { | |
681 | 742 | let @ = invoke(this, "createNewRequest", [request], nil) | |
682 | 743 | if ($isInstanceOf(@, "Int")) | |
683 | 744 | then @ | |
684 | 745 | else throw(($getType(@) + " couldn't be cast to Int")) | |
685 | 746 | } | |
686 | 747 | if ((newRequestId == newRequestId)) | |
687 | 748 | then { | |
688 | 749 | let args = [((toString(i.caller) + "_") + toString(1)), shareId, borrowAssetId, borrowAmount, toString(this), "replenishFromLandEVALONLY", toString(valueOrErrorMessage(newRequestId, "Can't create new request"))] | |
689 | 750 | let inv = reentrantInvoke(getLendSrvAddr(), "flashPosition", args, nil) | |
690 | 751 | if ((inv == inv)) | |
691 | 752 | then $Tuple2(getIntegerValue(this, "EVALONLY_STAKEDAMOUNT"), borrowAmount) | |
692 | 753 | else throw("Strict value is not equal to itself.") | |
693 | 754 | } | |
694 | 755 | else throw("Strict value is not equal to itself.") | |
695 | 756 | } | |
696 | 757 | else $Tuple2(replenishByType(pType, pool, NO_LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId)._1, 0) | |
697 | - | let userStaked = $ | |
698 | - | let borrowAmount = $ | |
699 | - | let $ | |
700 | - | if (($ | |
758 | + | let userStaked = $t02301724468._1 | |
759 | + | let borrowAmount = $t02301724468._2 | |
760 | + | let $t02447224639 = withdrawAmountCalc(pool, userStaked, borrowAmount, borrowAssetId) | |
761 | + | if (($t02447224639 == $t02447224639)) | |
701 | 762 | then { | |
702 | - | let userGetBBeforeRepay = $ | |
703 | - | let userGetABeforeRepay = $ | |
704 | - | let assetIdB = $ | |
705 | - | let toUserAmountB = $ | |
706 | - | let assetIdA = $ | |
707 | - | let toUserAmountA = $ | |
708 | - | let $ | |
709 | - | let AIdAfter = $ | |
710 | - | let BIdAfter = $ | |
711 | - | let balAAfter = $ | |
712 | - | let balBAfter = $ | |
713 | - | let shareIdAfter = $ | |
763 | + | let userGetBBeforeRepay = $t02447224639._6 | |
764 | + | let userGetABeforeRepay = $t02447224639._5 | |
765 | + | let assetIdB = $t02447224639._4 | |
766 | + | let toUserAmountB = $t02447224639._3 | |
767 | + | let assetIdA = $t02447224639._2 | |
768 | + | let toUserAmountA = $t02447224639._1 | |
769 | + | let $t02464224757 = getPoolData(Address(fromBase58String(pool)), pType) | |
770 | + | let AIdAfter = $t02464224757._1 | |
771 | + | let BIdAfter = $t02464224757._2 | |
772 | + | let balAAfter = $t02464224757._3 | |
773 | + | let balBAfter = $t02464224757._4 | |
774 | + | let shareIdAfter = $t02464224757._5 | |
714 | 775 | let ratioBefore = fraction(balB, SCALE8, balA) | |
715 | 776 | let ratioAfter = fraction(balBAfter, SCALE8, balAAfter) | |
716 | 777 | let impact = (SCALE8 - fraction(ratioBefore, SCALE8, ratioAfter)) | |
717 | 778 | let imcatMod = if ((0 > impact)) | |
718 | 779 | then (impact * -1) | |
719 | 780 | else impact | |
720 | 781 | $Tuple2(nil, [userGetABeforeRepay, userGetBBeforeRepay, imcatMod]) | |
721 | 782 | } | |
722 | 783 | else throw("Strict value is not equal to itself.") | |
723 | 784 | } | |
724 | 785 | ||
725 | 786 | ||
726 | 787 | ||
727 | 788 | @Callable(i) | |
728 | 789 | func replenishFromLandEVALONLY (requestId) = { | |
729 | - | let $ | |
730 | - | let user = $ | |
731 | - | let pool = $ | |
732 | - | let pmtA = $ | |
733 | - | let AId = $ | |
734 | - | let pmtB = $ | |
735 | - | let BId = $ | |
736 | - | let balA = $ | |
737 | - | let balB = $ | |
738 | - | let shareId = $ | |
739 | - | let bwAsset = $ | |
740 | - | let bwAmount = $ | |
790 | + | let $t02512725231 = parseRequest(requestId) | |
791 | + | let user = $t02512725231._1 | |
792 | + | let pool = $t02512725231._2 | |
793 | + | let pmtA = $t02512725231._3 | |
794 | + | let AId = $t02512725231._4 | |
795 | + | let pmtB = $t02512725231._5 | |
796 | + | let BId = $t02512725231._6 | |
797 | + | let balA = $t02512725231._7 | |
798 | + | let balB = $t02512725231._8 | |
799 | + | let shareId = $t02512725231._9 | |
800 | + | let bwAsset = $t02512725231._10 | |
801 | + | let bwAmount = $t02512725231._11 | |
741 | 802 | if ((size(i.payments) != 1)) | |
742 | 803 | then throw("Wrong payment size") | |
743 | 804 | else if (if ((assetIdToStr(i.payments[0].assetId) != bwAsset)) | |
744 | 805 | then true | |
745 | 806 | else (i.payments[0].amount != bwAmount)) | |
746 | 807 | then throw("Wrong payment") | |
747 | 808 | else { | |
748 | - | let $ | |
809 | + | let $t02542125545 = if ((AId == bwAsset)) | |
749 | 810 | then $Tuple2((pmtA + i.payments[0].amount), pmtB) | |
750 | 811 | else $Tuple2(pmtA, (pmtB + i.payments[0].amount)) | |
751 | - | let pmtAllA = $ | |
752 | - | let pmtAllB = $ | |
812 | + | let pmtAllA = $t02542125545._1 | |
813 | + | let pmtAllB = $t02542125545._2 | |
753 | 814 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
754 | - | let $ | |
755 | - | let userStaked = $ | |
756 | - | let axlyFee = $ | |
815 | + | let $t02562725736 = replenishByType(pType, pool, LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
816 | + | let userStaked = $t02562725736._1 | |
817 | + | let axlyFee = $t02562725736._2 | |
757 | 818 | $Tuple2([IntegerEntry("EVALONLY_STAKEDAMOUNT", userStaked)], userStaked) | |
758 | 819 | } | |
759 | 820 | } | |
760 | 821 | ||
761 | 822 | ||
762 | 823 | ||
763 | 824 | @Callable(i) | |
764 | 825 | func replenish (pool,leverage,borrowAssetId) = if (if ((100 > leverage)) | |
765 | 826 | then true | |
766 | 827 | else (leverage > 300)) | |
767 | 828 | then throw("Leverage can't be <100 and >300") | |
768 | 829 | else { | |
769 | 830 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
770 | - | let $ | |
771 | - | let AId = $ | |
772 | - | let BId = $ | |
773 | - | let balA = $ | |
774 | - | let balB = $ | |
775 | - | let shareId = $ | |
776 | - | let $ | |
831 | + | let $t02611326203 = getPoolData(Address(fromBase58String(pool)), pType) | |
832 | + | let AId = $t02611326203._1 | |
833 | + | let BId = $t02611326203._2 | |
834 | + | let balA = $t02611326203._3 | |
835 | + | let balB = $t02611326203._4 | |
836 | + | let shareId = $t02611326203._5 | |
837 | + | let $t02620626843 = if ((size(i.payments) == 2)) | |
777 | 838 | then if ((assetIdToStr(i.payments[0].assetId) != AId)) | |
778 | 839 | then throw("Wrong payment asset A") | |
779 | 840 | else if ((assetIdToStr(i.payments[1].assetId) != BId)) | |
780 | 841 | then throw("Wrong payment asset B") | |
781 | 842 | else $Tuple4(i.payments[0].amount, AId, i.payments[1].amount, BId) | |
782 | 843 | else if ((size(i.payments) == 1)) | |
783 | 844 | then if ((assetIdToStr(i.payments[0].assetId) == AId)) | |
784 | 845 | then $Tuple4(i.payments[0].amount, AId, 0, BId) | |
785 | 846 | else if ((assetIdToStr(i.payments[0].assetId) == BId)) | |
786 | 847 | then $Tuple4(0, AId, i.payments[0].amount, BId) | |
787 | 848 | else throw("Wrong payment") | |
788 | 849 | else throw("One or two payments expected") | |
789 | - | let pmtA = $ | |
790 | - | let pmtAssetA = $ | |
791 | - | let pmtB = $ | |
792 | - | let pmtAssetB = $ | |
850 | + | let pmtA = $t02620626843._1 | |
851 | + | let pmtAssetA = $t02620626843._2 | |
852 | + | let pmtB = $t02620626843._3 | |
853 | + | let pmtAssetB = $t02620626843._4 | |
793 | 854 | let newPosNum = getNewUserPositionNumber(pool, toString(i.caller)) | |
794 | 855 | if ((leverage > 100)) | |
795 | 856 | then { | |
796 | 857 | let dPriceA = ( let @ = invoke(priceOracleAddr, "getTWAP60", [pmtAssetA, false], nil) | |
797 | 858 | if ($isInstanceOf(@, "(Int, Int)")) | |
798 | 859 | then @ | |
799 | 860 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._2 | |
800 | 861 | let dPriceB = ( let @ = invoke(priceOracleAddr, "getTWAP60", [pmtAssetB, false], nil) | |
801 | 862 | if ($isInstanceOf(@, "(Int, Int)")) | |
802 | 863 | then @ | |
803 | 864 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._2 | |
804 | 865 | let paydInDollar = (fraction(dPriceA, pmtA, pow(10, 0, getAssetDecimals(pmtAssetA), 0, 0, DOWN)) + fraction(dPriceB, pmtB, pow(10, 0, getAssetDecimals(pmtAssetB), 0, 0, DOWN))) | |
805 | 866 | let borrowAmount = fraction(paydInDollar, (leverage - 100), 100) | |
806 | 867 | let request = makeString([toString(i.caller), pool, toString(pmtA), pmtAssetA, toString(pmtB), pmtAssetB, toString(balA), toString(balB), shareId, borrowAssetId, toString(borrowAmount)], ",") | |
807 | 868 | let newRequestId = { | |
808 | 869 | let @ = invoke(this, "createNewRequest", [request], nil) | |
809 | 870 | if ($isInstanceOf(@, "Int")) | |
810 | 871 | then @ | |
811 | 872 | else throw(($getType(@) + " couldn't be cast to Int")) | |
812 | 873 | } | |
813 | 874 | if ((newRequestId == newRequestId)) | |
814 | 875 | then { | |
815 | 876 | let args = [((toString(i.caller) + "_") + toString(newPosNum)), shareId, borrowAssetId, borrowAmount, toString(this), "replenishFromLand", toString(valueOrErrorMessage(newRequestId, "Can't create new request"))] | |
816 | 877 | let inv = reentrantInvoke(getLendSrvAddr(), "flashPosition", args, nil) | |
817 | 878 | if ((inv == inv)) | |
818 | 879 | then nil | |
819 | 880 | else throw("Strict value is not equal to itself.") | |
820 | 881 | } | |
821 | 882 | else throw("Strict value is not equal to itself.") | |
822 | 883 | } | |
823 | 884 | else { | |
824 | - | let $ | |
825 | - | let userStaked = $ | |
826 | - | let axlyFee = $ | |
827 | - | replenishEntries(pool, toString(i.caller), userStaked, axlyFee, newPosNum, shareId, pType) | |
885 | + | let $t02814028252 = replenishByType(pType, pool, NO_LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
886 | + | let userStaked = $t02814028252._1 | |
887 | + | let axlyFee = $t02814028252._2 | |
888 | + | (replenishEntries(pool, toString(i.caller), userStaked, axlyFee, newPosNum, shareId, pType) ++ getCursEntries(AId, BId, shareId)) | |
828 | 889 | } | |
829 | 890 | } | |
830 | 891 | ||
831 | 892 | ||
832 | 893 | ||
833 | 894 | @Callable(i) | |
834 | 895 | func replenishFromLand (requestId) = { | |
835 | - | let $ | |
836 | - | let user = $ | |
837 | - | let pool = $ | |
838 | - | let pmtA = $ | |
839 | - | let AId = $ | |
840 | - | let pmtB = $ | |
841 | - | let BId = $ | |
842 | - | let balA = $ | |
843 | - | let balB = $ | |
844 | - | let shareId = $ | |
845 | - | let bwAsset = $ | |
846 | - | let bwAmount = $ | |
896 | + | let $t02845628560 = parseRequest(requestId) | |
897 | + | let user = $t02845628560._1 | |
898 | + | let pool = $t02845628560._2 | |
899 | + | let pmtA = $t02845628560._3 | |
900 | + | let AId = $t02845628560._4 | |
901 | + | let pmtB = $t02845628560._5 | |
902 | + | let BId = $t02845628560._6 | |
903 | + | let balA = $t02845628560._7 | |
904 | + | let balB = $t02845628560._8 | |
905 | + | let shareId = $t02845628560._9 | |
906 | + | let bwAsset = $t02845628560._10 | |
907 | + | let bwAmount = $t02845628560._11 | |
847 | 908 | if ((size(i.payments) != 1)) | |
848 | 909 | then throw("Wrong payment size") | |
849 | 910 | else if (if ((assetIdToStr(i.payments[0].assetId) != bwAsset)) | |
850 | 911 | then true | |
851 | 912 | else (i.payments[0].amount != bwAmount)) | |
852 | 913 | then throw("Wrong payment") | |
853 | 914 | else { | |
854 | - | let $ | |
915 | + | let $t02875028874 = if ((AId == bwAsset)) | |
855 | 916 | then $Tuple2((pmtA + i.payments[0].amount), pmtB) | |
856 | 917 | else $Tuple2(pmtA, (pmtB + i.payments[0].amount)) | |
857 | - | let pmtAllA = $ | |
858 | - | let pmtAllB = $ | |
918 | + | let pmtAllA = $t02875028874._1 | |
919 | + | let pmtAllB = $t02875028874._2 | |
859 | 920 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
860 | - | let $ | |
861 | - | let userStaked = $ | |
862 | - | let axlyFee = $ | |
921 | + | let $t02895629065 = replenishByType(pType, pool, LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
922 | + | let userStaked = $t02895629065._1 | |
923 | + | let axlyFee = $t02895629065._2 | |
863 | 924 | let posNum = getNewUserPositionNumber(pool, toString(i.caller)) | |
864 | 925 | let borrowEntries = [IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAmount), bwAmount), StringEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAssetId), bwAsset)] | |
865 | 926 | let entries = replenishEntries(pool, user, userStaked, axlyFee, posNum, shareId, pType) | |
866 | - | $Tuple2(((entries ++ borrowEntries) :+ DeleteEntry((requestId + kRequestId))), userStaked) | |
927 | + | $Tuple2((((entries ++ getCursEntries(AId, BId, shareId)) ++ borrowEntries) :+ DeleteEntry((requestId + kRequestId))), userStaked) | |
867 | 928 | } | |
868 | 929 | } | |
869 | 930 | ||
870 | 931 | ||
871 | 932 | ||
872 | 933 | @Callable(i) | |
873 | 934 | func withdraw (pool,posId) = { | |
874 | 935 | let user = toString(i.caller) | |
875 | 936 | let pAmount = valueOrErrorMessage(getInteger(this, (((((pool + "_") + user) + "_") + toString(posId)) + kUserPosition)), "Unknown position") | |
876 | 937 | let userInterest = getIntegerValue(this, (((((pool + "_") + user) + "_") + toString(posId)) + kUserPositionInterest)) | |
877 | 938 | let poolInterst = getIntegerValue(this, (pool + kPoolInterest)) | |
878 | 939 | let poolTotalShare = getPoolTotalShare(pool) | |
879 | 940 | let userCanWithdraw = (pAmount + fraction(pAmount, (poolInterst - userInterest), SCALE10)) | |
880 | 941 | let userAddr = Address(fromBase58String(user)) | |
881 | 942 | let borrowAmount = getIntegerValue(this, (((((pool + "_") + user) + "_") + toString(posId)) + kUserBorrowAmount)) | |
882 | 943 | let borrowAsset = getStringValue(this, (((((pool + "_") + user) + "_") + toString(posId)) + kUserBorrowAssetId)) | |
883 | 944 | let debt = if ((borrowAmount > 0)) | |
884 | 945 | then { | |
885 | 946 | let @ = invoke(getLendSrvAddr(), "getAssetDebt", [false, ((((pool + "_") + user) + "_") + toString(posId)), borrowAsset], nil) | |
886 | 947 | if ($isInstanceOf(@, "Int")) | |
887 | 948 | then @ | |
888 | 949 | else throw(($getType(@) + " couldn't be cast to Int")) | |
889 | 950 | } | |
890 | 951 | else 0 | |
891 | - | let $ | |
892 | - | if (($ | |
952 | + | let $t03054430697 = withdrawAmountCalc(pool, userCanWithdraw, debt, borrowAsset) | |
953 | + | if (($t03054430697 == $t03054430697)) | |
893 | 954 | then { | |
894 | - | let assetIdB = $t02880228922._4 | |
895 | - | let toUserAmountB = $t02880228922._3 | |
896 | - | let assetIdA = $t02880228922._2 | |
897 | - | let toUserAmountA = $t02880228922._1 | |
955 | + | let shareId = $t03054430697._7 | |
956 | + | let cBalBAfter = $t03054430697._6 | |
957 | + | let cBalAAfter = $t03054430697._5 | |
958 | + | let assetIdB = $t03054430697._4 | |
959 | + | let toUserAmountB = $t03054430697._3 | |
960 | + | let assetIdA = $t03054430697._2 | |
961 | + | let toUserAmountA = $t03054430697._1 | |
898 | 962 | let closeDbtInv = if ((debt > 0)) | |
899 | 963 | then invoke(getLendSrvAddr(), "repayFor", [((user + "_") + toString(posId))], [AttachedPayment(assetIdFromStr(borrowAsset), debt)]) | |
900 | 964 | else 0 | |
901 | 965 | if ((closeDbtInv == closeDbtInv)) | |
902 | - | then [DeleteEntry((((((pool + "_") + user) + "_") + toString(posId)) + kUserPosition)), DeleteEntry((((((pool + "_") + user) + "_") + toString(posId)) + kUserPositionInterest)), IntegerEntry((pool + kPoolTotal), (poolTotalShare - userCanWithdraw)), ScriptTransfer(userAddr, toUserAmountA, assetIdFromStr(assetIdA)), ScriptTransfer(userAddr, toUserAmountB, assetIdFromStr(assetIdB))] | |
966 | + | then ([DeleteEntry((((((pool + "_") + user) + "_") + toString(posId)) + kUserPosition)), DeleteEntry((((((pool + "_") + user) + "_") + toString(posId)) + kUserPositionInterest)), IntegerEntry((pool + kPoolTotal), (poolTotalShare - userCanWithdraw)), ScriptTransfer(userAddr, toUserAmountA, assetIdFromStr(assetIdA)), ScriptTransfer(userAddr, toUserAmountB, assetIdFromStr(assetIdB))] ++ getCursEntries(assetIdA, assetIdB, shareId)) | |
903 | 967 | else throw("Strict value is not equal to itself.") | |
904 | 968 | } | |
905 | 969 | else throw("Strict value is not equal to itself.") | |
906 | 970 | } | |
907 | 971 | ||
908 | 972 | ||
909 | 973 | ||
910 | 974 | @Callable(i) | |
911 | 975 | func createNewRequest (params) = valueOrElse(isSelfCall(i), { | |
912 | 976 | let newRequestId = (valueOrElse(getInteger(this, kRequestIter), 0) + 1) | |
913 | 977 | $Tuple2([StringEntry((toString(newRequestId) + kRequestId), params), IntegerEntry(kRequestIter, newRequestId)], newRequestId) | |
914 | 978 | }) | |
915 | 979 | ||
916 | 980 | ||
917 | 981 | ||
918 | 982 | @Callable(i) | |
919 | 983 | func capitalizeExKeeper (pool,type,tokenToId,amountToExchange,claim,amountsIn,addresses,assetsToReceive,estReceived,slippageTolerance,minReceived,options) = { | |
920 | - | let $ | |
984 | + | let $t03204132235 = if (claim) | |
921 | 985 | then claimFarmed(type, pool) | |
922 | 986 | else { | |
923 | 987 | let claimedAsset = if ((type == SF_POOL)) | |
924 | 988 | then SWOPID | |
925 | 989 | else WXID | |
926 | 990 | $Tuple2(amountToExchange, claimedAsset) | |
927 | 991 | } | |
928 | - | let claimedAmount = $ | |
929 | - | let claimedAsset = $ | |
992 | + | let claimedAmount = $t03204132235._1 | |
993 | + | let claimedAsset = $t03204132235._2 | |
930 | 994 | let exchangedAmount = exchangeKeeper(tokenToId, amountToExchange, claimedAsset, amountsIn, addresses, assetsToReceive, estReceived, slippageTolerance, minReceived, options) | |
931 | 995 | let change = (claimedAmount - amountToExchange) | |
932 | 996 | let changeEntry = if ((change > 0)) | |
933 | 997 | then [IntegerEntry((pool + kPoolCapChange), (change + valueOrElse(getInteger(this, (pool + kPoolCapChange)), 0)))] | |
934 | 998 | else nil | |
935 | 999 | (capitalize(pool, type, tokenToId, exchangedAmount) ++ changeEntry) | |
936 | 1000 | } | |
937 | 1001 | ||
938 | 1002 | ||
939 | 1003 | ||
940 | 1004 | @Callable(i) | |
941 | 1005 | func capitalizeExPazzle (pool,type,tokenToId,amountToExchange,claim,routesStr,minToReceive,options) = { | |
942 | - | let $ | |
1006 | + | let $t03289233086 = if (claim) | |
943 | 1007 | then claimFarmed(type, pool) | |
944 | 1008 | else { | |
945 | 1009 | let claimedAsset = if ((type == SF_POOL)) | |
946 | 1010 | then SWOPID | |
947 | 1011 | else WXID | |
948 | 1012 | $Tuple2(amountToExchange, claimedAsset) | |
949 | 1013 | } | |
950 | - | let claimedAmount = $ | |
951 | - | let claimedAsset = $ | |
1014 | + | let claimedAmount = $t03289233086._1 | |
1015 | + | let claimedAsset = $t03289233086._2 | |
952 | 1016 | let exchangedAmount = exchangePazzle(tokenToId, amountToExchange, claimedAsset, routesStr, minToReceive, options) | |
953 | 1017 | let change = (claimedAmount - amountToExchange) | |
954 | 1018 | let changeEntry = if ((change > 0)) | |
955 | 1019 | then [IntegerEntry((pool + kPoolCapChange), (change + valueOrElse(getInteger(this, (pool + kPoolCapChange)), 0)))] | |
956 | 1020 | else nil | |
957 | 1021 | (capitalize(pool, type, tokenToId, exchangedAmount) ++ changeEntry) | |
958 | 1022 | } | |
959 | 1023 | ||
960 | 1024 | ||
961 | 1025 | ||
962 | 1026 | @Callable(i) | |
963 | 1027 | func capitalizeExSwopFi (pool,type,tokenToId,amountToExchange,claim,exchangers,exchangersType,args1,args2,routingAssetsKeys,minAmountToReceive,options) = { | |
964 | - | let $ | |
1028 | + | let $t03380934003 = if (claim) | |
965 | 1029 | then claimFarmed(type, pool) | |
966 | 1030 | else { | |
967 | 1031 | let claimedAsset = if ((type == SF_POOL)) | |
968 | 1032 | then SWOPID | |
969 | 1033 | else WXID | |
970 | 1034 | $Tuple2(amountToExchange, claimedAsset) | |
971 | 1035 | } | |
972 | - | let claimedAmount = $ | |
973 | - | let claimedAsset = $ | |
1036 | + | let claimedAmount = $t03380934003._1 | |
1037 | + | let claimedAsset = $t03380934003._2 | |
974 | 1038 | let exchangedAmount = exchangeSwopFi(tokenToId, amountToExchange, claimedAsset, exchangers, exchangersType, args1, args2, routingAssetsKeys, minAmountToReceive, options) | |
975 | 1039 | let change = (claimedAmount - amountToExchange) | |
976 | 1040 | let changeEntry = if ((change > 0)) | |
977 | 1041 | then [IntegerEntry((pool + kPoolCapChange), (change + valueOrElse(getInteger(this, (pool + kPoolCapChange)), 0)))] | |
978 | 1042 | else nil | |
979 | 1043 | (capitalize(pool, type, tokenToId, exchangedAmount) ++ changeEntry) | |
980 | 1044 | } | |
981 | 1045 | ||
982 | 1046 | ||
983 | 1047 | ||
984 | 1048 | @Callable(i) | |
985 | 1049 | func initNewPool (type,poolAddr,inFeeNoLoan,inFeeLoan,capFeeNoLoan,capFeeWithLoan) = if (if ((type != SF_POOL)) | |
986 | 1050 | then (type != WX_POOL) | |
987 | 1051 | else false) | |
988 | 1052 | then throw("Wrong type") | |
989 | 1053 | else { | |
990 | - | let $ | |
991 | - | let aId = $ | |
992 | - | let bId = $ | |
993 | - | let aBal = $ | |
994 | - | let bBal = $ | |
995 | - | let shareId = $ | |
1054 | + | let $t03464834742 = getPoolData(Address(fromBase58String(poolAddr)), type) | |
1055 | + | let aId = $t03464834742._1 | |
1056 | + | let bId = $t03464834742._2 | |
1057 | + | let aBal = $t03464834742._3 | |
1058 | + | let bBal = $t03464834742._4 | |
1059 | + | let shareId = $t03464834742._5 | |
996 | 1060 | [IntegerEntry((poolAddr + kAxlyInFeeWithoutLoan), inFeeNoLoan), IntegerEntry((poolAddr + kAxlyInFeeWithLoan), inFeeLoan), IntegerEntry((poolAddr + kAxlyNoLoanCapFee), capFeeNoLoan), IntegerEntry((poolAddr + kAxlyWithLoanCapFee), capFeeWithLoan), IntegerEntry((poolAddr + kPoolInterest), 0), StringEntry((kPool + poolAddr), type), StringEntry((shareId + kSharePool), poolAddr)] | |
997 | 1061 | } | |
998 | 1062 | ||
999 | 1063 | ||
1000 | 1064 | @Verifier(tx) | |
1001 | 1065 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
1002 | 1066 |
github/deemru/w8io/026f985 164.79 ms ◑