tx · DXj6csFNKmpdJqa7tq74Av6XU1rjhv83vKH4USbxesXU 3MrMbQwr3cpCvWMWCFjqUZzqRgxg8En6Jd5: -0.03700000 Waves 2022.12.15 13:01 [2361278] smart account 3MrMbQwr3cpCvWMWCFjqUZzqRgxg8En6Jd5 > SELF 0.00000000 Waves
{ "type": 13, "id": "DXj6csFNKmpdJqa7tq74Av6XU1rjhv83vKH4USbxesXU", "fee": 3700000, "feeAssetId": null, "timestamp": 1671098518287, "version": 2, "chainId": 84, "sender": "3MrMbQwr3cpCvWMWCFjqUZzqRgxg8En6Jd5", "senderPublicKey": "8WTLBzi1s9cZm76TPZ9czV6poaHGWvpZ7sCBeTBaa7uh", "proofs": [ "3qV57ZmSXMy1ezeLG9zN9dTcRHWiTtQsXXhkeGT5GZap6D6Ler8ATZgPbCKvKRFtwfbysqierupFn6gSgLvkeZvp" ], "script": "base64:BgJhCAISBAoCCAgSAwoBCBIAEgUKAwgIARIFCgMICAESBgoECAgIARIFCgMICAgSBQoDCAgBEgQKAggIEgMKAQgSBAoCCAESBQoDCAgBEgQKAggBEgQKAggBEgMKAQgSAwoBCGUAE2tfdG90YWxGZWVzSW5QZXJpb2QCE2tfdG90YWxGZWVzSW5QZXJpb2QAGGtfdG90YWxBc3NldEZlZXNJblBlcmlvZAIYa190b3RhbEFzc2V0RmVlc0luUGVyaW9kABRrX3RyYWRlckZlZXNJblBlcmlvZAIUa190cmFkZXJGZWVzSW5QZXJpb2QADmtfdHJhZGVyVm9sdW1lAg5rX3RyYWRlclZvbHVtZQAYa190cmFkZXJDdW11bGF0aXZlVm9sdW1lAhhrX3RyYWRlckN1bXVsYXRpdmVWb2x1bWUACmtfZmVlVGllcnMCCmtfZmVlVGllcnMADmtfbGFzdE5vdGlvbmFsAg5rX2xhc3ROb3Rpb25hbAAUa190b3RhbFNjb3JlSW5QZXJpb2QCFGtfdG90YWxTY29yZUluUGVyaW9kABVrX3RyYWRlclNjb3JlSW5QZXJpb2QCFWtfdHJhZGVyU2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udAEFB190cmFkZXIJAJQKAgUDbmlsBQZyZXN1bHQBaQEXdmlld19jb21wdXRlRmVlRGlzY291bnQBB190cmFkZXIEBnJlc3VsdAkBDmdldEZlZURpc2NvdW50AQUHX3RyYWRlcgkAAgEJAKQDAQUGcmVzdWx0AQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAkBDmFkbWluUHVibGljS2V5AHWSGw0=", "height": 2361278, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EWbphkhY6NbbuezqiPaYC3aVbUXB9C94t2kLetQdLB8R Next: C6sgCSTRqPbRwHr6t3oxVThLQD52fPNCzcp9QdYK5uqr Diff:
Old | New | Differences | |
---|---|---|---|
24 | 24 | let k_ammRewardRate = "k_ammRewardRate" | |
25 | 25 | ||
26 | 26 | let k_assetMaxAmountPerPeriod = "k_assetMaxAmountPerPeriod" | |
27 | + | ||
28 | + | let k_assetLastUpdated = "k_assetLastUpdated" | |
27 | 29 | ||
28 | 30 | let k_rewardAssetIds = "k_rewardAssetIds" | |
29 | 31 | ||
62 | 64 | let MS_IN_DAY = (1000 * 86400) | |
63 | 65 | ||
64 | 66 | let NO_DISCOUNT = (DECIMAL_UNIT / 100) | |
67 | + | ||
68 | + | let WEEK_COUNT = [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] | |
65 | 69 | ||
66 | 70 | func listToStr (_list) = { | |
67 | 71 | func _join (accumulator,val) = ((accumulator + val) + ",") | |
174 | 178 | ||
175 | 179 | ||
176 | 180 | func getAssetMaxAmountPerPeriodKey (_assetId) = ((k_assetMaxAmountPerPeriod + "_") + _assetId) | |
181 | + | ||
182 | + | ||
183 | + | func getAssetMaxAmountPerDefinedPeriodKey (_assetId,_period) = ((((k_assetMaxAmountPerPeriod + "_") + _assetId) + "_") + toString(_period)) | |
184 | + | ||
185 | + | ||
186 | + | func getAssetLastUpdatedKey (_assetId) = ((k_assetLastUpdated + "_") + _assetId) | |
177 | 187 | ||
178 | 188 | ||
179 | 189 | func getClaimedTraderAssetPeriodKey (_trader,_assetId,_period) = ((((((k_claimedAssetAndPeriod + "_") + _trader) + "_") + _assetId) + "_") + toString(_period)) | |
295 | 305 | } | |
296 | 306 | ||
297 | 307 | ||
308 | + | func getAssetMaxAmountPerDefinedPeriod (_assetId,_period) = { | |
309 | + | let key = getAssetMaxAmountPerDefinedPeriodKey(_assetId, _period) | |
310 | + | valueOrElse(getInteger(this, key), getAssetMaxAmountPerPeriod(_assetId)) | |
311 | + | } | |
312 | + | ||
313 | + | ||
298 | 314 | func getTotalClaimedForTraderAndAsset (_trader,_assetId) = { | |
299 | 315 | let key = getTotalClaimedForTraderAndAssetKey(_trader, _assetId) | |
300 | 316 | int0(key) | |
318 | 334 | int0(key) | |
319 | 335 | } | |
320 | 336 | else { | |
321 | - | let maxAmountOfAsset = | |
337 | + | let maxAmountOfAsset = getAssetMaxAmountPerDefinedPeriod(_assetId, _weekId) | |
322 | 338 | let maxAmountOfAssetToDistribute = muld(divd(totalFeesInPeriod, totalAssetFeesInPeriod), maxAmountOfAsset) | |
323 | 339 | maxAmountOfAssetToDistribute | |
324 | 340 | } | |
538 | 554 | let tiers = getFeeTiers() | |
539 | 555 | let cumulativeVolume = getTraderCumulativeVolume(_trader) | |
540 | 556 | func findFee (_acc,_tier) = { | |
541 | - | let $ | |
542 | - | let minCumulativeVolume = $ | |
543 | - | let discount = $ | |
557 | + | let $t01723817281 = _tier | |
558 | + | let minCumulativeVolume = $t01723817281._1 | |
559 | + | let discount = $t01723817281._2 | |
544 | 560 | if ((cumulativeVolume >= minCumulativeVolume)) | |
545 | 561 | then [discount] | |
546 | 562 | else _acc | |
627 | 643 | if (contains(_periods, toString(getWeekId(TIME)))) | |
628 | 644 | then throw("Can not claim rewards for current week") | |
629 | 645 | else { | |
630 | - | let $ | |
631 | - | let amount = $ | |
632 | - | let result = $ | |
646 | + | let $t01970019783 = claimAllRewardForPeriodForTrader(trader, _assetId, _periods) | |
647 | + | let amount = $t01970019783._1 | |
648 | + | let result = $t01970019783._2 | |
633 | 649 | if ((amount == 0)) | |
634 | 650 | then throw("Nothing to claim") | |
635 | 651 | else result | |
655 | 671 | else { | |
656 | 672 | let amms = getAmms() | |
657 | 673 | let rewardAssetIds = getRewardAssetIds() | |
674 | + | let weekId = getWeekId(TIME) | |
658 | 675 | let newRewardAssetIds = if (containsElement(rewardAssetIds, _assetId)) | |
659 | 676 | then rewardAssetIds | |
660 | 677 | else (rewardAssetIds :+ _assetId) | |
661 | - | [IntegerEntry(getAssetMaxAmountPerPeriodKey(_assetId), _maxAmountPerPeriod), StringEntry(k_rewardAssetIds, listToStr(newRewardAssetIds))] | |
678 | + | let previousMaxAmountPerPeriod = getAssetMaxAmountPerPeriod(_assetId) | |
679 | + | let fix = if ((previousMaxAmountPerPeriod > 0)) | |
680 | + | then { | |
681 | + | let key = getAssetLastUpdatedKey(_assetId) | |
682 | + | let prevUpdatedPeriod = valueOrElse(getInteger(this, key), 2736) | |
683 | + | func doFixAssetAmountAtPeriod (_acc,_increment) = { | |
684 | + | let fixWeekId = (prevUpdatedPeriod + _increment) | |
685 | + | if ((weekId > fixWeekId)) | |
686 | + | then (_acc :+ IntegerEntry(getAssetMaxAmountPerDefinedPeriodKey(_assetId, fixWeekId), previousMaxAmountPerPeriod)) | |
687 | + | else _acc | |
688 | + | } | |
689 | + | ||
690 | + | let $l = WEEK_COUNT | |
691 | + | let $s = size($l) | |
692 | + | let $acc0 = nil | |
693 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
694 | + | then $a | |
695 | + | else doFixAssetAmountAtPeriod($a, $l[$i]) | |
696 | + | ||
697 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
698 | + | then $a | |
699 | + | else throw("List size exceeds 52") | |
700 | + | ||
701 | + | $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($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) | |
702 | + | } | |
703 | + | else nil | |
704 | + | (fix ++ [IntegerEntry(getAssetMaxAmountPerPeriodKey(_assetId), _maxAmountPerPeriod), IntegerEntry(getAssetLastUpdatedKey(_assetId), weekId), StringEntry(k_rewardAssetIds, listToStr(newRewardAssetIds))]) | |
662 | 705 | } | |
663 | 706 | ||
664 | 707 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let k_totalFeesInPeriod = "k_totalFeesInPeriod" | |
5 | 5 | ||
6 | 6 | let k_totalAssetFeesInPeriod = "k_totalAssetFeesInPeriod" | |
7 | 7 | ||
8 | 8 | let k_traderFeesInPeriod = "k_traderFeesInPeriod" | |
9 | 9 | ||
10 | 10 | let k_traderVolume = "k_traderVolume" | |
11 | 11 | ||
12 | 12 | let k_traderCumulativeVolume = "k_traderCumulativeVolume" | |
13 | 13 | ||
14 | 14 | let k_feeTiers = "k_feeTiers" | |
15 | 15 | ||
16 | 16 | let k_lastNotional = "k_lastNotional" | |
17 | 17 | ||
18 | 18 | let k_totalScoreInPeriod = "k_totalScoreInPeriod" | |
19 | 19 | ||
20 | 20 | let k_traderScoreInPeriod = "k_traderScoreInPeriod" | |
21 | 21 | ||
22 | 22 | let k_traderAverageNotionalInPeriod = "k_traderAverageNotionalInPeriod" | |
23 | 23 | ||
24 | 24 | let k_ammRewardRate = "k_ammRewardRate" | |
25 | 25 | ||
26 | 26 | let k_assetMaxAmountPerPeriod = "k_assetMaxAmountPerPeriod" | |
27 | + | ||
28 | + | let k_assetLastUpdated = "k_assetLastUpdated" | |
27 | 29 | ||
28 | 30 | let k_rewardAssetIds = "k_rewardAssetIds" | |
29 | 31 | ||
30 | 32 | let k_amms = "k_amms" | |
31 | 33 | ||
32 | 34 | let k_claimedAssetAndPeriod = "k_claimedAssetAndPeriod" | |
33 | 35 | ||
34 | 36 | let k_oracleAddress = "k_oracleAddress" | |
35 | 37 | ||
36 | 38 | let k_oraclePrice = "price" | |
37 | 39 | ||
38 | 40 | let k_totalClaimedForTraderAndAsset = "k_totalClaimedForTraderAndAsset" | |
39 | 41 | ||
40 | 42 | let k_ammMaxAmountPerPeriod = "k_ammMaxAmountPerPeriod" | |
41 | 43 | ||
42 | 44 | let k_initialized = "k_initialized" | |
43 | 45 | ||
44 | 46 | let k_coordinatorAddress = "k_coordinatorAddress" | |
45 | 47 | ||
46 | 48 | let k_governance_asset = "k_gov_asset" | |
47 | 49 | ||
48 | 50 | let k_quote_asset = "k_quote_asset" | |
49 | 51 | ||
50 | 52 | let k_admin_public_key = "k_admin_public_key" | |
51 | 53 | ||
52 | 54 | let k_admin_address = "k_admin_address" | |
53 | 55 | ||
54 | 56 | let k_amm = "k_amm" | |
55 | 57 | ||
56 | 58 | let DECIMAL_UNIT = (1 * (((((((10 * 10) * 10) * 10) * 10) * 10) * 10) * 10)) | |
57 | 59 | ||
58 | 60 | let A = 70000000 | |
59 | 61 | ||
60 | 62 | let MS_IN_WEEK = (1000 * 604800) | |
61 | 63 | ||
62 | 64 | let MS_IN_DAY = (1000 * 86400) | |
63 | 65 | ||
64 | 66 | let NO_DISCOUNT = (DECIMAL_UNIT / 100) | |
67 | + | ||
68 | + | let WEEK_COUNT = [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] | |
65 | 69 | ||
66 | 70 | func listToStr (_list) = { | |
67 | 71 | func _join (accumulator,val) = ((accumulator + val) + ",") | |
68 | 72 | ||
69 | 73 | let newListStr = { | |
70 | 74 | let $l = _list | |
71 | 75 | let $s = size($l) | |
72 | 76 | let $acc0 = "" | |
73 | 77 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
74 | 78 | then $a | |
75 | 79 | else _join($a, $l[$i]) | |
76 | 80 | ||
77 | 81 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
78 | 82 | then $a | |
79 | 83 | else throw("List size exceeds 100") | |
80 | 84 | ||
81 | 85 | $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) | |
82 | 86 | } | |
83 | 87 | let newListStrU = dropRight(newListStr, 1) | |
84 | 88 | let newListStrR = if ((take(newListStrU, 1) == ",")) | |
85 | 89 | then drop(newListStrU, 1) | |
86 | 90 | else newListStrU | |
87 | 91 | newListStrR | |
88 | 92 | } | |
89 | 93 | ||
90 | 94 | ||
91 | 95 | func strToList (_str) = if ((_str == "")) | |
92 | 96 | then nil | |
93 | 97 | else split(_str, ",") | |
94 | 98 | ||
95 | 99 | ||
96 | 100 | func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN) | |
97 | 101 | ||
98 | 102 | ||
99 | 103 | func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN) | |
100 | 104 | ||
101 | 105 | ||
102 | 106 | func powd (_x,_y) = pow(_x, 8, _y, 8, 8, HALFEVEN) | |
103 | 107 | ||
104 | 108 | ||
105 | 109 | func abs (_x) = if ((_x > 0)) | |
106 | 110 | then _x | |
107 | 111 | else -(_x) | |
108 | 112 | ||
109 | 113 | ||
110 | 114 | func minv (_x,_y) = if ((_x > _y)) | |
111 | 115 | then _y | |
112 | 116 | else _x | |
113 | 117 | ||
114 | 118 | ||
115 | 119 | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
116 | 120 | ||
117 | 121 | ||
118 | 122 | let that = this | |
119 | 123 | ||
120 | 124 | func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(that, k_coordinatorAddress)), "Coordinator not set") | |
121 | 125 | ||
122 | 126 | ||
123 | 127 | func adminPublicKey () = fromBase58String(getStringValue(coordinator(), k_admin_public_key)) | |
124 | 128 | ||
125 | 129 | ||
126 | 130 | func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address)) | |
127 | 131 | ||
128 | 132 | ||
129 | 133 | func isWhitelist (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false) | |
130 | 134 | ||
131 | 135 | ||
132 | 136 | func int (k) = valueOrErrorMessage(getInteger(that, k), ("no value for " + k)) | |
133 | 137 | ||
134 | 138 | ||
135 | 139 | func int0 (k) = valueOrElse(getInteger(that, k), 0) | |
136 | 140 | ||
137 | 141 | ||
138 | 142 | func initialized () = valueOrElse(getBoolean(that, k_initialized), false) | |
139 | 143 | ||
140 | 144 | ||
141 | 145 | func getRewardAssetIds () = strToList(valueOrElse(getString(that, k_rewardAssetIds), "")) | |
142 | 146 | ||
143 | 147 | ||
144 | 148 | let TIME = lastBlock.timestamp | |
145 | 149 | ||
146 | 150 | func getTraderVolumeKey (_trader,_dayId) = ((((k_traderVolume + "_") + _trader) + "_") + toString(_dayId)) | |
147 | 151 | ||
148 | 152 | ||
149 | 153 | func getTraderCumulativeVolumeKey (_trader) = ((k_traderCumulativeVolume + "_") + _trader) | |
150 | 154 | ||
151 | 155 | ||
152 | 156 | func getTraderFeesInPeriodKey (_amm,_trader,_weekId) = ((((((k_traderFeesInPeriod + "_") + _amm) + "_") + _trader) + "_") + toString(_weekId)) | |
153 | 157 | ||
154 | 158 | ||
155 | 159 | func getTotalAmmFeesInPeriodKey (_amm,_weekId) = ((((k_totalFeesInPeriod + "_") + _amm) + "_") + toString(_weekId)) | |
156 | 160 | ||
157 | 161 | ||
158 | 162 | func getTotalAssetFeesInPeriodKey (_assetId,_weekId) = ((((k_totalAssetFeesInPeriod + "_") + _assetId) + "_") + toString(_weekId)) | |
159 | 163 | ||
160 | 164 | ||
161 | 165 | func getLastNotionalKey (_amm,_trader) = ((((k_lastNotional + "_") + _amm) + "_") + _trader) | |
162 | 166 | ||
163 | 167 | ||
164 | 168 | func getTraderScoreInPeriodKey (_amm,_trader,_weekId) = ((((((k_traderScoreInPeriod + "_") + _amm) + "_") + _trader) + "_") + toString(_weekId)) | |
165 | 169 | ||
166 | 170 | ||
167 | 171 | func getTotalScoreInPeriodKey (_amm,_weekId) = ((((k_totalScoreInPeriod + "_") + _amm) + "_") + toString(_weekId)) | |
168 | 172 | ||
169 | 173 | ||
170 | 174 | func getTraderAverageNotionalInPeriodKey (_amm,_trader,_weekId) = ((((((k_traderAverageNotionalInPeriod + "_") + _amm) + "_") + _trader) + "_") + toString(_weekId)) | |
171 | 175 | ||
172 | 176 | ||
173 | 177 | func getAmmRewardRateKey (_amm,_assetId) = ((((k_ammRewardRate + "_") + _amm) + "_") + _assetId) | |
174 | 178 | ||
175 | 179 | ||
176 | 180 | func getAssetMaxAmountPerPeriodKey (_assetId) = ((k_assetMaxAmountPerPeriod + "_") + _assetId) | |
181 | + | ||
182 | + | ||
183 | + | func getAssetMaxAmountPerDefinedPeriodKey (_assetId,_period) = ((((k_assetMaxAmountPerPeriod + "_") + _assetId) + "_") + toString(_period)) | |
184 | + | ||
185 | + | ||
186 | + | func getAssetLastUpdatedKey (_assetId) = ((k_assetLastUpdated + "_") + _assetId) | |
177 | 187 | ||
178 | 188 | ||
179 | 189 | func getClaimedTraderAssetPeriodKey (_trader,_assetId,_period) = ((((((k_claimedAssetAndPeriod + "_") + _trader) + "_") + _assetId) + "_") + toString(_period)) | |
180 | 190 | ||
181 | 191 | ||
182 | 192 | func getOraclePriceKey (_assetId,_period) = ((((k_oraclePrice + "_") + toString(_period)) + "_") + _assetId) | |
183 | 193 | ||
184 | 194 | ||
185 | 195 | func getTotalClaimedForTraderAndAssetKey (_trader,_assetId) = ((((k_totalClaimedForTraderAndAsset + "_") + _trader) + "_") + _assetId) | |
186 | 196 | ||
187 | 197 | ||
188 | 198 | func getAmmMaxAmountPerPeriodKey (_amm,_assetId) = ((((k_ammMaxAmountPerPeriod + "_") + _amm) + "_") + _assetId) | |
189 | 199 | ||
190 | 200 | ||
191 | 201 | func usdnToDecimals (_amount) = (_amount * 100) | |
192 | 202 | ||
193 | 203 | ||
194 | 204 | func getWeekStart (_weekId) = (_weekId * MS_IN_WEEK) | |
195 | 205 | ||
196 | 206 | ||
197 | 207 | func getWeekEnd (_weekId) = ((_weekId + 1) * MS_IN_WEEK) | |
198 | 208 | ||
199 | 209 | ||
200 | 210 | func getWeekId (_ts) = (_ts / MS_IN_WEEK) | |
201 | 211 | ||
202 | 212 | ||
203 | 213 | func getDayId (_ts) = (_ts / MS_IN_DAY) | |
204 | 214 | ||
205 | 215 | ||
206 | 216 | func getFeeTiers () = { | |
207 | 217 | let storedTiers = valueOrElse(getString(this, k_feeTiers), "") | |
208 | 218 | if ((storedTiers == "")) | |
209 | 219 | then nil | |
210 | 220 | else { | |
211 | 221 | let tiers = split(valueOrElse(getString(this, k_feeTiers), ""), ",") | |
212 | 222 | func toFeeTier (_acc,_tier) = { | |
213 | 223 | let tierSplit = split(_tier, ":") | |
214 | 224 | let minCumulativeVolume = parseIntValue(tierSplit[0]) | |
215 | 225 | let discount = parseIntValue(tierSplit[1]) | |
216 | 226 | (_acc :+ $Tuple2(minCumulativeVolume, discount)) | |
217 | 227 | } | |
218 | 228 | ||
219 | 229 | let $l = tiers | |
220 | 230 | let $s = size($l) | |
221 | 231 | let $acc0 = nil | |
222 | 232 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
223 | 233 | then $a | |
224 | 234 | else toFeeTier($a, $l[$i]) | |
225 | 235 | ||
226 | 236 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
227 | 237 | then $a | |
228 | 238 | else throw("List size exceeds 10") | |
229 | 239 | ||
230 | 240 | $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) | |
231 | 241 | } | |
232 | 242 | } | |
233 | 243 | ||
234 | 244 | ||
235 | 245 | func getTraderVolume (_trader,_dayId) = { | |
236 | 246 | let key = getTraderVolumeKey(_trader, _dayId) | |
237 | 247 | valueOrElse(getInteger(this, key), 0) | |
238 | 248 | } | |
239 | 249 | ||
240 | 250 | ||
241 | 251 | func getTraderCumulativeVolume (_trader) = { | |
242 | 252 | let key = getTraderCumulativeVolumeKey(_trader) | |
243 | 253 | valueOrElse(getInteger(this, key), 0) | |
244 | 254 | } | |
245 | 255 | ||
246 | 256 | ||
247 | 257 | func getFeesInPeriod (_amm,_trader,_weekId) = { | |
248 | 258 | let key = getTraderFeesInPeriodKey(_amm, _trader, _weekId) | |
249 | 259 | int0(key) | |
250 | 260 | } | |
251 | 261 | ||
252 | 262 | ||
253 | 263 | func getTotalFeesInPeriod (_amm,_weekId) = { | |
254 | 264 | let key = getTotalAmmFeesInPeriodKey(_amm, _weekId) | |
255 | 265 | int0(key) | |
256 | 266 | } | |
257 | 267 | ||
258 | 268 | ||
259 | 269 | func getTotalAssetFeesInPeriod (_assetId,_weekId) = { | |
260 | 270 | let key = getTotalAssetFeesInPeriodKey(_assetId, _weekId) | |
261 | 271 | int0(key) | |
262 | 272 | } | |
263 | 273 | ||
264 | 274 | ||
265 | 275 | func getLastNotional (_amm,_trader) = { | |
266 | 276 | let key = getLastNotionalKey(_amm, _trader) | |
267 | 277 | int0(key) | |
268 | 278 | } | |
269 | 279 | ||
270 | 280 | ||
271 | 281 | func getTraderScoreInPeriod (_amm,_trader,_weekId) = { | |
272 | 282 | let key = getTraderScoreInPeriodKey(_amm, _trader, _weekId) | |
273 | 283 | int0(key) | |
274 | 284 | } | |
275 | 285 | ||
276 | 286 | ||
277 | 287 | func getTotalScoreInPeriod (_amm,_weekId) = { | |
278 | 288 | let key = getTotalScoreInPeriodKey(_amm, _weekId) | |
279 | 289 | int0(key) | |
280 | 290 | } | |
281 | 291 | ||
282 | 292 | ||
283 | 293 | func getAmms () = strToList(valueOrElse(getString(that, k_amms), "")) | |
284 | 294 | ||
285 | 295 | ||
286 | 296 | func getAmmRewardRate (_amm,_assetId) = { | |
287 | 297 | let key = getAmmRewardRateKey(_amm, _assetId) | |
288 | 298 | int0(key) | |
289 | 299 | } | |
290 | 300 | ||
291 | 301 | ||
292 | 302 | func getAssetMaxAmountPerPeriod (_assetId) = { | |
293 | 303 | let key = getAssetMaxAmountPerPeriodKey(_assetId) | |
294 | 304 | int0(key) | |
295 | 305 | } | |
296 | 306 | ||
297 | 307 | ||
308 | + | func getAssetMaxAmountPerDefinedPeriod (_assetId,_period) = { | |
309 | + | let key = getAssetMaxAmountPerDefinedPeriodKey(_assetId, _period) | |
310 | + | valueOrElse(getInteger(this, key), getAssetMaxAmountPerPeriod(_assetId)) | |
311 | + | } | |
312 | + | ||
313 | + | ||
298 | 314 | func getTotalClaimedForTraderAndAsset (_trader,_assetId) = { | |
299 | 315 | let key = getTotalClaimedForTraderAndAssetKey(_trader, _assetId) | |
300 | 316 | int0(key) | |
301 | 317 | } | |
302 | 318 | ||
303 | 319 | ||
304 | 320 | func getRewardAssetPrice (_assetId,_weekId) = { | |
305 | 321 | let oracleAddressStr = valueOrErrorMessage(getString(that, k_oracleAddress), "Oracle not set") | |
306 | 322 | let oracleAddress = valueOrErrorMessage(addressFromString(oracleAddressStr), "Invalid oracle address") | |
307 | 323 | let priceKey = getOraclePriceKey(_assetId, _weekId) | |
308 | 324 | usdnToDecimals(valueOrErrorMessage(getInteger(oracleAddress, priceKey), ((("No oracle price for asset " + _assetId) + " period ") + toString(_weekId)))) | |
309 | 325 | } | |
310 | 326 | ||
311 | 327 | ||
312 | 328 | func getMaxAmountOfAssetToDistribute (_amm,_assetId,_weekId) = { | |
313 | 329 | let totalFeesInPeriod = getTotalFeesInPeriod(_amm, _weekId) | |
314 | 330 | let totalAssetFeesInPeriod = getTotalAssetFeesInPeriod(_assetId, _weekId) | |
315 | 331 | if ((totalAssetFeesInPeriod == 0)) | |
316 | 332 | then { | |
317 | 333 | let key = getAmmMaxAmountPerPeriodKey(_amm, _assetId) | |
318 | 334 | int0(key) | |
319 | 335 | } | |
320 | 336 | else { | |
321 | - | let maxAmountOfAsset = | |
337 | + | let maxAmountOfAsset = getAssetMaxAmountPerDefinedPeriod(_assetId, _weekId) | |
322 | 338 | let maxAmountOfAssetToDistribute = muld(divd(totalFeesInPeriod, totalAssetFeesInPeriod), maxAmountOfAsset) | |
323 | 339 | maxAmountOfAssetToDistribute | |
324 | 340 | } | |
325 | 341 | } | |
326 | 342 | ||
327 | 343 | ||
328 | 344 | func rewardForTraderInAssetInPeriod (_amm,_trader,_assetId,_weekId) = { | |
329 | 345 | let rewardAssetRate = getAmmRewardRate(_amm, _assetId) | |
330 | 346 | if ((rewardAssetRate == 0)) | |
331 | 347 | then 0 | |
332 | 348 | else { | |
333 | 349 | let totalFeesInPeriod = getTotalFeesInPeriod(_amm, _weekId) | |
334 | 350 | let rewardAssetPrice = getRewardAssetPrice(_assetId, _weekId) | |
335 | 351 | let maxAmountOfAssetToDistribute = getMaxAmountOfAssetToDistribute(_amm, _assetId, _weekId) | |
336 | 352 | let traderScore = getTraderScoreInPeriod(_amm, _trader, _weekId) | |
337 | 353 | let totalTraderScore = getTotalScoreInPeriod(_amm, _weekId) | |
338 | 354 | if ((totalTraderScore == 0)) | |
339 | 355 | then 0 | |
340 | 356 | else { | |
341 | 357 | let totalAssetToDistribute = divd(muld(totalFeesInPeriod, rewardAssetRate), rewardAssetPrice) | |
342 | 358 | let actualTotalAssetToDistribute = minv(totalAssetToDistribute, maxAmountOfAssetToDistribute) | |
343 | 359 | let traderShareInRewards = divd(muld(actualTotalAssetToDistribute, traderScore), totalTraderScore) | |
344 | 360 | traderShareInRewards | |
345 | 361 | } | |
346 | 362 | } | |
347 | 363 | } | |
348 | 364 | ||
349 | 365 | ||
350 | 366 | func rewardForAmmInAssetInPeriod (_amm,_assetId,_weekId) = { | |
351 | 367 | let rewardAssetRate = getAmmRewardRate(_amm, _assetId) | |
352 | 368 | if ((rewardAssetRate == 0)) | |
353 | 369 | then 0 | |
354 | 370 | else { | |
355 | 371 | let totalFeesInPeriod = getTotalFeesInPeriod(_amm, _weekId) | |
356 | 372 | let rewardAssetPrice = getRewardAssetPrice(_assetId, _weekId) | |
357 | 373 | let maxAmountOfAssetToDistribute = getMaxAmountOfAssetToDistribute(_amm, _assetId, _weekId) | |
358 | 374 | let totalAssetToDistribute = divd(muld(totalFeesInPeriod, rewardAssetRate), rewardAssetPrice) | |
359 | 375 | let actualTotalAssetToDistribute = minv(totalAssetToDistribute, maxAmountOfAssetToDistribute) | |
360 | 376 | actualTotalAssetToDistribute | |
361 | 377 | } | |
362 | 378 | } | |
363 | 379 | ||
364 | 380 | ||
365 | 381 | func totalRewardForTraderInAssetInPeriod (_trader,_assetId,_weekId) = { | |
366 | 382 | let amms = getAmms() | |
367 | 383 | func compute (_acc,_amm) = (_acc + rewardForTraderInAssetInPeriod(_amm, _trader, _assetId, _weekId)) | |
368 | 384 | ||
369 | 385 | let $l = amms | |
370 | 386 | let $s = size($l) | |
371 | 387 | let $acc0 = 0 | |
372 | 388 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
373 | 389 | then $a | |
374 | 390 | else compute($a, $l[$i]) | |
375 | 391 | ||
376 | 392 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
377 | 393 | then $a | |
378 | 394 | else throw("List size exceeds 20") | |
379 | 395 | ||
380 | 396 | $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($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
381 | 397 | } | |
382 | 398 | ||
383 | 399 | ||
384 | 400 | func totalRewardForTraderInAsset (_trader,_assetId,_periods) = { | |
385 | 401 | func compute (_acc,_weekId) = (_acc + totalRewardForTraderInAssetInPeriod(_trader, _assetId, _weekId)) | |
386 | 402 | ||
387 | 403 | let $l = _periods | |
388 | 404 | let $s = size($l) | |
389 | 405 | let $acc0 = 0 | |
390 | 406 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
391 | 407 | then $a | |
392 | 408 | else compute($a, $l[$i]) | |
393 | 409 | ||
394 | 410 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
395 | 411 | then $a | |
396 | 412 | else throw("List size exceeds 12") | |
397 | 413 | ||
398 | 414 | $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($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12) | |
399 | 415 | } | |
400 | 416 | ||
401 | 417 | ||
402 | 418 | func getTraderAverageNotionalInPeriod (_amm,_trader,_weekId,_defaultValue) = { | |
403 | 419 | let key = getTraderAverageNotionalInPeriodKey(_amm, _trader, _weekId) | |
404 | 420 | valueOrElse(getInteger(that, key), _defaultValue) | |
405 | 421 | } | |
406 | 422 | ||
407 | 423 | ||
408 | 424 | func isClaimed (_trader,_assetId,_period) = { | |
409 | 425 | let key = getClaimedTraderAssetPeriodKey(_trader, _assetId, _period) | |
410 | 426 | valueOrElse(getBoolean(that, key), false) | |
411 | 427 | } | |
412 | 428 | ||
413 | 429 | ||
414 | 430 | func adjust (_amount,_assetId) = { | |
415 | 431 | let asset = valueOrErrorMessage(assetInfo(fromBase58String(_assetId)), "Invalid asset id") | |
416 | 432 | let decimals = asset.decimals | |
417 | 433 | if ((decimals == 6)) | |
418 | 434 | then (_amount / 100) | |
419 | 435 | else _amount | |
420 | 436 | } | |
421 | 437 | ||
422 | 438 | ||
423 | 439 | func claimAllRewardForPeriodForTrader (_trader,_assetId,_periods) = { | |
424 | 440 | let periods = strToList(_periods) | |
425 | 441 | func checkAndFilterFn (_acc,_next) = { | |
426 | 442 | let period = valueOrErrorMessage(parseInt(_next), ("Invalid period: " + _next)) | |
427 | 443 | if (if (containsElement(_acc, period)) | |
428 | 444 | then true | |
429 | 445 | else isClaimed(_trader, _assetId, period)) | |
430 | 446 | then _acc | |
431 | 447 | else (_acc :+ period) | |
432 | 448 | } | |
433 | 449 | ||
434 | 450 | let validPeriods = { | |
435 | 451 | let $l = periods | |
436 | 452 | let $s = size($l) | |
437 | 453 | let $acc0 = nil | |
438 | 454 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
439 | 455 | then $a | |
440 | 456 | else checkAndFilterFn($a, $l[$i]) | |
441 | 457 | ||
442 | 458 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
443 | 459 | then $a | |
444 | 460 | else throw("List size exceeds 12") | |
445 | 461 | ||
446 | 462 | $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($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12) | |
447 | 463 | } | |
448 | 464 | func markPeriodAsDoneFn (_acc,_period) = (_acc :+ BooleanEntry(getClaimedTraderAssetPeriodKey(_trader, _assetId, _period), true)) | |
449 | 465 | ||
450 | 466 | let markPeriodsAsClaimed = { | |
451 | 467 | let $l = validPeriods | |
452 | 468 | let $s = size($l) | |
453 | 469 | let $acc0 = nil | |
454 | 470 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
455 | 471 | then $a | |
456 | 472 | else markPeriodAsDoneFn($a, $l[$i]) | |
457 | 473 | ||
458 | 474 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
459 | 475 | then $a | |
460 | 476 | else throw("List size exceeds 16") | |
461 | 477 | ||
462 | 478 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16) | |
463 | 479 | } | |
464 | 480 | let amount = totalRewardForTraderInAsset(_trader, _assetId, validPeriods) | |
465 | 481 | $Tuple2(amount, ([ScriptTransfer(addressFromStringValue(_trader), adjust(amount, _assetId), fromBase58String(_assetId)), IntegerEntry(getTotalClaimedForTraderAndAssetKey(_trader, _assetId), (getTotalClaimedForTraderAndAsset(_trader, _assetId) + amount))] ++ markPeriodsAsClaimed)) | |
466 | 482 | } | |
467 | 483 | ||
468 | 484 | ||
469 | 485 | func updateTraderVolume (_trader,_dayId,_generatedVolume) = { | |
470 | 486 | let actualDayVolume = (getTraderVolume(_trader, _dayId) + _generatedVolume) | |
471 | 487 | let daysBefore = [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] | |
472 | 488 | func updateCumulativeVolume (_acc,_minusDay) = (_acc + getTraderVolume(_trader, (_dayId - _minusDay))) | |
473 | 489 | ||
474 | 490 | let cumulativeVolume = { | |
475 | 491 | let $l = daysBefore | |
476 | 492 | let $s = size($l) | |
477 | 493 | let $acc0 = 0 | |
478 | 494 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
479 | 495 | then $a | |
480 | 496 | else updateCumulativeVolume($a, $l[$i]) | |
481 | 497 | ||
482 | 498 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
483 | 499 | then $a | |
484 | 500 | else throw("List size exceeds 30") | |
485 | 501 | ||
486 | 502 | $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($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) | |
487 | 503 | } | |
488 | 504 | [IntegerEntry(getTraderVolumeKey(_trader, _dayId), actualDayVolume), IntegerEntry(getTraderCumulativeVolumeKey(_trader), (cumulativeVolume + actualDayVolume))] | |
489 | 505 | } | |
490 | 506 | ||
491 | 507 | ||
492 | 508 | func updateAmmFees (_amm,_trader,_weekId,_actualFee) = { | |
493 | 509 | let traderFeesKey = getTraderFeesInPeriodKey(_amm, _trader, _weekId) | |
494 | 510 | let totalFeesKey = getTotalAmmFeesInPeriodKey(_amm, _weekId) | |
495 | 511 | let rewardAssets = getRewardAssetIds() | |
496 | 512 | let feesInPeriod = getFeesInPeriod(_amm, _trader, _weekId) | |
497 | 513 | let totalFeesInPeriod = getTotalFeesInPeriod(_amm, _weekId) | |
498 | 514 | let newFeesInPeriod = (feesInPeriod + _actualFee) | |
499 | 515 | let newTotalFeesInPeriod = (totalFeesInPeriod + _actualFee) | |
500 | 516 | func doHandleRewardAssetId (_acc,_assetId) = { | |
501 | 517 | let key = getAmmRewardRateKey(_amm, _assetId) | |
502 | 518 | if ((int0(key) > 0)) | |
503 | 519 | then { | |
504 | 520 | let totalAssetFeesKey = getTotalAssetFeesInPeriodKey(_assetId, _weekId) | |
505 | 521 | (_acc :+ IntegerEntry(totalAssetFeesKey, (getTotalAssetFeesInPeriod(_assetId, _weekId) + _actualFee))) | |
506 | 522 | } | |
507 | 523 | else _acc | |
508 | 524 | } | |
509 | 525 | ||
510 | 526 | let updateAssetFees = { | |
511 | 527 | let $l = rewardAssets | |
512 | 528 | let $s = size($l) | |
513 | 529 | let $acc0 = nil | |
514 | 530 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
515 | 531 | then $a | |
516 | 532 | else doHandleRewardAssetId($a, $l[$i]) | |
517 | 533 | ||
518 | 534 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
519 | 535 | then $a | |
520 | 536 | else throw("List size exceeds 10") | |
521 | 537 | ||
522 | 538 | $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) | |
523 | 539 | } | |
524 | 540 | ([IntegerEntry(traderFeesKey, newFeesInPeriod), IntegerEntry(totalFeesKey, newTotalFeesInPeriod)] ++ updateAssetFees) | |
525 | 541 | } | |
526 | 542 | ||
527 | 543 | ||
528 | 544 | func updateAmmData (_amm,_trader,_weekId,_traderAverage,_traderLastNotional,_traderScore,_totalScore) = { | |
529 | 545 | let totalScoreInPeriodKey = getTotalScoreInPeriodKey(_amm, _weekId) | |
530 | 546 | let traderScoreInPeriodKey = getTraderScoreInPeriodKey(_amm, _trader, _weekId) | |
531 | 547 | let lastNotionalKey = getLastNotionalKey(_amm, _trader) | |
532 | 548 | let traderAverageNotionalInPeriodKey = getTraderAverageNotionalInPeriodKey(_amm, _trader, _weekId) | |
533 | 549 | [IntegerEntry(totalScoreInPeriodKey, _totalScore), IntegerEntry(traderScoreInPeriodKey, _traderScore), IntegerEntry(lastNotionalKey, _traderLastNotional), IntegerEntry(traderAverageNotionalInPeriodKey, _traderAverage)] | |
534 | 550 | } | |
535 | 551 | ||
536 | 552 | ||
537 | 553 | func getFeeDiscount (_trader) = { | |
538 | 554 | let tiers = getFeeTiers() | |
539 | 555 | let cumulativeVolume = getTraderCumulativeVolume(_trader) | |
540 | 556 | func findFee (_acc,_tier) = { | |
541 | - | let $ | |
542 | - | let minCumulativeVolume = $ | |
543 | - | let discount = $ | |
557 | + | let $t01723817281 = _tier | |
558 | + | let minCumulativeVolume = $t01723817281._1 | |
559 | + | let discount = $t01723817281._2 | |
544 | 560 | if ((cumulativeVolume >= minCumulativeVolume)) | |
545 | 561 | then [discount] | |
546 | 562 | else _acc | |
547 | 563 | } | |
548 | 564 | ||
549 | 565 | let resultList = { | |
550 | 566 | let $l = tiers | |
551 | 567 | let $s = size($l) | |
552 | 568 | let $acc0 = [NO_DISCOUNT] | |
553 | 569 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
554 | 570 | then $a | |
555 | 571 | else findFee($a, $l[$i]) | |
556 | 572 | ||
557 | 573 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
558 | 574 | then $a | |
559 | 575 | else throw("List size exceeds 5") | |
560 | 576 | ||
561 | 577 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
562 | 578 | } | |
563 | 579 | resultList[0] | |
564 | 580 | } | |
565 | 581 | ||
566 | 582 | ||
567 | 583 | @Callable(i) | |
568 | 584 | func initialize (_coordinator,_oracle) = if (initialized()) | |
569 | 585 | then throw("Already initialized") | |
570 | 586 | else [StringEntry(k_coordinatorAddress, _coordinator), StringEntry(k_oracleAddress, _oracle), BooleanEntry(k_initialized, true)] | |
571 | 587 | ||
572 | 588 | ||
573 | 589 | ||
574 | 590 | @Callable(i) | |
575 | 591 | func setOracleAddress (_oracle) = if (if (!(initialized())) | |
576 | 592 | then true | |
577 | 593 | else (i.caller != adminAddress())) | |
578 | 594 | then throw("Invalid setOracleAddress parameters") | |
579 | 595 | else [StringEntry(k_oracleAddress, _oracle)] | |
580 | 596 | ||
581 | 597 | ||
582 | 598 | ||
583 | 599 | @Callable(i) | |
584 | 600 | func view_getPeriod () = { | |
585 | 601 | let weekId = getWeekId(TIME) | |
586 | 602 | let weekStart = getWeekStart(weekId) | |
587 | 603 | let weekEnd = getWeekEnd(weekId) | |
588 | 604 | throw(((((toString(weekStart) + ",") + toString(weekEnd)) + ",") + toString(TIME))) | |
589 | 605 | } | |
590 | 606 | ||
591 | 607 | ||
592 | 608 | ||
593 | 609 | @Callable(i) | |
594 | 610 | func view_getMaxAmountOfAssetToDistribute (_amm,_assetId,_weekId) = throw(toString(getMaxAmountOfAssetToDistribute(_amm, _assetId, _weekId))) | |
595 | 611 | ||
596 | 612 | ||
597 | 613 | ||
598 | 614 | @Callable(i) | |
599 | 615 | func view_claimRewards (_trader,_assetId,_period) = throw(toString(totalRewardForTraderInAsset(_trader, _assetId, [_period]))) | |
600 | 616 | ||
601 | 617 | ||
602 | 618 | ||
603 | 619 | @Callable(i) | |
604 | 620 | func view_calcReward (_trader,_amm,_assetId,_period) = throw(toString(rewardForTraderInAssetInPeriod(_amm, _assetId, _trader, _period))) | |
605 | 621 | ||
606 | 622 | ||
607 | 623 | ||
608 | 624 | @Callable(i) | |
609 | 625 | func view_claimAllRewards (_trader,_assetId,_periods) = { | |
610 | 626 | let result = claimAllRewardForPeriodForTrader(_trader, _assetId, _periods) | |
611 | 627 | throw(((toString(result._1) + ",") + toString(getTotalClaimedForTraderAndAsset(_trader, _assetId)))) | |
612 | 628 | } | |
613 | 629 | ||
614 | 630 | ||
615 | 631 | ||
616 | 632 | @Callable(i) | |
617 | 633 | func view_earnedRewards (_amm,_assetId,_period) = { | |
618 | 634 | let result = rewardForAmmInAssetInPeriod(_amm, _assetId, _period) | |
619 | 635 | throw(toString(result)) | |
620 | 636 | } | |
621 | 637 | ||
622 | 638 | ||
623 | 639 | ||
624 | 640 | @Callable(i) | |
625 | 641 | func claimAllRewards (_assetId,_periods) = { | |
626 | 642 | let trader = toString(i.caller) | |
627 | 643 | if (contains(_periods, toString(getWeekId(TIME)))) | |
628 | 644 | then throw("Can not claim rewards for current week") | |
629 | 645 | else { | |
630 | - | let $ | |
631 | - | let amount = $ | |
632 | - | let result = $ | |
646 | + | let $t01970019783 = claimAllRewardForPeriodForTrader(trader, _assetId, _periods) | |
647 | + | let amount = $t01970019783._1 | |
648 | + | let result = $t01970019783._2 | |
633 | 649 | if ((amount == 0)) | |
634 | 650 | then throw("Nothing to claim") | |
635 | 651 | else result | |
636 | 652 | } | |
637 | 653 | } | |
638 | 654 | ||
639 | 655 | ||
640 | 656 | ||
641 | 657 | @Callable(i) | |
642 | 658 | func setFeeDiscountTiers (_discounts) = if (if (!(initialized())) | |
643 | 659 | then true | |
644 | 660 | else (i.caller != adminAddress())) | |
645 | 661 | then throw("Invalid setFeeDiscountTiers params") | |
646 | 662 | else [StringEntry(k_feeTiers, _discounts)] | |
647 | 663 | ||
648 | 664 | ||
649 | 665 | ||
650 | 666 | @Callable(i) | |
651 | 667 | func attachRewardAsset (_assetId,_maxAmountPerPeriod) = if (if (!(initialized())) | |
652 | 668 | then true | |
653 | 669 | else (i.caller != adminAddress())) | |
654 | 670 | then throw("Invalid attachRewardAsset params") | |
655 | 671 | else { | |
656 | 672 | let amms = getAmms() | |
657 | 673 | let rewardAssetIds = getRewardAssetIds() | |
674 | + | let weekId = getWeekId(TIME) | |
658 | 675 | let newRewardAssetIds = if (containsElement(rewardAssetIds, _assetId)) | |
659 | 676 | then rewardAssetIds | |
660 | 677 | else (rewardAssetIds :+ _assetId) | |
661 | - | [IntegerEntry(getAssetMaxAmountPerPeriodKey(_assetId), _maxAmountPerPeriod), StringEntry(k_rewardAssetIds, listToStr(newRewardAssetIds))] | |
678 | + | let previousMaxAmountPerPeriod = getAssetMaxAmountPerPeriod(_assetId) | |
679 | + | let fix = if ((previousMaxAmountPerPeriod > 0)) | |
680 | + | then { | |
681 | + | let key = getAssetLastUpdatedKey(_assetId) | |
682 | + | let prevUpdatedPeriod = valueOrElse(getInteger(this, key), 2736) | |
683 | + | func doFixAssetAmountAtPeriod (_acc,_increment) = { | |
684 | + | let fixWeekId = (prevUpdatedPeriod + _increment) | |
685 | + | if ((weekId > fixWeekId)) | |
686 | + | then (_acc :+ IntegerEntry(getAssetMaxAmountPerDefinedPeriodKey(_assetId, fixWeekId), previousMaxAmountPerPeriod)) | |
687 | + | else _acc | |
688 | + | } | |
689 | + | ||
690 | + | let $l = WEEK_COUNT | |
691 | + | let $s = size($l) | |
692 | + | let $acc0 = nil | |
693 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
694 | + | then $a | |
695 | + | else doFixAssetAmountAtPeriod($a, $l[$i]) | |
696 | + | ||
697 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
698 | + | then $a | |
699 | + | else throw("List size exceeds 52") | |
700 | + | ||
701 | + | $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($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) | |
702 | + | } | |
703 | + | else nil | |
704 | + | (fix ++ [IntegerEntry(getAssetMaxAmountPerPeriodKey(_assetId), _maxAmountPerPeriod), IntegerEntry(getAssetLastUpdatedKey(_assetId), weekId), StringEntry(k_rewardAssetIds, listToStr(newRewardAssetIds))]) | |
662 | 705 | } | |
663 | 706 | ||
664 | 707 | ||
665 | 708 | ||
666 | 709 | @Callable(i) | |
667 | 710 | func attachRewards (_amm,_assetId,_rewardRate) = if (if (if (!(initialized())) | |
668 | 711 | then true | |
669 | 712 | else (i.caller != adminAddress())) | |
670 | 713 | then true | |
671 | 714 | else !(isWhitelist(_amm))) | |
672 | 715 | then throw("Invalid attachRewards params") | |
673 | 716 | else { | |
674 | 717 | let amms = getAmms() | |
675 | 718 | let rewardAssetIds = getRewardAssetIds() | |
676 | 719 | let newAmms = if (containsElement(amms, _amm)) | |
677 | 720 | then amms | |
678 | 721 | else (amms :+ _amm) | |
679 | 722 | let newRewardAssetIds = if (containsElement(rewardAssetIds, _assetId)) | |
680 | 723 | then rewardAssetIds | |
681 | 724 | else (rewardAssetIds :+ _assetId) | |
682 | 725 | [IntegerEntry(getAmmRewardRateKey(_amm, _assetId), _rewardRate), StringEntry(k_amms, listToStr(newAmms)), StringEntry(k_rewardAssetIds, listToStr(newRewardAssetIds))] | |
683 | 726 | } | |
684 | 727 | ||
685 | 728 | ||
686 | 729 | ||
687 | 730 | @Callable(i) | |
688 | 731 | func notifyFees (_trader,_fee) = { | |
689 | 732 | let amm = toString(i.caller) | |
690 | 733 | if (if (!(isWhitelist(amm))) | |
691 | 734 | then true | |
692 | 735 | else !(initialized())) | |
693 | 736 | then throw("Invalid notifyFees params") | |
694 | 737 | else { | |
695 | 738 | let actualFee = usdnToDecimals(_fee) | |
696 | 739 | let weekId = getWeekId(TIME) | |
697 | 740 | updateAmmFees(amm, _trader, weekId, actualFee) | |
698 | 741 | } | |
699 | 742 | } | |
700 | 743 | ||
701 | 744 | ||
702 | 745 | ||
703 | 746 | @Callable(i) | |
704 | 747 | func notifyNotional (_trader,_notional) = { | |
705 | 748 | let amm = toString(i.caller) | |
706 | 749 | if (if (!(isWhitelist(amm))) | |
707 | 750 | then true | |
708 | 751 | else !(initialized())) | |
709 | 752 | then throw("Invalid notifyNotional params") | |
710 | 753 | else { | |
711 | 754 | let actualNotional = usdnToDecimals(_notional) | |
712 | 755 | let lastNotional = getLastNotional(amm, _trader) | |
713 | 756 | let weekId = getWeekId(TIME) | |
714 | 757 | let dayId = getDayId(TIME) | |
715 | 758 | let weekStart = getWeekStart(weekId) | |
716 | 759 | let weekEnd = getWeekEnd(weekId) | |
717 | 760 | let t = (weekEnd - weekStart) | |
718 | 761 | let oldRunningAverage = getTraderAverageNotionalInPeriod(amm, _trader, weekId, lastNotional) | |
719 | 762 | let w = divd((weekEnd - TIME), t) | |
720 | 763 | let oldTraderAmmScore = getTraderScoreInPeriod(amm, _trader, weekId) | |
721 | 764 | let oldTotalAmmScore = getTotalScoreInPeriod(amm, weekId) | |
722 | 765 | let fees = getFeesInPeriod(amm, _trader, weekId) | |
723 | 766 | let newRunningAverage = ((oldRunningAverage + muld(actualNotional, w)) - muld(lastNotional, w)) | |
724 | 767 | let newTraderAmmScore = muld(powd(fees, A), powd(newRunningAverage, (DECIMAL_UNIT - A))) | |
725 | 768 | let newTotalAmmScoreInPeriod = ((oldTotalAmmScore - oldTraderAmmScore) + newTraderAmmScore) | |
726 | 769 | (updateAmmData(amm, _trader, weekId, newRunningAverage, actualNotional, newTraderAmmScore, newTotalAmmScoreInPeriod) ++ updateTraderVolume(_trader, dayId, abs((lastNotional - actualNotional)))) | |
727 | 770 | } | |
728 | 771 | } | |
729 | 772 | ||
730 | 773 | ||
731 | 774 | ||
732 | 775 | @Callable(i) | |
733 | 776 | func computeFeeDiscount (_trader) = { | |
734 | 777 | let result = getFeeDiscount(_trader) | |
735 | 778 | $Tuple2(nil, result) | |
736 | 779 | } | |
737 | 780 | ||
738 | 781 | ||
739 | 782 | ||
740 | 783 | @Callable(i) | |
741 | 784 | func view_computeFeeDiscount (_trader) = { | |
742 | 785 | let result = getFeeDiscount(_trader) | |
743 | 786 | throw(toString(result)) | |
744 | 787 | } | |
745 | 788 | ||
746 | 789 | ||
747 | 790 | @Verifier(tx) | |
748 | 791 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], adminPublicKey()) | |
749 | 792 |
github/deemru/w8io/169f3d6 97.14 ms ◑