tx · 6avgBrkSjVmTjA6vuNDMQP7TyUeeSVWT4hYJptRQpNPJ

3N6G8j53WGVsDVPR8R8GBxmsaqkML1ayNKV:  -0.01700000 Waves

2023.05.04 11:35 [2562780] smart account 3N6G8j53WGVsDVPR8R8GBxmsaqkML1ayNKV > SELF 0.00000000 Waves

{ "type": 13, "id": "6avgBrkSjVmTjA6vuNDMQP7TyUeeSVWT4hYJptRQpNPJ", "fee": 1700000, "feeAssetId": null, "timestamp": 1683189410718, "version": 2, "chainId": 84, "sender": "3N6G8j53WGVsDVPR8R8GBxmsaqkML1ayNKV", "senderPublicKey": "G8swj2SJhdPvP3eHnoPqp9DM2w2LQJABHJSY3ygtNSSo", "proofs": [ "2H84xvvKnw44Lym7G4SeFtoaBrqBo9kTCDaH5tubjXK3rZN9S88NRHGa8LrN76B6eDLqvr7PBLVxctPpqqmfpsi6" ], "script": "base64:BgLZEggCEgUKAwgIBBIFCgMIGAESBwoFEQgYAQESBgoECAgICBIGCgQICAgCEgUKAwgIBBIGCgQICAEBEgQKAggYEgMKAQgSABIECgIICBIDCgEIEgQKAggIIglzZXBhcmF0b3IiDGtleVd4QXNzZXRJZCITa2V5QmFja2VuZFB1YmxpY0tleSIba2V5RXhpc3RzUmVmZXJyZXJUb1JlZmVycmFsIgtwcm9ncmFtTmFtZSIPcmVmZXJyZXJBZGRyZXNzIg9yZWZlcnJhbEFkZHJlc3MiEmtleUNsYWltZWRSZWZlcnJlciIOY2xhaW1lckFkZHJlc3MiEmtleUNsYWltZWRSZWZlcnJhbCIUa2V5VW5jbGFpbWVkUmVmZXJyZXIiFGtleVVuY2xhaW1lZFJlZmVycmFsIgtrZXlSZWZlcnJlciIOa2V5UHJvZ3JhbU5hbWUiFWtleVRvdGFsUmVmZXJyYWxDb3VudCIWa2V5QWN0aXZlUmVmZXJyYWxDb3VudCITa2V5SXNSZWZlcnJhbEFjdGl2ZSIWa2V5Q2xhaW1lZFRvdGFsQWRkcmVzcyIHYWRkcmVzcyIYa2V5V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kAlAoCBQNuaWwJAMwIAgUCYWoJAMwIAgUCYWkFA25pbAFRAQxzZXRUb3RhbEtleXMCAWUBcwQCYkkJAQt2YWx1ZU9yRWxzZQIJAJ8IAQkBAWgCBQFlBQFzAAAEAmJKCQELdmFsdWVPckVsc2UCCQCfCAEJAQFqAgUBZQUBcwAABAJhQQkBC3ZhbHVlT3JFbHNlAgkAnwgBCQEBawIFAWUFAXMAAAQCYksJAQt2YWx1ZU9yRWxzZQIJAJ8IAQkBAWwCBQFlBQFzAAAEAmFpCQBkAgUCYkkFAmJKBAJhagkAZAIFAmFBBQJiSwkAlAoCCQDMCAIJAQxJbnRlZ2VyRW50cnkCCQEBcgEFAXMFAmFpCQDMCAIJAQxJbnRlZ2VyRW50cnkCCQEBdAEFAXMFAmFqBQNuaWwFBHVuaXQBAmJMAQJiTQAEAmJOBAFOCQEBTAADCQABAgUBTgIKQnl0ZVZlY3RvcgQBUwUBTgUBUwMJAAECBQFOAgRVbml0CAUCYkwPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAmJMCWJvZHlCeXRlcwkAkQMCCAUCYkwGcHJvb2ZzAAAFAmJOgQYUSg==", "height": 2562780, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: A8x9rZyXp95QyYfHAvu9ewpFJU1fMKAB1Je8auYDMKni Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 6 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let separator = "__"
5+
6+func keyWxAssetId () = makeString(["%s", "wxAssetId"], separator)
7+
8+
9+let keyBackendPublicKey = makeString(["%s", "backendPublicKey"], separator)
10+
11+func keyExistsReferrerToReferral (programName,referrerAddress,referralAddress) = makeString(["%s%s%s%s", "existsReferrerToReferral", programName, referrerAddress, referralAddress], separator)
12+
13+
14+func keyClaimedReferrer (programName,claimerAddress) = makeString(["%s%s%s", "claimedReferrer", programName, claimerAddress], separator)
15+
16+
17+func keyClaimedReferral (programName,claimerAddress) = makeString(["%s%s%s", "claimedReferral", programName, claimerAddress], separator)
18+
19+
20+func keyUnclaimedReferrer (programName,claimerAddress) = makeString(["%s%s%s", "unclaimedReferrer", programName, claimerAddress], separator)
21+
22+
23+func keyUnclaimedReferral (programName,claimerAddress) = makeString(["%s%s%s", "unclaimedReferral", programName, claimerAddress], separator)
24+
25+
26+func keyReferrer (programName,referralAddress) = makeString(["%s%s%s", "referrer", programName, referralAddress], separator)
27+
28+
29+func keyProgramName (programName) = makeString(["%s%s", "programName", programName], separator)
30+
31+
32+func keyTotalReferralCount (programName,referrerAddress) = makeString(["%s%s%s", "totalReferralCount", programName, referrerAddress], separator)
33+
34+
35+func keyActiveReferralCount (programName,referrerAddress) = makeString(["%s%s%s", "activeReferralCount", programName, referrerAddress], separator)
36+
37+
38+func keyIsReferralActive (programName,referralAddress) = makeString(["%s%s%s", "activeReferral", programName, referralAddress], separator)
39+
40+
41+func keyClaimedTotalAddress (address) = makeString(["%s%s", "claimedTotalAddress", address], separator)
42+
43+
44+func keyUnclaimedTotalAddress (address) = makeString(["%s%s", "unclaimedTotalAddress", address], separator)
45+
46+
47+func keyClaimedTotal (programName) = makeString(["%s%s", "claimedTotal", programName], separator)
48+
49+
50+func keyRewardsTotal (programName) = makeString(["%s%s", "rewardsTotal", programName], separator)
51+
52+
53+func keyRewardAssetId (programName) = makeString(["%s%s", "rewardAssetId", programName], separator)
54+
55+
56+func keyTreasuryContract (programName) = makeString(["%s%s", "treasuryContract", programName], separator)
57+
58+
59+func keyImplementationContract (programName) = makeString(["%s%s", "implementationContract", programName], separator)
60+
61+
62+func keyAllReferralPrograms (address) = makeString(["%s%s", "allReferralPrograms", address], separator)
63+
64+
65+func keyManagerPublicKey () = "%s__managerPublicKey"
66+
67+
68+func keyManagerVaultAddress () = "%s__managerVaultAddress"
69+
70+
71+func getManagerAddressOrFail () = addressFromStringValue(getStringValue(keyManagerVaultAddress()))
72+
73+
74+func keyClaimHistory (programName,userAddress,transactionId,type) = makeString(["%s%s%s%s%s", "history", type, programName, userAddress, transactionId], separator)
75+
76+
77+func formatClaimHistory (amount) = makeString(["%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount)], separator)
78+
79+
80+func throwErr (msg) = throw(makeString(["referral.ride:", msg], " "))
81+
82+
83+func managerPublicKeyOrUnit () = {
84+ let managerVaultAddress = getManagerAddressOrFail()
85+ match getString(managerVaultAddress, keyManagerPublicKey()) {
86+ case s: String =>
87+ fromBase58String(s)
88+ case _: Unit =>
89+ unit
90+ case _ =>
91+ throw("Match error")
92+ }
93+ }
94+
95+
96+func mustManager (i) = {
97+ let pd = throwErr("permission denied")
98+ match managerPublicKeyOrUnit() {
99+ case pk: ByteVector =>
100+ if ((i.callerPublicKey == pk))
101+ then true
102+ else pd
103+ case _: Unit =>
104+ if ((i.caller == this))
105+ then true
106+ else pd
107+ case _ =>
108+ throw("Match error")
109+ }
110+ }
111+
112+
113+func updateAllReferralPrograms (address,programName) = {
114+ let allReferralPrograms = valueOrElse(getString(keyAllReferralPrograms(address)), "")
115+ let updatedAllReferralPrograms = if (contains(allReferralPrograms, programName))
116+ then nil
117+ else {
118+ let newAllReferralPrograms = if ((allReferralPrograms == ""))
119+ then programName
120+ else makeString([allReferralPrograms, programName], separator)
121+[StringEntry(keyAllReferralPrograms(address), newAllReferralPrograms)]
122+ }
123+ updatedAllReferralPrograms
124+ }
125+
126+
127+@Callable(i)
128+func claimInternal (programName,claimerAddress,isImplementationContract) = {
129+ let checkProgramExists = if (valueOrElse(getBoolean(keyProgramName(programName)), false))
130+ then true
131+ else throwErr("program does not exist")
132+ if ((checkProgramExists == checkProgramExists))
133+ then {
134+ let $t047005637 = if (isImplementationContract)
135+ then $Tuple5(valueOrElse(getInteger(keyClaimedReferral(programName, claimerAddress)), 0), valueOrElse(getInteger(keyUnclaimedReferral(programName, claimerAddress)), 0), keyClaimedReferral(programName, claimerAddress), keyUnclaimedReferral(programName, claimerAddress), keyClaimHistory(programName, claimerAddress, toBase58String(i.transactionId), "claimReferral"))
136+ else $Tuple5(valueOrElse(getInteger(keyClaimedReferrer(programName, claimerAddress)), 0), valueOrElse(getInteger(keyUnclaimedReferrer(programName, claimerAddress)), 0), keyClaimedReferrer(programName, claimerAddress), keyUnclaimedReferrer(programName, claimerAddress), keyClaimHistory(programName, claimerAddress, toBase58String(i.transactionId), "claimReferrer"))
137+ let claimerClaimed = $t047005637._1
138+ let claimerUnclaimed = $t047005637._2
139+ let keyClaimed = $t047005637._3
140+ let keyUnclaimed = $t047005637._4
141+ let claimHistoryKey = $t047005637._5
142+ let claimedTotal = valueOrElse(getInteger(keyClaimedTotal(programName)), 0)
143+ let treasuryContract = value(addressFromString(value(getString(keyTreasuryContract(programName)))))
144+ let rewardAssetId = fromBase58String(value(getString(keyRewardAssetId(programName))))
145+ let claimedTotalAddress = valueOrElse(getInteger(keyClaimedTotalAddress(claimerAddress)), 0)
146+ let unclaimedTotalAddress = valueOrElse(getInteger(keyUnclaimedTotalAddress(claimerAddress)), 0)
147+ if (if (isImplementationContract)
148+ then (claimerUnclaimed == 0)
149+ else false)
150+ then $Tuple2(nil, 0)
151+ else {
152+ let checkCanClaim = if ((claimerUnclaimed > 0))
153+ then true
154+ else throwErr("nothing to claim")
155+ if ((checkCanClaim == checkCanClaim))
156+ then {
157+ let newClaimerClaimed = (claimerClaimed + claimerUnclaimed)
158+ let newClaimedTotal = (claimedTotal + claimerUnclaimed)
159+ let newClaimedTotalAddress = (claimedTotalAddress + claimerUnclaimed)
160+ let newUnclaimedTotalAddress = (unclaimedTotalAddress - claimerUnclaimed)
161+ let balanceBefore = value(assetBalance(this, rewardAssetId))
162+ if ((balanceBefore == balanceBefore))
163+ then {
164+ let res = invoke(treasuryContract, "withdrawReferralReward", [claimerUnclaimed], nil)
165+ if ((res == res))
166+ then {
167+ let balanceAfter = value(assetBalance(this, rewardAssetId))
168+ if ((balanceAfter == balanceAfter))
169+ then {
170+ let balanceDiff = (balanceAfter - balanceBefore)
171+ if ((balanceDiff == balanceDiff))
172+ then {
173+ let checkBalance = if ((balanceDiff == claimerUnclaimed))
174+ then true
175+ else throwErr("insufficient balance on referral contract")
176+ if ((checkBalance == checkBalance))
177+ then $Tuple2([IntegerEntry(keyClaimed, newClaimerClaimed), IntegerEntry(keyUnclaimed, 0), IntegerEntry(keyClaimedTotal(programName), newClaimedTotal), IntegerEntry(keyClaimedTotalAddress(claimerAddress), newClaimedTotalAddress), IntegerEntry(keyUnclaimedTotalAddress(claimerAddress), newUnclaimedTotalAddress), ScriptTransfer(addressFromStringValue(claimerAddress), claimerUnclaimed, rewardAssetId), StringEntry(claimHistoryKey, formatClaimHistory(claimerUnclaimed))], claimerUnclaimed)
178+ else throw("Strict value is not equal to itself.")
179+ }
180+ else throw("Strict value is not equal to itself.")
181+ }
182+ else throw("Strict value is not equal to itself.")
183+ }
184+ else throw("Strict value is not equal to itself.")
185+ }
186+ else throw("Strict value is not equal to itself.")
187+ }
188+ else throw("Strict value is not equal to itself.")
189+ }
190+ }
191+ else throw("Strict value is not equal to itself.")
192+ }
193+
194+
195+
196+@Callable(i)
197+func claimBulkInternal (claimer,programNames,currentIter) = {
198+ let checkCaller = if ((i.caller == this))
199+ then true
200+ else throwErr("permission denied")
201+ if ((checkCaller == checkCaller))
202+ then if ((currentIter == size(programNames)))
203+ then nil
204+ else {
205+ let programName = programNames[currentIter]
206+ let programUnclaimed = valueOrElse(getInteger(keyUnclaimedReferrer(programName, claimer)), 0)
207+ let claimHistoryKey = keyClaimHistory(programName, claimer, toBase58String(i.transactionId), "claimBulk")
208+ let claimBulkInternal = invoke(this, "claimBulkInternal", [claimer, programNames, (currentIter + 1)], nil)
209+ if ((claimBulkInternal == claimBulkInternal))
210+ then {
211+ let unclaimedReferrer = valueOrElse(getInteger(keyUnclaimedReferrer(programName, claimer)), 0)
212+ let claim = if ((unclaimedReferrer > 0))
213+ then invoke(this, "claimInternal", [programName, claimer, false], nil)
214+ else unit
215+ if ((claim == claim))
216+ then $Tuple2(nil, [claimBulkInternal, claim])
217+ else throw("Strict value is not equal to itself.")
218+ }
219+ else throw("Strict value is not equal to itself.")
220+ }
221+ else throw("Strict value is not equal to itself.")
222+ }
223+
224+
225+
226+@Callable(i)
227+func incUnclaimedWithPaymentInternal (paymentAmounts,programName,referrerAddresses,currentIter,resAmount) = {
228+ let checkCaller = if ((i.caller == this))
229+ then true
230+ else throwErr("permission denied")
231+ if ((checkCaller == checkCaller))
232+ then {
233+ let argsComparison = (size(paymentAmounts) == size(referrerAddresses))
234+ let check = if (argsComparison)
235+ then true
236+ else throwErr("lists in args must be same size")
237+ if ((check == check))
238+ then if ((currentIter == size(paymentAmounts)))
239+ then $Tuple2(nil, resAmount)
240+ else {
241+ let referrerAddress = referrerAddresses[currentIter]
242+ let unclaimedTotalAddress = valueOrElse(getInteger(keyUnclaimedTotalAddress(referrerAddress)), 0)
243+ let referrerUnclaimed = valueOrElse(getInteger(keyUnclaimedReferrer(programName, referrerAddress)), 0)
244+ let rewardsTotal = valueOrElse(getInteger(keyRewardsTotal(programName)), 0)
245+ let newUnclaimedTotalAddress = (unclaimedTotalAddress + paymentAmounts[currentIter])
246+ let newReferrerUnclaimed = (referrerUnclaimed + paymentAmounts[currentIter])
247+ let newResAmount = (resAmount + paymentAmounts[currentIter])
248+ let inv = invoke(this, "incUnclaimedWithPaymentInternal", [paymentAmounts, programName, referrerAddresses, (currentIter + 1), newResAmount], nil)
249+ if ((inv == inv))
250+ then {
251+ let updatedAllReferrerPrograms = updateAllReferralPrograms(referrerAddress, programName)
252+ $Tuple2(([IntegerEntry(keyUnclaimedTotalAddress(referrerAddress), newUnclaimedTotalAddress), IntegerEntry(keyUnclaimedReferrer(programName, referrerAddress), newReferrerUnclaimed), IntegerEntry(keyRewardsTotal(programName), (rewardsTotal + paymentAmounts[currentIter]))] ++ updatedAllReferrerPrograms), inv)
253+ }
254+ else throw("Strict value is not equal to itself.")
255+ }
256+ else throw("Strict value is not equal to itself.")
257+ }
258+ else throw("Strict value is not equal to itself.")
259+ }
260+
261+
262+
263+@Callable(i)
264+func createReferralProgram (programName,treasuryContract,implementationContract,rewardAssetId) = {
265+ let checkCaller = mustManager(i)
266+ if ((checkCaller == checkCaller))
267+ then {
268+ let checkProgramName = if ((getBoolean(keyProgramName(programName)) == unit))
269+ then true
270+ else throwErr("program name already exists")
271+ if ((checkProgramName == checkProgramName))
272+ then {
273+ let programNameIsValid = if (!(contains(programName, separator)))
274+ then !(contains(programName, " "))
275+ else false
276+ let checkProgramExists = if (programNameIsValid)
277+ then true
278+ else throwErr("invalid program name")
279+ if ((checkProgramExists == checkProgramExists))
280+ then {
281+ let checkRewardAsset = if ((assetInfo(fromBase58String(rewardAssetId)) != unit))
282+ then true
283+ else throwErr("invalid reward asset id")
284+ if ((checkRewardAsset == checkRewardAsset))
285+ then $Tuple2([BooleanEntry(keyProgramName(programName), true), StringEntry(keyTreasuryContract(programName), treasuryContract), StringEntry(keyImplementationContract(programName), implementationContract), StringEntry(keyRewardAssetId(programName), rewardAssetId), IntegerEntry(keyRewardsTotal(programName), 0)], unit)
286+ else throw("Strict value is not equal to itself.")
287+ }
288+ else throw("Strict value is not equal to itself.")
289+ }
290+ else throw("Strict value is not equal to itself.")
291+ }
292+ else throw("Strict value is not equal to itself.")
293+ }
294+
295+
296+
297+@Callable(i)
298+func createPair (programName,referrerAddress,referralAddress,signature) = {
299+ let checkProgramExists = if (valueOrElse(getBoolean(keyProgramName(programName)), false))
300+ then true
301+ else throwErr("program does not exist")
302+ if ((checkProgramExists == checkProgramExists))
303+ then {
304+ let pairReferrerToReferralExistCheck = if ((getBoolean(keyExistsReferrerToReferral(programName, referrerAddress, referralAddress)) == unit))
305+ then true
306+ else throwErr("pair already exists")
307+ if ((pairReferrerToReferralExistCheck == pairReferrerToReferralExistCheck))
308+ then {
309+ let noRefSelf = if ((referrerAddress != referralAddress))
310+ then true
311+ else throwErr("cannot refer to self")
312+ if ((noRefSelf == noRefSelf))
313+ then {
314+ let pair = toBytes(makeString([programName, referrerAddress, referralAddress], ":"))
315+ let backendPublicKey = fromBase58String(value(getString(keyBackendPublicKey)))
316+ let validateSignature = if (sigVerify(pair, signature, backendPublicKey))
317+ then true
318+ else throwErr("bad signature")
319+ if ((validateSignature == validateSignature))
320+ then {
321+ let totalReferralCount = valueOrElse(getInteger(keyTotalReferralCount(programName, referrerAddress)), 0)
322+ let newTotalReferralCount = (totalReferralCount + 1)
323+ let updatedAllReferrerPrograms = updateAllReferralPrograms(referrerAddress, programName)
324+ let updatedAllReferralPrograms = updateAllReferralPrograms(referralAddress, programName)
325+ $Tuple2((([BooleanEntry(keyExistsReferrerToReferral(programName, referrerAddress, referralAddress), true), IntegerEntry(keyTotalReferralCount(programName, referrerAddress), newTotalReferralCount), StringEntry(keyReferrer(programName, referralAddress), referrerAddress)] ++ updatedAllReferrerPrograms) ++ updatedAllReferralPrograms), unit)
326+ }
327+ else throw("Strict value is not equal to itself.")
328+ }
329+ else throw("Strict value is not equal to itself.")
330+ }
331+ else throw("Strict value is not equal to itself.")
332+ }
333+ else throw("Strict value is not equal to itself.")
334+ }
335+
336+
337+
338+@Callable(i)
339+func updateReferralActivity (programName,referralAddress,isActive) = {
340+ let implementationContract = value(getString(keyImplementationContract(programName)))
341+ let isReferralActive = (getBoolean(keyIsReferralActive(programName, referralAddress)) != unit)
342+ let referrerAddress = value(getString(keyReferrer(programName, referralAddress)))
343+ let checkCaller = if ((toString(i.caller) == implementationContract))
344+ then true
345+ else throwErr("permission denied")
346+ if ((checkCaller == checkCaller))
347+ then {
348+ let update = if ((isReferralActive == isActive))
349+ then $Tuple2(nil, unit)
350+ else {
351+ let update = if ((isActive == true))
352+ then {
353+ let newActiveReferralCount = (valueOrElse(getInteger(keyActiveReferralCount(programName, referrerAddress)), 0) + 1)
354+ $Tuple2([BooleanEntry(keyIsReferralActive(programName, referralAddress), true), IntegerEntry(keyActiveReferralCount(programName, referrerAddress), newActiveReferralCount)], unit)
355+ }
356+ else {
357+ let newActiveReferralCount = (valueOrElse(getInteger(keyActiveReferralCount(programName, referrerAddress)), 0) - 1)
358+ $Tuple2([DeleteEntry(keyIsReferralActive(programName, referralAddress)), IntegerEntry(keyActiveReferralCount(programName, referrerAddress), newActiveReferralCount)], unit)
359+ }
360+ update
361+ }
362+ update
363+ }
364+ else throw("Strict value is not equal to itself.")
365+ }
366+
367+
368+
369+@Callable(i)
370+func incUnclaimed (programName,referralAddress,referrerReward,referralReward) = {
371+ let implementationContract = value(getString(keyImplementationContract(programName)))
372+ let referrerAddress = value(getString(keyReferrer(programName, referralAddress)))
373+ let checkCaller = if ((toString(i.caller) == implementationContract))
374+ then true
375+ else throwErr("permission denied")
376+ if ((checkCaller == checkCaller))
377+ then {
378+ let checkProgram = if ((programName == "wxlock"))
379+ then true
380+ else throwErr("invalid program")
381+ if ((checkProgram == checkProgram))
382+ then {
383+ let checkReferrerInProgram = if (contains(valueOrElse(getString(keyAllReferralPrograms(referrerAddress)), ""), programName))
384+ then true
385+ else throwErr(((("referrer not in program=" + programName) + " addr=") + referrerAddress))
386+ if ((checkReferrerInProgram == checkReferrerInProgram))
387+ then {
388+ let checkReferralInProgram = if (contains(valueOrElse(getString(keyAllReferralPrograms(referralAddress)), ""), programName))
389+ then true
390+ else throwErr(((("referral not in program=" + programName) + " addr=") + referralAddress))
391+ if ((checkReferralInProgram == checkReferralInProgram))
392+ then {
393+ let unclaimedTotalReferrer = valueOrElse(getInteger(keyUnclaimedTotalAddress(referrerAddress)), 0)
394+ let referrerUnclaimed = valueOrElse(getInteger(keyUnclaimedReferrer(programName, referrerAddress)), 0)
395+ let unclaimedTotalReferral = valueOrElse(getInteger(keyUnclaimedTotalAddress(referralAddress)), 0)
396+ let referralUnclaimed = valueOrElse(getInteger(keyUnclaimedReferral(programName, referralAddress)), 0)
397+ let rewardsTotal = valueOrElse(getInteger(keyRewardsTotal(programName)), 0)
398+ let newUnclaimedTotalReferrer = (unclaimedTotalReferrer + referrerReward)
399+ let newReferrerUnclaimed = (referrerUnclaimed + referrerReward)
400+ let newUnclaimedTotalReferral = (unclaimedTotalReferral + referralReward)
401+ let newReferralUnclaimed = (referralUnclaimed + referralReward)
402+ $Tuple2([IntegerEntry(keyUnclaimedTotalAddress(referrerAddress), newUnclaimedTotalReferrer), IntegerEntry(keyUnclaimedTotalAddress(referralAddress), newUnclaimedTotalReferral), IntegerEntry(keyUnclaimedReferrer(programName, referrerAddress), newReferrerUnclaimed), IntegerEntry(keyUnclaimedReferral(programName, referralAddress), newReferralUnclaimed), IntegerEntry(keyRewardsTotal(programName), ((rewardsTotal + referrerReward) + referralReward))], unit)
403+ }
404+ else throw("Strict value is not equal to itself.")
405+ }
406+ else throw("Strict value is not equal to itself.")
407+ }
408+ else throw("Strict value is not equal to itself.")
409+ }
410+ else throw("Strict value is not equal to itself.")
411+ }
412+
413+
414+
415+@Callable(i)
416+func incUnclaimedWithPayment (programName,referrerAddresses) = {
417+ let checkProgram = if ((programName == "wxSpotFee"))
418+ then true
419+ else throwErr("invalid program")
420+ if ((checkProgram == checkProgram))
421+ then {
422+ func map (accum,next) = {
423+ let assetIdCheck = (toBase58String(value(next.assetId)) == value(getString(keyRewardAssetId(programName))))
424+ let amountCheck = if (assetIdCheck)
425+ then true
426+ else throwErr("invalid asset id")
427+ if ((amountCheck == amountCheck))
428+ then (accum :+ next.amount)
429+ else throw("Strict value is not equal to itself.")
430+ }
431+
432+ let payments = {
433+ let $l = i.payments
434+ let $s = size($l)
435+ let $acc0 = nil
436+ func $f0_1 ($a,$i) = if (($i >= $s))
437+ then $a
438+ else map($a, $l[$i])
439+
440+ func $f0_2 ($a,$i) = if (($i >= $s))
441+ then $a
442+ else throw("List size exceeds 10")
443+
444+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
445+ }
446+ let resAmount = {
447+ let @ = invoke(this, "incUnclaimedWithPaymentInternal", [payments, programName, referrerAddresses, 0, 0], nil)
448+ if ($isInstanceOf(@, "Int"))
449+ then @
450+ else throw(($getType(@) + " couldn't be cast to Int"))
451+ }
452+ if ((resAmount == resAmount))
453+ then {
454+ let treasuryContract = addressFromStringValue(value(getString(keyTreasuryContract(programName))))
455+ let rewardAssetId = fromBase58String(value(getString(keyRewardAssetId(programName))))
456+[ScriptTransfer(treasuryContract, resAmount, rewardAssetId)]
457+ }
458+ else throw("Strict value is not equal to itself.")
459+ }
460+ else throw("Strict value is not equal to itself.")
461+ }
462+
463+
464+
465+@Callable(i)
466+func claim (programName) = {
467+ let checkProgramExists = if (valueOrElse(getBoolean(keyProgramName(programName)), false))
468+ then true
469+ else throwErr("program does not exist")
470+ if ((checkProgramExists == checkProgramExists))
471+ then {
472+ let isImplementationContract = (toString(i.caller) == value(getString(keyImplementationContract(programName))))
473+ let claimerAddress = if (isImplementationContract)
474+ then toString(i.originCaller)
475+ else toString(i.caller)
476+ let claimInternal = invoke(this, "claimInternal", [programName, claimerAddress, isImplementationContract], nil)
477+ if ((claimInternal == claimInternal))
478+ then $Tuple2(nil, claimInternal)
479+ else throw("Strict value is not equal to itself.")
480+ }
481+ else throw("Strict value is not equal to itself.")
482+ }
483+
484+
485+
486+@Callable(i)
487+func claimBulk () = {
488+ let callerAddress = toString(i.caller)
489+ let callerProgramsStr = getString(keyAllReferralPrograms(toString(i.caller)))
490+ let programsExists = if (isDefined(callerProgramsStr))
491+ then true
492+ else throwErr("no referral programs")
493+ if ((programsExists == programsExists))
494+ then {
495+ let callerPrograms = split(value(callerProgramsStr), "__")
496+ let bulkClaim = invoke(this, "claimBulkInternal", [callerAddress, callerPrograms, 0], nil)
497+ if ((bulkClaim == bulkClaim))
498+ then $Tuple2(nil, bulkClaim)
499+ else throw("Strict value is not equal to itself.")
500+ }
501+ else throw("Strict value is not equal to itself.")
502+ }
503+
504+
505+
506+@Callable(i)
507+func claimREADONLY (programName,userAddress) = {
508+ let claimerClaimed = valueOrElse(getInteger(keyClaimedReferrer(programName, userAddress)), 0)
509+ let claimerUnclaimed = valueOrElse(getInteger(keyUnclaimedReferrer(programName, userAddress)), 0)
510+ $Tuple2(nil, [claimerUnclaimed, claimerClaimed])
511+ }
512+
513+
514+
515+@Callable(i)
516+func claimBulkREADONLY (claimer) = {
517+ let claimedTotalAddress = valueOrElse(getInteger(keyClaimedTotalAddress(claimer)), 0)
518+ let unclaimedTotalAddress = valueOrElse(getInteger(keyUnclaimedTotalAddress(claimer)), 0)
519+ $Tuple2(nil, [unclaimedTotalAddress, claimedTotalAddress])
520+ }
521+
522+
523+
524+@Callable(i)
525+func setTotalKeys (programName,address) = {
526+ let claimedReferrer = valueOrElse(getInteger(keyClaimedReferrer(programName, address)), 0)
527+ let claimedReferral = valueOrElse(getInteger(keyClaimedReferral(programName, address)), 0)
528+ let unclaimedReferrer = valueOrElse(getInteger(keyUnclaimedReferrer(programName, address)), 0)
529+ let unclaimedReferral = valueOrElse(getInteger(keyUnclaimedReferral(programName, address)), 0)
530+ let claimedTotalAddress = (claimedReferrer + claimedReferral)
531+ let unclaimedTotalAddress = (unclaimedReferrer + unclaimedReferral)
532+ $Tuple2([IntegerEntry(keyClaimedTotalAddress(address), claimedTotalAddress), IntegerEntry(keyUnclaimedTotalAddress(address), unclaimedTotalAddress)], unit)
533+ }
534+
535+
536+@Verifier(tx)
537+func verify () = {
538+ let targetPublicKey = match managerPublicKeyOrUnit() {
539+ case pk: ByteVector =>
540+ pk
541+ case _: Unit =>
542+ tx.senderPublicKey
543+ case _ =>
544+ throw("Match error")
545+ }
546+ sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
547+ }
548+

github/deemru/w8io/169f3d6 
34.45 ms