tx · 3WWDMfPow81FkoH7UPPg55BWBydrAQnEpmwjBAKnMMs2 3N9eLqWNqb7jeF383m9qsXEBqpp8qfQmfbx: -0.10000000 Waves 2022.06.04 08:17 [2081177] smart account 3N9eLqWNqb7jeF383m9qsXEBqpp8qfQmfbx > SELF 0.00000000 Waves
{ "type": 13, "id": "3WWDMfPow81FkoH7UPPg55BWBydrAQnEpmwjBAKnMMs2", "fee": 10000000, "feeAssetId": null, "timestamp": 1654319875940, "version": 2, "chainId": 84, "sender": "3N9eLqWNqb7jeF383m9qsXEBqpp8qfQmfbx", "senderPublicKey": "5cWdpE4X7mfNkLmxJ389ws6qGZof4fwydqMcqPexhJ7w", "proofs": [ "2GPPxik9Yv7RKUdRSASUJfNxsLzQiFQVcDBrAEmnrgSZeep4YXgVfKLvpHDyywK6EZuQdt2AUoQ5LpxUgVwFQxCR" ], "script": "base64:AAIFAAAAAAAAAEoIAhIHCgUICAgBARIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSBAoCCAkSAwoBCBIFCgMBCAESAwoBCAAAACMAAAAADGxvY2tpbmdTdG9yZQUAAAAEdGhpcwAAAAAMc3Rha2luZ1N0b3JlAgAAAAhfUmVzZXJ2ZQAAAAARbWluaW11bUxvY2tBbW91bnQCAAAADl9NaW5Mb2NrQW1vdW50AAAAABFtYXhpbXVtTG9ja0Ftb3VudAIAAAAOX01heExvY2tBbW91bnQAAAAACWFzc2V0TGlzdAUAAAADbmlsAAAAABF1bmxvY2tFbGlnaWJpbGl0eQIAAAAcX0VsaWdpYmxlX3RvX3VubG9ja19hdF9ibG9jawAAAAAMbG9ja2VkQW1vdW50AgAAAA5fQW1vdW50X2xvY2tlZAAAAAALbG9ja2VkQXNzZXQCAAAADV9Bc3NldF9sb2NrZWQAAAAABHVzZXICAAAABV9Vc2VyAAAAAApBUFlfQW1vdW50AgAAAAtfQVBZX2Ftb3VudAAAAAARdG90YWxMb2NrZWRBTW91bnQCAAAAFF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ck5hdGl2ZSgxMDYyKQAAAAEFAAAABnVzZXJJZAUAAAANdUxvY2tlZEFtb3VudAkAAZsAAAABBQAAAAZ1QXNzZXQJAARMAAAAAgkBAAAADEJvb2xlYW5FbnRyeQAAAAIFAAAAEnVBbHJlYWR5Q2xhaW1lZEtleQYFAAAAA25pbAkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAAApm7rI", "height": 2081177, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3deVgrG3KMRJogWR3AzhGSgfayWS75pvBwBooXshataT Next: 6kiaSBn4H2gSoA9wMLfRiR8NQzx68UrgKSv6YvJcge2G Diff:
Old | New | Differences | |
---|---|---|---|
111 | 111 | ||
112 | 112 | ||
113 | 113 | func adminOnly (i) = { | |
114 | - | let AdminAddress = | |
114 | + | let AdminAddress = toBase58String(i.caller.bytes) | |
115 | 115 | let otherAdminAddress = (admin + toString(i.caller)) | |
116 | - | if (if ((AdminAddress != | |
116 | + | if (if ((AdminAddress != valueOrErrorMessage(getS(admin), "not an admin"))) | |
117 | 117 | then true | |
118 | - | else (AdminAddress != | |
118 | + | else (AdminAddress != valueOrErrorMessage(getS(otherAdminAddress), "not an admin"))) | |
119 | 119 | then throw("unauthorized") | |
120 | 120 | else true | |
121 | 121 | } | |
319 | 319 | if ((check2 == check2)) | |
320 | 320 | then { | |
321 | 321 | let lockPeriod = LockPeriod | |
322 | - | let userId = | |
322 | + | let userId = toBase58String(i.caller.bytes) | |
323 | 323 | let amountToStake = i.payments[0].amount | |
324 | 324 | let minToStake = throwOrReturnI(getI((AssetTicker + minimumLockAmount)), "internal error: minimum stacking amount not specified") | |
325 | 325 | let maxToStake = throwOrReturnI(getI((AssetTicker + maximumLockAmount)), "internal error: maximum staking amount not specified") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let lockingStore = this | |
5 | 5 | ||
6 | 6 | let stakingStore = "_Reserve" | |
7 | 7 | ||
8 | 8 | let minimumLockAmount = "_MinLockAmount" | |
9 | 9 | ||
10 | 10 | let maximumLockAmount = "_MaxLockAmount" | |
11 | 11 | ||
12 | 12 | let assetList = nil | |
13 | 13 | ||
14 | 14 | let unlockEligibility = "_Eligible_to_unlock_at_block" | |
15 | 15 | ||
16 | 16 | let lockedAmount = "_Amount_locked" | |
17 | 17 | ||
18 | 18 | let lockedAsset = "_Asset_locked" | |
19 | 19 | ||
20 | 20 | let user = "_User" | |
21 | 21 | ||
22 | 22 | let APY_Amount = "_APY_amount" | |
23 | 23 | ||
24 | 24 | let totalLockedAMount = "_Total_Locked_Amount" | |
25 | 25 | ||
26 | 26 | let lockingPeriod = "_Days_locked" | |
27 | 27 | ||
28 | 28 | let entryIndex = "_Entry_Index" | |
29 | 29 | ||
30 | 30 | let alreadyClaimed = "_Already_Claimed" | |
31 | 31 | ||
32 | 32 | let admin = "admin_" | |
33 | 33 | ||
34 | 34 | let BlockPerDay = 1440 | |
35 | 35 | ||
36 | 36 | let thirtyDaysLockPeriod = 30 | |
37 | 37 | ||
38 | 38 | let sixtyDaysLockPeriod = 60 | |
39 | 39 | ||
40 | 40 | let ninetyDaysLockPeriod = 90 | |
41 | 41 | ||
42 | 42 | func getI (key) = getInteger(this, key) | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func getS (key) = getString(this, key) | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func getIV (key) = value(getInteger(this, key)) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func getSV (key) = value(getString(this, key)) | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func throwIf (condition,error) = if (condition) | |
55 | 55 | then throw(error) | |
56 | 56 | else true | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func throwOrReturnI (val,error) = match val { | |
60 | 60 | case val: Int => | |
61 | 61 | val | |
62 | 62 | case _ => | |
63 | 63 | throw(error) | |
64 | 64 | } | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func throwOrReturnS (val,error) = match val { | |
68 | 68 | case val: String => | |
69 | 69 | val | |
70 | 70 | case _ => | |
71 | 71 | throw(error) | |
72 | 72 | } | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func writeInt (key,value) = if ((0 > value)) | |
76 | 76 | then throw(((("writing negative value " + toString(value)) + " for key ") + key)) | |
77 | 77 | else IntegerEntry(key, value) | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func writeStr (key,value) = if ((" " == value)) | |
81 | 81 | then throw(("writing an empty string " + value)) | |
82 | 82 | else StringEntry(key, value) | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func daysToBlocks (days) = if (if (if ((days != thirtyDaysLockPeriod)) | |
86 | 86 | then true | |
87 | 87 | else (days != sixtyDaysLockPeriod)) | |
88 | 88 | then true | |
89 | 89 | else (days != ninetyDaysLockPeriod)) | |
90 | 90 | then throw("invalid Lock Period") | |
91 | 91 | else (((days + 1) * BlockPerDay) + height) | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func blocksToDays (blocksLeft) = if ((0 >= blocksLeft)) | |
95 | 95 | then 0 | |
96 | 96 | else { | |
97 | 97 | let multiplier = pow(10, 0, 3, 0, 0, CEILING) | |
98 | 98 | let daysleft = fraction(blocksLeft, multiplier, BlockPerDay) | |
99 | 99 | daysleft | |
100 | 100 | } | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func writeConstString (key,value) = if (!(isDefined(getS(key)))) | |
104 | 104 | then writeStr(key, value) | |
105 | 105 | else throw(("already initialized: " + key)) | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func writeConstInteger (key,value) = if (!(isDefined(getS(key)))) | |
109 | 109 | then writeInt(key, value) | |
110 | 110 | else throw(("already initialized: " + key)) | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func adminOnly (i) = { | |
114 | - | let AdminAddress = | |
114 | + | let AdminAddress = toBase58String(i.caller.bytes) | |
115 | 115 | let otherAdminAddress = (admin + toString(i.caller)) | |
116 | - | if (if ((AdminAddress != | |
116 | + | if (if ((AdminAddress != valueOrErrorMessage(getS(admin), "not an admin"))) | |
117 | 117 | then true | |
118 | - | else (AdminAddress != | |
118 | + | else (AdminAddress != valueOrErrorMessage(getS(otherAdminAddress), "not an admin"))) | |
119 | 119 | then throw("unauthorized") | |
120 | 120 | else true | |
121 | 121 | } | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func writeConfigValue (key,data) = match data { | |
125 | 125 | case data: String => | |
126 | 126 | writeConstString(key, data) | |
127 | 127 | case data: Int => | |
128 | 128 | writeConstInteger(key, data) | |
129 | 129 | case _ => | |
130 | 130 | throw("unsupported config type") | |
131 | 131 | } | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | func incrementEntryIndex (key) = { | |
135 | 135 | let uIndex = getI(key) | |
136 | 136 | if (isDefined(uIndex)) | |
137 | 137 | then (value(uIndex) + 1) | |
138 | 138 | else 0 | |
139 | 139 | } | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | @Callable(i) | |
143 | 143 | func addAsset (AssetTicker,AssetID,AssetReserve,AssetMinimumLockAmount,AssetMaximumLockAmount) = { | |
144 | 144 | let check = adminOnly(i) | |
145 | 145 | if ((check == check)) | |
146 | 146 | then { | |
147 | 147 | let aStakingStore = (AssetTicker + stakingStore) | |
148 | 148 | let aMinimumLockAmount = (AssetTicker + minimumLockAmount) | |
149 | 149 | let aMaximumLockAmount = (AssetTicker + maximumLockAmount) | |
150 | 150 | let checkMinMax = if ((AssetMaximumLockAmount > AssetMinimumLockAmount)) | |
151 | 151 | then [writeConstInteger(aMinimumLockAmount, AssetMinimumLockAmount), writeConstInteger(aMaximumLockAmount, AssetMaximumLockAmount)] | |
152 | 152 | else [writeConstInteger(aMinimumLockAmount, AssetMaximumLockAmount), writeConstInteger(aMaximumLockAmount, AssetMinimumLockAmount)] | |
153 | 153 | ([writeConstString(AssetTicker, AssetID), writeConstString(aStakingStore, AssetReserve)] ++ checkMinMax) | |
154 | 154 | } | |
155 | 155 | else throw("Strict value is not equal to itself.") | |
156 | 156 | } | |
157 | 157 | ||
158 | 158 | ||
159 | 159 | ||
160 | 160 | @Callable(i) | |
161 | 161 | func deleteAsset (AssetTicker) = { | |
162 | 162 | let check = adminOnly(i) | |
163 | 163 | if ((check == check)) | |
164 | 164 | then { | |
165 | 165 | let assetID = throwOrReturnS(getS(AssetTicker), (("asset with ticker " + AssetTicker) + "not found")) | |
166 | 166 | if ((assetID == assetID)) | |
167 | 167 | then [DeleteEntry(AssetTicker), DeleteEntry((AssetTicker + minimumLockAmount)), DeleteEntry((AssetTicker + maximumLockAmount)), DeleteEntry((AssetTicker + stakingStore))] | |
168 | 168 | else throw("Strict value is not equal to itself.") | |
169 | 169 | } | |
170 | 170 | else throw("Strict value is not equal to itself.") | |
171 | 171 | } | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | ||
175 | 175 | @Callable(i) | |
176 | 176 | func getAssetIdByTicker (AssetTicker) = { | |
177 | 177 | let check = adminOnly(i) | |
178 | 178 | if ((check == check)) | |
179 | 179 | then { | |
180 | 180 | let a = throwOrReturnS(getS(AssetTicker), "asset not found") | |
181 | 181 | $Tuple2(nil, a) | |
182 | 182 | } | |
183 | 183 | else throw("Strict value is not equal to itself.") | |
184 | 184 | } | |
185 | 185 | ||
186 | 186 | ||
187 | 187 | ||
188 | 188 | @Callable(i) | |
189 | 189 | func init (AdminAddress) = { | |
190 | 190 | let adminAddr = valueOrErrorMessage(addressFromString(AdminAddress), "invalid address") | |
191 | 191 | [writeConstString(admin, toString(adminAddr))] | |
192 | 192 | } | |
193 | 193 | ||
194 | 194 | ||
195 | 195 | ||
196 | 196 | @Callable(i) | |
197 | 197 | func _deleteEntry (key) = { | |
198 | 198 | let check = adminOnly(i) | |
199 | 199 | if ((check == check)) | |
200 | 200 | then [DeleteEntry(key)] | |
201 | 201 | else throw("Strict value is not equal to itself.") | |
202 | 202 | } | |
203 | 203 | ||
204 | 204 | ||
205 | 205 | ||
206 | 206 | @Callable(i) | |
207 | 207 | func addAdmin (AdminAddress) = { | |
208 | 208 | let check = adminOnly(i) | |
209 | 209 | if ((check == check)) | |
210 | 210 | then { | |
211 | 211 | let adminAddr = valueOrErrorMessage(addressFromString(AdminAddress), "invalid address") | |
212 | 212 | let newAdmin = (admin + toString(adminAddr)) | |
213 | 213 | [writeConstString(newAdmin, AdminAddress)] | |
214 | 214 | } | |
215 | 215 | else throw("Strict value is not equal to itself.") | |
216 | 216 | } | |
217 | 217 | ||
218 | 218 | ||
219 | 219 | ||
220 | 220 | @Callable(i) | |
221 | 221 | func changeMainAdmin (newAddress) = { | |
222 | 222 | let checks = adminOnly(i) | |
223 | 223 | if ((checks == checks)) | |
224 | 224 | then { | |
225 | 225 | let adminAddr = valueOrErrorMessage(addressFromString(newAddress), "invalid address") | |
226 | 226 | let del = DeleteEntry(admin) | |
227 | 227 | if ((del == del)) | |
228 | 228 | then [writeConstString(admin, toString(adminAddr))] | |
229 | 229 | else throw("Strict value is not equal to itself.") | |
230 | 230 | } | |
231 | 231 | else throw("Strict value is not equal to itself.") | |
232 | 232 | } | |
233 | 233 | ||
234 | 234 | ||
235 | 235 | ||
236 | 236 | @Callable(i) | |
237 | 237 | func updateOtherAdminAddress (newAddress) = { | |
238 | 238 | let checks = adminOnly(i) | |
239 | 239 | if ((checks == checks)) | |
240 | 240 | then { | |
241 | 241 | let adminAddr = valueOrErrorMessage(addressFromString(newAddress), "invalid address") | |
242 | 242 | let caller = toString(i.caller) | |
243 | 243 | let otherAdmin = (admin + caller) | |
244 | 244 | let checkOldAddress = throwOrReturnS(getS(otherAdmin), "no previous address found") | |
245 | 245 | if ((checkOldAddress == checkOldAddress)) | |
246 | 246 | then { | |
247 | 247 | let delAddress = DeleteEntry(otherAdmin) | |
248 | 248 | if ((delAddress == delAddress)) | |
249 | 249 | then [writeConstString(otherAdmin, toString(adminAddr))] | |
250 | 250 | else throw("Strict value is not equal to itself.") | |
251 | 251 | } | |
252 | 252 | else throw("Strict value is not equal to itself.") | |
253 | 253 | } | |
254 | 254 | else throw("Strict value is not equal to itself.") | |
255 | 255 | } | |
256 | 256 | ||
257 | 257 | ||
258 | 258 | ||
259 | 259 | @Callable(i) | |
260 | 260 | func removeOtherAdmin (address) = { | |
261 | 261 | let checks = adminOnly(i) | |
262 | 262 | if ((checks == checks)) | |
263 | 263 | then { | |
264 | 264 | let adminAddr = valueOrErrorMessage(addressFromString(address), "invalid address") | |
265 | 265 | let otherAddress = (admin + toString(adminAddr)) | |
266 | 266 | let delAdmin = DeleteEntry(otherAddress) | |
267 | 267 | if ((delAdmin == delAdmin)) | |
268 | 268 | then nil | |
269 | 269 | else throw("Strict value is not equal to itself.") | |
270 | 270 | } | |
271 | 271 | else throw("Strict value is not equal to itself.") | |
272 | 272 | } | |
273 | 273 | ||
274 | 274 | ||
275 | 275 | ||
276 | 276 | @Callable(i) | |
277 | 277 | func updateConfigValue (key,data) = { | |
278 | 278 | let checks = adminOnly(i) | |
279 | 279 | if ((checks == checks)) | |
280 | 280 | then { | |
281 | 281 | let del = DeleteEntry(key) | |
282 | 282 | if ((del == del)) | |
283 | 283 | then [writeConfigValue(key, data)] | |
284 | 284 | else throw("Strict value is not equal to itself.") | |
285 | 285 | } | |
286 | 286 | else throw("Strict value is not equal to itself.") | |
287 | 287 | } | |
288 | 288 | ||
289 | 289 | ||
290 | 290 | ||
291 | 291 | @Callable(i) | |
292 | 292 | func getDaysLeftToClaim (userAddress) = { | |
293 | 293 | let check0 = adminOnly(i) | |
294 | 294 | if ((check0 == check0)) | |
295 | 295 | then { | |
296 | 296 | let check1 = valueOrErrorMessage(addressFromString(userAddress), "invalid address") | |
297 | 297 | if ((check1 == check1)) | |
298 | 298 | then { | |
299 | 299 | let uEntryIndex = ("_" + toString(throwOrReturnI(getI((userAddress + entryIndex)), ("no entry found for " + userAddress)))) | |
300 | 300 | let uUnlockEligibility = ((userAddress + uEntryIndex) + unlockEligibility) | |
301 | 301 | let uBlocks = throwOrReturnI(getI(uUnlockEligibility), "internal error") | |
302 | 302 | let uBlocksToDays = daysToBlocks((height - uBlocks)) | |
303 | 303 | $Tuple2(nil, uBlocksToDays) | |
304 | 304 | } | |
305 | 305 | else throw("Strict value is not equal to itself.") | |
306 | 306 | } | |
307 | 307 | else throw("Strict value is not equal to itself.") | |
308 | 308 | } | |
309 | 309 | ||
310 | 310 | ||
311 | 311 | ||
312 | 312 | @Callable(i) | |
313 | 313 | func Lock (LockPeriod,AssetTicker,APY) = { | |
314 | 314 | let check1 = throwIf((1 != size(i.payments)), "attach amount you want to lock") | |
315 | 315 | if ((check1 == check1)) | |
316 | 316 | then { | |
317 | 317 | let asset = toBase58String(value(i.payments[0].assetId)) | |
318 | 318 | let check2 = throwIf((getS(AssetTicker) != asset), "asset not supported") | |
319 | 319 | if ((check2 == check2)) | |
320 | 320 | then { | |
321 | 321 | let lockPeriod = LockPeriod | |
322 | - | let userId = | |
322 | + | let userId = toBase58String(i.caller.bytes) | |
323 | 323 | let amountToStake = i.payments[0].amount | |
324 | 324 | let minToStake = throwOrReturnI(getI((AssetTicker + minimumLockAmount)), "internal error: minimum stacking amount not specified") | |
325 | 325 | let maxToStake = throwOrReturnI(getI((AssetTicker + maximumLockAmount)), "internal error: maximum staking amount not specified") | |
326 | 326 | let check3 = throwIf(if ((minToStake > amountToStake)) | |
327 | 327 | then true | |
328 | 328 | else (amountToStake > maxToStake), "staking amount is out of range") | |
329 | 329 | if ((check3 == check3)) | |
330 | 330 | then { | |
331 | 331 | let uTotalLocked = (userId + totalLockedAMount) | |
332 | 332 | let uSumTotal = if (!(isDefined(getI(uTotalLocked)))) | |
333 | 333 | then 0 | |
334 | 334 | else (amountToStake + value(getI(uTotalLocked))) | |
335 | 335 | let check4 = throwIf((uSumTotal > maxToStake), "you have maxed out your quota") | |
336 | 336 | if ((check4 == check4)) | |
337 | 337 | then { | |
338 | 338 | let uEntryIndex = ((userId + AssetTicker) + entryIndex) | |
339 | 339 | let uIncrEntryIndex = incrementEntryIndex(uEntryIndex) | |
340 | 340 | let uEntryToString = ((("_" + AssetTicker) + "_") + toString(uIncrEntryIndex)) | |
341 | 341 | let uUserId = ((userId + uEntryToString) + user) | |
342 | 342 | let uAsset = ((userId + uEntryToString) + lockedAsset) | |
343 | 343 | let uLockingPeriod = ((userId + uEntryToString) + lockingPeriod) | |
344 | 344 | let uLockedAmount = ((userId + uEntryToString) + lockedAmount) | |
345 | 345 | let uAPY = ((userId + uEntryToString) + APY_Amount) | |
346 | 346 | let uUnlockEligibility = ((userId + uEntryToString) + unlockEligibility) | |
347 | 347 | let uAlreadyClaimed = ((userId + uEntryToString) + alreadyClaimed) | |
348 | 348 | [writeConstInteger(uEntryIndex, uIncrEntryIndex), writeConstString(uUserId, userId), writeConstString(uAsset, asset), writeConstInteger(uLockingPeriod, lockPeriod), writeConstInteger(uLockedAmount, i.payments[0].amount), writeConstInteger(uTotalLocked, uSumTotal), writeConstInteger(uUnlockEligibility, daysToBlocks(LockPeriod)), writeConstInteger(uAPY, APY), BooleanEntry(uAlreadyClaimed, false)] | |
349 | 349 | } | |
350 | 350 | else throw("Strict value is not equal to itself.") | |
351 | 351 | } | |
352 | 352 | else throw("Strict value is not equal to itself.") | |
353 | 353 | } | |
354 | 354 | else throw("Strict value is not equal to itself.") | |
355 | 355 | } | |
356 | 356 | else throw("Strict value is not equal to itself.") | |
357 | 357 | } | |
358 | 358 | ||
359 | 359 | ||
360 | 360 | ||
361 | 361 | @Callable(i) | |
362 | 362 | func Claim (AssetTicker) = { | |
363 | 363 | let userId = toString(i.caller) | |
364 | 364 | let uEntryIndex = ((("_" + AssetTicker) + "_") + toString(throwOrReturnI(getI(((userId + AssetTicker) + entryIndex)), "no entry found for user"))) | |
365 | 365 | let uAlreadyClaimedKey = ((userId + uEntryIndex) + alreadyClaimed) | |
366 | 366 | let check0 = throwIf((valueOrErrorMessage(getBoolean(uAlreadyClaimedKey), "cannot ascertain claimability") == true), (("user + " + userId) + " already claimed")) | |
367 | 367 | if ((check0 == check0)) | |
368 | 368 | then { | |
369 | 369 | let uAsset = getSV(((userId + uEntryIndex) + lockedAsset)) | |
370 | 370 | let uLockedAmount = getIV(((userId + uEntryIndex) + lockedAmount)) | |
371 | 371 | let stakingReserve = addressFromStringValue(throwOrReturnS(getS((AssetTicker + stakingStore)), "internal error: no reserve found")) | |
372 | 372 | let APYAMount = getIV(((userId + uEntryIndex) + APY_Amount)) | |
373 | 373 | let period = getIV(((userId + uEntryIndex) + unlockEligibility)) | |
374 | 374 | let blocksLeft = if ((0 >= (period - height))) | |
375 | 375 | then 0 | |
376 | 376 | else (period - height) | |
377 | 377 | let daysLeft = blocksToDays(blocksLeft) | |
378 | 378 | let check1 = throwIf((period > height), (toString(daysLeft) + "/1000 days left to claim")) | |
379 | 379 | if ((check1 == check1)) | |
380 | 380 | then { | |
381 | 381 | let transferAPYAmount = invoke(stakingReserve, "transferInterest", [userId, APYAMount, toBytes(uAsset)], nil) | |
382 | 382 | if ((transferAPYAmount == transferAPYAmount)) | |
383 | 383 | then [ScriptTransfer(addressFromStringValue(userId), uLockedAmount, toBytes(uAsset)), BooleanEntry(uAlreadyClaimedKey, true)] | |
384 | 384 | else throw("Strict value is not equal to itself.") | |
385 | 385 | } | |
386 | 386 | else throw("Strict value is not equal to itself.") | |
387 | 387 | } | |
388 | 388 | else throw("Strict value is not equal to itself.") | |
389 | 389 | } | |
390 | 390 | ||
391 | 391 |
github/deemru/w8io/026f985 48.87 ms ◑