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