tx · GsS7t7aBcAqRaMLwTKj3TdyDCzqF3Suqix8h4bMpN1LZ

3NAsFvuLwxz1iUtZ9fmhfmSN16r9NEsPqsh:  -0.01700000 Waves

2022.08.03 12:46 [2168143] smart account 3NAsFvuLwxz1iUtZ9fmhfmSN16r9NEsPqsh > SELF 0.00000000 Waves

{ "type": 13, "id": "GsS7t7aBcAqRaMLwTKj3TdyDCzqF3Suqix8h4bMpN1LZ", "fee": 1700000, "feeAssetId": null, "timestamp": 1659520018820, "version": 1, "sender": "3NAsFvuLwxz1iUtZ9fmhfmSN16r9NEsPqsh", "senderPublicKey": "33fpjdpM9FMu87RZKePniPardKqQXM96sm7VhAk3JEVQ", "proofs": [ "4TWGVrUGxfd2QPbdi7rxxTyrfaff5FkSWQREbrHRskCVoL9sPpM7J3Xg2rDD9Re2f2WPJchAMmutEd5m7F6hbmG1" ], "script": "base64:BgIzCAISBgoECAgICBIGCgQICAgCEgUKAwgIBBIGCgQICAEBEgMKAQgSBAoCCAgSAwoBCBIAGQAJc2VwYXJhdG9yAgJfXwATa2V5QmFja2VuZFB1YmxpY0tleQkAuQkCCQDMCAICAiVzCQDMCAICEGJhY2tlbmRQdWJsaWNLZXkFA25pbAUJc2VwYXJhdG9yARtrZXlFeGlzdHNSZWZlcnJlclRvUmVmZXJyYWwDC3Byb2dyYW1OYW1lD3JlZmVycmVyQWRkcmVzcw9yZWZlcnJhbEFkZHJlc3MJALkJAgkAzAgCAgglcyVzJXMlcwkAzAgCAhhleGlzdHNSZWZlcnJlclRvUmVmZXJyYWwJAMwIAgULcHJvZ3JhbU5hbWUJAMwIAgUPcmVmZXJyZXJBZGRyZXNzCQDMCAIFD3JlZmVycmFsQWRkcmVzcwUDbmlsBQlzZXBhcmF0b3IBEmtleUNsYWltZWRSZWZlcnJlcgILcHJvZ3JhbU5hbWUOY2xhaW1lckFkZHJlc3MJALkJAgkAzAgCAgglcyVzJXMlcwkAzAgCAg9jbGFpbWVkUmVmZXJyZXIJAMwIAgULcHJv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JsaWNLZXkJAQV2YWx1ZQEFAnBtBgkBCHRocm93RXJyAQIbeW91IGFyZSBub3QgcGVuZGluZyBtYW5hZ2VyAwkAAAIFB2NoZWNrUE0FB2NoZWNrUE0JAMwIAgkBC1N0cmluZ0VudHJ5AgkBE2tleU1hbmFnZXJQdWJsaWNLZXkACQDYBAEJAQV2YWx1ZQEFAnBtCQDMCAIJAQtEZWxldGVFbnRyeQEJARprZXlQZW5kaW5nTWFuYWdlclB1YmxpY0tleQAFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAED3RhcmdldFB1YmxpY0tleQQHJG1hdGNoMAkBFm1hbmFnZXJQdWJsaWNLZXlPclVuaXQAAwkAAQIFByRtYXRjaDACCkJ5dGVWZWN0b3IEAnBrBQckbWF0Y2gwBQJwawMJAAECBQckbWF0Y2gwAgRVbml0CAUCdHgPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFD3RhcmdldFB1YmxpY0tleVt9SxI=", "chainId": 84, "height": 2168143, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3YzZr6vnD6D7LZ1t4ih11zb7Q8h7BMZRAea5C9Rs68PJ Next: 42MY5jDK7rB1bFkLEwFHS96wAWDxMhKMpqEfGZKLS7BT Diff:
OldNewDifferences
88 func keyExistsReferrerToReferral (programName,referrerAddress,referralAddress) = makeString(["%s%s%s%s", "existsReferrerToReferral", programName, referrerAddress, referralAddress], separator)
99
1010
11-func keyClaimed (programName,claimerAddress) = makeString(["%s%s%s%s", "claimed", programName, claimerAddress], separator)
11+func keyClaimedReferrer (programName,claimerAddress) = makeString(["%s%s%s%s", "claimedReferrer", programName, claimerAddress], separator)
1212
1313
14-func keyUnclaimed (programName,claimerAddress) = makeString(["%s%s%s%s", "unclaimed", programName, claimerAddress], separator)
14+func keyClaimedReferral (programName,claimerAddress) = makeString(["%s%s%s%s", "claimedReferral", programName, claimerAddress], separator)
15+
16+
17+func keyUnclaimedReferrer (programName,claimerAddress) = makeString(["%s%s%s%s", "unclaimedReferrer", programName, claimerAddress], separator)
18+
19+
20+func keyUnclaimedReferral (programName,claimerAddress) = makeString(["%s%s%s%s", "unclaimedReferral", programName, claimerAddress], separator)
1521
1622
1723 func keyReferrer (programName,referralAddress) = makeString(["%s%s%s", "referrer", programName, referralAddress], separator)
209215 if ((checkCaller == checkCaller))
210216 then {
211217 let referrerAddress = value(getString(keyReferrer(programName, referralAddress)))
212- let referrerUnclaimed = valueOrElse(getInteger(keyUnclaimed(programName, referrerAddress)), 0)
213- let referralUnclaimed = valueOrElse(getInteger(keyUnclaimed(programName, referralAddress)), 0)
218+ let referrerUnclaimed = valueOrElse(getInteger(keyUnclaimedReferrer(programName, referrerAddress)), 0)
219+ let referralUnclaimed = valueOrElse(getInteger(keyUnclaimedReferral(programName, referralAddress)), 0)
214220 let rewardsTotal = valueOrElse(getInteger(keyRewardsTotal(programName)), 0)
215221 let newReferrerUnclaimed = (referrerUnclaimed + referrerReward)
216222 let newReferralUnclaimed = (referralUnclaimed + referralReward)
217- $Tuple2([IntegerEntry(keyUnclaimed(programName, referrerAddress), newReferrerUnclaimed), IntegerEntry(keyUnclaimed(programName, referralAddress), newReferralUnclaimed), IntegerEntry(keyRewardsTotal(programName), ((rewardsTotal + referrerReward) + referralReward))], unit)
223+ $Tuple2([IntegerEntry(keyUnclaimedReferrer(programName, referrerAddress), newReferrerUnclaimed), IntegerEntry(keyUnclaimedReferral(programName, referralAddress), newReferralUnclaimed), IntegerEntry(keyRewardsTotal(programName), ((rewardsTotal + referrerReward) + referralReward))], unit)
218224 }
219225 else throw("Strict value is not equal to itself.")
220226 }
228234 else throwErr("program does not exist")
229235 if ((checkProgramExists == checkProgramExists))
230236 then {
231- let userAddressStr = toString(i.caller)
237+ let isImplementationContract = (toString(i.caller) == value(getString(keyImplementationContract(programName))))
238+ let $t084049132 = if (isImplementationContract)
239+ then {
240+ let user = toString(i.originCaller)
241+ $Tuple5(user, valueOrElse(getInteger(keyClaimedReferral(programName, user)), 0), valueOrElse(getInteger(keyUnclaimedReferral(programName, user)), 0), keyClaimedReferral(programName, user), keyUnclaimedReferral(programName, user))
242+ }
243+ else {
244+ let user = toString(i.caller)
245+ $Tuple5(user, valueOrElse(getInteger(keyClaimedReferrer(programName, user)), 0), valueOrElse(getInteger(keyUnclaimedReferrer(programName, user)), 0), keyClaimedReferral(programName, user), keyUnclaimedReferral(programName, user))
246+ }
247+ let userAddressStr = $t084049132._1
248+ let claimerClaimed = $t084049132._2
249+ let claimerUnclaimed = $t084049132._3
250+ let keyClaimed = $t084049132._4
251+ let keyUnclaimed = $t084049132._5
232252 let claimedTotal = valueOrElse(getInteger(keyClaimedTotal(programName)), 0)
233- let claimerClaimed = valueOrElse(getInteger(keyClaimed(programName, userAddressStr)), 0)
234- let claimerUnclaimed = valueOrElse(getInteger(keyUnclaimed(programName, userAddressStr)), 0)
235253 let treasuryContract = value(addressFromString(value(getString(keyTreasuryContract(programName)))))
236254 let rewardAssetId = fromBase58String(value(getString(keyRewardAssetId(programName))))
237- let checkCanClaim = if ((claimerUnclaimed > 0))
238- then true
239- else throwErr("nothing to claim")
240- if ((checkCanClaim == checkCanClaim))
241- then {
242- let newClaimerClaimed = (claimerClaimed + claimerUnclaimed)
243- let newClaimedTotal = (claimedTotal + claimerUnclaimed)
244- let balanceBefore = value(assetBalance(this, rewardAssetId))
245- if ((balanceBefore == balanceBefore))
255+ if (if (isImplementationContract)
256+ then (claimerUnclaimed == 0)
257+ else false)
258+ then $Tuple2(nil, 0)
259+ else {
260+ let checkCanClaim = if ((claimerUnclaimed > 0))
261+ then true
262+ else throwErr("nothing to claim")
263+ if ((checkCanClaim == checkCanClaim))
246264 then {
247- let res = invoke(treasuryContract, "withdrawReferralReward", [claimerUnclaimed], nil)
248- if ((res == res))
265+ let newClaimerClaimed = (claimerClaimed + claimerUnclaimed)
266+ let newClaimedTotal = (claimedTotal + claimerUnclaimed)
267+ let balanceBefore = value(assetBalance(this, rewardAssetId))
268+ if ((balanceBefore == balanceBefore))
249269 then {
250- let balanceAfter = value(assetBalance(this, rewardAssetId))
251- if ((balanceAfter == balanceAfter))
270+ let res = invoke(treasuryContract, "withdrawReferralReward", [claimerUnclaimed], nil)
271+ if ((res == res))
252272 then {
253- let balanceDiff = (balanceAfter - balanceBefore)
254- if ((balanceDiff == balanceDiff))
273+ let balanceAfter = value(assetBalance(this, rewardAssetId))
274+ if ((balanceAfter == balanceAfter))
255275 then {
256- let checkBalance = if ((balanceDiff == claimerUnclaimed))
257- then true
258- else throwErr("insufficient balance on referral contract")
259- if ((checkBalance == checkBalance))
260- then $Tuple2([IntegerEntry(keyClaimed(programName, userAddressStr), newClaimerClaimed), IntegerEntry(keyClaimedTotal(programName), newClaimedTotal), IntegerEntry(keyUnclaimed(programName, userAddressStr), 0), ScriptTransfer(i.caller, claimerUnclaimed, rewardAssetId), StringEntry(keyClaimHistory(programName, userAddressStr, toBase58String(i.transactionId)), formatClaimHistory(claimerUnclaimed))], unit)
276+ let balanceDiff = (balanceAfter - balanceBefore)
277+ if ((balanceDiff == balanceDiff))
278+ then {
279+ let checkBalance = if ((balanceDiff == claimerUnclaimed))
280+ then true
281+ else throwErr("insufficient balance on referral contract")
282+ if ((checkBalance == checkBalance))
283+ then $Tuple2([IntegerEntry(keyClaimed, newClaimerClaimed), IntegerEntry(keyClaimedTotal(programName), newClaimedTotal), IntegerEntry(keyUnclaimed, 0), ScriptTransfer(addressFromStringValue(userAddressStr), claimerUnclaimed, rewardAssetId), StringEntry(keyClaimHistory(programName, userAddressStr, toBase58String(i.transactionId)), formatClaimHistory(claimerUnclaimed))], claimerUnclaimed)
284+ else throw("Strict value is not equal to itself.")
285+ }
261286 else throw("Strict value is not equal to itself.")
262287 }
263288 else throw("Strict value is not equal to itself.")
268293 }
269294 else throw("Strict value is not equal to itself.")
270295 }
271- else throw("Strict value is not equal to itself.")
272296 }
273297 else throw("Strict value is not equal to itself.")
274298 }
277301
278302 @Callable(i)
279303 func claimREADONLY (programName,userAddress) = {
280- let claimerClaimed = valueOrElse(getInteger(keyClaimed(programName, userAddress)), 0)
281- let claimerUnclaimed = valueOrElse(getInteger(keyUnclaimed(programName, userAddress)), 0)
304+ let claimerClaimed = valueOrElse(getInteger(keyClaimedReferrer(programName, userAddress)), 0)
305+ let claimerUnclaimed = valueOrElse(getInteger(keyUnclaimedReferrer(programName, userAddress)), 0)
282306 $Tuple2(nil, [claimerUnclaimed, claimerClaimed])
283307 }
284308
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let separator = "__"
55
66 let keyBackendPublicKey = makeString(["%s", "backendPublicKey"], separator)
77
88 func keyExistsReferrerToReferral (programName,referrerAddress,referralAddress) = makeString(["%s%s%s%s", "existsReferrerToReferral", programName, referrerAddress, referralAddress], separator)
99
1010
11-func keyClaimed (programName,claimerAddress) = makeString(["%s%s%s%s", "claimed", programName, claimerAddress], separator)
11+func keyClaimedReferrer (programName,claimerAddress) = makeString(["%s%s%s%s", "claimedReferrer", programName, claimerAddress], separator)
1212
1313
14-func keyUnclaimed (programName,claimerAddress) = makeString(["%s%s%s%s", "unclaimed", programName, claimerAddress], separator)
14+func keyClaimedReferral (programName,claimerAddress) = makeString(["%s%s%s%s", "claimedReferral", programName, claimerAddress], separator)
15+
16+
17+func keyUnclaimedReferrer (programName,claimerAddress) = makeString(["%s%s%s%s", "unclaimedReferrer", programName, claimerAddress], separator)
18+
19+
20+func keyUnclaimedReferral (programName,claimerAddress) = makeString(["%s%s%s%s", "unclaimedReferral", programName, claimerAddress], separator)
1521
1622
1723 func keyReferrer (programName,referralAddress) = makeString(["%s%s%s", "referrer", programName, referralAddress], separator)
1824
1925
2026 func keyProgramName (programName) = makeString(["%s%s", "programName", programName], separator)
2127
2228
2329 func keyTotalReferralCount (programName,referrerAddress) = makeString(["%s%s%s", "totalReferralCount", programName, referrerAddress], separator)
2430
2531
2632 func keyActiveReferralCount (programName,referrerAddress) = makeString(["%s%s%s", "activeReferralCount", programName, referrerAddress], separator)
2733
2834
2935 func keyIsReferralActive (programName,referralAddress) = makeString(["%s%s%s", "activeReferral", programName, referralAddress], separator)
3036
3137
3238 func keyClaimedTotal (programName) = makeString(["%s%s", "claimedTotal", programName], separator)
3339
3440
3541 func keyRewardsTotal (programName) = makeString(["%s%s", "rewardsTotal", programName], separator)
3642
3743
3844 func keyRewardAssetId (programName) = makeString(["%s%s", "rewardAssetId", programName], separator)
3945
4046
4147 func keyTreasuryContract (programName) = makeString(["%s%s", "treasuryContract", programName], separator)
4248
4349
4450 func keyImplementationContract (programName) = makeString(["%s%s", "implementationContract", programName], separator)
4551
4652
4753 func keyManagerPublicKey () = "%s__managerPublicKey"
4854
4955
5056 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
5157
5258
5359 func keyClaimHistory (programName,userAddress,transactionId) = makeString(["%s%s%s%s%s", "history", "claim", programName, userAddress, transactionId], separator)
5460
5561
5662 func formatClaimHistory (amount) = makeString(["%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount)], separator)
5763
5864
5965 func throwErr (msg) = throw(makeString(["referral.ride:", msg], " "))
6066
6167
6268 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
6369 case s: String =>
6470 fromBase58String(s)
6571 case _: Unit =>
6672 unit
6773 case _ =>
6874 throw("Match error")
6975 }
7076
7177
7278 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
7379 case s: String =>
7480 fromBase58String(s)
7581 case _: Unit =>
7682 unit
7783 case _ =>
7884 throw("Match error")
7985 }
8086
8187
8288 func mustManager (i) = {
8389 let pd = throwErr("permission denied")
8490 match managerPublicKeyOrUnit() {
8591 case pk: ByteVector =>
8692 if ((i.callerPublicKey == pk))
8793 then true
8894 else pd
8995 case _: Unit =>
9096 if ((i.caller == this))
9197 then true
9298 else pd
9399 case _ =>
94100 throw("Match error")
95101 }
96102 }
97103
98104
99105 @Callable(i)
100106 func createReferralProgram (programName,treasuryContract,implementationContract,rewardAssetId) = {
101107 let checkCaller = mustManager(i)
102108 if ((checkCaller == checkCaller))
103109 then {
104110 let checkProgramName = if ((getBoolean(keyProgramName(programName)) == unit))
105111 then true
106112 else throwErr("program name already exists")
107113 if ((checkProgramName == checkProgramName))
108114 then {
109115 let programNameIsValid = if (!(contains(programName, separator)))
110116 then !(contains(programName, " "))
111117 else false
112118 let checkProgramExists = if (programNameIsValid)
113119 then true
114120 else throwErr("invalid program name")
115121 if ((checkProgramExists == checkProgramExists))
116122 then {
117123 let checkRewardAsset = if ((assetInfo(fromBase58String(rewardAssetId)) != unit))
118124 then true
119125 else throwErr("invalid reward asset id")
120126 if ((checkRewardAsset == checkRewardAsset))
121127 then $Tuple2([BooleanEntry(keyProgramName(programName), true), StringEntry(keyTreasuryContract(programName), treasuryContract), StringEntry(keyImplementationContract(programName), implementationContract), StringEntry(keyRewardAssetId(programName), rewardAssetId), IntegerEntry(keyRewardsTotal(programName), 0)], unit)
122128 else throw("Strict value is not equal to itself.")
123129 }
124130 else throw("Strict value is not equal to itself.")
125131 }
126132 else throw("Strict value is not equal to itself.")
127133 }
128134 else throw("Strict value is not equal to itself.")
129135 }
130136
131137
132138
133139 @Callable(i)
134140 func createPair (programName,referrerAddress,referralAddress,signature) = {
135141 let checkProgramExists = if (valueOrElse(getBoolean(keyProgramName(programName)), false))
136142 then true
137143 else throwErr("program does not exist")
138144 if ((checkProgramExists == checkProgramExists))
139145 then {
140146 let pairReferrerToReferralExistCheck = if ((getBoolean(keyExistsReferrerToReferral(programName, referrerAddress, referralAddress)) == unit))
141147 then true
142148 else throwErr("pair already exists")
143149 if ((pairReferrerToReferralExistCheck == pairReferrerToReferralExistCheck))
144150 then {
145151 let noRefSelf = if ((referrerAddress != referralAddress))
146152 then true
147153 else throwErr("cannot refer to self")
148154 if ((noRefSelf == noRefSelf))
149155 then {
150156 let pair = toBytes(makeString([programName, referrerAddress, referralAddress], ":"))
151157 let backendPublicKey = fromBase58String(value(getString(keyBackendPublicKey)))
152158 let validateSignature = if (sigVerify(pair, signature, backendPublicKey))
153159 then true
154160 else throwErr("bad signature")
155161 if ((validateSignature == validateSignature))
156162 then {
157163 let totalReferralCount = valueOrElse(getInteger(keyTotalReferralCount(programName, referrerAddress)), 0)
158164 let newTotalReferralCount = (totalReferralCount + 1)
159165 $Tuple2([BooleanEntry(keyExistsReferrerToReferral(programName, referrerAddress, referralAddress), true), IntegerEntry(keyTotalReferralCount(programName, referrerAddress), newTotalReferralCount), StringEntry(keyReferrer(programName, referralAddress), referrerAddress)], unit)
160166 }
161167 else throw("Strict value is not equal to itself.")
162168 }
163169 else throw("Strict value is not equal to itself.")
164170 }
165171 else throw("Strict value is not equal to itself.")
166172 }
167173 else throw("Strict value is not equal to itself.")
168174 }
169175
170176
171177
172178 @Callable(i)
173179 func updateReferralActivity (programName,referralAddress,isActive) = {
174180 let implementationContract = value(getString(keyImplementationContract(programName)))
175181 let isReferralActive = (getBoolean(keyIsReferralActive(programName, referralAddress)) != unit)
176182 let referrerAddress = value(getString(keyReferrer(programName, referralAddress)))
177183 let checkCaller = if ((toString(i.caller) == implementationContract))
178184 then true
179185 else throwErr("permission denied")
180186 if ((checkCaller == checkCaller))
181187 then {
182188 let update = if ((isReferralActive == isActive))
183189 then $Tuple2(nil, unit)
184190 else {
185191 let update = if ((isActive == true))
186192 then {
187193 let newActiveReferralCount = (valueOrElse(getInteger(keyActiveReferralCount(programName, referrerAddress)), 0) + 1)
188194 $Tuple2([BooleanEntry(keyIsReferralActive(programName, referralAddress), true), IntegerEntry(keyActiveReferralCount(programName, referrerAddress), newActiveReferralCount)], unit)
189195 }
190196 else {
191197 let newActiveReferralCount = (valueOrElse(getInteger(keyActiveReferralCount(programName, referrerAddress)), 0) - 1)
192198 $Tuple2([DeleteEntry(keyIsReferralActive(programName, referralAddress)), IntegerEntry(keyActiveReferralCount(programName, referrerAddress), newActiveReferralCount)], unit)
193199 }
194200 update
195201 }
196202 update
197203 }
198204 else throw("Strict value is not equal to itself.")
199205 }
200206
201207
202208
203209 @Callable(i)
204210 func incUnclaimed (programName,referralAddress,referrerReward,referralReward) = {
205211 let implementationContract = value(getString(keyImplementationContract(programName)))
206212 let checkCaller = if ((toString(i.caller) == implementationContract))
207213 then true
208214 else throwErr("permission denied")
209215 if ((checkCaller == checkCaller))
210216 then {
211217 let referrerAddress = value(getString(keyReferrer(programName, referralAddress)))
212- let referrerUnclaimed = valueOrElse(getInteger(keyUnclaimed(programName, referrerAddress)), 0)
213- let referralUnclaimed = valueOrElse(getInteger(keyUnclaimed(programName, referralAddress)), 0)
218+ let referrerUnclaimed = valueOrElse(getInteger(keyUnclaimedReferrer(programName, referrerAddress)), 0)
219+ let referralUnclaimed = valueOrElse(getInteger(keyUnclaimedReferral(programName, referralAddress)), 0)
214220 let rewardsTotal = valueOrElse(getInteger(keyRewardsTotal(programName)), 0)
215221 let newReferrerUnclaimed = (referrerUnclaimed + referrerReward)
216222 let newReferralUnclaimed = (referralUnclaimed + referralReward)
217- $Tuple2([IntegerEntry(keyUnclaimed(programName, referrerAddress), newReferrerUnclaimed), IntegerEntry(keyUnclaimed(programName, referralAddress), newReferralUnclaimed), IntegerEntry(keyRewardsTotal(programName), ((rewardsTotal + referrerReward) + referralReward))], unit)
223+ $Tuple2([IntegerEntry(keyUnclaimedReferrer(programName, referrerAddress), newReferrerUnclaimed), IntegerEntry(keyUnclaimedReferral(programName, referralAddress), newReferralUnclaimed), IntegerEntry(keyRewardsTotal(programName), ((rewardsTotal + referrerReward) + referralReward))], unit)
218224 }
219225 else throw("Strict value is not equal to itself.")
220226 }
221227
222228
223229
224230 @Callable(i)
225231 func claim (programName) = {
226232 let checkProgramExists = if (valueOrElse(getBoolean(keyProgramName(programName)), false))
227233 then true
228234 else throwErr("program does not exist")
229235 if ((checkProgramExists == checkProgramExists))
230236 then {
231- let userAddressStr = toString(i.caller)
237+ let isImplementationContract = (toString(i.caller) == value(getString(keyImplementationContract(programName))))
238+ let $t084049132 = if (isImplementationContract)
239+ then {
240+ let user = toString(i.originCaller)
241+ $Tuple5(user, valueOrElse(getInteger(keyClaimedReferral(programName, user)), 0), valueOrElse(getInteger(keyUnclaimedReferral(programName, user)), 0), keyClaimedReferral(programName, user), keyUnclaimedReferral(programName, user))
242+ }
243+ else {
244+ let user = toString(i.caller)
245+ $Tuple5(user, valueOrElse(getInteger(keyClaimedReferrer(programName, user)), 0), valueOrElse(getInteger(keyUnclaimedReferrer(programName, user)), 0), keyClaimedReferral(programName, user), keyUnclaimedReferral(programName, user))
246+ }
247+ let userAddressStr = $t084049132._1
248+ let claimerClaimed = $t084049132._2
249+ let claimerUnclaimed = $t084049132._3
250+ let keyClaimed = $t084049132._4
251+ let keyUnclaimed = $t084049132._5
232252 let claimedTotal = valueOrElse(getInteger(keyClaimedTotal(programName)), 0)
233- let claimerClaimed = valueOrElse(getInteger(keyClaimed(programName, userAddressStr)), 0)
234- let claimerUnclaimed = valueOrElse(getInteger(keyUnclaimed(programName, userAddressStr)), 0)
235253 let treasuryContract = value(addressFromString(value(getString(keyTreasuryContract(programName)))))
236254 let rewardAssetId = fromBase58String(value(getString(keyRewardAssetId(programName))))
237- let checkCanClaim = if ((claimerUnclaimed > 0))
238- then true
239- else throwErr("nothing to claim")
240- if ((checkCanClaim == checkCanClaim))
241- then {
242- let newClaimerClaimed = (claimerClaimed + claimerUnclaimed)
243- let newClaimedTotal = (claimedTotal + claimerUnclaimed)
244- let balanceBefore = value(assetBalance(this, rewardAssetId))
245- if ((balanceBefore == balanceBefore))
255+ if (if (isImplementationContract)
256+ then (claimerUnclaimed == 0)
257+ else false)
258+ then $Tuple2(nil, 0)
259+ else {
260+ let checkCanClaim = if ((claimerUnclaimed > 0))
261+ then true
262+ else throwErr("nothing to claim")
263+ if ((checkCanClaim == checkCanClaim))
246264 then {
247- let res = invoke(treasuryContract, "withdrawReferralReward", [claimerUnclaimed], nil)
248- if ((res == res))
265+ let newClaimerClaimed = (claimerClaimed + claimerUnclaimed)
266+ let newClaimedTotal = (claimedTotal + claimerUnclaimed)
267+ let balanceBefore = value(assetBalance(this, rewardAssetId))
268+ if ((balanceBefore == balanceBefore))
249269 then {
250- let balanceAfter = value(assetBalance(this, rewardAssetId))
251- if ((balanceAfter == balanceAfter))
270+ let res = invoke(treasuryContract, "withdrawReferralReward", [claimerUnclaimed], nil)
271+ if ((res == res))
252272 then {
253- let balanceDiff = (balanceAfter - balanceBefore)
254- if ((balanceDiff == balanceDiff))
273+ let balanceAfter = value(assetBalance(this, rewardAssetId))
274+ if ((balanceAfter == balanceAfter))
255275 then {
256- let checkBalance = if ((balanceDiff == claimerUnclaimed))
257- then true
258- else throwErr("insufficient balance on referral contract")
259- if ((checkBalance == checkBalance))
260- then $Tuple2([IntegerEntry(keyClaimed(programName, userAddressStr), newClaimerClaimed), IntegerEntry(keyClaimedTotal(programName), newClaimedTotal), IntegerEntry(keyUnclaimed(programName, userAddressStr), 0), ScriptTransfer(i.caller, claimerUnclaimed, rewardAssetId), StringEntry(keyClaimHistory(programName, userAddressStr, toBase58String(i.transactionId)), formatClaimHistory(claimerUnclaimed))], unit)
276+ let balanceDiff = (balanceAfter - balanceBefore)
277+ if ((balanceDiff == balanceDiff))
278+ then {
279+ let checkBalance = if ((balanceDiff == claimerUnclaimed))
280+ then true
281+ else throwErr("insufficient balance on referral contract")
282+ if ((checkBalance == checkBalance))
283+ then $Tuple2([IntegerEntry(keyClaimed, newClaimerClaimed), IntegerEntry(keyClaimedTotal(programName), newClaimedTotal), IntegerEntry(keyUnclaimed, 0), ScriptTransfer(addressFromStringValue(userAddressStr), claimerUnclaimed, rewardAssetId), StringEntry(keyClaimHistory(programName, userAddressStr, toBase58String(i.transactionId)), formatClaimHistory(claimerUnclaimed))], claimerUnclaimed)
284+ else throw("Strict value is not equal to itself.")
285+ }
261286 else throw("Strict value is not equal to itself.")
262287 }
263288 else throw("Strict value is not equal to itself.")
264289 }
265290 else throw("Strict value is not equal to itself.")
266291 }
267292 else throw("Strict value is not equal to itself.")
268293 }
269294 else throw("Strict value is not equal to itself.")
270295 }
271- else throw("Strict value is not equal to itself.")
272296 }
273297 else throw("Strict value is not equal to itself.")
274298 }
275299
276300
277301
278302 @Callable(i)
279303 func claimREADONLY (programName,userAddress) = {
280- let claimerClaimed = valueOrElse(getInteger(keyClaimed(programName, userAddress)), 0)
281- let claimerUnclaimed = valueOrElse(getInteger(keyUnclaimed(programName, userAddress)), 0)
304+ let claimerClaimed = valueOrElse(getInteger(keyClaimedReferrer(programName, userAddress)), 0)
305+ let claimerUnclaimed = valueOrElse(getInteger(keyUnclaimedReferrer(programName, userAddress)), 0)
282306 $Tuple2(nil, [claimerUnclaimed, claimerClaimed])
283307 }
284308
285309
286310
287311 @Callable(i)
288312 func setManager (pendingManagerPublicKey) = {
289313 let checkCaller = mustManager(i)
290314 if ((checkCaller == checkCaller))
291315 then {
292316 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
293317 if ((checkManagerPublicKey == checkManagerPublicKey))
294318 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
295319 else throw("Strict value is not equal to itself.")
296320 }
297321 else throw("Strict value is not equal to itself.")
298322 }
299323
300324
301325
302326 @Callable(i)
303327 func confirmManager () = {
304328 let pm = pendingManagerPublicKeyOrUnit()
305329 let hasPM = if (isDefined(pm))
306330 then true
307331 else throwErr("no pending manager")
308332 if ((hasPM == hasPM))
309333 then {
310334 let checkPM = if ((i.callerPublicKey == value(pm)))
311335 then true
312336 else throwErr("you are not pending manager")
313337 if ((checkPM == checkPM))
314338 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
315339 else throw("Strict value is not equal to itself.")
316340 }
317341 else throw("Strict value is not equal to itself.")
318342 }
319343
320344
321345 @Verifier(tx)
322346 func verify () = {
323347 let targetPublicKey = match managerPublicKeyOrUnit() {
324348 case pk: ByteVector =>
325349 pk
326350 case _: Unit =>
327351 tx.senderPublicKey
328352 case _ =>
329353 throw("Match error")
330354 }
331355 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
332356 }
333357

github/deemru/w8io/169f3d6 
76.56 ms