tx · FcSbJUZFDd2qjamnSVWTAaSt2VP9vgbKkCoxS74X6E3L 3MrZiB53oC5t3EgGm2VTcUZ32s4fU7ouqEb: -0.03400000 Waves 2022.08.16 10:47 [2186736] smart account 3MrZiB53oC5t3EgGm2VTcUZ32s4fU7ouqEb > SELF 0.00000000 Waves
{ "type": 13, "id": "FcSbJUZFDd2qjamnSVWTAaSt2VP9vgbKkCoxS74X6E3L", "fee": 3400000, "feeAssetId": null, "timestamp": 1660636067283, "version": 2, "chainId": 84, "sender": "3MrZiB53oC5t3EgGm2VTcUZ32s4fU7ouqEb", "senderPublicKey": "DK6p79pR2qeCcRc55Jqx5W57tpipviJSSvCaCr5SCH24", "proofs": [ "ggMVo3RMK8ByzHL1hjybghWWn3pv5cwZ49hjJQkEC4akSc5FLytFC5QqkHDJdxJYbJMTGwXZH36VETwaTzo5HfD" ], "script": "base64:BgI9CAISBAoCCAgSAwoBCBIFCgMICAESBgoECAgIARIFCgMICAgSBAoCCAgSBgoECAgBARIECgIIARIECgIIAUkAE2tfdG90YWxGZWVzSW5QZXJpb2QCE2tfdG90YWxGZWVzSW5QZXJpb2QAFGtfdHJhZGVyRmVlc0luUGVyaW9kAhRrX3RyYWRlckZlZXNJblBlcmlvZAAOa19sYXN0Tm90aW9uYWwCDmtfbGFzdE5vdGlvbmFsABRrX3RvdGFsU2NvcmVJblBlcmlvZAIUa190b3RhbFNjb3JlSW5QZXJpb2QAFWtfdHJhZGVyU2NvcmVJblBlcmlvZAIVa190cmFkZXJTY29yZUluUGVyaW9kAB9rX3RyYWRlckF2ZXJhZ2VOb3Rpb25hbEluUGVyaW9kAh9rX3RyYWRlckF2ZXJhZ2VOb3Rpb25hbEluUGVyaW9kAA9rX2FtbVJld2FyZFJhdGUCD2tfYW1tUmV3YXJkUmF0ZQAXa19hbW1NYXhBbW91bnRQZXJQZXJpb2QCF2tfYW1tTWF4QW1vdW50UGVyUGVyaW9kABBrX3Jld2FyZEFzc2V0SWRzAhBrX3Jld2FyZEF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kBBG11bGQCBQxsYXN0Tm90aW9uYWwFAXcEEW5ld1RyYWRlckFtbVNjb3JlCQEEbXVsZAIJAQRwb3dkAgUEZmVlcwUBQQkBBHBvd2QCBRFuZXdSdW5uaW5nQXZlcmFnZQkAZQIFDERFQ0lNQUxfVU5JVAUBQQQYbmV3VG90YWxBbW1TY29yZUluUGVyaW9kCQBkAgkAZQIFEG9sZFRvdGFsQW1tU2NvcmUFEW9sZFRyYWRlckFtbVNjb3JlBRFuZXdUcmFkZXJBbW1TY29yZQkBDXVwZGF0ZUFtbURhdGEHBQNhbW0FB190cmFkZXIFBndlZWtJZAURbmV3UnVubmluZ0F2ZXJhZ2UFDmFjdHVhbE5vdGlvbmFsBRFuZXdUcmFkZXJBbW1TY29yZQUYbmV3VG90YWxBbW1TY29yZUluUGVyaW9kAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAkBDmFkbWluUHVibGljS2V5ANJswHw=", "height": 2186736, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let k_totalFeesInPeriod = "k_totalFeesInPeriod" | |
5 | + | ||
6 | + | let k_traderFeesInPeriod = "k_traderFeesInPeriod" | |
7 | + | ||
8 | + | let k_lastNotional = "k_lastNotional" | |
9 | + | ||
10 | + | let k_totalScoreInPeriod = "k_totalScoreInPeriod" | |
11 | + | ||
12 | + | let k_traderScoreInPeriod = "k_traderScoreInPeriod" | |
13 | + | ||
14 | + | let k_traderAverageNotionalInPeriod = "k_traderAverageNotionalInPeriod" | |
15 | + | ||
16 | + | let k_ammRewardRate = "k_ammRewardRate" | |
17 | + | ||
18 | + | let k_ammMaxAmountPerPeriod = "k_ammMaxAmountPerPeriod" | |
19 | + | ||
20 | + | let k_rewardAssetIds = "k_rewardAssetIds" | |
21 | + | ||
22 | + | let k_amms = "k_amms" | |
23 | + | ||
24 | + | let k_claimedAssetAndPeriod = "k_claimedAssetAndPeriod" | |
25 | + | ||
26 | + | let k_oracleAddress = "k_oracleAddress" | |
27 | + | ||
28 | + | let k_oraclePrice = "price" | |
29 | + | ||
30 | + | let k_totalClaimedForTraderAndAsset = "k_totalClaimedForTraderAndAsset" | |
31 | + | ||
32 | + | let k_initialized = "k_initialized" | |
33 | + | ||
34 | + | let k_coordinatorAddress = "k_coordinatorAddress" | |
35 | + | ||
36 | + | let k_governance_asset = "k_gov_asset" | |
37 | + | ||
38 | + | let k_quote_asset = "k_quote_asset" | |
39 | + | ||
40 | + | let k_admin_public_key = "k_admin_public_key" | |
41 | + | ||
42 | + | let k_admin_address = "k_admin_address" | |
43 | + | ||
44 | + | let k_amm = "k_amm" | |
45 | + | ||
46 | + | let DECIMAL_UNIT = (1 * (((((((10 * 10) * 10) * 10) * 10) * 10) * 10) * 10)) | |
47 | + | ||
48 | + | let A = 70000000 | |
49 | + | ||
50 | + | let MS_IN_WEEK = (1000 * 604800) | |
51 | + | ||
52 | + | func listToStr (_list) = { | |
53 | + | func _join (accumulator,val) = ((accumulator + val) + ",") | |
54 | + | ||
55 | + | let newListStr = { | |
56 | + | let $l = _list | |
57 | + | let $s = size($l) | |
58 | + | let $acc0 = "" | |
59 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
60 | + | then $a | |
61 | + | else _join($a, $l[$i]) | |
62 | + | ||
63 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
64 | + | then $a | |
65 | + | else throw("List size exceeds 100") | |
66 | + | ||
67 | + | $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) | |
68 | + | } | |
69 | + | let newListStrU = dropRight(newListStr, 1) | |
70 | + | let newListStrR = if ((take(newListStrU, 1) == ",")) | |
71 | + | then drop(newListStrU, 1) | |
72 | + | else newListStrU | |
73 | + | newListStrR | |
74 | + | } | |
75 | + | ||
76 | + | ||
77 | + | func strToList (_str) = if ((_str == "")) | |
78 | + | then nil | |
79 | + | else split(_str, ",") | |
80 | + | ||
81 | + | ||
82 | + | func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN) | |
83 | + | ||
84 | + | ||
85 | + | func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN) | |
86 | + | ||
87 | + | ||
88 | + | func powd (_x,_y) = pow(_x, 8, _y, 8, 8, HALFEVEN) | |
89 | + | ||
90 | + | ||
91 | + | func abs (_x) = if ((_x > 0)) | |
92 | + | then _x | |
93 | + | else -(_x) | |
94 | + | ||
95 | + | ||
96 | + | func minv (_x,_y) = if ((_x > _y)) | |
97 | + | then _y | |
98 | + | else _x | |
99 | + | ||
100 | + | ||
101 | + | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
102 | + | ||
103 | + | ||
104 | + | func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set") | |
105 | + | ||
106 | + | ||
107 | + | func adminPublicKey () = fromBase58String(getStringValue(coordinator(), k_admin_public_key)) | |
108 | + | ||
109 | + | ||
110 | + | func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address)) | |
111 | + | ||
112 | + | ||
113 | + | func isWhitelist (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false) | |
114 | + | ||
115 | + | ||
116 | + | func int (k) = valueOrErrorMessage(getInteger(this, k), ("no value for " + k)) | |
117 | + | ||
118 | + | ||
119 | + | func int0 (k) = valueOrElse(getInteger(this, k), 0) | |
120 | + | ||
121 | + | ||
122 | + | func initialized () = valueOrElse(getBoolean(this, k_initialized), false) | |
123 | + | ||
124 | + | ||
125 | + | func getFeesInPeriodKey (_amm,_trader,_weekId) = ((((((k_traderFeesInPeriod + "_") + _amm) + "_") + _trader) + "_") + toString(_weekId)) | |
126 | + | ||
127 | + | ||
128 | + | func getTotalFeesInPeriodKey (_amm,_weekId) = ((((k_totalFeesInPeriod + "_") + _amm) + "_") + toString(_weekId)) | |
129 | + | ||
130 | + | ||
131 | + | func getLastNotionalKey (_amm,_trader) = ((((k_lastNotional + "_") + _amm) + "_") + _trader) | |
132 | + | ||
133 | + | ||
134 | + | func getTraderScoreInPeriodKey (_amm,_trader,_weekId) = ((((((k_traderScoreInPeriod + "_") + _amm) + "_") + _trader) + "_") + toString(_weekId)) | |
135 | + | ||
136 | + | ||
137 | + | func getTotalScoreInPeriodKey (_amm,_weekId) = ((((k_totalScoreInPeriod + "_") + _amm) + "_") + toString(_weekId)) | |
138 | + | ||
139 | + | ||
140 | + | func getTraderAverageNotionalInPeriodKey (_amm,_trader,_weekId) = ((((((k_traderAverageNotionalInPeriod + "_") + _amm) + "_") + _trader) + "_") + toString(_weekId)) | |
141 | + | ||
142 | + | ||
143 | + | func getAmmRewardRateKey (_amm,_assetId) = ((((k_ammRewardRate + "_") + _amm) + "_") + _assetId) | |
144 | + | ||
145 | + | ||
146 | + | func getAmmMaxAmountPerPeriodKey (_amm,_assetId) = ((((k_ammMaxAmountPerPeriod + "_") + _amm) + "_") + _assetId) | |
147 | + | ||
148 | + | ||
149 | + | func getClaimedTraderAssetPeriodKey (_trader,_assetId,_period) = ((((((k_claimedAssetAndPeriod + "_") + _trader) + "_") + _assetId) + "_") + toString(_period)) | |
150 | + | ||
151 | + | ||
152 | + | func getOraclePriceKey (_assetId,_period) = ((((k_oraclePrice + "_") + toString(_period)) + "_") + _assetId) | |
153 | + | ||
154 | + | ||
155 | + | func getTotalClaimedForTraderAndAssetKey (_trader,_assetId) = ((((k_totalClaimedForTraderAndAsset + "_") + _trader) + "_") + _assetId) | |
156 | + | ||
157 | + | ||
158 | + | func updateAmmFees (_amm,_trader,_weekId,_traderFees,_totalFees) = { | |
159 | + | let traderFeesKey = getFeesInPeriodKey(_amm, _trader, _weekId) | |
160 | + | let totalFeesKey = getTotalFeesInPeriodKey(_amm, _weekId) | |
161 | + | [IntegerEntry(traderFeesKey, _traderFees), IntegerEntry(totalFeesKey, _totalFees)] | |
162 | + | } | |
163 | + | ||
164 | + | ||
165 | + | func updateAmmData (_amm,_trader,_weekId,_traderAverage,_traderLastNotional,_traderScore,_totalScore) = { | |
166 | + | let totalScoreInPeriodKey = getTotalScoreInPeriodKey(_amm, _weekId) | |
167 | + | let traderScoreInPeriodKey = getTraderScoreInPeriodKey(_amm, _trader, _weekId) | |
168 | + | let lastNotionalKey = getLastNotionalKey(_amm, _trader) | |
169 | + | let traderAverageNotionalInPeriodKey = getTraderAverageNotionalInPeriodKey(_amm, _trader, _weekId) | |
170 | + | [IntegerEntry(totalScoreInPeriodKey, _totalScore), IntegerEntry(traderScoreInPeriodKey, _traderScore), IntegerEntry(lastNotionalKey, _traderLastNotional), IntegerEntry(traderAverageNotionalInPeriodKey, _traderAverage)] | |
171 | + | } | |
172 | + | ||
173 | + | ||
174 | + | func usdnToDecimals (_amount) = (_amount * 100) | |
175 | + | ||
176 | + | ||
177 | + | func getWeekStart (_weekId) = (_weekId * MS_IN_WEEK) | |
178 | + | ||
179 | + | ||
180 | + | func getWeekEnd (_weekId) = ((_weekId + 1) * MS_IN_WEEK) | |
181 | + | ||
182 | + | ||
183 | + | func getWeekId (_ts) = (_ts / MS_IN_WEEK) | |
184 | + | ||
185 | + | ||
186 | + | func getFeesInPeriod (_amm,_trader,_weekId) = { | |
187 | + | let key = getFeesInPeriodKey(_amm, _trader, _weekId) | |
188 | + | valueOrElse(getInteger(this, key), 0) | |
189 | + | } | |
190 | + | ||
191 | + | ||
192 | + | func getTotalFeesInPeriod (_amm,_weekId) = { | |
193 | + | let key = getTotalFeesInPeriodKey(_amm, _weekId) | |
194 | + | valueOrElse(getInteger(this, key), 0) | |
195 | + | } | |
196 | + | ||
197 | + | ||
198 | + | func getLastNotional (_amm,_trader) = { | |
199 | + | let key = getLastNotionalKey(_amm, _trader) | |
200 | + | valueOrElse(getInteger(this, key), 0) | |
201 | + | } | |
202 | + | ||
203 | + | ||
204 | + | func getTraderScoreInPeriod (_amm,_trader,_weekId) = { | |
205 | + | let key = getTraderScoreInPeriodKey(_amm, _trader, _weekId) | |
206 | + | valueOrElse(getInteger(this, key), 0) | |
207 | + | } | |
208 | + | ||
209 | + | ||
210 | + | func getTotalScoreInPeriod (_amm,_weekId) = { | |
211 | + | let key = getTotalScoreInPeriodKey(_amm, _weekId) | |
212 | + | valueOrElse(getInteger(this, key), 0) | |
213 | + | } | |
214 | + | ||
215 | + | ||
216 | + | func getAmms () = strToList(valueOrElse(getString(this, k_amms), "")) | |
217 | + | ||
218 | + | ||
219 | + | func getRewardAssetIds () = strToList(valueOrElse(getString(this, k_rewardAssetIds), "")) | |
220 | + | ||
221 | + | ||
222 | + | func getAmmRewardRate (_amm,_assetId) = { | |
223 | + | let key = getAmmRewardRateKey(_amm, _assetId) | |
224 | + | valueOrElse(getInteger(this, key), 0) | |
225 | + | } | |
226 | + | ||
227 | + | ||
228 | + | func getAmmMaxAmountPerPeriod (_amm,_assetId) = { | |
229 | + | let key = getAmmMaxAmountPerPeriodKey(_amm, _assetId) | |
230 | + | valueOrElse(getInteger(this, key), 0) | |
231 | + | } | |
232 | + | ||
233 | + | ||
234 | + | func getTotalClaimedForTraderAndAsset (_trader,_assetId) = { | |
235 | + | let key = getTotalClaimedForTraderAndAssetKey(_trader, _assetId) | |
236 | + | valueOrElse(getInteger(this, key), 0) | |
237 | + | } | |
238 | + | ||
239 | + | ||
240 | + | func getRewardAssetPrice (_assetId,_weekId) = { | |
241 | + | let oracleAddressStr = valueOrErrorMessage(getString(this, k_oracleAddress), "Oracle not set") | |
242 | + | let oracleAddress = valueOrErrorMessage(addressFromString(oracleAddressStr), "Invalid oracle address") | |
243 | + | let priceKey = getOraclePriceKey(_assetId, _weekId) | |
244 | + | usdnToDecimals(valueOrErrorMessage(getInteger(oracleAddress, priceKey), ((("No oracle price for asset " + _assetId) + " period ") + toString(_weekId)))) | |
245 | + | } | |
246 | + | ||
247 | + | ||
248 | + | func rewardForTraderInAssetInPeriod (_amm,_trader,_assetId,_weekId) = { | |
249 | + | let rewardAssetRate = getAmmRewardRate(_amm, _assetId) | |
250 | + | if ((rewardAssetRate == 0)) | |
251 | + | then 0 | |
252 | + | else { | |
253 | + | let totalFeesInPeriod = getTotalFeesInPeriod(_amm, _weekId) | |
254 | + | let rewardAssetPrice = getRewardAssetPrice(_assetId, _weekId) | |
255 | + | let maxAmountOfAssetToDistribute = getAmmMaxAmountPerPeriod(_amm, _assetId) | |
256 | + | let traderScore = getTraderScoreInPeriod(_amm, _trader, _weekId) | |
257 | + | let totalTraderScore = getTotalScoreInPeriod(_amm, _weekId) | |
258 | + | if ((totalTraderScore == 0)) | |
259 | + | then 0 | |
260 | + | else { | |
261 | + | let totalAssetToDistribute = muld(divd(totalFeesInPeriod, rewardAssetPrice), rewardAssetRate) | |
262 | + | let actualTotalAssetToDistribute = minv(totalAssetToDistribute, maxAmountOfAssetToDistribute) | |
263 | + | let traderShareInRewards = divd(muld(actualTotalAssetToDistribute, traderScore), totalTraderScore) | |
264 | + | traderShareInRewards | |
265 | + | } | |
266 | + | } | |
267 | + | } | |
268 | + | ||
269 | + | ||
270 | + | func totalRewardForTraderInAssetInPeriod (_trader,_assetId,_weekId) = { | |
271 | + | let amms = getAmms() | |
272 | + | func compute (_acc,_amm) = (_acc + rewardForTraderInAssetInPeriod(_amm, _trader, _assetId, _weekId)) | |
273 | + | ||
274 | + | let $l = amms | |
275 | + | let $s = size($l) | |
276 | + | let $acc0 = 0 | |
277 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
278 | + | then $a | |
279 | + | else compute($a, $l[$i]) | |
280 | + | ||
281 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
282 | + | then $a | |
283 | + | else throw("List size exceeds 20") | |
284 | + | ||
285 | + | $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) | |
286 | + | } | |
287 | + | ||
288 | + | ||
289 | + | func totalRewardForTraderInAsset (_trader,_assetId,_periods) = { | |
290 | + | func compute (_acc,_weekId) = (_acc + totalRewardForTraderInAssetInPeriod(_trader, _assetId, _weekId)) | |
291 | + | ||
292 | + | let $l = _periods | |
293 | + | let $s = size($l) | |
294 | + | let $acc0 = 0 | |
295 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
296 | + | then $a | |
297 | + | else compute($a, $l[$i]) | |
298 | + | ||
299 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
300 | + | then $a | |
301 | + | else throw("List size exceeds 18") | |
302 | + | ||
303 | + | $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($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18) | |
304 | + | } | |
305 | + | ||
306 | + | ||
307 | + | func getTraderAverageNotionalInPeriod (_amm,_trader,_weekId,_defaultValue) = { | |
308 | + | let key = getTraderAverageNotionalInPeriodKey(_amm, _trader, _weekId) | |
309 | + | valueOrElse(getInteger(this, key), _defaultValue) | |
310 | + | } | |
311 | + | ||
312 | + | ||
313 | + | func isClaimed (_trader,_assetId,_period) = { | |
314 | + | let key = getClaimedTraderAssetPeriodKey(_trader, _assetId, _period) | |
315 | + | valueOrElse(getBoolean(this, key), false) | |
316 | + | } | |
317 | + | ||
318 | + | ||
319 | + | func claimAllRewardForPeriodForTrader (_trader,_assetId,_periods) = { | |
320 | + | let periods = strToList(_periods) | |
321 | + | func checkAndFilterFn (_acc,_next) = { | |
322 | + | let period = valueOrErrorMessage(parseInt(_next), ("Invalid period: " + _next)) | |
323 | + | if (if (containsElement(_acc, period)) | |
324 | + | then true | |
325 | + | else isClaimed(_trader, _assetId, period)) | |
326 | + | then _acc | |
327 | + | else (_acc :+ period) | |
328 | + | } | |
329 | + | ||
330 | + | let validPeriods = { | |
331 | + | let $l = periods | |
332 | + | let $s = size($l) | |
333 | + | let $acc0 = nil | |
334 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
335 | + | then $a | |
336 | + | else checkAndFilterFn($a, $l[$i]) | |
337 | + | ||
338 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
339 | + | then $a | |
340 | + | else throw("List size exceeds 18") | |
341 | + | ||
342 | + | $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($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18) | |
343 | + | } | |
344 | + | func markPeriodAsDoneFn (_acc,_period) = (_acc :+ BooleanEntry(getClaimedTraderAssetPeriodKey(_trader, _assetId, _period), true)) | |
345 | + | ||
346 | + | let markPeriodsAsClaimed = { | |
347 | + | let $l = validPeriods | |
348 | + | let $s = size($l) | |
349 | + | let $acc0 = nil | |
350 | + | func $f1_1 ($a,$i) = if (($i >= $s)) | |
351 | + | then $a | |
352 | + | else markPeriodAsDoneFn($a, $l[$i]) | |
353 | + | ||
354 | + | func $f1_2 ($a,$i) = if (($i >= $s)) | |
355 | + | then $a | |
356 | + | else throw("List size exceeds 18") | |
357 | + | ||
358 | + | $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($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18) | |
359 | + | } | |
360 | + | let amount = totalRewardForTraderInAsset(_trader, _assetId, validPeriods) | |
361 | + | $Tuple2(amount, ([ScriptTransfer(addressFromStringValue(_trader), amount, fromBase58String(_assetId)), IntegerEntry(getTotalClaimedForTraderAndAssetKey(_trader, _assetId), (getTotalClaimedForTraderAndAsset(_trader, _assetId) + amount))] ++ markPeriodsAsClaimed)) | |
362 | + | } | |
363 | + | ||
364 | + | ||
365 | + | @Callable(i) | |
366 | + | func initialize (_coordinator,_oracle) = if (initialized()) | |
367 | + | then throw("Already initialized") | |
368 | + | else [StringEntry(k_coordinatorAddress, _coordinator), StringEntry(k_oracleAddress, _oracle), BooleanEntry(k_initialized, true)] | |
369 | + | ||
370 | + | ||
371 | + | ||
372 | + | @Callable(i) | |
373 | + | func setOracleAddress (_oracle) = if (if (!(initialized())) | |
374 | + | then true | |
375 | + | else (i.caller != adminAddress())) | |
376 | + | then throw("Invalid setOracleAddress parameters") | |
377 | + | else [StringEntry(k_oracleAddress, _oracle)] | |
378 | + | ||
379 | + | ||
380 | + | ||
381 | + | @Callable(i) | |
382 | + | func view_claimRewards (_trader,_assetId,_period) = throw(toString(totalRewardForTraderInAsset(_trader, _assetId, [_period]))) | |
383 | + | ||
384 | + | ||
385 | + | ||
386 | + | @Callable(i) | |
387 | + | func view_calcReward (_trader,_amm,_assetId,_period) = throw(toString(rewardForTraderInAssetInPeriod(_amm, _assetId, _trader, _period))) | |
388 | + | ||
389 | + | ||
390 | + | ||
391 | + | @Callable(i) | |
392 | + | func view_claimAllRewards (_trader,_assetId,_periods) = { | |
393 | + | let result = claimAllRewardForPeriodForTrader(_trader, _assetId, _periods) | |
394 | + | throw(((toString(result._1) + ",") + toString(getTotalClaimedForTraderAndAsset(_trader, _assetId)))) | |
395 | + | } | |
396 | + | ||
397 | + | ||
398 | + | ||
399 | + | @Callable(i) | |
400 | + | func claimAllRewards (_assetId,_periods) = { | |
401 | + | let trader = toString(i.caller) | |
402 | + | let $t01263812721 = claimAllRewardForPeriodForTrader(trader, _assetId, _periods) | |
403 | + | let amount = $t01263812721._1 | |
404 | + | let result = $t01263812721._2 | |
405 | + | if ((amount == 0)) | |
406 | + | then throw("Nothing to claim") | |
407 | + | else result | |
408 | + | } | |
409 | + | ||
410 | + | ||
411 | + | ||
412 | + | @Callable(i) | |
413 | + | func attachRewards (_amm,_assetId,_maxAmountPerPeriod,_rewardRate) = if (if (!(initialized())) | |
414 | + | then true | |
415 | + | else (i.caller != adminAddress())) | |
416 | + | then throw("Invalid attachRewards params") | |
417 | + | else { | |
418 | + | let amms = getAmms() | |
419 | + | let rewardAssetIds = getRewardAssetIds() | |
420 | + | let newAmms = if (containsElement(amms, _amm)) | |
421 | + | then amms | |
422 | + | else (amms :+ _amm) | |
423 | + | let newRewardAssetIds = if (containsElement(rewardAssetIds, _assetId)) | |
424 | + | then rewardAssetIds | |
425 | + | else (rewardAssetIds :+ _assetId) | |
426 | + | [IntegerEntry(getAmmRewardRateKey(_amm, _assetId), _rewardRate), IntegerEntry(getAmmMaxAmountPerPeriodKey(_amm, _assetId), _maxAmountPerPeriod), StringEntry(k_amms, listToStr(newAmms)), StringEntry(k_rewardAssetIds, listToStr(newRewardAssetIds))] | |
427 | + | } | |
428 | + | ||
429 | + | ||
430 | + | ||
431 | + | @Callable(i) | |
432 | + | func notifyFees (_trader,_fee) = { | |
433 | + | let amm = toString(i.caller) | |
434 | + | if (if (!(isWhitelist(amm))) | |
435 | + | then true | |
436 | + | else !(initialized())) | |
437 | + | then throw("Invalid notifyFees params") | |
438 | + | else { | |
439 | + | let actualFee = usdnToDecimals(_fee) | |
440 | + | let ts = lastBlock.timestamp | |
441 | + | let weekId = getWeekId(ts) | |
442 | + | let feesInPeriod = getFeesInPeriod(amm, _trader, weekId) | |
443 | + | let totalFeesInPeriod = getTotalFeesInPeriod(amm, weekId) | |
444 | + | let newFeesInPeriod = (feesInPeriod + actualFee) | |
445 | + | let newTotalFeesInPeriod = (totalFeesInPeriod + actualFee) | |
446 | + | updateAmmFees(amm, _trader, weekId, newFeesInPeriod, newTotalFeesInPeriod) | |
447 | + | } | |
448 | + | } | |
449 | + | ||
450 | + | ||
451 | + | ||
452 | + | @Callable(i) | |
453 | + | func notifyNotional (_trader,_notional) = { | |
454 | + | let amm = toString(i.caller) | |
455 | + | if (if (!(isWhitelist(amm))) | |
456 | + | then true | |
457 | + | else !(initialized())) | |
458 | + | then throw("Invalid notifyNotional params") | |
459 | + | else { | |
460 | + | let actualNotional = usdnToDecimals(_notional) | |
461 | + | let ts = lastBlock.timestamp | |
462 | + | let lastNotional = getLastNotional(amm, _trader) | |
463 | + | let weekId = getWeekId(ts) | |
464 | + | let weekStart = getWeekStart(weekId) | |
465 | + | let weekEnd = getWeekEnd(weekId) | |
466 | + | let t = (weekEnd - weekStart) | |
467 | + | let oldRunningAverage = getTraderAverageNotionalInPeriod(amm, _trader, weekId, lastNotional) | |
468 | + | let w = divd((weekEnd - ts), t) | |
469 | + | let oldTraderAmmScore = getTraderScoreInPeriod(amm, _trader, weekId) | |
470 | + | let oldTotalAmmScore = getTotalScoreInPeriod(amm, weekId) | |
471 | + | let fees = getFeesInPeriod(amm, _trader, weekId) | |
472 | + | let newRunningAverage = ((oldRunningAverage + muld(actualNotional, w)) - muld(lastNotional, w)) | |
473 | + | let newTraderAmmScore = muld(powd(fees, A), powd(newRunningAverage, (DECIMAL_UNIT - A))) | |
474 | + | let newTotalAmmScoreInPeriod = ((oldTotalAmmScore - oldTraderAmmScore) + newTraderAmmScore) | |
475 | + | updateAmmData(amm, _trader, weekId, newRunningAverage, actualNotional, newTraderAmmScore, newTotalAmmScoreInPeriod) | |
476 | + | } | |
477 | + | } | |
478 | + | ||
479 | + | ||
480 | + | @Verifier(tx) | |
481 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], adminPublicKey()) | |
482 | + |
github/deemru/w8io/026f985 43.79 ms ◑