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