tx · AM4CJw4MDMfKEh2A6QJx5BF8PwCGTvh2KuWNsEpvw2Zc 3Mp5kisFrqESzrXxAMEPk2k69zpeF41czEE: -0.01500000 Waves 2023.08.08 16:18 [2701664] smart account 3Mp5kisFrqESzrXxAMEPk2k69zpeF41czEE > SELF 0.00000000 Waves
{ "type": 13, "id": "AM4CJw4MDMfKEh2A6QJx5BF8PwCGTvh2KuWNsEpvw2Zc", "fee": 1500000, "feeAssetId": null, "timestamp": 1691500738052, "version": 2, "chainId": 84, "sender": "3Mp5kisFrqESzrXxAMEPk2k69zpeF41czEE", "senderPublicKey": "G349Uq3FTox7dRNLeAfAQeoACvwZ9iEnVSaHcEYn6j8J", "proofs": [ "2qGZqaFsUUxgrkLHfw7H3hwGkE9rvMabKgpdC1mXgu1t8CM4j8PEFaJ5J45JTg4uTLEFFmDk2GnQBaEsotRNDEYw" ], "script": "base64:BgKFFQgCEgMKAQISBgoEARgRARIECgIIARIAEgASAwoBCBIAEgQKAhgREgASAwoBCCIDU0VQIgVTQ0FMRSIFTVVMVDgiB01VTFQ4QkkiCnplcm9CaWdJbnQiFHByb2Nlc3NpbmdTdGFnZVRvdGFsIhVwcm9jZXNzaW5nU3RhZ2VTaGFyZXMiBk1VTFQxOCIITVVMVDE4QkkiC3dhdmVzU3RyaW5nIg5nZXROdW1iZXJCeUtleSIDa2V5Ig9nZXROdW1iZXJPckZhaWwiDmdldFN0cmluZ0J5S2V5Ig9nZXRTdHJpbmdPckZhaWwiDHBhcnNlQXNzZXRJZCIFaW5wdXQiB3dyYXBFcnIiA21zZyIIdGhyb3dFcnIiA2FicyIDdmFsIglhYnNCaWdJbnQiC2tleU1heERlcHRoIg9tYXhEZXB0aERlZmF1bHQiCG1heERlcHRoIhFrZXlGYWN0b3J5QWRkcmVzcyIRZmFjdG9yeUFkZHJlc3NTdHIiD2ZhY3RvcnlDb250cmFjdCISa2V5RW1pc3Npb25BZGRyZXNzIhlrZXlWb3RpbmdFbWlzc2lvbkNvbnRyYWN0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JiQQUCYkEEAmJCCQD8BwQFBHRoaXMCE3RyYWRlUmV3YXJkSW50ZXJuYWwJAMwIAgUCYlcJAMwIAgUCYngJAMwIAgUCYnkJAMwIAgAABQNuaWwFA25pbAMJAAACBQJiQgUCYkIJAJQKAgUDbmlsBQJiQgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgJhQwESY2xhaW1UcmFkaW5nUmV3YXJkAAQCYUUIBQJhQwZjYWxsZXIEAmJYCQClCAEFAmFFBAJiWQkBAmJhAQUCYlgDCQBmAgUCYlkAAAkAlAoCCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMFAmFFBQJiWQUCYWoJAMwIAgkBDEludGVnZXJFbnRyeQIJAQJhRAEFAmJYAAAFA25pbAUCYlkJAQF0AQIQbm90aGluZyB0byBjbGFpbQJhQwEaY2xhaW1UcmFkaW5nUmV3YXJkUkVBRE9OTFkBAmFFCQCUCgIFA25pbAkBAmJhAQUCYUUBAmJaAQJjYQAEAmNiBAJhTwkBAmFRAAMJAAECBQJhTwIKQnl0ZVZlY3RvcgQCYVUFAmFPBQJhVQMJAAECBQJhTwIEVW5pdAgFAmJaD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJiWglib2R5Qnl0ZXMJAJEDAggFAmJaBnByb29mcwAABQJjYpN3w5k=", "height": 2701664, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9zo1J28X6gnXZXw5PmvdzWGFXxG6N2quZEoyMsQegPw2 Next: APBEZEcYLZdwadZipwgJVCVNUhpr4gd6YV5ezYcrQqYK Diff:
Old | New | Differences | |
---|---|---|---|
6 | 6 | let SCALE = 1000 | |
7 | 7 | ||
8 | 8 | let MULT8 = 100000000 | |
9 | + | ||
10 | + | let MULT8BI = toBigInt(MULT8) | |
9 | 11 | ||
10 | 12 | let zeroBigInt = toBigInt(0) | |
11 | 13 | ||
274 | 276 | else throw(($getType(@) + " couldn't be cast to Int")) | |
275 | 277 | } | |
276 | 278 | let dh = toBigInt((height - rewardPerGwxIntegralLastHeight)) | |
277 | - | let rewardPerGwxIntegral = (rewardPerGwxIntegralPrevious + fraction(dh, ((toBigInt(emissionRate) * toBigInt(gwxHoldersRewardCurrent)) * MULT18BI), toBigInt(gwxAmountTotal))) | |
279 | + | let rewardPerGwxIntegral = (rewardPerGwxIntegralPrevious + fraction(dh, ((toBigInt(emissionRate) * toBigInt(gwxHoldersRewardCurrent)) * MULT18BI), (toBigInt(gwxAmountTotal) * MULT8BI))) | |
278 | 280 | $Tuple2([IntegerEntry(keyGwxRewardEmissionStartHeight(), height), StringEntry(keyRewardPerGwxIntegral(), toString(rewardPerGwxIntegral))], rewardPerGwxIntegral) | |
279 | 281 | } | |
280 | 282 | ||
293 | 295 | }, zeroBigInt) | |
294 | 296 | let userIdxOrFail = getUserIndexByAddress(toString(boostingContractOrFail()), toString(userAddress)) | |
295 | 297 | let userUnclaimed = valueOrElse(getInteger(keyUserUnclaimed(userIdxOrFail)), 0) | |
296 | - | let $ | |
297 | - | let rewardPerGwxIntegralActions = $ | |
298 | - | let rewardPerGwxIntegral = $ | |
298 | + | let $t01034510562 = _refreshRewardPerGwxIntegral() | |
299 | + | let rewardPerGwxIntegralActions = $t01034510562._1 | |
300 | + | let rewardPerGwxIntegral = $t01034510562._2 | |
299 | 301 | let userGwxAmount = { | |
300 | 302 | let @ = invoke(boostingContractOrFail(), "getUserGwxAmount", [toString(userAddress)], nil) | |
301 | 303 | if ($isInstanceOf(@, "Int")) | |
367 | 369 | let cfgArray = readConfigArrayOrFail() | |
368 | 370 | let userAddress = i.caller | |
369 | 371 | let userAddressStr = toString(userAddress) | |
370 | - | let $ | |
371 | - | let amount = $ | |
372 | - | let actions = $ | |
372 | + | let $t01287312930 = commonClaimReward(userAddressStr) | |
373 | + | let amount = $t01287312930._1 | |
374 | + | let actions = $t01287312930._2 | |
373 | 375 | let checkAmount = if ((amount > 0)) | |
374 | 376 | then true | |
375 | 377 | else throw("nothing to claim") | |
422 | 424 | ||
423 | 425 | @Callable(i) | |
424 | 426 | func claimRewardREADONLY (address) = { | |
425 | - | let $ | |
426 | - | let amount = $ | |
427 | - | let actions = $ | |
427 | + | let $t01425714307 = commonClaimReward(address) | |
428 | + | let amount = $t01425714307._1 | |
429 | + | let actions = $t01425714307._2 | |
428 | 430 | let referralUnclaimed = valueOrElse(getInteger(referralsContractAddressOrFail, keyUnclaimedReferral(referralProgramName, address)), 0) | |
429 | 431 | let totalAmount = (amount + referralUnclaimed) | |
430 | 432 | $Tuple2(nil, totalAmount) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let SCALE = 1000 | |
7 | 7 | ||
8 | 8 | let MULT8 = 100000000 | |
9 | + | ||
10 | + | let MULT8BI = toBigInt(MULT8) | |
9 | 11 | ||
10 | 12 | let zeroBigInt = toBigInt(0) | |
11 | 13 | ||
12 | 14 | let processingStageTotal = 0 | |
13 | 15 | ||
14 | 16 | let processingStageShares = 1 | |
15 | 17 | ||
16 | 18 | let MULT18 = 1000000000000000000 | |
17 | 19 | ||
18 | 20 | let MULT18BI = toBigInt(MULT18) | |
19 | 21 | ||
20 | 22 | let wavesString = "WAVES" | |
21 | 23 | ||
22 | 24 | func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0) | |
23 | 25 | ||
24 | 26 | ||
25 | 27 | func getNumberOrFail (key) = valueOrErrorMessage(getInteger(this, key), (("mandatory this." + key) + " is not defined")) | |
26 | 28 | ||
27 | 29 | ||
28 | 30 | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
29 | 31 | ||
30 | 32 | ||
31 | 33 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (("mandatory this." + key) + " is not defined")) | |
32 | 34 | ||
33 | 35 | ||
34 | 36 | func parseAssetId (input) = if ((input == wavesString)) | |
35 | 37 | then unit | |
36 | 38 | else fromBase58String(input) | |
37 | 39 | ||
38 | 40 | ||
39 | 41 | func wrapErr (msg) = makeString(["gwx_reward.ride:", msg], " ") | |
40 | 42 | ||
41 | 43 | ||
42 | 44 | func throwErr (msg) = throw(wrapErr(msg)) | |
43 | 45 | ||
44 | 46 | ||
45 | 47 | func abs (val) = if ((0 > val)) | |
46 | 48 | then -(val) | |
47 | 49 | else val | |
48 | 50 | ||
49 | 51 | ||
50 | 52 | func absBigInt (val) = if ((zeroBigInt > val)) | |
51 | 53 | then -(val) | |
52 | 54 | else val | |
53 | 55 | ||
54 | 56 | ||
55 | 57 | let keyMaxDepth = "%s__maxDepth" | |
56 | 58 | ||
57 | 59 | let maxDepthDefault = 30 | |
58 | 60 | ||
59 | 61 | let maxDepth = valueOrElse(getInteger(this, keyMaxDepth), maxDepthDefault) | |
60 | 62 | ||
61 | 63 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
62 | 64 | ||
63 | 65 | ||
64 | 66 | let factoryAddressStr = getStringOrFail(keyFactoryAddress()) | |
65 | 67 | ||
66 | 68 | let factoryContract = addressFromStringValue(factoryAddressStr) | |
67 | 69 | ||
68 | 70 | func keyEmissionAddress () = "%s%s__config__emissionAddress" | |
69 | 71 | ||
70 | 72 | ||
71 | 73 | func keyVotingEmissionContract () = makeString(["%s", "votingEmissionContract"], SEP) | |
72 | 74 | ||
73 | 75 | ||
74 | 76 | let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract())) | |
75 | 77 | ||
76 | 78 | func keyNumToUserMapping (num) = makeString(["%s%s%s", "mapping", "num2user", toString(num)], SEP) | |
77 | 79 | ||
78 | 80 | ||
79 | 81 | let keyReferralProgramName = makeString(["%s%s", "referral", "programName"], SEP) | |
80 | 82 | ||
81 | 83 | let referralProgramNameDefault = "wxlock" | |
82 | 84 | ||
83 | 85 | let referralProgramName = valueOrElse(getString(this, keyReferralProgramName), referralProgramNameDefault) | |
84 | 86 | ||
85 | 87 | let keyReferralMinGWxAmount = makeString(["%s%s", "referral", "minGWxAmount"], SEP) | |
86 | 88 | ||
87 | 89 | let referralMinGWxAmountDefault = (500 * MULT8) | |
88 | 90 | ||
89 | 91 | let referralMinGWxAmount = valueOrElse(getInteger(this, keyReferralMinGWxAmount), referralMinGWxAmountDefault) | |
90 | 92 | ||
91 | 93 | let keyReferrerRewardPermille = makeString(["%s%s", "referral", "referrerRewardPermille"], SEP) | |
92 | 94 | ||
93 | 95 | let referrerRewardPermilleDefault = 50 | |
94 | 96 | ||
95 | 97 | let referrerRewardPermille = valueOrElse(getInteger(this, keyReferrerRewardPermille), referrerRewardPermilleDefault) | |
96 | 98 | ||
97 | 99 | let keyReferralRewardPermille = makeString(["%s%s", "referral", "referralRewardPermille"], SEP) | |
98 | 100 | ||
99 | 101 | let referralRewardPermilleDefault = 50 | |
100 | 102 | ||
101 | 103 | let referralRewardPermille = valueOrElse(getInteger(this, keyReferralRewardPermille), referralRewardPermilleDefault) | |
102 | 104 | ||
103 | 105 | func keyReferrer (referralAddress) = makeString(["%s%s%s", "referrer", referralProgramName, referralAddress], SEP) | |
104 | 106 | ||
105 | 107 | ||
106 | 108 | func keyUnclaimedReferral (programName,claimerAddress) = makeString(["%s%s%s", "unclaimedReferral", programName, claimerAddress], SEP) | |
107 | 109 | ||
108 | 110 | ||
109 | 111 | let emissionAddressStr = getStringOrFail(keyEmissionAddress()) | |
110 | 112 | ||
111 | 113 | let emissionContract = addressFromStringValue(emissionAddressStr) | |
112 | 114 | ||
113 | 115 | let IdxCfgAssetId = 1 | |
114 | 116 | ||
115 | 117 | let IdxCfgPacemakerAddress = 2 | |
116 | 118 | ||
117 | 119 | let IdxCfgBoostingContract = 3 | |
118 | 120 | ||
119 | 121 | let IdxCfgMaxDepth = 4 | |
120 | 122 | ||
121 | 123 | func keyConfig () = "%s__config" | |
122 | 124 | ||
123 | 125 | ||
124 | 126 | func getEmissionAddress () = addressFromStringValue(valueOrErrorMessage(getString(this, keyEmissionAddress()), (("mandatory this." + keyEmissionAddress()) + " is not defined"))) | |
125 | 127 | ||
126 | 128 | ||
127 | 129 | let emissionAddress = getEmissionAddress() | |
128 | 130 | ||
129 | 131 | let wxAssetIdStr = split(value(getString(emissionAddress, keyConfig())), SEP)[1] | |
130 | 132 | ||
131 | 133 | let wxAssetId = fromBase58String(wxAssetIdStr) | |
132 | 134 | ||
133 | 135 | func readConfigArrayOrFail () = split(getStringOrFail(keyConfig()), SEP) | |
134 | 136 | ||
135 | 137 | ||
136 | 138 | func formatConfig (wxAssetIdStr,matcherPacemakerAddressStr,boostingContractAddressStr,maxDepth) = makeString(["%s%s%s%d", wxAssetIdStr, matcherPacemakerAddressStr, boostingContractAddressStr, toString(maxDepth)], SEP) | |
137 | 139 | ||
138 | 140 | ||
139 | 141 | func boostingContractOrFail () = { | |
140 | 142 | let cfgArray = readConfigArrayOrFail() | |
141 | 143 | valueOrErrorMessage(addressFromString(cfgArray[IdxCfgBoostingContract]), "boosting contract address is not defined") | |
142 | 144 | } | |
143 | 145 | ||
144 | 146 | ||
145 | 147 | func keyGwxRewardEmissionStartHeight () = "%s%s__gwxRewardEmissionPart__startHeight" | |
146 | 148 | ||
147 | 149 | ||
148 | 150 | func keyUsersCount () = "%s__nextUserNum" | |
149 | 151 | ||
150 | 152 | ||
151 | 153 | func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
152 | 154 | ||
153 | 155 | ||
154 | 156 | func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current" | |
155 | 157 | ||
156 | 158 | ||
157 | 159 | func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next" | |
158 | 160 | ||
159 | 161 | ||
160 | 162 | func keyPoolWeightVirtual () = "%s%s__poolWeight__GWXvirtualPOOL" | |
161 | 163 | ||
162 | 164 | ||
163 | 165 | func keyUserUnclaimed (userIndex) = makeString(["%s%d", "userUnclaimed", toString(userIndex)], SEP) | |
164 | 166 | ||
165 | 167 | ||
166 | 168 | func keyReferralsContractAddress () = makeString(["%s%s", "config", "referralsContractAddress"], SEP) | |
167 | 169 | ||
168 | 170 | ||
169 | 171 | let referralsContractAddressOrFail = addressFromStringValue(getStringOrFail(keyReferralsContractAddress())) | |
170 | 172 | ||
171 | 173 | func keyTradingRewardHistory (user,i) = makeString(["%s%s%s%s", "tradingReward", "history", user, toBase58String(i.transactionId)], SEP) | |
172 | 174 | ||
173 | 175 | ||
174 | 176 | func keyTradingReward (userAddress) = makeString(["%s%s", "tradingReward", userAddress], SEP) | |
175 | 177 | ||
176 | 178 | ||
177 | 179 | func keyMaxRecipients () = makeString(["%s", "maxRecipients"], SEP) | |
178 | 180 | ||
179 | 181 | ||
180 | 182 | func HistoryEntry (type,user,amount,i) = { | |
181 | 183 | let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP) | |
182 | 184 | let historyDATA = makeString(["%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount)], SEP) | |
183 | 185 | StringEntry(historyKEY, historyDATA) | |
184 | 186 | } | |
185 | 187 | ||
186 | 188 | ||
187 | 189 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
188 | 190 | ||
189 | 191 | ||
190 | 192 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
191 | 193 | ||
192 | 194 | ||
193 | 195 | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
194 | 196 | case s: String => | |
195 | 197 | addressFromStringValue(s) | |
196 | 198 | case _ => | |
197 | 199 | this | |
198 | 200 | } | |
199 | 201 | ||
200 | 202 | ||
201 | 203 | func managerPublicKeyOrUnit () = { | |
202 | 204 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
203 | 205 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
204 | 206 | case s: String => | |
205 | 207 | fromBase58String(s) | |
206 | 208 | case _: Unit => | |
207 | 209 | unit | |
208 | 210 | case _ => | |
209 | 211 | throw("Match error") | |
210 | 212 | } | |
211 | 213 | } | |
212 | 214 | ||
213 | 215 | ||
214 | 216 | func mustManager (i) = { | |
215 | 217 | let pd = throw("Permission denied") | |
216 | 218 | match managerPublicKeyOrUnit() { | |
217 | 219 | case pk: ByteVector => | |
218 | 220 | if ((i.callerPublicKey == pk)) | |
219 | 221 | then true | |
220 | 222 | else pd | |
221 | 223 | case _: Unit => | |
222 | 224 | if ((i.caller == this)) | |
223 | 225 | then true | |
224 | 226 | else pd | |
225 | 227 | case _ => | |
226 | 228 | throw("Match error") | |
227 | 229 | } | |
228 | 230 | } | |
229 | 231 | ||
230 | 232 | ||
231 | 233 | func getUserIndexByAddress (boostingContractAddressStr,userAddress) = { | |
232 | 234 | let key = makeString(["%s%s%s", "mapping", "user2num", userAddress], SEP) | |
233 | 235 | parseIntValue(valueOrErrorMessage(getString(Address(fromBase58String(boostingContractAddressStr)), key), ((("User address " + userAddress) + " is not found in boosting contract data, key=") + key))) | |
234 | 236 | } | |
235 | 237 | ||
236 | 238 | ||
237 | 239 | func commonClaimReward (userAddress) = { | |
238 | 240 | let cfgArray = readConfigArrayOrFail() | |
239 | 241 | let userIdx = getUserIndexByAddress(cfgArray[IdxCfgBoostingContract], userAddress) | |
240 | 242 | let userUnclaimedOption = getInteger(keyUserUnclaimed(userIdx)) | |
241 | 243 | match userUnclaimedOption { | |
242 | 244 | case _: Unit => | |
243 | 245 | $Tuple2(0, nil) | |
244 | 246 | case u: Int => | |
245 | 247 | $Tuple2(u, [IntegerEntry(keyUserUnclaimed(userIdx), 0)]) | |
246 | 248 | case _ => | |
247 | 249 | throw("Match error") | |
248 | 250 | } | |
249 | 251 | } | |
250 | 252 | ||
251 | 253 | ||
252 | 254 | func getTradingReward (userAddress) = valueOrElse(getInteger(this, keyTradingReward(userAddress)), 0) | |
253 | 255 | ||
254 | 256 | ||
255 | 257 | func keyRewardPerGwxIntegral () = makeString(["%s", "rewardPerGwxIntegral"], SEP) | |
256 | 258 | ||
257 | 259 | ||
258 | 260 | func _refreshRewardPerGwxIntegral () = { | |
259 | 261 | let rewardPerGwxIntegralPrevious = valueOrElse( match getString(this, keyRewardPerGwxIntegral()) { | |
260 | 262 | case s: String => | |
261 | 263 | parseBigInt(s) | |
262 | 264 | case _: Unit => | |
263 | 265 | unit | |
264 | 266 | case _ => | |
265 | 267 | throw("Match error") | |
266 | 268 | }, zeroBigInt) | |
267 | 269 | let rewardPerGwxIntegralLastHeight = valueOrErrorMessage(getInteger(this, keyGwxRewardEmissionStartHeight()), wrapErr(("invalid " + keyGwxRewardEmissionStartHeight()))) | |
268 | 270 | let emissionRate = valueOrErrorMessage(getInteger(emissionContract, keyRatePerBlockCurrent()), wrapErr(("invalid " + keyRatePerBlockCurrent()))) | |
269 | 271 | let gwxHoldersRewardCurrent = valueOrElse(getInteger(emissionContract, keyGwxHoldersRewardCurrent()), 0) | |
270 | 272 | let gwxAmountTotal = { | |
271 | 273 | let @ = invoke(boostingContractOrFail(), "getGwxTotalREADONLY", nil, nil) | |
272 | 274 | if ($isInstanceOf(@, "Int")) | |
273 | 275 | then @ | |
274 | 276 | else throw(($getType(@) + " couldn't be cast to Int")) | |
275 | 277 | } | |
276 | 278 | let dh = toBigInt((height - rewardPerGwxIntegralLastHeight)) | |
277 | - | let rewardPerGwxIntegral = (rewardPerGwxIntegralPrevious + fraction(dh, ((toBigInt(emissionRate) * toBigInt(gwxHoldersRewardCurrent)) * MULT18BI), toBigInt(gwxAmountTotal))) | |
279 | + | let rewardPerGwxIntegral = (rewardPerGwxIntegralPrevious + fraction(dh, ((toBigInt(emissionRate) * toBigInt(gwxHoldersRewardCurrent)) * MULT18BI), (toBigInt(gwxAmountTotal) * MULT8BI))) | |
278 | 280 | $Tuple2([IntegerEntry(keyGwxRewardEmissionStartHeight(), height), StringEntry(keyRewardPerGwxIntegral(), toString(rewardPerGwxIntegral))], rewardPerGwxIntegral) | |
279 | 281 | } | |
280 | 282 | ||
281 | 283 | ||
282 | 284 | func keyRewardPerGwxIntegralUserLast (userAddress) = makeString(["%s%s", "rewardPerGwxIntegralUserLast", toString(userAddress)], SEP) | |
283 | 285 | ||
284 | 286 | ||
285 | 287 | func _refreshUserReward (userAddress) = { | |
286 | 288 | let rewardPerGwxIntegralUserLast = valueOrElse( match getString(this, keyRewardPerGwxIntegralUserLast(userAddress)) { | |
287 | 289 | case s: String => | |
288 | 290 | parseBigInt(s) | |
289 | 291 | case _: Unit => | |
290 | 292 | unit | |
291 | 293 | case _ => | |
292 | 294 | throw("Match error") | |
293 | 295 | }, zeroBigInt) | |
294 | 296 | let userIdxOrFail = getUserIndexByAddress(toString(boostingContractOrFail()), toString(userAddress)) | |
295 | 297 | let userUnclaimed = valueOrElse(getInteger(keyUserUnclaimed(userIdxOrFail)), 0) | |
296 | - | let $ | |
297 | - | let rewardPerGwxIntegralActions = $ | |
298 | - | let rewardPerGwxIntegral = $ | |
298 | + | let $t01034510562 = _refreshRewardPerGwxIntegral() | |
299 | + | let rewardPerGwxIntegralActions = $t01034510562._1 | |
300 | + | let rewardPerGwxIntegral = $t01034510562._2 | |
299 | 301 | let userGwxAmount = { | |
300 | 302 | let @ = invoke(boostingContractOrFail(), "getUserGwxAmount", [toString(userAddress)], nil) | |
301 | 303 | if ($isInstanceOf(@, "Int")) | |
302 | 304 | then @ | |
303 | 305 | else throw(($getType(@) + " couldn't be cast to Int")) | |
304 | 306 | } | |
305 | 307 | let userReward = (toInt(fraction(toBigInt(userGwxAmount), (rewardPerGwxIntegral - rewardPerGwxIntegralUserLast), MULT18BI)) + userUnclaimed) | |
306 | 308 | $Tuple2(([StringEntry(keyRewardPerGwxIntegralUserLast(userAddress), toString(rewardPerGwxIntegral))] ++ rewardPerGwxIntegralActions), userReward) | |
307 | 309 | } | |
308 | 310 | ||
309 | 311 | ||
310 | 312 | @Callable(i) | |
311 | 313 | func refreshUserReward (userAddressBytes) = { | |
312 | 314 | let checkCaller = if ((i.caller == boostingContractOrFail())) | |
313 | 315 | then true | |
314 | 316 | else throwErr("permission denied") | |
315 | 317 | if ((checkCaller == checkCaller)) | |
316 | 318 | then _refreshUserReward(Address(userAddressBytes)) | |
317 | 319 | else throw("Strict value is not equal to itself.") | |
318 | 320 | } | |
319 | 321 | ||
320 | 322 | ||
321 | 323 | ||
322 | 324 | @Callable(i) | |
323 | 325 | func tradeRewardInternal (paymentAmountLeftOver,userAddresses,rewards,currentIter) = if ((currentIter == size(userAddresses))) | |
324 | 326 | then nil | |
325 | 327 | else { | |
326 | 328 | let checks = [if ((i.caller == this)) | |
327 | 329 | then true | |
328 | 330 | else throwErr("Permission denied"), if ((paymentAmountLeftOver >= rewards[currentIter])) | |
329 | 331 | then true | |
330 | 332 | else throwErr("insufficient payment assetId")] | |
331 | 333 | if ((checks == checks)) | |
332 | 334 | then { | |
333 | 335 | let tradeRewardInternal = invoke(this, "tradeRewardInternal", [(paymentAmountLeftOver - rewards[currentIter]), userAddresses, rewards, (currentIter + 1)], nil) | |
334 | 336 | if ((tradeRewardInternal == tradeRewardInternal)) | |
335 | 337 | then { | |
336 | 338 | let tradingRewardHistoryKey = keyTradingRewardHistory(userAddresses[currentIter], i) | |
337 | 339 | let userAddress = addressFromStringValue(userAddresses[currentIter]) | |
338 | 340 | $Tuple2([IntegerEntry(tradingRewardHistoryKey, rewards[currentIter]), IntegerEntry(keyTradingReward(userAddresses[currentIter]), rewards[currentIter])], tradeRewardInternal) | |
339 | 341 | } | |
340 | 342 | else throw("Strict value is not equal to itself.") | |
341 | 343 | } | |
342 | 344 | else throw("Strict value is not equal to itself.") | |
343 | 345 | } | |
344 | 346 | ||
345 | 347 | ||
346 | 348 | ||
347 | 349 | @Callable(i) | |
348 | 350 | func updateReferralActivity (userAddress,gWxAmountStart) = { | |
349 | 351 | let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddress)) | |
350 | 352 | let activeReferralInv = if ((referrer == unit)) | |
351 | 353 | then unit | |
352 | 354 | else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (gWxAmountStart >= referralMinGWxAmount)], nil) | |
353 | 355 | if ((activeReferralInv == activeReferralInv)) | |
354 | 356 | then $Tuple2(nil, unit) | |
355 | 357 | else throw("Strict value is not equal to itself.") | |
356 | 358 | } | |
357 | 359 | ||
358 | 360 | ||
359 | 361 | ||
360 | 362 | @Callable(i) | |
361 | 363 | func processPendingPeriodsAndUsers () = $Tuple2(nil, throwErr("deprecated")) | |
362 | 364 | ||
363 | 365 | ||
364 | 366 | ||
365 | 367 | @Callable(i) | |
366 | 368 | func claimReward () = { | |
367 | 369 | let cfgArray = readConfigArrayOrFail() | |
368 | 370 | let userAddress = i.caller | |
369 | 371 | let userAddressStr = toString(userAddress) | |
370 | - | let $ | |
371 | - | let amount = $ | |
372 | - | let actions = $ | |
372 | + | let $t01287312930 = commonClaimReward(userAddressStr) | |
373 | + | let amount = $t01287312930._1 | |
374 | + | let actions = $t01287312930._2 | |
373 | 375 | let checkAmount = if ((amount > 0)) | |
374 | 376 | then true | |
375 | 377 | else throw("nothing to claim") | |
376 | 378 | if ((checkAmount == checkAmount)) | |
377 | 379 | then { | |
378 | 380 | let userGwxAmount = { | |
379 | 381 | let @ = invoke(boostingContractOrFail(), "getUserGwxAmount", [userAddressStr], nil) | |
380 | 382 | if ($isInstanceOf(@, "Int")) | |
381 | 383 | then @ | |
382 | 384 | else throw(($getType(@) + " couldn't be cast to Int")) | |
383 | 385 | } | |
384 | 386 | let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddressStr)) | |
385 | 387 | let activeReferralInv = if ((referrer == unit)) | |
386 | 388 | then unit | |
387 | 389 | else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (userGwxAmount >= referralMinGWxAmount)], nil) | |
388 | 390 | if ((activeReferralInv == activeReferralInv)) | |
389 | 391 | then { | |
390 | 392 | let referralInv = if (if ((referrer == unit)) | |
391 | 393 | then true | |
392 | 394 | else (referralMinGWxAmount > userGwxAmount)) | |
393 | 395 | then unit | |
394 | 396 | else { | |
395 | 397 | let referrerReward = fraction(amount, referrerRewardPermille, SCALE) | |
396 | 398 | let referralReward = fraction(amount, referralRewardPermille, SCALE) | |
397 | 399 | invoke(referralsContractAddressOrFail, "incUnclaimed", [referralProgramName, userAddress, referrerReward, referralReward], nil) | |
398 | 400 | } | |
399 | 401 | if ((referralInv == referralInv)) | |
400 | 402 | then { | |
401 | 403 | let claimedReferral = { | |
402 | 404 | let @ = invoke(referralsContractAddressOrFail, "claim", [referralProgramName], nil) | |
403 | 405 | if ($isInstanceOf(@, "Int")) | |
404 | 406 | then @ | |
405 | 407 | else throw(($getType(@) + " couldn't be cast to Int")) | |
406 | 408 | } | |
407 | 409 | if ((claimedReferral == claimedReferral)) | |
408 | 410 | then { | |
409 | 411 | let totalAmount = (amount + claimedReferral) | |
410 | 412 | $Tuple2(([ScriptTransfer(i.caller, amount, fromBase58String(cfgArray[IdxCfgAssetId])), HistoryEntry("claim", userAddressStr, totalAmount, i)] ++ actions), totalAmount) | |
411 | 413 | } | |
412 | 414 | else throw("Strict value is not equal to itself.") | |
413 | 415 | } | |
414 | 416 | else throw("Strict value is not equal to itself.") | |
415 | 417 | } | |
416 | 418 | else throw("Strict value is not equal to itself.") | |
417 | 419 | } | |
418 | 420 | else throw("Strict value is not equal to itself.") | |
419 | 421 | } | |
420 | 422 | ||
421 | 423 | ||
422 | 424 | ||
423 | 425 | @Callable(i) | |
424 | 426 | func claimRewardREADONLY (address) = { | |
425 | - | let $ | |
426 | - | let amount = $ | |
427 | - | let actions = $ | |
427 | + | let $t01425714307 = commonClaimReward(address) | |
428 | + | let amount = $t01425714307._1 | |
429 | + | let actions = $t01425714307._2 | |
428 | 430 | let referralUnclaimed = valueOrElse(getInteger(referralsContractAddressOrFail, keyUnclaimedReferral(referralProgramName, address)), 0) | |
429 | 431 | let totalAmount = (amount + referralUnclaimed) | |
430 | 432 | $Tuple2(nil, totalAmount) | |
431 | 433 | } | |
432 | 434 | ||
433 | 435 | ||
434 | 436 | ||
435 | 437 | @Callable(i) | |
436 | 438 | func onEmissionForGwxStart () = if ((i.caller != factoryContract)) | |
437 | 439 | then throw("permissions denied") | |
438 | 440 | else [IntegerEntry(keyGwxRewardEmissionStartHeight(), height)] | |
439 | 441 | ||
440 | 442 | ||
441 | 443 | ||
442 | 444 | @Callable(i) | |
443 | 445 | func tradeReward (userAddresses,rewards) = { | |
444 | 446 | let argsComparison = (size(userAddresses) == size(rewards)) | |
445 | 447 | let maxRecipients = valueOrElse(getInteger(keyMaxRecipients()), 0) | |
446 | 448 | let payment = i.payments[0] | |
447 | 449 | let paymentAssetId = payment.assetId | |
448 | 450 | let paymentAmount = payment.amount | |
449 | 451 | let checks = [if ((maxRecipients >= size(userAddresses))) | |
450 | 452 | then true | |
451 | 453 | else throwErr("Too many recipients"), if (argsComparison) | |
452 | 454 | then true | |
453 | 455 | else throwErr("Arguments size mismatch"), if ((paymentAssetId == wxAssetId)) | |
454 | 456 | then true | |
455 | 457 | else throwErr("Wrong asset payment")] | |
456 | 458 | if ((checks == checks)) | |
457 | 459 | then { | |
458 | 460 | let tradeRewardInternal = invoke(this, "tradeRewardInternal", [paymentAmount, userAddresses, rewards, 0], nil) | |
459 | 461 | if ((tradeRewardInternal == tradeRewardInternal)) | |
460 | 462 | then $Tuple2(nil, tradeRewardInternal) | |
461 | 463 | else throw("Strict value is not equal to itself.") | |
462 | 464 | } | |
463 | 465 | else throw("Strict value is not equal to itself.") | |
464 | 466 | } | |
465 | 467 | ||
466 | 468 | ||
467 | 469 | ||
468 | 470 | @Callable(i) | |
469 | 471 | func claimTradingReward () = { | |
470 | 472 | let userAddress = i.caller | |
471 | 473 | let userAddressString = toString(userAddress) | |
472 | 474 | let reward = getTradingReward(userAddressString) | |
473 | 475 | if ((reward > 0)) | |
474 | 476 | then $Tuple2([ScriptTransfer(userAddress, reward, wxAssetId), IntegerEntry(keyTradingReward(userAddressString), 0)], reward) | |
475 | 477 | else throwErr("nothing to claim") | |
476 | 478 | } | |
477 | 479 | ||
478 | 480 | ||
479 | 481 | ||
480 | 482 | @Callable(i) | |
481 | 483 | func claimTradingRewardREADONLY (userAddress) = $Tuple2(nil, getTradingReward(userAddress)) | |
482 | 484 | ||
483 | 485 | ||
484 | 486 | @Verifier(tx) | |
485 | 487 | func verify () = { | |
486 | 488 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
487 | 489 | case pk: ByteVector => | |
488 | 490 | pk | |
489 | 491 | case _: Unit => | |
490 | 492 | tx.senderPublicKey | |
491 | 493 | case _ => | |
492 | 494 | throw("Match error") | |
493 | 495 | } | |
494 | 496 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
495 | 497 | } | |
496 | 498 |
github/deemru/w8io/026f985 57.20 ms ◑