tx · CHN1X3y47uEBa9hXivL1KLRRac73pdrC68HiFXmp9G9m 3N9eLqWNqb7jeF383m9qsXEBqpp8qfQmfbx: -0.10000000 Waves 2022.06.04 02:25 [2080823] smart account 3N9eLqWNqb7jeF383m9qsXEBqpp8qfQmfbx > SELF 0.00000000 Waves
{ "type": 13, "id": "CHN1X3y47uEBa9hXivL1KLRRac73pdrC68HiFXmp9G9m", "fee": 10000000, "feeAssetId": null, "timestamp": 1654298817827, "version": 2, "chainId": 84, "sender": "3N9eLqWNqb7jeF383m9qsXEBqpp8qfQmfbx", "senderPublicKey": "5cWdpE4X7mfNkLmxJ389ws6qGZof4fwydqMcqPexhJ7w", "proofs": [ "P8X15mTkDePHzFVkE4Dfmmid6ooVvDkTtChsVU9cEnDqASKsdDyCbPepmYssovMQrAKiTxvKtwQinHKCvJECxwd" ], "script": "base64:AAIFAAAAAAAAAEoIAhIHCgUICAgBARIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSBAoCCAkSAwoBCBIFCgMBCAESAwoBCAAAACMAAAAADGxvY2tpbmdTdG9yZQUAAAAEdGhpcwAAAAAMc3Rha2luZ1N0b3JlAgAAAAhfUmVzZXJ2ZQAAAAARbWluaW11bUxvY2tBbW91bnQCAAAADl9NaW5Mb2NrQW1vdW50AAAAABFtYXhpbXVtTG9ja0Ftb3VudAIAAAAOX01heExvY2tBbW91bnQAAAAACWFzc2V0TGlzdAUAAAADbmlsAAAAABF1bmxvY2tFbGlnaWJpbGl0eQIAAAAcX0VsaWdpYmxlX3RvX3VubG9ja19hdF9ibG9jawAAAAAMbG9ja2VkQW1vdW50AgAAAA5fQW1vdW50X2xvY2tlZAAAAAALbG9ja2VkQXNzZXQCAAAADV9Bc3NldF9sb2NrZWQAAAAABHVzZXICAAAABV9Vc2VyAAAAAApBUFlfQW1vdW50AgAAAAtfQVBZX2Ftb3VudAAAAAARdG90YWxMb2NrZWRBTW91bnQCAAAAFF9Ub3RhbF9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lnaHQAAAAAAAAAAAAJAABlAAAAAgUAAAAGcGVyaW9kBQAAAAZoZWlnaHQEAAAACGRheXNMZWZ0CQEAAAAMYmxvY2tzVG9EYXlzAAAAAQUAAAAKYmxvY2tzTGVmdAQAAAAGY2hlY2sxCQEAAAAHdGhyb3dJZgAAAAIJAABmAAAAAgUAAAAGcGVyaW9kBQAAAAZoZWlnaHQJAAEsAAAAAgkAAaQAAAABBQAAAAhkYXlzTGVmdAIAAAAYLzEwMDAgZGF5cyBsZWZ0IHRvIGNsYWltAwkAAAAAAAACBQAAAAZjaGVjazEFAAAABmNoZWNrMQQAAAARdHJhbnNmZXJBUFlBbW91bnQJAAP8AAAABAUAAAAOc3Rha2luZ1Jlc2VydmUCAAAAEHRyYW5zZmVySW50ZXJlc3QJAARMAAAAAgUAAAAGdXNlcklkCQAETAAAAAIFAAAACUFQWUFNb3VudAkABEwAAAACCQABmwAAAAEFAAAABnVBc3NldAUAAAADbmlsBQAAAANuaWwDCQAAAAAAAAIFAAAAEXRyYW5zZmVyQVBZQW1vdW50BQAAABF0cmFuc2ZlckFQWUFtb3VudAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABBQAAAAZ1c2VySWQFAAAADXVMb2NrZWRBbW91bnQJAAGbAAAAAQUAAAAGdUFzc2V0CQAETAAAAAIJAQAAAAxCb29sZWFuRW50cnkAAAACBQAAABJ1QWxyZWFkeUNsYWltZWRLZXkGBQAAAANuaWwJAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAAACso6/A==", "height": 2080823, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2DkezzTDzH2P9UL8sPnEbQTyoHqFuhRXKNe1j34WqXM6 Next: ATY5EkrWutknbRSqoq1rbneebPJ6p1mZRMLDHJde9jPT Diff:
Old | New | Differences | |
---|---|---|---|
113 | 113 | func adminOnly (i) = { | |
114 | 114 | let AdminAddress = toString(i.caller) | |
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 | } | |
155 | 155 | ||
156 | 156 | ||
157 | 157 | @Callable(i) | |
158 | + | func deleteAsset (AssetTicker) = { | |
159 | + | let check = adminOnly(i) | |
160 | + | if ((check == check)) | |
161 | + | then { | |
162 | + | let assetID = throwOrReturnS(getS(AssetTicker), (("asset with ticker " + AssetTicker) + "not found")) | |
163 | + | if ((assetID == assetID)) | |
164 | + | then [DeleteEntry(AssetTicker), DeleteEntry((AssetTicker + minimumLockAmount)), DeleteEntry((AssetTicker + maximumLockAmount)), DeleteEntry((AssetTicker + stakingStore))] | |
165 | + | else throw("Strict value is not equal to itself.") | |
166 | + | } | |
167 | + | else throw("Strict value is not equal to itself.") | |
168 | + | } | |
169 | + | ||
170 | + | ||
171 | + | ||
172 | + | @Callable(i) | |
158 | 173 | func getAssetIdByTicker (AssetTicker) = { | |
159 | 174 | let check = adminOnly(i) | |
160 | 175 | if ((check == check)) | |
171 | 186 | func init (AdminAddress) = { | |
172 | 187 | let adminAddr = valueOrErrorMessage(addressFromString(AdminAddress), "invalid address") | |
173 | 188 | [writeConstString(admin, toString(adminAddr))] | |
189 | + | } | |
190 | + | ||
191 | + | ||
192 | + | ||
193 | + | @Callable(i) | |
194 | + | func _deleteEntry (key) = { | |
195 | + | let check = adminOnly(i) | |
196 | + | if ((check == check)) | |
197 | + | then [DeleteEntry(key)] | |
198 | + | else throw("Strict value is not equal to itself.") | |
174 | 199 | } | |
175 | 200 | ||
176 | 201 |
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 | 114 | let AdminAddress = toString(i.caller) | |
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,AssetStakingStore,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 | [writeConstString(AssetTicker, AssetID), writeConstString(aStakingStore, AssetStakingStore), writeConstInteger(aMinimumLockAmount, AssetMinimumLockAmount), writeConstInteger(aMaximumLockAmount, AssetMaximumLockAmount)] | |
151 | 151 | } | |
152 | 152 | else throw("Strict value is not equal to itself.") | |
153 | 153 | } | |
154 | 154 | ||
155 | 155 | ||
156 | 156 | ||
157 | 157 | @Callable(i) | |
158 | + | func deleteAsset (AssetTicker) = { | |
159 | + | let check = adminOnly(i) | |
160 | + | if ((check == check)) | |
161 | + | then { | |
162 | + | let assetID = throwOrReturnS(getS(AssetTicker), (("asset with ticker " + AssetTicker) + "not found")) | |
163 | + | if ((assetID == assetID)) | |
164 | + | then [DeleteEntry(AssetTicker), DeleteEntry((AssetTicker + minimumLockAmount)), DeleteEntry((AssetTicker + maximumLockAmount)), DeleteEntry((AssetTicker + stakingStore))] | |
165 | + | else throw("Strict value is not equal to itself.") | |
166 | + | } | |
167 | + | else throw("Strict value is not equal to itself.") | |
168 | + | } | |
169 | + | ||
170 | + | ||
171 | + | ||
172 | + | @Callable(i) | |
158 | 173 | func getAssetIdByTicker (AssetTicker) = { | |
159 | 174 | let check = adminOnly(i) | |
160 | 175 | if ((check == check)) | |
161 | 176 | then { | |
162 | 177 | let a = throwOrReturnS(getS(AssetTicker), "asset not found") | |
163 | 178 | $Tuple2(nil, a) | |
164 | 179 | } | |
165 | 180 | else throw("Strict value is not equal to itself.") | |
166 | 181 | } | |
167 | 182 | ||
168 | 183 | ||
169 | 184 | ||
170 | 185 | @Callable(i) | |
171 | 186 | func init (AdminAddress) = { | |
172 | 187 | let adminAddr = valueOrErrorMessage(addressFromString(AdminAddress), "invalid address") | |
173 | 188 | [writeConstString(admin, toString(adminAddr))] | |
189 | + | } | |
190 | + | ||
191 | + | ||
192 | + | ||
193 | + | @Callable(i) | |
194 | + | func _deleteEntry (key) = { | |
195 | + | let check = adminOnly(i) | |
196 | + | if ((check == check)) | |
197 | + | then [DeleteEntry(key)] | |
198 | + | else throw("Strict value is not equal to itself.") | |
174 | 199 | } | |
175 | 200 | ||
176 | 201 | ||
177 | 202 | ||
178 | 203 | @Callable(i) | |
179 | 204 | func addAdmin (AdminAddress) = { | |
180 | 205 | let check = adminOnly(i) | |
181 | 206 | if ((check == check)) | |
182 | 207 | then { | |
183 | 208 | let adminAddr = valueOrErrorMessage(addressFromString(AdminAddress), "invalid address") | |
184 | 209 | let newAdmin = (admin + toString(adminAddr)) | |
185 | 210 | [writeConstString(newAdmin, AdminAddress)] | |
186 | 211 | } | |
187 | 212 | else throw("Strict value is not equal to itself.") | |
188 | 213 | } | |
189 | 214 | ||
190 | 215 | ||
191 | 216 | ||
192 | 217 | @Callable(i) | |
193 | 218 | func changeMainAdmin (newAddress) = { | |
194 | 219 | let checks = adminOnly(i) | |
195 | 220 | if ((checks == checks)) | |
196 | 221 | then { | |
197 | 222 | let adminAddr = valueOrErrorMessage(addressFromString(newAddress), "invalid address") | |
198 | 223 | let del = DeleteEntry(admin) | |
199 | 224 | if ((del == del)) | |
200 | 225 | then [writeConstString(admin, toString(adminAddr))] | |
201 | 226 | else throw("Strict value is not equal to itself.") | |
202 | 227 | } | |
203 | 228 | else throw("Strict value is not equal to itself.") | |
204 | 229 | } | |
205 | 230 | ||
206 | 231 | ||
207 | 232 | ||
208 | 233 | @Callable(i) | |
209 | 234 | func updateOtherAdminAddress (newAddress) = { | |
210 | 235 | let checks = adminOnly(i) | |
211 | 236 | if ((checks == checks)) | |
212 | 237 | then { | |
213 | 238 | let adminAddr = valueOrErrorMessage(addressFromString(newAddress), "invalid address") | |
214 | 239 | let caller = toString(i.caller) | |
215 | 240 | let otherAdmin = (admin + caller) | |
216 | 241 | let checkOldAddress = throwOrReturnS(getS(otherAdmin), "no previous address found") | |
217 | 242 | if ((checkOldAddress == checkOldAddress)) | |
218 | 243 | then { | |
219 | 244 | let delAddress = DeleteEntry(otherAdmin) | |
220 | 245 | if ((delAddress == delAddress)) | |
221 | 246 | then [writeConstString(otherAdmin, toString(adminAddr))] | |
222 | 247 | else throw("Strict value is not equal to itself.") | |
223 | 248 | } | |
224 | 249 | else throw("Strict value is not equal to itself.") | |
225 | 250 | } | |
226 | 251 | else throw("Strict value is not equal to itself.") | |
227 | 252 | } | |
228 | 253 | ||
229 | 254 | ||
230 | 255 | ||
231 | 256 | @Callable(i) | |
232 | 257 | func removeOtherAdmin (address) = { | |
233 | 258 | let checks = adminOnly(i) | |
234 | 259 | if ((checks == checks)) | |
235 | 260 | then { | |
236 | 261 | let adminAddr = valueOrErrorMessage(addressFromString(address), "invalid address") | |
237 | 262 | let otherAddress = (admin + toString(adminAddr)) | |
238 | 263 | let delAdmin = DeleteEntry(otherAddress) | |
239 | 264 | if ((delAdmin == delAdmin)) | |
240 | 265 | then nil | |
241 | 266 | else throw("Strict value is not equal to itself.") | |
242 | 267 | } | |
243 | 268 | else throw("Strict value is not equal to itself.") | |
244 | 269 | } | |
245 | 270 | ||
246 | 271 | ||
247 | 272 | ||
248 | 273 | @Callable(i) | |
249 | 274 | func updateConfigValue (key,data) = { | |
250 | 275 | let checks = adminOnly(i) | |
251 | 276 | if ((checks == checks)) | |
252 | 277 | then { | |
253 | 278 | let del = DeleteEntry(key) | |
254 | 279 | if ((del == del)) | |
255 | 280 | then [writeConfigValue(key, data)] | |
256 | 281 | else throw("Strict value is not equal to itself.") | |
257 | 282 | } | |
258 | 283 | else throw("Strict value is not equal to itself.") | |
259 | 284 | } | |
260 | 285 | ||
261 | 286 | ||
262 | 287 | ||
263 | 288 | @Callable(i) | |
264 | 289 | func getDaysLeftToClaim (userAddress) = { | |
265 | 290 | let check0 = adminOnly(i) | |
266 | 291 | if ((check0 == check0)) | |
267 | 292 | then { | |
268 | 293 | let check1 = valueOrErrorMessage(addressFromString(userAddress), "invalid address") | |
269 | 294 | if ((check1 == check1)) | |
270 | 295 | then { | |
271 | 296 | let uEntryIndex = ("_" + toString(throwOrReturnI(getI((userAddress + entryIndex)), ("no entry found for " + userAddress)))) | |
272 | 297 | let uUnlockEligibility = ((userAddress + uEntryIndex) + unlockEligibility) | |
273 | 298 | let uBlocks = throwOrReturnI(getI(uUnlockEligibility), "internal error") | |
274 | 299 | let uBlocksToDays = daysToBlocks((height - uBlocks)) | |
275 | 300 | $Tuple2(nil, uBlocksToDays) | |
276 | 301 | } | |
277 | 302 | else throw("Strict value is not equal to itself.") | |
278 | 303 | } | |
279 | 304 | else throw("Strict value is not equal to itself.") | |
280 | 305 | } | |
281 | 306 | ||
282 | 307 | ||
283 | 308 | ||
284 | 309 | @Callable(i) | |
285 | 310 | func Lock (LockPeriod,AssetTicker,APY) = { | |
286 | 311 | let check1 = throwIf((1 != size(i.payments)), "attach amount you want to lock") | |
287 | 312 | if ((check1 == check1)) | |
288 | 313 | then { | |
289 | 314 | let asset = toBase58String(value(i.payments[0].assetId)) | |
290 | 315 | let check2 = throwIf((getS(AssetTicker) != asset), "asset not supported") | |
291 | 316 | if ((check2 == check2)) | |
292 | 317 | then { | |
293 | 318 | let lockPeriod = LockPeriod | |
294 | 319 | let userId = toString(i.caller) | |
295 | 320 | let amountToStake = i.payments[0].amount | |
296 | 321 | let minToStake = throwOrReturnI(getI((AssetTicker + minimumLockAmount)), "internal error: minimum stacking amount not specified") | |
297 | 322 | let maxToStake = throwOrReturnI(getI((AssetTicker + maximumLockAmount)), "internal error: maximum staking amount not specified") | |
298 | 323 | let check3 = throwIf(if ((minToStake > amountToStake)) | |
299 | 324 | then true | |
300 | 325 | else (amountToStake > maxToStake), "staking amount is out of range") | |
301 | 326 | if ((check3 == check3)) | |
302 | 327 | then { | |
303 | 328 | let uTotalLocked = (userId + totalLockedAMount) | |
304 | 329 | let uSumTotal = if (!(isDefined(getI(uTotalLocked)))) | |
305 | 330 | then 0 | |
306 | 331 | else (amountToStake + value(getI(uTotalLocked))) | |
307 | 332 | let check4 = throwIf((uSumTotal > maxToStake), "you have maxed out your quota") | |
308 | 333 | if ((check4 == check4)) | |
309 | 334 | then { | |
310 | 335 | let uEntryIndex = ((userId + AssetTicker) + entryIndex) | |
311 | 336 | let uIncrEntryIndex = incrementEntryIndex(uEntryIndex) | |
312 | 337 | let uEntryToString = ((("_" + AssetTicker) + "_") + toString(uIncrEntryIndex)) | |
313 | 338 | let uUserId = ((userId + uEntryToString) + user) | |
314 | 339 | let uAsset = ((userId + uEntryToString) + lockedAsset) | |
315 | 340 | let uLockingPeriod = ((userId + uEntryToString) + lockingPeriod) | |
316 | 341 | let uLockedAmount = ((userId + uEntryToString) + lockedAmount) | |
317 | 342 | let uAPY = ((userId + uEntryToString) + APY_Amount) | |
318 | 343 | let uUnlockEligibility = ((userId + uEntryToString) + unlockEligibility) | |
319 | 344 | let uAlreadyClaimed = ((userId + uEntryToString) + alreadyClaimed) | |
320 | 345 | [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)] | |
321 | 346 | } | |
322 | 347 | else throw("Strict value is not equal to itself.") | |
323 | 348 | } | |
324 | 349 | else throw("Strict value is not equal to itself.") | |
325 | 350 | } | |
326 | 351 | else throw("Strict value is not equal to itself.") | |
327 | 352 | } | |
328 | 353 | else throw("Strict value is not equal to itself.") | |
329 | 354 | } | |
330 | 355 | ||
331 | 356 | ||
332 | 357 | ||
333 | 358 | @Callable(i) | |
334 | 359 | func Claim (AssetTicker) = { | |
335 | 360 | let userId = toString(i.caller) | |
336 | 361 | let uEntryIndex = ((("_" + AssetTicker) + "_") + toString(throwOrReturnI(getI(((userId + AssetTicker) + entryIndex)), "no entry found for user"))) | |
337 | 362 | let uAlreadyClaimedKey = ((userId + uEntryIndex) + alreadyClaimed) | |
338 | 363 | let check0 = throwIf((valueOrErrorMessage(getBoolean(uAlreadyClaimedKey), "cannot ascertain claimability") == true), (("user + " + userId) + " already claimed")) | |
339 | 364 | if ((check0 == check0)) | |
340 | 365 | then { | |
341 | 366 | let uAsset = getSV(((userId + uEntryIndex) + lockedAsset)) | |
342 | 367 | let uLockedAmount = getIV(((userId + uEntryIndex) + lockedAmount)) | |
343 | 368 | let stakingReserve = addressFromStringValue(throwOrReturnS(getS((AssetTicker + stakingStore)), "internal error: no reserve found")) | |
344 | 369 | let APYAMount = getIV(((userId + uEntryIndex) + APY_Amount)) | |
345 | 370 | let period = getIV(((userId + uEntryIndex) + unlockEligibility)) | |
346 | 371 | let blocksLeft = if ((0 >= (period - height))) | |
347 | 372 | then 0 | |
348 | 373 | else (period - height) | |
349 | 374 | let daysLeft = blocksToDays(blocksLeft) | |
350 | 375 | let check1 = throwIf((period > height), (toString(daysLeft) + "/1000 days left to claim")) | |
351 | 376 | if ((check1 == check1)) | |
352 | 377 | then { | |
353 | 378 | let transferAPYAmount = invoke(stakingReserve, "transferInterest", [userId, APYAMount, toBytes(uAsset)], nil) | |
354 | 379 | if ((transferAPYAmount == transferAPYAmount)) | |
355 | 380 | then [ScriptTransfer(addressFromStringValue(userId), uLockedAmount, toBytes(uAsset)), BooleanEntry(uAlreadyClaimedKey, true)] | |
356 | 381 | else throw("Strict value is not equal to itself.") | |
357 | 382 | } | |
358 | 383 | else throw("Strict value is not equal to itself.") | |
359 | 384 | } | |
360 | 385 | else throw("Strict value is not equal to itself.") | |
361 | 386 | } | |
362 | 387 | ||
363 | 388 |
github/deemru/w8io/169f3d6 61.57 ms ◑