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