tx · 7gbRoMG6CsZTqFywwXtMe34zNTsC9zBwsdNrq7Fny9n7 3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy: -0.02200000 Waves 2024.11.17 18:23 [3375627] smart account 3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy > SELF 0.00000000 Waves
{ "type": 13, "id": "7gbRoMG6CsZTqFywwXtMe34zNTsC9zBwsdNrq7Fny9n7", "fee": 2200000, "feeAssetId": null, "timestamp": 1731856992792, "version": 2, "chainId": 84, "sender": "3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy", "senderPublicKey": "FsR18761ZAsUqsTd7TK3XmR6bhihs1UXVmpHYxz5JzQ1", "proofs": [ "6WW8o4LQ4yHmBRg9FHdULXn2tSfAYMnEYP4PqyMMyxoDdTKZMVxbSwhe6vRaov2r1EywnnzAt9kf6qxrMDxPvtd" ], "script": "base64:BgJCCAISBgoECAgICBIDCgEIEgMKAQESBAoCCAESAwoBARIECgIIARIAEgMKAQgSAwoBARIDCgEBEgASAwoBCBIDCgEIggEACkRBWV9NSUxMSVMAgLiZKQAFY2hhaW4JAMkBAgkAygECCAUEdGhpcwVieXRlcwABAAEAC3VzZHRBc3NldElkBAckbWF0Y2gwBQVjaGFpbgMJAAACAQFXBQckbWF0Y2gwASCE2nqyCAM/TtG7yo7ui5O8yYLdC136B5ao1CP5qA//uQMJAAACAQFUBQckbWF0Y2gwASBVsdifcoeC7+XjW42sBatl3ppDoS8WuwXzGreHpfHFGAkAAgECDVVua25vd24gY2hhaW4AFWRlZmF1bHRSZXN0QWRkcmVzc1N0cgQHJG1hdGNoMAUFY2hhaW4DCQAAAgEBVwUHJG1hdGNoMAIjM1BRQ3V2RmJ2aDRMa1BVbnJuVTF6M2puYkExcDltM1dOaHYDCQAAAgEBVAUHJG1hdGNoMAIjM011bWtHR3p0Q0tBWHBXRHF4a2Rkb2ZxWFNVYnFRa3ZTSnkJAAIBAg1Vbmtub3duIGNoYWluABBhY3JlczJ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AgkBC3ZhbHVlT3JFbHNlAgkAmggCBQ9zdGFraW5nQ29udHJhY3QJAQlrZXlVc2VyWFABBQRhZGRyAAAFB2RlbHRhWFAECWx2bFBvaW50cwkBB2xldmVsVXACCQELdmFsdWVPckVsc2UCCQCaCAIFD3N0YWtpbmdDb250cmFjdAkBDGtleVVzZXJMZXZlbAEFBGFkZHIAAAUFbmV3WFAJAJQKAgUDbmlsCQDNCAIFCWx2bFBvaW50cwUFbmV3WFAARs76Zg==", "height": 3375627, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DDcidiwvRopooNb6KPA5bzJxz5JBZPoB2Wu5Z2aRrujh Next: 5HCYZ5sZ7T97L6sD4uAdTCSoEiNoa79Y16oNJU5ZuvVS Diff:
Old | New | Differences | |
---|---|---|---|
29 | 29 | then "3P4UH3T9nXpMNpUmSmQjPmEz3G85t3zn6eA" | |
30 | 30 | else if ((base58'2T' == $match0)) | |
31 | 31 | then "3NBPx1Fciu3JQNEGZ21jSnTdutLNGGBUSXh" | |
32 | - | else throw("Unknown chain") | |
33 | - | } | |
34 | - | ||
35 | - | let arbitrageDelay = match chain { | |
36 | - | case _ => | |
37 | - | if ((base58'2W' == $match0)) | |
38 | - | then DAY_MILLIS | |
39 | - | else if ((base58'2T' == $match0)) | |
40 | - | then 60000 | |
41 | 32 | else throw("Unknown chain") | |
42 | 33 | } | |
43 | 34 | ||
156 | 147 | ||
157 | 148 | let stakersAmountLeftKey = "stakersAmountLeft" | |
158 | 149 | ||
159 | - | func keyLastArbTimeByUser (addr) = ("lastArbTimeUser_" + addr) | |
150 | + | func keyLastWlgTradeTimeByUser (addr) = ("lastArbTimeUser_" + addr) | |
151 | + | ||
152 | + | ||
153 | + | func keyLastWlgTradeLimitByUser (addr) = ("lastWlgLimitUser_" + addr) | |
160 | 154 | ||
161 | 155 | ||
162 | 156 | let wlgIssueTimeKey = "wlg_issueTime" | |
411 | 405 | func prolog2 () = asInt(reentrantInvoke(acres2Contract, "saveLastTx", nil, nil)) | |
412 | 406 | ||
413 | 407 | ||
414 | - | func | |
415 | - | let lastTime = valueOrElse(getInteger( | |
416 | - | let | |
417 | - | | |
418 | - | | |
419 | - | | |
408 | + | func getSwapLimitWlgold (addr) = { | |
409 | + | let lastTime = valueOrElse(getInteger(keyLastWlgTradeTimeByUser(addr)), 0) | |
410 | + | let defaultLimit = valueOrElse(getInteger(acres2Contract, keyAcresStakedAmountByUser(addr)), 0) | |
411 | + | let lastLimitLeft = valueOrElse(getInteger(keyLastWlgTradeLimitByUser(addr)), defaultLimit) | |
412 | + | let currentLimit = (lastLimitLeft + fraction(defaultLimit, (lastBlock.timestamp - lastTime), DAY_MILLIS)) | |
413 | + | min([currentLimit, defaultLimit]) | |
420 | 414 | } | |
421 | 415 | ||
422 | 416 | ||
503 | 497 | ||
504 | 498 | ||
505 | 499 | @Callable(i) | |
506 | - | func buyWlg ( | |
500 | + | func buyWlg (minToReceive) = { | |
507 | 501 | let prologResult = prolog2() | |
508 | 502 | if ((prologResult == prologResult)) | |
509 | 503 | then if ((size(i.payments) != 1)) | |
524 | 518 | let curStats = getWlgStats2("", [rest2Contract, acres2Contract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, usdtAmt) | |
525 | 519 | let curWlgAmount = curStats[ixWlgAmount] | |
526 | 520 | let wlgPrice = curStats[ixWlgPrice] | |
527 | - | let buyPrice = fraction(wlgPrice, 6, 5) | |
521 | + | let buyPrice = fraction(wlgPrice, 6, 5, CEILING) | |
528 | 522 | let wlgAmount = fraction(usdtAmt, MULT8, buyPrice) | |
529 | - | let maxWlg = | |
523 | + | let maxWlg = getSwapLimitWlgold(addr) | |
530 | 524 | if ((wlgAmount > maxWlg)) | |
531 | - | then throw((("You can get max " + fixedPoint(maxWlg, 8)) + " WLGOLD")) | |
532 | - | else if (( | |
525 | + | then throw((("You can get max " + fixedPoint(maxWlg, 8)) + " WLGOLD at the moment")) | |
526 | + | else if ((minToReceive > wlgAmount)) | |
533 | 527 | then throw("Price changed during operation, please try again") | |
534 | 528 | else { | |
535 | 529 | let profitAmount = (usdtAmt / 6) | |
536 | - | $Tuple2([Reissue(wlgAssetId, wlgAmount, true), IntegerEntry(wlgIssuedAmountKey, (curWlgAmount + wlgAmount)), IntegerEntry( | |
530 | + | $Tuple2([Reissue(wlgAssetId, wlgAmount, true), IntegerEntry(wlgIssuedAmountKey, (curWlgAmount + wlgAmount)), IntegerEntry(keyLastWlgTradeTimeByUser(addr), lastBlock.timestamp), ScriptTransfer(addressFromStringValue(value(getString(profitAddrKey))), profitAmount, usdtAssetId), ScriptTransfer(caller, wlgAmount, wlgAssetId)], prologResult) | |
537 | 531 | } | |
538 | 532 | } | |
539 | 533 | } | |
546 | 540 | @Callable(i) | |
547 | 541 | func buyWlgREADONLY (address,usdtAmt) = { | |
548 | 542 | let curStats = getWlgStats2("", [rest2Contract, acres2Contract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, usdtAmt) | |
549 | - | let curWlgAmount = curStats[ixWlgAmount] | |
550 | 543 | let wlgPrice = curStats[ixWlgPrice] | |
551 | - | let buyPrice = fraction(wlgPrice, 6, 5) | |
544 | + | let buyPrice = fraction(wlgPrice, 6, 5, CEILING) | |
552 | 545 | let wlgAmount = fraction(usdtAmt, MULT8, buyPrice) | |
553 | - | let maxWlg = | |
546 | + | let maxWlg = getSwapLimitWlgold(address) | |
554 | 547 | let maxUsdt = fraction(maxWlg, buyPrice, MULT8) | |
555 | 548 | let profitAmount = (usdtAmt / 6) | |
556 | 549 | $Tuple2(nil, [wlgAmount, MINSHOPPAYMENT, maxUsdt, profitAmount]) | |
569 | 562 | let wlgAmt = pmt.amount | |
570 | 563 | let caller = i.caller | |
571 | 564 | let addr = toString(caller) | |
572 | - | let maxWlg = | |
565 | + | let maxWlg = getSwapLimitWlgold(addr) | |
573 | 566 | if ((wlgAmt > maxWlg)) | |
574 | - | then throw((("You can spend max " + fixedPoint(maxWlg, 8)) + " WLGOLD")) | |
567 | + | then throw((("You can spend max " + fixedPoint(maxWlg, 8)) + " WLGOLD at the moment")) | |
575 | 568 | else if (if (!(isDefined(pmt.assetId))) | |
576 | 569 | then true | |
577 | 570 | else (value(pmt.assetId) != wlgAssetId)) | |
587 | 580 | then throw("Price changed during operation, please try again") | |
588 | 581 | else { | |
589 | 582 | let profitAmount = (usdtAmt / 5) | |
590 | - | $Tuple2([Burn(wlgAssetId, wlgAmt), IntegerEntry(wlgIssuedAmountKey, (curWlgAmount - wlgAmt)), IntegerEntry( | |
583 | + | $Tuple2([Burn(wlgAssetId, wlgAmt), IntegerEntry(wlgIssuedAmountKey, (curWlgAmount - wlgAmt)), IntegerEntry(keyLastWlgTradeTimeByUser(addr), lastBlock.timestamp), ScriptTransfer(addressFromStringValue(value(getString(profitAddrKey))), profitAmount, usdtAssetId), ScriptTransfer(caller, usdtAmt, usdtAssetId)], prologResult) | |
591 | 584 | } | |
592 | 585 | } | |
593 | 586 | } | |
598 | 591 | ||
599 | 592 | @Callable(i) | |
600 | 593 | func sellWlgREADONLY (address,wlgAmt) = { | |
601 | - | let maxWlg = | |
594 | + | let maxWlg = getSwapLimitWlgold(address) | |
602 | 595 | let curStats = getWlgStats2("", [rest2Contract, acres2Contract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, 0) | |
603 | - | let curWlgAmount = curStats[ixWlgAmount] | |
604 | 596 | let sellPrice = (curStats[ixWlgPrice] / 2) | |
605 | 597 | let usdtAmt = fraction(wlgAmt, sellPrice, MULT8) | |
606 | 598 | let minWlg = fraction(MINSHOPPAYMENT, MULT8, sellPrice) | |
617 | 609 | then if ((size(i.payments) != 0)) | |
618 | 610 | then throw("No payments required") | |
619 | 611 | else { | |
620 | - | let $ | |
621 | - | let actions = $ | |
622 | - | let wlgClaimedAmount = $ | |
612 | + | let $t01193312002 = claimInternal2(toString(i.caller)) | |
613 | + | let actions = $t01193312002._1 | |
614 | + | let wlgClaimedAmount = $t01193312002._2 | |
623 | 615 | $Tuple2((actions :+ ScriptTransfer(i.caller, wlgClaimedAmount, wlgAssetId)), prologResult) | |
624 | 616 | } | |
625 | 617 | else throw("Strict value is not equal to itself.") | |
635 | 627 | else false) | |
636 | 628 | then throw("Permission denied") | |
637 | 629 | else { | |
638 | - | let $ | |
639 | - | let actions = $ | |
640 | - | let wlgClaimedAmount = $ | |
630 | + | let $t01232112375 = claimInternal2(addr) | |
631 | + | let actions = $t01232112375._1 | |
632 | + | let wlgClaimedAmount = $t01232112375._2 | |
641 | 633 | $Tuple2(if ((wlgClaimedAmount > 0)) | |
642 | 634 | then (actions :+ ScriptTransfer(addressFromStringValue(addr), wlgClaimedAmount, wlgAssetId)) | |
643 | 635 | else actions, wlgClaimedAmount) | |
723 | 715 | func takeWlgXp (addr) = if ((i.caller != stakingContract)) | |
724 | 716 | then throw("Permission denied") | |
725 | 717 | else { | |
726 | - | let $ | |
727 | - | let actions = $ | |
728 | - | let xp = $ | |
718 | + | let $t02043920482 = takeXpInternal(addr, 0) | |
719 | + | let actions = $t02043920482._1 | |
720 | + | let xp = $t02043920482._2 | |
729 | 721 | $Tuple2(actions, xp) | |
730 | 722 | } | |
731 | 723 | ||
733 | 725 | ||
734 | 726 | @Callable(i) | |
735 | 727 | func checkWlgXpREADONLY (addr) = { | |
736 | - | let $ | |
737 | - | let ignored = $ | |
738 | - | let deltaXP = $ | |
728 | + | let $t02055920607 = takeXpInternal(addr, 0) | |
729 | + | let ignored = $t02055920607._1 | |
730 | + | let deltaXP = $t02055920607._2 | |
739 | 731 | let newXP = (valueOrElse(getInteger(stakingContract, keyUserXP(addr)), 0) + deltaXP) | |
740 | 732 | let lvlPoints = levelUp(valueOrElse(getInteger(stakingContract, keyUserLevel(addr)), 0), newXP) | |
741 | 733 | $Tuple2(nil, (lvlPoints :+ newXP)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let DAY_MILLIS = 86400000 | |
5 | 5 | ||
6 | 6 | let chain = take(drop(this.bytes, 1), 1) | |
7 | 7 | ||
8 | 8 | let usdtAssetId = match chain { | |
9 | 9 | case _ => | |
10 | 10 | if ((base58'2W' == $match0)) | |
11 | 11 | then base58'9wc3LXNA4TEBsXyKtoLE9mrbDD7WMHXvXrCjZvabLAsi' | |
12 | 12 | else if ((base58'2T' == $match0)) | |
13 | 13 | then base58'6mWwf9mZBjVgkC54idpyaZLQfAosD914wT8fGf2iiY63' | |
14 | 14 | else throw("Unknown chain") | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | let defaultRestAddressStr = match chain { | |
18 | 18 | case _ => | |
19 | 19 | if ((base58'2W' == $match0)) | |
20 | 20 | then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv" | |
21 | 21 | else if ((base58'2T' == $match0)) | |
22 | 22 | then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy" | |
23 | 23 | else throw("Unknown chain") | |
24 | 24 | } | |
25 | 25 | ||
26 | 26 | let acres2AddressStr = match chain { | |
27 | 27 | case _ => | |
28 | 28 | if ((base58'2W' == $match0)) | |
29 | 29 | then "3P4UH3T9nXpMNpUmSmQjPmEz3G85t3zn6eA" | |
30 | 30 | else if ((base58'2T' == $match0)) | |
31 | 31 | then "3NBPx1Fciu3JQNEGZ21jSnTdutLNGGBUSXh" | |
32 | - | else throw("Unknown chain") | |
33 | - | } | |
34 | - | ||
35 | - | let arbitrageDelay = match chain { | |
36 | - | case _ => | |
37 | - | if ((base58'2W' == $match0)) | |
38 | - | then DAY_MILLIS | |
39 | - | else if ((base58'2T' == $match0)) | |
40 | - | then 60000 | |
41 | 32 | else throw("Unknown chain") | |
42 | 33 | } | |
43 | 34 | ||
44 | 35 | let SEP = "__" | |
45 | 36 | ||
46 | 37 | let MULT6 = 1000000 | |
47 | 38 | ||
48 | 39 | let MULT8 = 100000000 | |
49 | 40 | ||
50 | 41 | let MINSHOPPAYMENT = 100000 | |
51 | 42 | ||
52 | 43 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
53 | 44 | ||
54 | 45 | ||
55 | 46 | let IdxCfgStakingDapp = 1 | |
56 | 47 | ||
57 | 48 | let IdxCfgWlgDapp = 4 | |
58 | 49 | ||
59 | 50 | let IdxCfgPuzzlePoolDapp = 5 | |
60 | 51 | ||
61 | 52 | let IdxCfgInvestFundDapp = 6 | |
62 | 53 | ||
63 | 54 | let IdxCfgAcresDapp = 8 | |
64 | 55 | ||
65 | 56 | func keyRestCfg () = "%s__restConfig" | |
66 | 57 | ||
67 | 58 | ||
68 | 59 | func keyRestAddress () = "%s__restAddr" | |
69 | 60 | ||
70 | 61 | ||
71 | 62 | func keyRest2Address () = "%s__rest2Addr" | |
72 | 63 | ||
73 | 64 | ||
74 | 65 | func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP) | |
75 | 66 | ||
76 | 67 | ||
77 | 68 | func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx))) | |
78 | 69 | ||
79 | 70 | ||
80 | 71 | let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr)) | |
81 | 72 | ||
82 | 73 | let restCfg = readRestCfgOrFail(restContract) | |
83 | 74 | ||
84 | 75 | let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp) | |
85 | 76 | ||
86 | 77 | let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp) | |
87 | 78 | ||
88 | 79 | let puzzlePoolContract = getContractAddressOrFail(restCfg, IdxCfgPuzzlePoolDapp) | |
89 | 80 | ||
90 | 81 | let investFundContract = getContractAddressOrFail(restCfg, IdxCfgInvestFundDapp) | |
91 | 82 | ||
92 | 83 | let acresContract = getContractAddressOrFail(restCfg, IdxCfgAcresDapp) | |
93 | 84 | ||
94 | 85 | let wlgAssetIdKey = "wlg_assetId" | |
95 | 86 | ||
96 | 87 | let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "WLGOLD is not issued yet") | |
97 | 88 | ||
98 | 89 | func asInt (v) = match v { | |
99 | 90 | case n: Int => | |
100 | 91 | n | |
101 | 92 | case _ => | |
102 | 93 | throw("fail to cast into Int") | |
103 | 94 | } | |
104 | 95 | ||
105 | 96 | ||
106 | 97 | func fixedPoint (val,decimals) = { | |
107 | 98 | let tenPow = pow(10, 0, decimals, 0, 0, DOWN) | |
108 | 99 | let lowPart = toString((val % tenPow)) | |
109 | 100 | let zeroes = drop(toString(tenPow), (1 + size(lowPart))) | |
110 | 101 | (((toString((val / tenPow)) + ".") + zeroes) + lowPart) | |
111 | 102 | } | |
112 | 103 | ||
113 | 104 | ||
114 | 105 | let SCALE8 = 100000000 | |
115 | 106 | ||
116 | 107 | let xpLevelScale = 3200 | |
117 | 108 | ||
118 | 109 | let xpLevelRecipPow = 4000 | |
119 | 110 | ||
120 | 111 | let numPointsOnLevelUp = 3 | |
121 | 112 | ||
122 | 113 | let wlgBaseAmountXp = 100000000000 | |
123 | 114 | ||
124 | 115 | func keyUserXP (addr) = ("userXP_" + addr) | |
125 | 116 | ||
126 | 117 | ||
127 | 118 | func keyUserLevel (addr) = ("userLevel_" + addr) | |
128 | 119 | ||
129 | 120 | ||
130 | 121 | let xpWlg = 10000 | |
131 | 122 | ||
132 | 123 | func levelByXP (xp) = fraction(xpLevelScale, pow(xp, 4, xpLevelRecipPow, 4, 4, DOWN), SCALE8) | |
133 | 124 | ||
134 | 125 | ||
135 | 126 | func levelUp (currLevel,newXP) = { | |
136 | 127 | let newLevel = levelByXP(newXP) | |
137 | 128 | [newLevel, (numPointsOnLevelUp * (newLevel - currLevel))] | |
138 | 129 | } | |
139 | 130 | ||
140 | 131 | ||
141 | 132 | let MILLION6 = 100000000000000 | |
142 | 133 | ||
143 | 134 | let PLAYERSHARE = 400000 | |
144 | 135 | ||
145 | 136 | let DAYMILLIS = 86400000 | |
146 | 137 | ||
147 | 138 | let teamAddrKey = "teamAddr" | |
148 | 139 | ||
149 | 140 | let lastTeamTimeKey = "lastClaimedTime_team" | |
150 | 141 | ||
151 | 142 | let teamAmountLeftKey = "teamAmountLeft" | |
152 | 143 | ||
153 | 144 | let lastActivitiesTimeKey = "lastClaimedTime_activities" | |
154 | 145 | ||
155 | 146 | let actAmountLeftKey = "activitiesAmountLeft" | |
156 | 147 | ||
157 | 148 | let stakersAmountLeftKey = "stakersAmountLeft" | |
158 | 149 | ||
159 | - | func keyLastArbTimeByUser (addr) = ("lastArbTimeUser_" + addr) | |
150 | + | func keyLastWlgTradeTimeByUser (addr) = ("lastArbTimeUser_" + addr) | |
151 | + | ||
152 | + | ||
153 | + | func keyLastWlgTradeLimitByUser (addr) = ("lastWlgLimitUser_" + addr) | |
160 | 154 | ||
161 | 155 | ||
162 | 156 | let wlgIssueTimeKey = "wlg_issueTime" | |
163 | 157 | ||
164 | 158 | let wlgIssuedAmountKey = "wlg_issuedAmount" | |
165 | 159 | ||
166 | 160 | func keyAcresStakedAmountByUser (addr) = ("acresStakedAmountByUser_" + addr) | |
167 | 161 | ||
168 | 162 | ||
169 | 163 | func keyWlgStakedAmountByUser (addr) = ("wlgStakedAmountByUser_" + addr) | |
170 | 164 | ||
171 | 165 | ||
172 | 166 | let wlgStakedTotalKey = "wlgStakedAmountTotal" | |
173 | 167 | ||
174 | 168 | func keyWlgStakedTimeByUser (addr) = ("wlgStakedTimeByUser_" + addr) | |
175 | 169 | ||
176 | 170 | ||
177 | 171 | let M6_ = 1000000 | |
178 | 172 | ||
179 | 173 | let M8_ = 100000000 | |
180 | 174 | ||
181 | 175 | let TEAM_SHARE = 200000 | |
182 | 176 | ||
183 | 177 | let ACTIVITY_SHARE = 100000 | |
184 | 178 | ||
185 | 179 | let PLAYER_SHARE = 400000 | |
186 | 180 | ||
187 | 181 | let YEAR_MILLIS = 31557600000 | |
188 | 182 | ||
189 | 183 | let DAY_MS = 86400000 | |
190 | 184 | ||
191 | 185 | let DAY_BLOCKS = 1440 | |
192 | 186 | ||
193 | 187 | let ISSUE10 = 1000000000 | |
194 | 188 | ||
195 | 189 | let PLAYERS10_SHARE = 800000 | |
196 | 190 | ||
197 | 191 | let MARKETING10_SHARE = 100000 | |
198 | 192 | ||
199 | 193 | let TEAM10_SHARE = 100000 | |
200 | 194 | ||
201 | 195 | let NEW_STAKING_START = 1731279600000 | |
202 | 196 | ||
203 | 197 | let marketingAddrKey = "marketingAddr" | |
204 | 198 | ||
205 | 199 | let teamAdrKey = "teamAddr" | |
206 | 200 | ||
207 | 201 | let lastTeamTimKey = "lastClaimedTime_team" | |
208 | 202 | ||
209 | 203 | let teamAmtLeftKey = "teamAmountLeft" | |
210 | 204 | ||
211 | 205 | let lastActivitiesTimKey = "lastClaimedTime_activities" | |
212 | 206 | ||
213 | 207 | let actAmtLeftKey = "activitiesAmountLeft" | |
214 | 208 | ||
215 | 209 | let stakersAmtLeftKey = "stakersAmountLeft" | |
216 | 210 | ||
217 | 211 | func keyLastClaimTimeByUser (addr) = ("lastClaimedTimeUser_" + addr) | |
218 | 212 | ||
219 | 213 | ||
220 | 214 | func distrByPeriod (issuedAmount,period) = fraction(issuedAmount, (PLAYER_SHARE * (period + 1)), (6 * M6_)) | |
221 | 215 | ||
222 | 216 | ||
223 | 217 | let wlgIssue10TimeKey = "wlg_issue10Time" | |
224 | 218 | ||
225 | 219 | let wlgIssueTimKey = "wlg_issueTime" | |
226 | 220 | ||
227 | 221 | let wlgIssuedAmtKey = "wlg_issuedAmount" | |
228 | 222 | ||
229 | 223 | let zbIssuedAmtKey = "zbill_issuedAmount" | |
230 | 224 | ||
231 | 225 | func keyAcresStakedAmtByUser (addr) = ("acresStakedAmountByUser_" + addr) | |
232 | 226 | ||
233 | 227 | ||
234 | 228 | let totalFarmingPowerKey = "totalFarmingPower" | |
235 | 229 | ||
236 | 230 | let dapp2Rest = 0 | |
237 | 231 | ||
238 | 232 | let dapp2Staking = 1 | |
239 | 233 | ||
240 | 234 | let dapp2Wlg = 2 | |
241 | 235 | ||
242 | 236 | let dapp2Puzzle = 3 | |
243 | 237 | ||
244 | 238 | let dapp2InvestFund = 4 | |
245 | 239 | ||
246 | 240 | let levelAcres = [0, 10, 20, 40, 80, 150, 250, 400, 700, 1000] | |
247 | 241 | ||
248 | 242 | func getLevelByAcres (acres) = { | |
249 | 243 | let acr = ((acres + 99999999) / M8_) | |
250 | 244 | func checker (acc,item) = if ((item >= acr)) | |
251 | 245 | then acc | |
252 | 246 | else (acc + 1) | |
253 | 247 | ||
254 | 248 | let $l = levelAcres | |
255 | 249 | let $s = size($l) | |
256 | 250 | let $acc0 = 0 | |
257 | 251 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
258 | 252 | then $a | |
259 | 253 | else checker($a, $l[$i]) | |
260 | 254 | ||
261 | 255 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
262 | 256 | then $a | |
263 | 257 | else throw("List size exceeds 10") | |
264 | 258 | ||
265 | 259 | $f0_2($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) | |
266 | 260 | } | |
267 | 261 | ||
268 | 262 | ||
269 | 263 | func getFarmingPowerByAcres (acres) = ((acres * 20) * (getLevelByAcres(acres) + 4)) | |
270 | 264 | ||
271 | 265 | ||
272 | 266 | func getFarmingPowers (userAddrStrOrEmpty,acres2Contract) = { | |
273 | 267 | let totalFP = valueOrElse(getInteger(acres2Contract, totalFarmingPowerKey), 0) | |
274 | 268 | let userAcres = valueOrElse(getInteger(acres2Contract, keyAcresStakedAmtByUser(userAddrStrOrEmpty)), 0) | |
275 | 269 | let userFP = getFarmingPowerByAcres(userAcres) | |
276 | 270 | [totalFP, userFP] | |
277 | 271 | } | |
278 | 272 | ||
279 | 273 | ||
280 | 274 | func keyUserBet (addr) = ("userBet_" + addr) | |
281 | 275 | ||
282 | 276 | ||
283 | 277 | func keyUserTickets (addr) = ("userTickets_" + addr) | |
284 | 278 | ||
285 | 279 | ||
286 | 280 | let keyTotalTickets = "totalTickets" | |
287 | 281 | ||
288 | 282 | func winningBet (day) = (toInt(value(value(blockInfoByHeight((day * DAY_BLOCKS))).vrf)) % 4) | |
289 | 283 | ||
290 | 284 | ||
291 | 285 | let idxTotalFP = 0 | |
292 | 286 | ||
293 | 287 | let idxUserFP = 1 | |
294 | 288 | ||
295 | 289 | let ixWlgAmount = 0 | |
296 | 290 | ||
297 | 291 | let ixWlgWlg = 1 | |
298 | 292 | ||
299 | 293 | let ixWlgPrice = 2 | |
300 | 294 | ||
301 | 295 | let ixWlgIssueTime = 8 | |
302 | 296 | ||
303 | 297 | let ixWlgTeamAmLeft = 11 | |
304 | 298 | ||
305 | 299 | let ixWlgTeamAmAvailNow = 12 | |
306 | 300 | ||
307 | 301 | let ixWlgActAmLeft = 15 | |
308 | 302 | ||
309 | 303 | let ixWlgActAmAvailNow = 16 | |
310 | 304 | ||
311 | 305 | let ixWlgAmLeftTotal = 19 | |
312 | 306 | ||
313 | 307 | let ixWlgUserAmAvailNow = 23 | |
314 | 308 | ||
315 | 309 | let ixWlgEffUserTime = 24 | |
316 | 310 | ||
317 | 311 | let ixWlgIssue10Amount = 25 | |
318 | 312 | ||
319 | 313 | let ixWlgMarketingIssue10Amount = 26 | |
320 | 314 | ||
321 | 315 | let ixWlgTeamIssue10Amount = 27 | |
322 | 316 | ||
323 | 317 | let ixWlgUser10part = 28 | |
324 | 318 | ||
325 | 319 | let ixWlgIssue10Time = 29 | |
326 | 320 | ||
327 | 321 | func getWlgStats2 (userAddrOpt,contracts,usdtId,usdtBalanceCorrection) = { | |
328 | 322 | let issuedAmount = valueOrErrorMessage(getInteger(contracts[dapp2Wlg], wlgIssuedAmtKey), "WLGOLD is not issued yet") | |
329 | 323 | let restUsd = assetBalance(contracts[dapp2Rest], usdtId) | |
330 | 324 | let wlgUsd = (assetBalance(contracts[dapp2Wlg], usdtId) - usdtBalanceCorrection) | |
331 | 325 | let puzzleUsd = assetBalance(contracts[dapp2Puzzle], usdtId) | |
332 | 326 | let acres2Usd = assetBalance(contracts[dapp2Staking], usdtId) | |
333 | 327 | let investFndContract = contracts[dapp2InvestFund] | |
334 | 328 | let investFundTotal = (assetBalance(investFndContract, usdtId) + valueOrElse(getInteger(investFndContract, zbIssuedAmtKey), 0)) | |
335 | 329 | let totalFundsUsd = ((acres2Usd + wlgUsd) + investFundTotal) | |
336 | 330 | let wlgId = valueOrErrorMessage(getBinary(contracts[dapp2Wlg], "wlg_assetId"), "Not initialized yet") | |
337 | 331 | let now = lastBlock.timestamp | |
338 | 332 | let issueTime = valueOrErrorMessage(getInteger(contracts[dapp2Wlg], wlgIssueTimKey), "Not initialized") | |
339 | 333 | let wlgWlg = assetBalance(contracts[dapp2Wlg], wlgId) | |
340 | 334 | let teamTotal = fraction(issuedAmount, TEAM_SHARE, M6_) | |
341 | 335 | let teamAmountLeft = valueOrElse(getInteger(contracts[dapp2Wlg], teamAmtLeftKey), teamTotal) | |
342 | 336 | let lastTeamTime = valueOrElse(getInteger(contracts[dapp2Wlg], lastTeamTimKey), issueTime) | |
343 | 337 | let teamAddr = addressFromStringValue(value(getString(contracts[dapp2Wlg], teamAdrKey))) | |
344 | 338 | let teamAmountAvailableNow = min([fraction(teamTotal, (now - lastTeamTime), (3 * YEAR_MILLIS)), teamAmountLeft]) | |
345 | 339 | let teamWlgold = assetBalance(teamAddr, wlgId) | |
346 | 340 | let actTotal = fraction(issuedAmount, ACTIVITY_SHARE, M6_) | |
347 | 341 | let actAmountLeft = valueOrElse(getInteger(contracts[dapp2Wlg], actAmtLeftKey), actTotal) | |
348 | 342 | let lastActivitiesTime = valueOrElse(getInteger(contracts[dapp2Wlg], lastActivitiesTimKey), issueTime) | |
349 | 343 | let actAmountAvailableNow = min([fraction(actTotal, (now - lastActivitiesTime), (3 * YEAR_MILLIS)), actAmountLeft]) | |
350 | 344 | let actWlgold = assetBalance(contracts[dapp2Rest], wlgId) | |
351 | 345 | let lastUserTime = valueOrElse(getInteger(contracts[dapp2Wlg], keyLastClaimTimeByUser(userAddrOpt)), issueTime) | |
352 | 346 | let lastUserPeriod = ((lastUserTime - issueTime) / YEAR_MILLIS) | |
353 | 347 | let nowLimited = min([now, (issueTime + (3 * YEAR_MILLIS))]) | |
354 | 348 | let curPeriod = min([((now - issueTime) / YEAR_MILLIS), 2]) | |
355 | 349 | let eff = getFarmingPowers(userAddrOpt, contracts[dapp2Staking]) | |
356 | 350 | let curPeriodDistribution = distrByPeriod(issuedAmount, curPeriod) | |
357 | 351 | let prevPeriodEnd = (issueTime + (YEAR_MILLIS * curPeriod)) | |
358 | 352 | let prevPrevPeriodEnd = (issueTime + (YEAR_MILLIS * (curPeriod - 1))) | |
359 | 353 | let a0 = fraction(curPeriodDistribution, (nowLimited - lastUserTime), YEAR_MILLIS) | |
360 | 354 | let userAvailable = if ((lastUserPeriod == curPeriod)) | |
361 | 355 | then a0 | |
362 | 356 | else if ((lastUserPeriod == (curPeriod - 1))) | |
363 | 357 | then { | |
364 | 358 | let a1 = fraction(distrByPeriod(issuedAmount, (curPeriod - 1)), (prevPeriodEnd - lastUserTime), YEAR_MILLIS) | |
365 | 359 | (a1 + a0) | |
366 | 360 | } | |
367 | 361 | else { | |
368 | 362 | let a2 = fraction(distrByPeriod(issuedAmount, (curPeriod - 2)), (prevPrevPeriodEnd - lastUserTime), YEAR_MILLIS) | |
369 | 363 | let a1 = distrByPeriod(issuedAmount, (curPeriod - 1)) | |
370 | 364 | ((a2 + a1) + a0) | |
371 | 365 | } | |
372 | 366 | let amountLeftTotal = valueOrElse(getInteger(contracts[dapp2Wlg], stakersAmtLeftKey), 0) | |
373 | 367 | let userAmount = if ((eff[idxTotalFP] != 0)) | |
374 | 368 | then fraction(userAvailable, eff[idxUserFP], eff[idxTotalFP]) | |
375 | 369 | else 0 | |
376 | 370 | let lastIssue10Time = valueOrElse(getInteger(contracts[dapp2Wlg], wlgIssue10TimeKey), NEW_STAKING_START) | |
377 | 371 | let issue10Amount = fraction(ISSUE10, max([(now - lastIssue10Time), 0]), DAY_MS) | |
378 | 372 | let marketingIssue10Amount = fraction(issue10Amount, MARKETING10_SHARE, M6_) | |
379 | 373 | let teamIssue10Amount = fraction(issue10Amount, TEAM10_SHARE, M6_) | |
380 | 374 | let user10Interval = max([(now - max([NEW_STAKING_START, lastUserTime])), 0]) | |
381 | 375 | let user10part = if ((eff[idxTotalFP] != 0)) | |
382 | 376 | then fraction(fraction(fraction(ISSUE10, user10Interval, DAY_MS), eff[idxUserFP], eff[idxTotalFP]), PLAYERS10_SHARE, M6_) | |
383 | 377 | else 0 | |
384 | 378 | let newIssue10Time = max([NEW_STAKING_START, now]) | |
385 | 379 | [issuedAmount, wlgWlg, fraction(totalFundsUsd, M8_, issuedAmount), totalFundsUsd, restUsd, acres2Usd, wlgUsd, puzzleUsd, issueTime, lastTeamTime, teamTotal, teamAmountLeft, teamAmountAvailableNow, teamWlgold, actTotal, actAmountLeft, actAmountAvailableNow, actWlgold, curPeriod, amountLeftTotal, curPeriodDistribution, lastUserTime, investFundTotal, userAmount, nowLimited, issue10Amount, marketingIssue10Amount, teamIssue10Amount, user10part, newIssue10Time, eff[idxTotalFP]] | |
386 | 380 | } | |
387 | 381 | ||
388 | 382 | ||
389 | 383 | let net = take(drop(this.bytes, 1), 1) | |
390 | 384 | ||
391 | 385 | let defaultRest2AddressStr = match net { | |
392 | 386 | case _ => | |
393 | 387 | if ((base58'2W' == $match0)) | |
394 | 388 | then "3PFwYta8biEz31zpeFe5DJK8wE5trSpQVF8" | |
395 | 389 | else if ((base58'2T' == $match0)) | |
396 | 390 | then "3N7UuYar6264P58FBhVWKPQAh4Yua2hgngv" | |
397 | 391 | else throw("Unknown chain") | |
398 | 392 | } | |
399 | 393 | ||
400 | 394 | let profitAddrKey = "profitAddr" | |
401 | 395 | ||
402 | 396 | let stakersAmountPaidTotalKey = "stakersAmountPaidTotal" | |
403 | 397 | ||
404 | 398 | func keyStakersAmountPaidUser (addr) = ("stakersAmountPaidUser_" + addr) | |
405 | 399 | ||
406 | 400 | ||
407 | 401 | let rest2Contract = addressFromStringValue(valueOrElse(getString(this, keyRest2Address()), defaultRest2AddressStr)) | |
408 | 402 | ||
409 | 403 | let acres2Contract = addressFromStringValue(acres2AddressStr) | |
410 | 404 | ||
411 | 405 | func prolog2 () = asInt(reentrantInvoke(acres2Contract, "saveLastTx", nil, nil)) | |
412 | 406 | ||
413 | 407 | ||
414 | - | func | |
415 | - | let lastTime = valueOrElse(getInteger( | |
416 | - | let | |
417 | - | | |
418 | - | | |
419 | - | | |
408 | + | func getSwapLimitWlgold (addr) = { | |
409 | + | let lastTime = valueOrElse(getInteger(keyLastWlgTradeTimeByUser(addr)), 0) | |
410 | + | let defaultLimit = valueOrElse(getInteger(acres2Contract, keyAcresStakedAmountByUser(addr)), 0) | |
411 | + | let lastLimitLeft = valueOrElse(getInteger(keyLastWlgTradeLimitByUser(addr)), defaultLimit) | |
412 | + | let currentLimit = (lastLimitLeft + fraction(defaultLimit, (lastBlock.timestamp - lastTime), DAY_MILLIS)) | |
413 | + | min([currentLimit, defaultLimit]) | |
420 | 414 | } | |
421 | 415 | ||
422 | 416 | ||
423 | 417 | func claimInternal2 (addr) = { | |
424 | 418 | let curStats = getWlgStats2(addr, [rest2Contract, acres2Contract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, 0) | |
425 | 419 | let userTimeKey = keyLastClaimTimeByUser(addr) | |
426 | 420 | let lastUserTime = valueOrElse(getInteger(userTimeKey), 0) | |
427 | 421 | let userEffTime = curStats[ixWlgEffUserTime] | |
428 | 422 | if ((lastUserTime == userEffTime)) | |
429 | 423 | then $Tuple2(nil, 0) | |
430 | 424 | else { | |
431 | 425 | let now = lastBlock.timestamp | |
432 | 426 | let issueTime = curStats[ixWlgIssueTime] | |
433 | 427 | let teamAmountLeft = curStats[ixWlgTeamAmLeft] | |
434 | 428 | let teamAmount = (curStats[ixWlgTeamAmAvailNow] + curStats[ixWlgTeamIssue10Amount]) | |
435 | 429 | let teamTransfer = if ((teamAmount > 0)) | |
436 | 430 | then [ScriptTransfer(addressFromStringValue(value(getString(teamAddrKey))), teamAmount, wlgAssetId)] | |
437 | 431 | else nil | |
438 | 432 | let actAmountLeft = curStats[ixWlgActAmLeft] | |
439 | 433 | let actAmount = curStats[ixWlgActAmAvailNow] | |
440 | 434 | let actTransfer = if ((actAmount > 0)) | |
441 | 435 | then [ScriptTransfer(restContract, actAmount, wlgAssetId)] | |
442 | 436 | else nil | |
443 | 437 | let marketingAmount = curStats[ixWlgMarketingIssue10Amount] | |
444 | 438 | let marketingTransfer = if ((marketingAmount > 0)) | |
445 | 439 | then [ScriptTransfer(addressFromStringValue(value(getString(marketingAddrKey))), marketingAmount, wlgAssetId)] | |
446 | 440 | else nil | |
447 | 441 | let userAmount = curStats[ixWlgUserAmAvailNow] | |
448 | 442 | let userKey = keyStakersAmountPaidUser(addr) | |
449 | 443 | let userTotal = (userAmount + curStats[ixWlgUser10part]) | |
450 | 444 | let issued10Amount = curStats[ixWlgIssue10Amount] | |
451 | 445 | $Tuple2(((([Reissue(wlgAssetId, issued10Amount, true), IntegerEntry(wlgIssuedAmountKey, (curStats[ixWlgAmount] + issued10Amount)), IntegerEntry(wlgIssue10TimeKey, curStats[ixWlgIssue10Time]), IntegerEntry(userKey, (valueOrElse(getInteger(userKey), 0) + userAmount)), IntegerEntry(stakersAmountPaidTotalKey, (valueOrElse(getInteger(stakersAmountPaidTotalKey), 0) + userAmount)), IntegerEntry(stakersAmountLeftKey, (curStats[ixWlgAmLeftTotal] - userAmount)), IntegerEntry(teamAmountLeftKey, ((teamAmountLeft - teamAmount) + curStats[ixWlgTeamIssue10Amount])), IntegerEntry(lastTeamTimeKey, now), IntegerEntry(actAmountLeftKey, (actAmountLeft - actAmount)), IntegerEntry(lastActivitiesTimeKey, now), IntegerEntry(userTimeKey, userEffTime)] ++ teamTransfer) ++ actTransfer) ++ marketingTransfer), userTotal) | |
452 | 446 | } | |
453 | 447 | } | |
454 | 448 | ||
455 | 449 | ||
456 | 450 | func takeXpInternal (addr,delta) = { | |
457 | 451 | let now = lastBlock.timestamp | |
458 | 452 | let timeKey = keyWlgStakedTimeByUser(addr) | |
459 | 453 | let amountKey = keyWlgStakedAmountByUser(addr) | |
460 | 454 | let lastTime = valueOrElse(getInteger(timeKey), 0) | |
461 | 455 | let oldUser = valueOrElse(getInteger(amountKey), 0) | |
462 | 456 | let oldTotal = valueOrElse(getInteger(wlgStakedTotalKey), 0) | |
463 | 457 | let xp = fraction(fraction(xpWlg, oldUser, wlgBaseAmountXp), (lastTime - now), DAYMILLIS) | |
464 | 458 | $Tuple3([IntegerEntry(timeKey, now), IntegerEntry(amountKey, (oldUser + delta)), IntegerEntry(wlgStakedTotalKey, (oldTotal + delta))], xp, oldUser) | |
465 | 459 | } | |
466 | 460 | ||
467 | 461 | ||
468 | 462 | func claimTicketsInternal (addr,userBetStr) = { | |
469 | 463 | let totalTicketsKey = keyTotalTickets | |
470 | 464 | let ticketsKey = keyUserTickets(addr) | |
471 | 465 | let betKey = keyUserBet(addr) | |
472 | 466 | let dayBet = split(userBetStr, "_") | |
473 | 467 | let oldTotalTickets = valueOrElse(getInteger(totalTicketsKey), 0) | |
474 | 468 | let oldTickets = valueOrElse(getInteger(ticketsKey), 0) | |
475 | 469 | let deltaTickets = if ((winningBet(parseIntValue(dayBet[0])) == parseIntValue(dayBet[1]))) | |
476 | 470 | then 1 | |
477 | 471 | else 0 | |
478 | 472 | $Tuple3(if ((deltaTickets == 0)) | |
479 | 473 | then nil | |
480 | 474 | else [IntegerEntry(ticketsKey, (oldTickets + deltaTickets)), IntegerEntry(totalTicketsKey, (oldTotalTickets + deltaTickets))], DeleteEntry(betKey), deltaTickets) | |
481 | 475 | } | |
482 | 476 | ||
483 | 477 | ||
484 | 478 | @Callable(i) | |
485 | 479 | func constructorV1 (restAddr,marketingAddr,teamAddr,profitAddr) = if ((i.caller != this)) | |
486 | 480 | then throw("Permission denied") | |
487 | 481 | else if (isDefined(getBinary(wlgAssetIdKey))) | |
488 | 482 | then throw("Already initialized") | |
489 | 483 | else { | |
490 | 484 | let issuedAmount = MILLION6 | |
491 | 485 | let issue = Issue("WLGOLD", "WavesLands Gold investment token", issuedAmount, 8, true, unit, 0) | |
492 | 486 | let assetId = calculateAssetId(issue) | |
493 | 487 | [issue, IntegerEntry(wlgIssueTimeKey, lastBlock.timestamp), IntegerEntry(wlgIssuedAmountKey, issuedAmount), IntegerEntry(stakersAmountPaidTotalKey, 0), IntegerEntry(stakersAmountLeftKey, fraction(MILLION6, PLAYERSHARE, MULT6)), BinaryEntry(wlgAssetIdKey, assetId), StringEntry(keyRestAddress(), restAddr), StringEntry(marketingAddrKey, marketingAddr), StringEntry(teamAddrKey, teamAddr), StringEntry(profitAddrKey, profitAddr)] | |
494 | 488 | } | |
495 | 489 | ||
496 | 490 | ||
497 | 491 | ||
498 | 492 | @Callable(i) | |
499 | 493 | func constructorV2 (rest2Addr) = if ((i.caller != this)) | |
500 | 494 | then throw("Permission denied") | |
501 | 495 | else [StringEntry(keyRest2Address(), rest2Addr)] | |
502 | 496 | ||
503 | 497 | ||
504 | 498 | ||
505 | 499 | @Callable(i) | |
506 | - | func buyWlg ( | |
500 | + | func buyWlg (minToReceive) = { | |
507 | 501 | let prologResult = prolog2() | |
508 | 502 | if ((prologResult == prologResult)) | |
509 | 503 | then if ((size(i.payments) != 1)) | |
510 | 504 | then throw("exactly 1 payment must be attached") | |
511 | 505 | else { | |
512 | 506 | let pmt = i.payments[0] | |
513 | 507 | let usdtAmt = pmt.amount | |
514 | 508 | if (if (!(isDefined(pmt.assetId))) | |
515 | 509 | then true | |
516 | 510 | else (value(pmt.assetId) != usdtAssetId)) | |
517 | 511 | then throw("USDT payments only!") | |
518 | 512 | else { | |
519 | 513 | let caller = i.caller | |
520 | 514 | let addr = toString(caller) | |
521 | 515 | if ((MINSHOPPAYMENT > usdtAmt)) | |
522 | 516 | then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT")) | |
523 | 517 | else { | |
524 | 518 | let curStats = getWlgStats2("", [rest2Contract, acres2Contract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, usdtAmt) | |
525 | 519 | let curWlgAmount = curStats[ixWlgAmount] | |
526 | 520 | let wlgPrice = curStats[ixWlgPrice] | |
527 | - | let buyPrice = fraction(wlgPrice, 6, 5) | |
521 | + | let buyPrice = fraction(wlgPrice, 6, 5, CEILING) | |
528 | 522 | let wlgAmount = fraction(usdtAmt, MULT8, buyPrice) | |
529 | - | let maxWlg = | |
523 | + | let maxWlg = getSwapLimitWlgold(addr) | |
530 | 524 | if ((wlgAmount > maxWlg)) | |
531 | - | then throw((("You can get max " + fixedPoint(maxWlg, 8)) + " WLGOLD")) | |
532 | - | else if (( | |
525 | + | then throw((("You can get max " + fixedPoint(maxWlg, 8)) + " WLGOLD at the moment")) | |
526 | + | else if ((minToReceive > wlgAmount)) | |
533 | 527 | then throw("Price changed during operation, please try again") | |
534 | 528 | else { | |
535 | 529 | let profitAmount = (usdtAmt / 6) | |
536 | - | $Tuple2([Reissue(wlgAssetId, wlgAmount, true), IntegerEntry(wlgIssuedAmountKey, (curWlgAmount + wlgAmount)), IntegerEntry( | |
530 | + | $Tuple2([Reissue(wlgAssetId, wlgAmount, true), IntegerEntry(wlgIssuedAmountKey, (curWlgAmount + wlgAmount)), IntegerEntry(keyLastWlgTradeTimeByUser(addr), lastBlock.timestamp), ScriptTransfer(addressFromStringValue(value(getString(profitAddrKey))), profitAmount, usdtAssetId), ScriptTransfer(caller, wlgAmount, wlgAssetId)], prologResult) | |
537 | 531 | } | |
538 | 532 | } | |
539 | 533 | } | |
540 | 534 | } | |
541 | 535 | else throw("Strict value is not equal to itself.") | |
542 | 536 | } | |
543 | 537 | ||
544 | 538 | ||
545 | 539 | ||
546 | 540 | @Callable(i) | |
547 | 541 | func buyWlgREADONLY (address,usdtAmt) = { | |
548 | 542 | let curStats = getWlgStats2("", [rest2Contract, acres2Contract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, usdtAmt) | |
549 | - | let curWlgAmount = curStats[ixWlgAmount] | |
550 | 543 | let wlgPrice = curStats[ixWlgPrice] | |
551 | - | let buyPrice = fraction(wlgPrice, 6, 5) | |
544 | + | let buyPrice = fraction(wlgPrice, 6, 5, CEILING) | |
552 | 545 | let wlgAmount = fraction(usdtAmt, MULT8, buyPrice) | |
553 | - | let maxWlg = | |
546 | + | let maxWlg = getSwapLimitWlgold(address) | |
554 | 547 | let maxUsdt = fraction(maxWlg, buyPrice, MULT8) | |
555 | 548 | let profitAmount = (usdtAmt / 6) | |
556 | 549 | $Tuple2(nil, [wlgAmount, MINSHOPPAYMENT, maxUsdt, profitAmount]) | |
557 | 550 | } | |
558 | 551 | ||
559 | 552 | ||
560 | 553 | ||
561 | 554 | @Callable(i) | |
562 | 555 | func sellWlg (minAmount) = { | |
563 | 556 | let prologResult = prolog2() | |
564 | 557 | if ((prologResult == prologResult)) | |
565 | 558 | then if ((size(i.payments) != 1)) | |
566 | 559 | then throw("exactly 1 payment must be attached") | |
567 | 560 | else { | |
568 | 561 | let pmt = i.payments[0] | |
569 | 562 | let wlgAmt = pmt.amount | |
570 | 563 | let caller = i.caller | |
571 | 564 | let addr = toString(caller) | |
572 | - | let maxWlg = | |
565 | + | let maxWlg = getSwapLimitWlgold(addr) | |
573 | 566 | if ((wlgAmt > maxWlg)) | |
574 | - | then throw((("You can spend max " + fixedPoint(maxWlg, 8)) + " WLGOLD")) | |
567 | + | then throw((("You can spend max " + fixedPoint(maxWlg, 8)) + " WLGOLD at the moment")) | |
575 | 568 | else if (if (!(isDefined(pmt.assetId))) | |
576 | 569 | then true | |
577 | 570 | else (value(pmt.assetId) != wlgAssetId)) | |
578 | 571 | then throw("WLGOLD payments only!") | |
579 | 572 | else { | |
580 | 573 | let curStats = getWlgStats2("", [rest2Contract, acres2Contract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, 0) | |
581 | 574 | let curWlgAmount = curStats[ixWlgAmount] | |
582 | 575 | let sellPrice = (curStats[ixWlgPrice] / 2) | |
583 | 576 | let usdtAmt = fraction(wlgAmt, sellPrice, MULT8) | |
584 | 577 | if ((MINSHOPPAYMENT > usdtAmt)) | |
585 | 578 | then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT")) | |
586 | 579 | else if ((minAmount > usdtAmt)) | |
587 | 580 | then throw("Price changed during operation, please try again") | |
588 | 581 | else { | |
589 | 582 | let profitAmount = (usdtAmt / 5) | |
590 | - | $Tuple2([Burn(wlgAssetId, wlgAmt), IntegerEntry(wlgIssuedAmountKey, (curWlgAmount - wlgAmt)), IntegerEntry( | |
583 | + | $Tuple2([Burn(wlgAssetId, wlgAmt), IntegerEntry(wlgIssuedAmountKey, (curWlgAmount - wlgAmt)), IntegerEntry(keyLastWlgTradeTimeByUser(addr), lastBlock.timestamp), ScriptTransfer(addressFromStringValue(value(getString(profitAddrKey))), profitAmount, usdtAssetId), ScriptTransfer(caller, usdtAmt, usdtAssetId)], prologResult) | |
591 | 584 | } | |
592 | 585 | } | |
593 | 586 | } | |
594 | 587 | else throw("Strict value is not equal to itself.") | |
595 | 588 | } | |
596 | 589 | ||
597 | 590 | ||
598 | 591 | ||
599 | 592 | @Callable(i) | |
600 | 593 | func sellWlgREADONLY (address,wlgAmt) = { | |
601 | - | let maxWlg = | |
594 | + | let maxWlg = getSwapLimitWlgold(address) | |
602 | 595 | let curStats = getWlgStats2("", [rest2Contract, acres2Contract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, 0) | |
603 | - | let curWlgAmount = curStats[ixWlgAmount] | |
604 | 596 | let sellPrice = (curStats[ixWlgPrice] / 2) | |
605 | 597 | let usdtAmt = fraction(wlgAmt, sellPrice, MULT8) | |
606 | 598 | let minWlg = fraction(MINSHOPPAYMENT, MULT8, sellPrice) | |
607 | 599 | let profitAmount = (usdtAmt / 5) | |
608 | 600 | $Tuple2(nil, [usdtAmt, minWlg, maxWlg, profitAmount]) | |
609 | 601 | } | |
610 | 602 | ||
611 | 603 | ||
612 | 604 | ||
613 | 605 | @Callable(i) | |
614 | 606 | func claim () = { | |
615 | 607 | let prologResult = prolog2() | |
616 | 608 | if ((prologResult == prologResult)) | |
617 | 609 | then if ((size(i.payments) != 0)) | |
618 | 610 | then throw("No payments required") | |
619 | 611 | else { | |
620 | - | let $ | |
621 | - | let actions = $ | |
622 | - | let wlgClaimedAmount = $ | |
612 | + | let $t01193312002 = claimInternal2(toString(i.caller)) | |
613 | + | let actions = $t01193312002._1 | |
614 | + | let wlgClaimedAmount = $t01193312002._2 | |
623 | 615 | $Tuple2((actions :+ ScriptTransfer(i.caller, wlgClaimedAmount, wlgAssetId)), prologResult) | |
624 | 616 | } | |
625 | 617 | else throw("Strict value is not equal to itself.") | |
626 | 618 | } | |
627 | 619 | ||
628 | 620 | ||
629 | 621 | ||
630 | 622 | @Callable(i) | |
631 | 623 | func onStakeUnstakeLand (addr) = if (if (if ((i.caller != stakingContract)) | |
632 | 624 | then (i.caller != acresContract) | |
633 | 625 | else false) | |
634 | 626 | then (i.caller != acres2Contract) | |
635 | 627 | else false) | |
636 | 628 | then throw("Permission denied") | |
637 | 629 | else { | |
638 | - | let $ | |
639 | - | let actions = $ | |
640 | - | let wlgClaimedAmount = $ | |
630 | + | let $t01232112375 = claimInternal2(addr) | |
631 | + | let actions = $t01232112375._1 | |
632 | + | let wlgClaimedAmount = $t01232112375._2 | |
641 | 633 | $Tuple2(if ((wlgClaimedAmount > 0)) | |
642 | 634 | then (actions :+ ScriptTransfer(addressFromStringValue(addr), wlgClaimedAmount, wlgAssetId)) | |
643 | 635 | else actions, wlgClaimedAmount) | |
644 | 636 | } | |
645 | 637 | ||
646 | 638 | ||
647 | 639 | ||
648 | 640 | @Callable(i) | |
649 | 641 | func burnWlgold (wlgAmt) = if ((i.caller != acres2Contract)) | |
650 | 642 | then throw("Permission denied") | |
651 | 643 | else { | |
652 | 644 | let curStats = getWlgStats2("", [rest2Contract, acres2Contract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, 0) | |
653 | 645 | if ((wlgAmt > curStats[ixWlgWlg])) | |
654 | 646 | then throw(((("Only " + fixedPoint(curStats[ixWlgWlg], 8)) + " WLGOLD left on contract, can't burn ") + fixedPoint(wlgAmt, 8))) | |
655 | 647 | else { | |
656 | 648 | let wlgAmountLeft = (curStats[ixWlgAmount] - wlgAmt) | |
657 | 649 | $Tuple2([Burn(wlgAssetId, wlgAmt), IntegerEntry(wlgIssuedAmountKey, wlgAmountLeft)], wlgAmountLeft) | |
658 | 650 | } | |
659 | 651 | } | |
660 | 652 | ||
661 | 653 | ||
662 | 654 | ||
663 | 655 | @Callable(i) | |
664 | 656 | func betForTicket (bet) = { | |
665 | 657 | let prologResult = prolog2() | |
666 | 658 | if ((prologResult == prologResult)) | |
667 | 659 | then if ((size(i.payments) != 0)) | |
668 | 660 | then throw("No payments required") | |
669 | 661 | else if (((bet / 4) != 0)) | |
670 | 662 | then throw("Invalid bet: should be 0..3") | |
671 | 663 | else { | |
672 | 664 | let moment = (height % DAY_BLOCKS) | |
673 | 665 | if ((moment > (DAY_BLOCKS - 3))) | |
674 | 666 | then throw((("Cannot bet: the day is almost ended, please wait " + toString((DAY_BLOCKS - moment))) + " blocks")) | |
675 | 667 | else { | |
676 | 668 | let addr = toString(i.caller) | |
677 | 669 | let stakedAcres = valueOrElse(getInteger(acres2Contract, keyAcresStakedAmtByUser(addr)), 0) | |
678 | 670 | let lvl = getLevelByAcres(stakedAcres) | |
679 | 671 | if ((lvl == 0)) | |
680 | 672 | then throw("You need to stake some ACRES to bet") | |
681 | 673 | else { | |
682 | 674 | let tomorrow = ((height / DAY_BLOCKS) + 1) | |
683 | 675 | let betKey = keyUserBet(addr) | |
684 | 676 | let userBetStr = getString(betKey) | |
685 | 677 | let newBetEntry = StringEntry(betKey, ((toString(tomorrow) + "_") + toString(bet))) | |
686 | 678 | if (isDefined(userBetStr)) | |
687 | 679 | then { | |
688 | 680 | let userBet = value(userBetStr) | |
689 | 681 | if ((split(userBet, "_")[0] == toString(tomorrow))) | |
690 | 682 | then throw("You already bet for tomorrow") | |
691 | 683 | else { | |
692 | 684 | let r = claimTicketsInternal(addr, userBet) | |
693 | 685 | $Tuple2(((r._1 :+ r._2) :+ newBetEntry), r._2) | |
694 | 686 | } | |
695 | 687 | } | |
696 | 688 | else $Tuple2([newBetEntry], 0) | |
697 | 689 | } | |
698 | 690 | } | |
699 | 691 | } | |
700 | 692 | else throw("Strict value is not equal to itself.") | |
701 | 693 | } | |
702 | 694 | ||
703 | 695 | ||
704 | 696 | ||
705 | 697 | @Callable(i) | |
706 | 698 | func claimTickets () = { | |
707 | 699 | let prologResult = prolog2() | |
708 | 700 | if ((prologResult == prologResult)) | |
709 | 701 | then if ((size(i.payments) != 0)) | |
710 | 702 | then throw("No payments required") | |
711 | 703 | else { | |
712 | 704 | let addr = toString(i.caller) | |
713 | 705 | let userBetStr = valueOrErrorMessage(getString(keyUserBet(addr)), "You have no tickets to claim") | |
714 | 706 | let r = claimTicketsInternal(addr, userBetStr) | |
715 | 707 | $Tuple2((r._1 :+ r._2), r._3) | |
716 | 708 | } | |
717 | 709 | else throw("Strict value is not equal to itself.") | |
718 | 710 | } | |
719 | 711 | ||
720 | 712 | ||
721 | 713 | ||
722 | 714 | @Callable(i) | |
723 | 715 | func takeWlgXp (addr) = if ((i.caller != stakingContract)) | |
724 | 716 | then throw("Permission denied") | |
725 | 717 | else { | |
726 | - | let $ | |
727 | - | let actions = $ | |
728 | - | let xp = $ | |
718 | + | let $t02043920482 = takeXpInternal(addr, 0) | |
719 | + | let actions = $t02043920482._1 | |
720 | + | let xp = $t02043920482._2 | |
729 | 721 | $Tuple2(actions, xp) | |
730 | 722 | } | |
731 | 723 | ||
732 | 724 | ||
733 | 725 | ||
734 | 726 | @Callable(i) | |
735 | 727 | func checkWlgXpREADONLY (addr) = { | |
736 | - | let $ | |
737 | - | let ignored = $ | |
738 | - | let deltaXP = $ | |
728 | + | let $t02055920607 = takeXpInternal(addr, 0) | |
729 | + | let ignored = $t02055920607._1 | |
730 | + | let deltaXP = $t02055920607._2 | |
739 | 731 | let newXP = (valueOrElse(getInteger(stakingContract, keyUserXP(addr)), 0) + deltaXP) | |
740 | 732 | let lvlPoints = levelUp(valueOrElse(getInteger(stakingContract, keyUserLevel(addr)), 0), newXP) | |
741 | 733 | $Tuple2(nil, (lvlPoints :+ newXP)) | |
742 | 734 | } | |
743 | 735 | ||
744 | 736 |
github/deemru/w8io/169f3d6 92.53 ms ◑