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:BgKSFggCEgQKAgIBEgYKBAEYEQESBAoCCAESABIAEgMKAQgSABIECgIYERIAEgMKAQgiA1NFUCIFU0NBTEUiBU1VTFQ4IgdNVUxUOEJJIgp6ZXJvQmlnSW50IhRwcm9jZXNzaW5nU3RhZ2VUb3RhbCIVcHJvY2Vzc2luZ1N0YWdlU2hhcmVzIgZNVUxUMTgiCE1VTFQxOEJJIgt3YXZlc1N0cmluZyIHd3JhcEVyciIDbXNnIgh0aHJvd0VyciIOZ2V0TnVtYmVyQnlLZXkiA2tleSIPZ2V0TnVtYmVyT3JGYWlsIg5nZXRTdHJpbmdCeUtleSIPZ2V0U3RyaW5nT3JGYWlsIgxwYXJzZUFzc2V0SWQiBWlucHV0IgNhYnMiA3ZhbCIJYWJzQmlnSW50IgtrZXlNYXhEZXB0aCIPbWF4RGVwdGhEZWZhdWx0IghtYXhEZXB0aCIRa2V5RmFjdG9yeUFkZHJlc3MiEWZhY3RvcnlBZGRyZXNzU3RyIg9mYWN0b3J5Q29udHJhY3QiEmtleUVtaXNzaW9uQWRkcmVzcyIZa2V5Vm90aW5nRW1pc3Npb25Db250cmF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FARpjbGFpbVRyYWRpbmdSZXdhcmRSRUFET05MWQECYXQJAJQKAgUDbmlsCQECYVgBBQJhdAECY2cBAmNoAAQCY2kEAmFQCQECYVIAAwkAAQIFAmFQAgpCeXRlVmVjdG9yBAJhVgUCYVAFAmFWAwkAAQIFAmFQAgRVbml0CAUCY2cPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAmNnCWJvZHlCeXRlcwkAkQMCCAUCY2cGcHJvb2ZzAAAFAmNpOTeuvQ==", "height": 2721940, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ECZ5ks2Fr6gQpWBaUuJRgsVuctmivBG5Fo9GK2Uc75kg Next: EhLahnhRAZ4g4PS9GUxs3p4vafZ89q8j6Q1rkR5PjEA Diff:
OldNewDifferences
410410 }
411411 if ((referralInv == referralInv))
412412 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))
420415 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.")
423428 }
424429 else throw("Strict value is not equal to itself.")
425430 }
434439
435440 @Callable(i)
436441 func claimRewardREADONLY (address) = {
437- let $t01503915089 = commonClaimReward(address)
438- let amount = $t01503915089._1
439- let actions = $t01503915089._2
442+ let $t01506915119 = commonClaimReward(address)
443+ let amount = $t01506915119._1
444+ let actions = $t01506915119._2
440445 let referralUnclaimed = valueOrElse(getInteger(referralsContractAddressOrFail, keyUnclaimedReferral(referralProgramName, address)), 0)
441446 let totalAmount = (amount + referralUnclaimed)
442447 $Tuple2(nil, totalAmount)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let SCALE = 1000
77
88 let MULT8 = 100000000
99
1010 let MULT8BI = toBigInt(MULT8)
1111
1212 let zeroBigInt = toBigInt(0)
1313
1414 let processingStageTotal = 0
1515
1616 let processingStageShares = 1
1717
1818 let MULT18 = 1000000000000000000
1919
2020 let MULT18BI = toBigInt(MULT18)
2121
2222 let wavesString = "WAVES"
2323
2424 func wrapErr (msg) = makeString(["gwx_reward.ride:", msg], " ")
2525
2626
2727 func throwErr (msg) = throw(wrapErr(msg))
2828
2929
3030 func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0)
3131
3232
3333 func getNumberOrFail (key) = valueOrErrorMessage(getInteger(this, key), wrapErr((("mandatory this." + key) + " is not defined")))
3434
3535
3636 func getStringByKey (key) = valueOrElse(getString(this, key), "")
3737
3838
3939 func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), wrapErr((("mandatory this." + key) + " is not defined")))
4040
4141
4242 func parseAssetId (input) = if ((input == wavesString))
4343 then unit
4444 else fromBase58String(input)
4545
4646
4747 func abs (val) = if ((0 > val))
4848 then -(val)
4949 else val
5050
5151
5252 func absBigInt (val) = if ((zeroBigInt > val))
5353 then -(val)
5454 else val
5555
5656
5757 let keyMaxDepth = "%s__maxDepth"
5858
5959 let maxDepthDefault = 30
6060
6161 let maxDepth = valueOrElse(getInteger(this, keyMaxDepth), maxDepthDefault)
6262
6363 func keyFactoryAddress () = "%s%s__config__factoryAddress"
6464
6565
6666 let factoryAddressStr = getStringOrFail(keyFactoryAddress())
6767
6868 let factoryContract = addressFromStringValue(factoryAddressStr)
6969
7070 func keyEmissionAddress () = "%s%s__config__emissionAddress"
7171
7272
7373 func keyVotingEmissionContract () = makeString(["%s", "votingEmissionContract"], SEP)
7474
7575
7676 let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract()))
7777
7878 func keyNumToUserMapping (num) = makeString(["%s%s%s", "mapping", "num2user", toString(num)], SEP)
7979
8080
8181 let keyReferralProgramName = makeString(["%s%s", "referral", "programName"], SEP)
8282
8383 let referralProgramNameDefault = "wxlock"
8484
8585 let referralProgramName = valueOrElse(getString(this, keyReferralProgramName), referralProgramNameDefault)
8686
8787 let keyReferralMinGWxAmount = makeString(["%s%s", "referral", "minGWxAmount"], SEP)
8888
8989 let referralMinGWxAmountDefault = (500 * MULT8)
9090
9191 let referralMinGWxAmount = valueOrElse(getInteger(this, keyReferralMinGWxAmount), referralMinGWxAmountDefault)
9292
9393 let keyReferrerRewardPermille = makeString(["%s%s", "referral", "referrerRewardPermille"], SEP)
9494
9595 let referrerRewardPermilleDefault = 50
9696
9797 let referrerRewardPermille = valueOrElse(getInteger(this, keyReferrerRewardPermille), referrerRewardPermilleDefault)
9898
9999 let keyReferralRewardPermille = makeString(["%s%s", "referral", "referralRewardPermille"], SEP)
100100
101101 let referralRewardPermilleDefault = 50
102102
103103 let referralRewardPermille = valueOrElse(getInteger(this, keyReferralRewardPermille), referralRewardPermilleDefault)
104104
105105 func keyReferrer (referralAddress) = makeString(["%s%s%s", "referrer", referralProgramName, referralAddress], SEP)
106106
107107
108108 func keyUnclaimedReferral (programName,claimerAddress) = makeString(["%s%s%s", "unclaimedReferral", programName, claimerAddress], SEP)
109109
110110
111111 let emissionAddressStr = getStringOrFail(keyEmissionAddress())
112112
113113 let emissionContract = addressFromStringValue(emissionAddressStr)
114114
115115 let IdxCfgAssetId = 1
116116
117117 let IdxCfgPacemakerAddress = 2
118118
119119 let IdxCfgBoostingContract = 3
120120
121121 let IdxCfgMaxDepth = 4
122122
123123 func keyConfig () = "%s__config"
124124
125125
126126 func getEmissionAddress () = addressFromStringValue(valueOrErrorMessage(getString(this, keyEmissionAddress()), (("mandatory this." + keyEmissionAddress()) + " is not defined")))
127127
128128
129129 let emissionAddress = getEmissionAddress()
130130
131131 let wxAssetIdStr = split(value(getString(emissionAddress, keyConfig())), SEP)[1]
132132
133133 let wxAssetId = fromBase58String(wxAssetIdStr)
134134
135135 func readConfigArrayOrFail () = split(getStringOrFail(keyConfig()), SEP)
136136
137137
138138 func formatConfig (wxAssetIdStr,matcherPacemakerAddressStr,boostingContractAddressStr,maxDepth) = makeString(["%s%s%s%d", wxAssetIdStr, matcherPacemakerAddressStr, boostingContractAddressStr, toString(maxDepth)], SEP)
139139
140140
141141 func boostingContractOrFail () = {
142142 let cfgArray = readConfigArrayOrFail()
143143 valueOrErrorMessage(addressFromString(cfgArray[IdxCfgBoostingContract]), "boosting contract address is not defined")
144144 }
145145
146146
147147 func keyGwxRewardEmissionStartHeight () = "%s%s__gwxRewardEmissionPart__startHeight"
148148
149149
150150 func keyUsersCount () = "%s__nextUserNum"
151151
152152
153153 func keyUser2NumMapping (userAddress) = makeString(["%s%s%s__mapping__user2num", toString(userAddress)], SEP)
154154
155155
156156 func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
157157
158158
159159 func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current"
160160
161161
162162 func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next"
163163
164164
165165 func keyPoolWeightVirtual () = "%s%s__poolWeight__GWXvirtualPOOL"
166166
167167
168168 func keyUserUnclaimed (userIndex) = makeString(["%s%d", "userUnclaimed", toString(userIndex)], SEP)
169169
170170
171171 func keyReferralsContractAddress () = makeString(["%s%s", "config", "referralsContractAddress"], SEP)
172172
173173
174174 let referralsContractAddressOrFail = addressFromStringValue(getStringOrFail(keyReferralsContractAddress()))
175175
176176 func keyTradingRewardHistory (user,i) = makeString(["%s%s%s%s", "tradingReward", "history", user, toBase58String(i.transactionId)], SEP)
177177
178178
179179 func keyTradingReward (userAddress) = makeString(["%s%s", "tradingReward", userAddress], SEP)
180180
181181
182182 func keyMaxRecipients () = makeString(["%s", "maxRecipients"], SEP)
183183
184184
185185 func HistoryEntry (type,user,amount,i) = {
186186 let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP)
187187 let historyDATA = makeString(["%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount)], SEP)
188188 StringEntry(historyKEY, historyDATA)
189189 }
190190
191191
192192 func keyManagerPublicKey () = "%s__managerPublicKey"
193193
194194
195195 func keyManagerVaultAddress () = "%s__managerVaultAddress"
196196
197197
198198 func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) {
199199 case s: String =>
200200 addressFromStringValue(s)
201201 case _ =>
202202 this
203203 }
204204
205205
206206 func managerPublicKeyOrUnit () = {
207207 let managerVaultAddress = getManagerVaultAddressOrThis()
208208 match getString(managerVaultAddress, keyManagerPublicKey()) {
209209 case s: String =>
210210 fromBase58String(s)
211211 case _: Unit =>
212212 unit
213213 case _ =>
214214 throw("Match error")
215215 }
216216 }
217217
218218
219219 func mustManager (i) = {
220220 let pd = throw("Permission denied")
221221 match managerPublicKeyOrUnit() {
222222 case pk: ByteVector =>
223223 if ((i.callerPublicKey == pk))
224224 then true
225225 else pd
226226 case _: Unit =>
227227 if ((i.caller == this))
228228 then true
229229 else pd
230230 case _ =>
231231 throw("Match error")
232232 }
233233 }
234234
235235
236236 func getUserIndexByAddress (boostingContractAddressStr,userAddress) = {
237237 let key = makeString(["%s%s%s", "mapping", "user2num", userAddress], SEP)
238238 parseIntValue(valueOrErrorMessage(getString(Address(fromBase58String(boostingContractAddressStr)), key), ((("User address " + userAddress) + " is not found in boosting contract data, key=") + key)))
239239 }
240240
241241
242242 func getTradingReward (userAddress) = valueOrElse(getInteger(this, keyTradingReward(userAddress)), 0)
243243
244244
245245 func keyRewardPerGwxIntegral () = makeString(["%s", "rewardPerGwxIntegral"], SEP)
246246
247247
248248 func getGwxAmountTotalOption () = {
249249 let keyGwxTotal = "%s%s__gwx__total"
250250 getInteger(boostingContractOrFail(), keyGwxTotal)
251251 }
252252
253253
254254 func getUserGwxAmountTotalOption (userAddress) = {
255255 func keyUserGwxAmountTotal (userAddress) = makeString(["%s%s__gwxAmountTotal", toString(userAddress)], SEP)
256256
257257 getInteger(boostingContractOrFail(), keyUserGwxAmountTotal(userAddress))
258258 }
259259
260260
261261 func _refreshRewardPerGwxIntegral () = {
262262 let rewardPerGwxIntegralPrevious = valueOrElse( match getString(this, keyRewardPerGwxIntegral()) {
263263 case s: String =>
264264 parseBigInt(s)
265265 case _: Unit =>
266266 unit
267267 case _ =>
268268 throw("Match error")
269269 }, zeroBigInt)
270270 let rewardPerGwxIntegralLastHeight = valueOrErrorMessage(getInteger(this, keyGwxRewardEmissionStartHeight()), wrapErr(("invalid " + keyGwxRewardEmissionStartHeight())))
271271 let emissionRate = valueOrErrorMessage(getInteger(emissionContract, keyRatePerBlockCurrent()), wrapErr(("invalid " + keyRatePerBlockCurrent())))
272272 let gwxHoldersRewardCurrent = valueOrElse(getInteger(emissionContract, keyGwxHoldersRewardCurrent()), 0)
273273 let gwxAmountTotal = valueOrElse(getGwxAmountTotalOption(), 0)
274274 let dh = toBigInt((height - rewardPerGwxIntegralLastHeight))
275275 let gwxAmountTotalBI = toBigInt(gwxAmountTotal)
276276 let rewardPerGwxIntegral = (rewardPerGwxIntegralPrevious + (if ((gwxAmountTotalBI == zeroBigInt))
277277 then zeroBigInt
278278 else fraction(dh, ((toBigInt(emissionRate) * toBigInt(gwxHoldersRewardCurrent)) * MULT18BI), (gwxAmountTotalBI * MULT8BI))))
279279 $Tuple2([IntegerEntry(keyGwxRewardEmissionStartHeight(), height), StringEntry(keyRewardPerGwxIntegral(), toString(rewardPerGwxIntegral))], rewardPerGwxIntegral)
280280 }
281281
282282
283283 func keyRewardPerGwxIntegralUserLast (userAddress) = makeString(["%s%s", "rewardPerGwxIntegralUserLast", toString(userAddress)], SEP)
284284
285285
286286 func _refreshUserReward (userAddress,userNum) = {
287287 let $t01012210210 = _refreshRewardPerGwxIntegral()
288288 let rewardPerGwxIntegralActions = $t01012210210._1
289289 let rewardPerGwxIntegral = $t01012210210._2
290290 let rewardPerGwxIntegralUserLast = match getString(this, keyRewardPerGwxIntegralUserLast(userAddress)) {
291291 case s: String =>
292292 valueOrErrorMessage(parseBigInt(s), wrapErr("invalid user last integral"))
293293 case _: Unit =>
294294 rewardPerGwxIntegral
295295 case _ =>
296296 throw("Match error")
297297 }
298298 let userIdxOption = getString(boostingContractOrFail(), keyUser2NumMapping(userAddress))
299299 let userUnclaimed = valueOrElse(getInteger(keyUserUnclaimed(userNum)), 0)
300300 let userGwxAmount = valueOrElse(getUserGwxAmountTotalOption(userAddress), 0)
301301 let userReward = (toInt(fraction(toBigInt(userGwxAmount), (rewardPerGwxIntegral - rewardPerGwxIntegralUserLast), MULT18BI)) + userUnclaimed)
302302 $Tuple2(([StringEntry(keyRewardPerGwxIntegralUserLast(userAddress), toString(rewardPerGwxIntegral))] ++ rewardPerGwxIntegralActions), userReward)
303303 }
304304
305305
306306 func commonClaimReward (userAddressStr) = {
307307 let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address"))
308308 let cfgArray = readConfigArrayOrFail()
309309 let userNum = getUserIndexByAddress(cfgArray[IdxCfgBoostingContract], userAddressStr)
310310 let $t01150111565 = _refreshUserReward(userAddress, userNum)
311311 let actions = $t01150111565._1
312312 let reward = $t01150111565._2
313313 $Tuple2(reward, ([IntegerEntry(keyUserUnclaimed(userNum), 0)] ++ actions))
314314 }
315315
316316
317317 @Callable(i)
318318 func refreshUserReward (userAddressBytes,userNum) = {
319319 let checkCaller = if ((i.caller == boostingContractOrFail()))
320320 then true
321321 else throwErr("permission denied")
322322 if ((checkCaller == checkCaller))
323323 then {
324324 let $t01184511923 = _refreshUserReward(Address(userAddressBytes), userNum)
325325 let actions = $t01184511923._1
326326 let reward = $t01184511923._2
327327 $Tuple2(([IntegerEntry(keyUserUnclaimed(userNum), reward)] ++ actions), reward)
328328 }
329329 else throw("Strict value is not equal to itself.")
330330 }
331331
332332
333333
334334 @Callable(i)
335335 func tradeRewardInternal (paymentAmountLeftOver,userAddresses,rewards,currentIter) = if ((currentIter == size(userAddresses)))
336336 then nil
337337 else {
338338 let checks = [if ((i.caller == this))
339339 then true
340340 else throwErr("Permission denied"), if ((paymentAmountLeftOver >= rewards[currentIter]))
341341 then true
342342 else throwErr("insufficient payment assetId")]
343343 if ((checks == checks))
344344 then {
345345 let tradeRewardInternal = invoke(this, "tradeRewardInternal", [(paymentAmountLeftOver - rewards[currentIter]), userAddresses, rewards, (currentIter + 1)], nil)
346346 if ((tradeRewardInternal == tradeRewardInternal))
347347 then {
348348 let tradingRewardHistoryKey = keyTradingRewardHistory(userAddresses[currentIter], i)
349349 let userAddress = addressFromStringValue(userAddresses[currentIter])
350350 $Tuple2([IntegerEntry(tradingRewardHistoryKey, rewards[currentIter]), IntegerEntry(keyTradingReward(userAddresses[currentIter]), rewards[currentIter])], tradeRewardInternal)
351351 }
352352 else throw("Strict value is not equal to itself.")
353353 }
354354 else throw("Strict value is not equal to itself.")
355355 }
356356
357357
358358
359359 @Callable(i)
360360 func updateReferralActivity (userAddress,gWxAmountStart) = {
361361 let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddress))
362362 let activeReferralInv = if ((referrer == unit))
363363 then unit
364364 else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (gWxAmountStart >= referralMinGWxAmount)], nil)
365365 if ((activeReferralInv == activeReferralInv))
366366 then $Tuple2(nil, unit)
367367 else throw("Strict value is not equal to itself.")
368368 }
369369
370370
371371
372372 @Callable(i)
373373 func processPendingPeriodsAndUsers () = $Tuple2(nil, throwErr("deprecated"))
374374
375375
376376
377377 @Callable(i)
378378 func claimReward () = {
379379 let cfgArray = readConfigArrayOrFail()
380380 let userAddress = i.caller
381381 let userAddressStr = toString(userAddress)
382382 let $t01365513712 = commonClaimReward(userAddressStr)
383383 let amount = $t01365513712._1
384384 let actions = $t01365513712._2
385385 let checkAmount = if ((amount > 0))
386386 then true
387387 else throw("nothing to claim")
388388 if ((checkAmount == checkAmount))
389389 then {
390390 let userGwxAmount = {
391391 let @ = invoke(boostingContractOrFail(), "getUserGwxAmount", [userAddressStr], nil)
392392 if ($isInstanceOf(@, "Int"))
393393 then @
394394 else throw(($getType(@) + " couldn't be cast to Int"))
395395 }
396396 let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddressStr))
397397 let activeReferralInv = if ((referrer == unit))
398398 then unit
399399 else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (userGwxAmount >= referralMinGWxAmount)], nil)
400400 if ((activeReferralInv == activeReferralInv))
401401 then {
402402 let referralInv = if (if ((referrer == unit))
403403 then true
404404 else (referralMinGWxAmount > userGwxAmount))
405405 then unit
406406 else {
407407 let referrerReward = fraction(amount, referrerRewardPermille, SCALE)
408408 let referralReward = fraction(amount, referralRewardPermille, SCALE)
409409 invoke(referralsContractAddressOrFail, "incUnclaimed", [referralProgramName, userAddress, referrerReward, referralReward], nil)
410410 }
411411 if ((referralInv == referralInv))
412412 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))
420415 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.")
423428 }
424429 else throw("Strict value is not equal to itself.")
425430 }
426431 else throw("Strict value is not equal to itself.")
427432 }
428433 else throw("Strict value is not equal to itself.")
429434 }
430435 else throw("Strict value is not equal to itself.")
431436 }
432437
433438
434439
435440 @Callable(i)
436441 func claimRewardREADONLY (address) = {
437- let $t01503915089 = commonClaimReward(address)
438- let amount = $t01503915089._1
439- let actions = $t01503915089._2
442+ let $t01506915119 = commonClaimReward(address)
443+ let amount = $t01506915119._1
444+ let actions = $t01506915119._2
440445 let referralUnclaimed = valueOrElse(getInteger(referralsContractAddressOrFail, keyUnclaimedReferral(referralProgramName, address)), 0)
441446 let totalAmount = (amount + referralUnclaimed)
442447 $Tuple2(nil, totalAmount)
443448 }
444449
445450
446451
447452 @Callable(i)
448453 func onEmissionForGwxStart () = if ((i.caller != factoryContract))
449454 then throw("permissions denied")
450455 else [IntegerEntry(keyGwxRewardEmissionStartHeight(), height)]
451456
452457
453458
454459 @Callable(i)
455460 func tradeReward (userAddresses,rewards) = {
456461 let argsComparison = (size(userAddresses) == size(rewards))
457462 let maxRecipients = valueOrElse(getInteger(keyMaxRecipients()), 0)
458463 let payment = i.payments[0]
459464 let paymentAssetId = payment.assetId
460465 let paymentAmount = payment.amount
461466 let checks = [if ((maxRecipients >= size(userAddresses)))
462467 then true
463468 else throwErr("Too many recipients"), if (argsComparison)
464469 then true
465470 else throwErr("Arguments size mismatch"), if ((paymentAssetId == wxAssetId))
466471 then true
467472 else throwErr("Wrong asset payment")]
468473 if ((checks == checks))
469474 then {
470475 let tradeRewardInternal = invoke(this, "tradeRewardInternal", [paymentAmount, userAddresses, rewards, 0], nil)
471476 if ((tradeRewardInternal == tradeRewardInternal))
472477 then $Tuple2(nil, tradeRewardInternal)
473478 else throw("Strict value is not equal to itself.")
474479 }
475480 else throw("Strict value is not equal to itself.")
476481 }
477482
478483
479484
480485 @Callable(i)
481486 func claimTradingReward () = {
482487 let userAddress = i.caller
483488 let userAddressString = toString(userAddress)
484489 let reward = getTradingReward(userAddressString)
485490 if ((reward > 0))
486491 then $Tuple2([ScriptTransfer(userAddress, reward, wxAssetId), IntegerEntry(keyTradingReward(userAddressString), 0)], reward)
487492 else throwErr("nothing to claim")
488493 }
489494
490495
491496
492497 @Callable(i)
493498 func claimTradingRewardREADONLY (userAddress) = $Tuple2(nil, getTradingReward(userAddress))
494499
495500
496501 @Verifier(tx)
497502 func verify () = {
498503 let targetPublicKey = match managerPublicKeyOrUnit() {
499504 case pk: ByteVector =>
500505 pk
501506 case _: Unit =>
502507 tx.senderPublicKey
503508 case _ =>
504509 throw("Match error")
505510 }
506511 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
507512 }
508513

github/deemru/w8io/169f3d6 
90.53 ms