tx · 8c3P2XRbBhvGNd9oLh8wrWwSQsJHzpFvHLhkVqCSdg5h 3N6HiBba5QMmEJjXYperGhB4Cthvfp8BrfR: -0.05000000 Waves 2023.04.25 17:22 [2550184] smart account 3N6HiBba5QMmEJjXYperGhB4Cthvfp8BrfR > SELF 0.00000000 Waves
{ "type": 13, "id": "8c3P2XRbBhvGNd9oLh8wrWwSQsJHzpFvHLhkVqCSdg5h", "fee": 5000000, "feeAssetId": null, "timestamp": 1682432613599, "version": 2, "chainId": 84, "sender": "3N6HiBba5QMmEJjXYperGhB4Cthvfp8BrfR", "senderPublicKey": "BjcKBqBFLdXP4UT8KE1K44XxeKzjNZ31fBfrxpRq8hYF", "proofs": [ "53rqAhzdCBvQFW4X6YdA7ppNo6h6jEpnT2JBL9fbStowXytAaczGvt1AsYLRJBrmayE2VHazMu68GQeovuMm5m37" ], "script": "base64:BgIXCAISBQoDCAgIEgASAwoBARIAEgMKAQh8AANTRVACAl9fAAVFTVBUWQIAAAlQUkVDSVNJT04AgKCUpY0dAAhERUNJTUFMUwCAwtcvABRERUZBVUxUX01BWF9TTElQUEFHRQkAaAIJAGkCBQlQUkVDSVNJT04AFAATAANEQVkJAGgCCQBoAgA8ADwAGAAEWUVBUgkAaAIFA0RBWQDtAgAPT1JBQ0xFX0RFQ0lNQUxTAMCEPQAISU5GSU5JVFkA//////////9/ABBNSU5fQU1PVU5UX0RFTFRBAOgHABVNQVhfUkFURV9IRUlHSFRfREVMVEEABQARTElRVUlEQVRJT05fQk9OVVMJAGgCCQBpAgUJUFJFQ0lTSU9OAGQABQAYTElRVUlEQVRJT05fUFJPVE9DT0xfRkVFCQBoAgkAaQIFCVBSRUNJU0lPTgBkAAIAFE1BWF9MSVFVSURBVElPTl9QQVJUCQBoAgkAaQIFCVBSRUNJU0lPTgBkADIADVNUQUJJTElUWV9GRUUJAGkCBQlQUkVDSVNJT04AZAAHRU5BQkxFRAIHRU5BQkxFRAAIRElTQUJMRUQCCERJU0FCTEVEABJJZHh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QEOd2l0aGRyYXdQcm9maXQBCF9hZGRyZXNzBAVjaGVjawkAzAgCCQEKbXVzdEFjdGl2ZQAJAMwIAgkBC211c3RCYWNrZW5kAQUBaQUDbmlsAwkAAAIFBWNoZWNrBQVjaGVjawQHZGV0YWlscwkA7wcBBQR0aGlzBApyZXdhcmRzQW10CAUHZGV0YWlscwlhdmFpbGFibGUJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwkBEUBleHRyTmF0aXZlKDEwNjIpAQUIX2FkZHJlc3MFCnJld2FyZHNBbXQFBHVuaXQFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAEByRtYXRjaDAJAQh2ZXJpZmllcgADCQABAgUHJG1hdGNoMAIGU3RyaW5nBAdhZGRyZXNzBQckbWF0Y2gwCQELdmFsdWVPckVsc2UCCQCbCAIJARFAZXh0ck5hdGl2ZSgxMDYyKQEFB2FkZHJlc3MJAQlrZXlTaWduZWQCCQClCAEFBHRoaXMJANgEAQgFAnR4AmlkBwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleZZg3RA=", "height": 2550184, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let SEP = "__" | |
5 | + | ||
6 | + | let EMPTY = "" | |
7 | + | ||
8 | + | let PRECISION = 1000000000000 | |
9 | + | ||
10 | + | let DECIMALS = 100000000 | |
11 | + | ||
12 | + | let DEFAULT_MAX_SLIPPAGE = ((PRECISION / 20) * 19) | |
13 | + | ||
14 | + | let DAY = ((60 * 60) * 24) | |
15 | + | ||
16 | + | let YEAR = (DAY * 365) | |
17 | + | ||
18 | + | let ORACLE_DECIMALS = 1000000 | |
19 | + | ||
20 | + | let INFINITY = 9223372036854775807 | |
21 | + | ||
22 | + | let MIN_AMOUNT_DELTA = 1000 | |
23 | + | ||
24 | + | let MAX_RATE_HEIGHT_DELTA = 5 | |
25 | + | ||
26 | + | let LIQUIDATION_BONUS = ((PRECISION / 100) * 5) | |
27 | + | ||
28 | + | let LIQUIDATION_PROTOCOL_FEE = ((PRECISION / 100) * 2) | |
29 | + | ||
30 | + | let MAX_LIQUIDATION_PART = ((PRECISION / 100) * 50) | |
31 | + | ||
32 | + | let STABILITY_FEE = (PRECISION / 100) | |
33 | + | ||
34 | + | let ENABLED = "ENABLED" | |
35 | + | ||
36 | + | let DISABLED = "DISABLED" | |
37 | + | ||
38 | + | let IdxVaultAssetCount = 1 | |
39 | + | ||
40 | + | let IdxVaultAssetAmount = 2 | |
41 | + | ||
42 | + | let IdxVaultAssetRate = 3 | |
43 | + | ||
44 | + | let IdxVaultCount = 1 | |
45 | + | ||
46 | + | let IdxVaultEastAmount = 2 | |
47 | + | ||
48 | + | let IdxVaultTimestamp = 3 | |
49 | + | ||
50 | + | let IdxStabilityFee = 4 | |
51 | + | ||
52 | + | let IdxLastFraction = 5 | |
53 | + | ||
54 | + | let invocationError = "Invocation error" | |
55 | + | ||
56 | + | func divd (_x,_y) = fraction(_x, DECIMALS, _y, HALFEVEN) | |
57 | + | ||
58 | + | ||
59 | + | func muld (_x,_y) = fraction(_x, _y, DECIMALS, HALFEVEN) | |
60 | + | ||
61 | + | ||
62 | + | func divp (_x,_y) = fraction(_x, PRECISION, _y, HALFEVEN) | |
63 | + | ||
64 | + | ||
65 | + | func mulp (_x,_y) = fraction(_x, _y, PRECISION, HALFEVEN) | |
66 | + | ||
67 | + | ||
68 | + | func join (ar) = makeString(ar, SEP) | |
69 | + | ||
70 | + | ||
71 | + | func keyInitialized () = join(["%s", "initialized"]) | |
72 | + | ||
73 | + | ||
74 | + | func keyCoordinatorAddress () = join(["%s", "coordinatorAddress"]) | |
75 | + | ||
76 | + | ||
77 | + | func keyVerifierAddress () = join(["%s", "verifierAddress"]) | |
78 | + | ||
79 | + | ||
80 | + | func keyServiceAddress () = join(["%s", "serviceAddress"]) | |
81 | + | ||
82 | + | ||
83 | + | func keyFrontendAddress () = join(["%s", "frontendAddress"]) | |
84 | + | ||
85 | + | ||
86 | + | func keyMinterAddress () = join(["%s", "minterAddress"]) | |
87 | + | ||
88 | + | ||
89 | + | func keyTreasuryAddress () = join(["%s", "treasuryAddress"]) | |
90 | + | ||
91 | + | ||
92 | + | func keyBackendAddress () = join(["%s", "backendAddress"]) | |
93 | + | ||
94 | + | ||
95 | + | func keyEastStakingAddress () = join(["%s", "eastStakingAddress"]) | |
96 | + | ||
97 | + | ||
98 | + | func keyOracleAddress () = join(["%s", "oracleAddress"]) | |
99 | + | ||
100 | + | ||
101 | + | func keyExchangeAddress () = join(["%s", "exchangeAddress"]) | |
102 | + | ||
103 | + | ||
104 | + | func keyEastAsset () = join(["%s", "eastAsset"]) | |
105 | + | ||
106 | + | ||
107 | + | func keyStEastAsset () = join(["%s", "stEastAsset"]) | |
108 | + | ||
109 | + | ||
110 | + | func keyAAssetBalance () = "A_asset_balance" | |
111 | + | ||
112 | + | ||
113 | + | func keyBAssetBalance () = "B_asset_balance" | |
114 | + | ||
115 | + | ||
116 | + | func keyVaultAsset (address,asset) = join(["%s%s%s", "vault", address, asset]) | |
117 | + | ||
118 | + | ||
119 | + | func keyVaultData (address) = join(["%s%s", "vault", address]) | |
120 | + | ||
121 | + | ||
122 | + | func keyPrecision () = join(["%s", "precision"]) | |
123 | + | ||
124 | + | ||
125 | + | func keyBackingRatio () = join(["%s", "backingRatio"]) | |
126 | + | ||
127 | + | ||
128 | + | func keyLiquidationRatio () = join(["%s", "liquidationRatio"]) | |
129 | + | ||
130 | + | ||
131 | + | func keyLiquidationBonus () = join(["%s", "liquidationBonus"]) | |
132 | + | ||
133 | + | ||
134 | + | func keyLiquidationProtocolFee () = join(["%s", "liquidationProtocolFee"]) | |
135 | + | ||
136 | + | ||
137 | + | func keyStabilityFee () = join(["%s", "stabilityFee"]) | |
138 | + | ||
139 | + | ||
140 | + | func keyMinAmountDelta () = join(["%s", "minAmountDelta"]) | |
141 | + | ||
142 | + | ||
143 | + | func keyTicker () = join(["%s", "ticker"]) | |
144 | + | ||
145 | + | ||
146 | + | func keyMaxRateHeightDelta () = join(["%s", "maxRateHeightDelta"]) | |
147 | + | ||
148 | + | ||
149 | + | func keyContractAssetId () = join(["%s", "contractAssetId"]) | |
150 | + | ||
151 | + | ||
152 | + | func keyOracleTickerPrice (ticker) = join(["%s%s", "price", ticker]) | |
153 | + | ||
154 | + | ||
155 | + | func keyOracleTickerPriceHeight (ticker) = join(["%s%s", "lastHeight", ticker]) | |
156 | + | ||
157 | + | ||
158 | + | func keySigned (_address,_txId) = join(["%s%s%s", "signed", _address, _txId]) | |
159 | + | ||
160 | + | ||
161 | + | func keyProtocolActive () = join(["%s", "protocolActive"]) | |
162 | + | ||
163 | + | ||
164 | + | func isInitialized () = valueOrElse(getBoolean(this, keyInitialized()), false) | |
165 | + | ||
166 | + | ||
167 | + | func mustInitialized () = if (!(isInitialized())) | |
168 | + | then throw("Not initialized") | |
169 | + | else unit | |
170 | + | ||
171 | + | ||
172 | + | func mustNotInitialized () = if (isInitialized()) | |
173 | + | then throw("Already initialized") | |
174 | + | else unit | |
175 | + | ||
176 | + | ||
177 | + | func mustSelf (i) = if ((i.caller != this)) | |
178 | + | then throw("Only self invocation allowed.") | |
179 | + | else unit | |
180 | + | ||
181 | + | ||
182 | + | func coordinator () = addressFromStringValue(valueOrErrorMessage(getString(keyCoordinatorAddress()), "Coordinator is not set")) | |
183 | + | ||
184 | + | ||
185 | + | func verifier () = match getString(keyCoordinatorAddress()) { | |
186 | + | case s: String => | |
187 | + | getString(addressFromStringValue(s), keyVerifierAddress()) | |
188 | + | case _: Unit => | |
189 | + | unit | |
190 | + | case _ => | |
191 | + | throw("Match error") | |
192 | + | } | |
193 | + | ||
194 | + | ||
195 | + | func getAddress (key,err) = addressFromStringValue(valueOrErrorMessage(getString(coordinator(), key), err)) | |
196 | + | ||
197 | + | ||
198 | + | func getMinterAddress () = getAddress(keyMinterAddress(), "Minter is not set") | |
199 | + | ||
200 | + | ||
201 | + | func getFrontendAddress () = getAddress(keyFrontendAddress(), "Frontend is not set") | |
202 | + | ||
203 | + | ||
204 | + | func getTreasuryAddress () = getAddress(keyTreasuryAddress(), "Treasury is not set") | |
205 | + | ||
206 | + | ||
207 | + | func getBackendAddress () = getAddress(keyBackendAddress(), "Backend is not set") | |
208 | + | ||
209 | + | ||
210 | + | func getOracleAddress () = getAddress(keyOracleAddress(), "Oracle is not set") | |
211 | + | ||
212 | + | ||
213 | + | func getEastStakingAddress () = getAddress(keyEastStakingAddress(), "East staking is not set") | |
214 | + | ||
215 | + | ||
216 | + | func isNotTreasury (i) = (i.caller != getTreasuryAddress()) | |
217 | + | ||
218 | + | ||
219 | + | func getMinAmountDelta () = valueOrElse(getInteger(coordinator(), keyMinAmountDelta()), MIN_AMOUNT_DELTA) | |
220 | + | ||
221 | + | ||
222 | + | func getMaxRateHeightDelta () = valueOrElse(getInteger(coordinator(), keyMaxRateHeightDelta()), MAX_RATE_HEIGHT_DELTA) | |
223 | + | ||
224 | + | ||
225 | + | func getLiquidationBonus () = valueOrElse(getInteger(coordinator(), keyLiquidationBonus()), LIQUIDATION_BONUS) | |
226 | + | ||
227 | + | ||
228 | + | func getLiquidationProtocolFee () = valueOrElse(getInteger(coordinator(), keyLiquidationProtocolFee()), LIQUIDATION_PROTOCOL_FEE) | |
229 | + | ||
230 | + | ||
231 | + | func getStabilityFee () = valueOrElse(getInteger(coordinator(), keyStabilityFee()), STABILITY_FEE) | |
232 | + | ||
233 | + | ||
234 | + | func getAssetId () = getStringValue(keyContractAssetId()) | |
235 | + | ||
236 | + | ||
237 | + | func getEastAssetStr () = valueOrErrorMessage(getString(coordinator(), keyEastAsset()), "East asset is not set") | |
238 | + | ||
239 | + | ||
240 | + | func getEastAsset () = fromBase58String(getEastAssetStr()) | |
241 | + | ||
242 | + | ||
243 | + | func isActive () = valueOrElse(getBoolean(coordinator(), keyProtocolActive()), false) | |
244 | + | ||
245 | + | ||
246 | + | func mustActive () = if (if (!(isActive())) | |
247 | + | then true | |
248 | + | else !(isInitialized())) | |
249 | + | then throw("Protocol is disabled. Please contact support.") | |
250 | + | else unit | |
251 | + | ||
252 | + | ||
253 | + | func mustFrontend (i) = if ((i.caller != getFrontendAddress())) | |
254 | + | then throw("Not allowed") | |
255 | + | else unit | |
256 | + | ||
257 | + | ||
258 | + | func mustBackend (i) = if ((i.caller != getBackendAddress())) | |
259 | + | then throw("Not allowed") | |
260 | + | else unit | |
261 | + | ||
262 | + | ||
263 | + | func mustNotVaultOwner (i,address) = if ((toBase58String(i.caller.bytes) == address)) | |
264 | + | then throw("Self invocation not allowed.") | |
265 | + | else unit | |
266 | + | ||
267 | + | ||
268 | + | func mustHaveOnePayment (i) = if ((size(i.payments) != 1)) | |
269 | + | then throw("Only one payment allowed.") | |
270 | + | else unit | |
271 | + | ||
272 | + | ||
273 | + | func mustHaveNoPayment (i) = if ((size(i.payments) != 0)) | |
274 | + | then throw("No payment allowed.") | |
275 | + | else unit | |
276 | + | ||
277 | + | ||
278 | + | func hasOnePayment (i) = (size(i.payments) == 1) | |
279 | + | ||
280 | + | ||
281 | + | func isPositive (number) = if ((0 >= number)) | |
282 | + | then throw("Attribute should be positive or zero.") | |
283 | + | else unit | |
284 | + | ||
285 | + | ||
286 | + | func isNotNegative (number) = if ((0 > number)) | |
287 | + | then throw("Attribute should be positive.") | |
288 | + | else unit | |
289 | + | ||
290 | + | ||
291 | + | func getSubvault (address,asset) = getString(keyVaultAsset(address, asset)) | |
292 | + | ||
293 | + | ||
294 | + | func isSubvaultExists (address,asset) = valueOrErrorMessage(getSubvault(address, asset), "Vault not exists") | |
295 | + | ||
296 | + | ||
297 | + | func getAssetString (p) = match p.assetId { | |
298 | + | case assetId: ByteVector => | |
299 | + | toBase58String(assetId) | |
300 | + | case _: Unit => | |
301 | + | "WAVES" | |
302 | + | case _ => | |
303 | + | throw("Match error") | |
304 | + | } | |
305 | + | ||
306 | + | ||
307 | + | func getAssetIdFromString (assetId) = if ((assetId == "WAVES")) | |
308 | + | then unit | |
309 | + | else fromBase58String(assetId) | |
310 | + | ||
311 | + | ||
312 | + | func isAsset (p,checkingAsset) = { | |
313 | + | let assetId = match checkingAsset { | |
314 | + | case bv: ByteVector => | |
315 | + | bv | |
316 | + | case s: String => | |
317 | + | getAssetIdFromString(s) | |
318 | + | case _: Unit => | |
319 | + | unit | |
320 | + | case _ => | |
321 | + | throw("Match error") | |
322 | + | } | |
323 | + | match assetId { | |
324 | + | case bv: ByteVector => | |
325 | + | let name = match assetInfo(bv) { | |
326 | + | case asset: Asset => | |
327 | + | asset.name | |
328 | + | case _: Unit => | |
329 | + | throw(("Can't find asset " + toBase58String(bv))) | |
330 | + | case _ => | |
331 | + | throw("Match error") | |
332 | + | } | |
333 | + | let err = throw(("Attached payment asset is not " + name)) | |
334 | + | match p.assetId { | |
335 | + | case paymentAsset: ByteVector => | |
336 | + | if ((paymentAsset != assetId)) | |
337 | + | then err | |
338 | + | else unit | |
339 | + | case _: Unit => | |
340 | + | err | |
341 | + | case _ => | |
342 | + | throw("Match error") | |
343 | + | } | |
344 | + | case _: Unit => | |
345 | + | if ((p.assetId != unit)) | |
346 | + | then throw("Attached payment asset is not WAVES") | |
347 | + | else unit | |
348 | + | case _ => | |
349 | + | throw("Match error") | |
350 | + | } | |
351 | + | } | |
352 | + | ||
353 | + | ||
354 | + | func getBackingRatio () = valueOrErrorMessage(getInteger(keyBackingRatio()), "Backing ratio is not set") | |
355 | + | ||
356 | + | ||
357 | + | func getLiquidationRatio () = valueOrErrorMessage(getInteger(keyLiquidationRatio()), "Liquidation ratio is not set") | |
358 | + | ||
359 | + | ||
360 | + | func checkAddress (_address) = match addressFromString(_address) { | |
361 | + | case address: Address => | |
362 | + | true | |
363 | + | case _: Unit => | |
364 | + | throw("Invalid address") | |
365 | + | case _ => | |
366 | + | throw("Match error") | |
367 | + | } | |
368 | + | ||
369 | + | ||
370 | + | func checkTxId (_id) = (size(fromBase58String(_id)) == 32) | |
371 | + | ||
372 | + | ||
373 | + | func getCurrentTimestampSec () = (lastBlock.timestamp / 1000) | |
374 | + | ||
375 | + | ||
376 | + | func mustWavesPayment (i) = { | |
377 | + | let check = mustHaveOnePayment(i) | |
378 | + | if ((check == check)) | |
379 | + | then { | |
380 | + | let pmtAssetId = i.payments[0].assetId | |
381 | + | match pmtAssetId { | |
382 | + | case a: Unit => | |
383 | + | unit | |
384 | + | case _ => | |
385 | + | throw("Only WAVES accepted") | |
386 | + | } | |
387 | + | } | |
388 | + | else throw("Strict value is not equal to itself.") | |
389 | + | } | |
390 | + | ||
391 | + | ||
392 | + | func getAssetInfo (assetId) = match assetId { | |
393 | + | case id: ByteVector => | |
394 | + | let stringId = toBase58String(id) | |
395 | + | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
396 | + | $Tuple3(stringId, info.name, info.decimals) | |
397 | + | case waves: Unit => | |
398 | + | $Tuple3("WAVES", "WAVES", 8) | |
399 | + | case _ => | |
400 | + | throw("Match error") | |
401 | + | } | |
402 | + | ||
403 | + | ||
404 | + | func checkHeightDelta (priceHeight) = { | |
405 | + | let maxHeightDelta = getMaxRateHeightDelta() | |
406 | + | let currentDiff = (lastBlock.height - priceHeight) | |
407 | + | if ((maxHeightDelta >= currentDiff)) | |
408 | + | then unit | |
409 | + | else throw("Large price delta.") | |
410 | + | } | |
411 | + | ||
412 | + | ||
413 | + | func getAssetUsdPrice () = { | |
414 | + | let ticker = getStringValue(this, keyTicker()) | |
415 | + | let oracleAddress = getOracleAddress() | |
416 | + | let priceHeight = getIntegerValue(oracleAddress, keyOracleTickerPriceHeight(ticker)) | |
417 | + | let checkHeight = checkHeightDelta(priceHeight) | |
418 | + | if ((checkHeight == checkHeight)) | |
419 | + | then { | |
420 | + | let price = getIntegerValue(oracleAddress, keyOracleTickerPrice(ticker)) | |
421 | + | fraction(price, PRECISION, ORACLE_DECIMALS) | |
422 | + | } | |
423 | + | else throw("Strict value is not equal to itself.") | |
424 | + | } | |
425 | + | ||
426 | + | ||
427 | + | let WAVES_EXCHANGE_SWAP_ADDRESS = addressFromStringValue("3P68zNiufsu1viZpu1aY3cdahRRKcvV5N93") | |
428 | + | ||
429 | + | func keySubvaultAddress () = join(["%s", "subvaultAddress"]) | |
430 | + | ||
431 | + | ||
432 | + | func keyLeasedAmount () = join(["%d", "keyLeasedAmount"]) | |
433 | + | ||
434 | + | ||
435 | + | func keyLeasingId () = join(["%s", "leasingId"]) | |
436 | + | ||
437 | + | ||
438 | + | func keyTotalRewarded () = join(["%s", "totalRewarded"]) | |
439 | + | ||
440 | + | ||
441 | + | func keyTotalProfitReceived () = join(["%s", "totalProfitReceived"]) | |
442 | + | ||
443 | + | ||
444 | + | func mustSubvault (i) = (toString(i.caller) == keySubvaultAddress()) | |
445 | + | ||
446 | + | ||
447 | + | func keyLeaseAddress () = join(["%s", "leaseAddress"]) | |
448 | + | ||
449 | + | ||
450 | + | func keyZeroLeasingState () = join(["%b", "zeroLeasingState"]) | |
451 | + | ||
452 | + | ||
453 | + | func getSubvaultAddress () = addressFromStringValue(getStringValue(keySubvaultAddress())) | |
454 | + | ||
455 | + | ||
456 | + | func getLeaseAddressStr () = getStringValue(keyLeaseAddress()) | |
457 | + | ||
458 | + | ||
459 | + | func getLeaseAddress () = addressFromStringValue(getLeaseAddressStr()) | |
460 | + | ||
461 | + | ||
462 | + | func getLeasedAmount () = valueOrElse(getInteger(keyLeasedAmount()), 0) | |
463 | + | ||
464 | + | ||
465 | + | func getTotalRewarded () = valueOrElse(getInteger(keyTotalRewarded()), 0) | |
466 | + | ||
467 | + | ||
468 | + | func getTotalProfitReceived () = valueOrElse(getInteger(keyTotalProfitReceived()), 0) | |
469 | + | ||
470 | + | ||
471 | + | func checkLeaseAmount (newAmt) = if ((newAmt >= 0)) | |
472 | + | then unit | |
473 | + | else throw(("Leasing balance too low: " + toString(newAmt))) | |
474 | + | ||
475 | + | ||
476 | + | @Callable(i) | |
477 | + | func initialize (_coordinatorAddress,_subvaultAddress,_leaseAddress) = { | |
478 | + | let checkAddresses = [mustNotInitialized(), checkAddress(_coordinatorAddress), checkAddress(_subvaultAddress), checkAddress(_leaseAddress)] | |
479 | + | if ((checkAddresses == checkAddresses)) | |
480 | + | then [StringEntry(keyCoordinatorAddress(), _coordinatorAddress), StringEntry(keySubvaultAddress(), _subvaultAddress), StringEntry(keyLeaseAddress(), _leaseAddress), BooleanEntry(keyZeroLeasingState(), true), BooleanEntry(keyInitialized(), true)] | |
481 | + | else throw("Strict value is not equal to itself.") | |
482 | + | } | |
483 | + | ||
484 | + | ||
485 | + | ||
486 | + | @Callable(i) | |
487 | + | func stake () = { | |
488 | + | let checks = [mustActive(), mustSubvault(i), mustWavesPayment(i)] | |
489 | + | if ((checks == checks)) | |
490 | + | then { | |
491 | + | let payment = i.payments[0] | |
492 | + | let leasingId = getBinary(this, keyLeasingId()) | |
493 | + | let newAmount = (getLeasedAmount() + payment.amount) | |
494 | + | let newLease = Lease(getLeaseAddress(), newAmount) | |
495 | + | let newLeaseId = calculateLeaseId(newLease) | |
496 | + | let baseEntries = [newLease, BinaryEntry(keyLeasingId(), newLeaseId), IntegerEntry(keyLeasedAmount(), newAmount)] | |
497 | + | let zeroLeasingState = getBooleanValue(this, keyZeroLeasingState()) | |
498 | + | let entries = if (zeroLeasingState) | |
499 | + | then (baseEntries :+ BooleanEntry(keyZeroLeasingState(), false)) | |
500 | + | else baseEntries | |
501 | + | match leasingId { | |
502 | + | case lId: ByteVector => | |
503 | + | if (zeroLeasingState) | |
504 | + | then entries | |
505 | + | else ([LeaseCancel(lId)] ++ entries) | |
506 | + | case _ => | |
507 | + | entries | |
508 | + | } | |
509 | + | } | |
510 | + | else throw("Strict value is not equal to itself.") | |
511 | + | } | |
512 | + | ||
513 | + | ||
514 | + | ||
515 | + | @Callable(i) | |
516 | + | func unstake (_amount) = { | |
517 | + | let checks = [mustActive(), mustSubvault(i), isPositive(_amount)] | |
518 | + | if ((checks == checks)) | |
519 | + | then { | |
520 | + | let subvault = getSubvaultAddress() | |
521 | + | let leaseAddr = addressFromStringValue(getStringValue(this, keyLeaseAddress())) | |
522 | + | let leasingId = getBinaryValue(this, keyLeasingId()) | |
523 | + | let newAmount = (getLeasedAmount() - _amount) | |
524 | + | let checkLeasingBalance = checkLeaseAmount(newAmount) | |
525 | + | if ((checkLeasingBalance == checkLeasingBalance)) | |
526 | + | then { | |
527 | + | let zeroLeasingState = getBooleanValue(this, keyZeroLeasingState()) | |
528 | + | let entries = if (zeroLeasingState) | |
529 | + | then nil | |
530 | + | else { | |
531 | + | let leaseCancel = LeaseCancel(leasingId) | |
532 | + | [leaseCancel] | |
533 | + | } | |
534 | + | let newEntries = if ((newAmount > 0)) | |
535 | + | then { | |
536 | + | let newLease = Lease(leaseAddr, newAmount) | |
537 | + | let newLeaseId = calculateLeaseId(newLease) | |
538 | + | (entries ++ [newLease, BinaryEntry(keyLeasingId(), newLeaseId)]) | |
539 | + | } | |
540 | + | else (entries :+ BooleanEntry(keyZeroLeasingState(), true)) | |
541 | + | (newEntries ++ [IntegerEntry(keyLeasedAmount(), newAmount), ScriptTransfer(subvault, _amount, unit)]) | |
542 | + | } | |
543 | + | else throw("Strict value is not equal to itself.") | |
544 | + | } | |
545 | + | else throw("Strict value is not equal to itself.") | |
546 | + | } | |
547 | + | ||
548 | + | ||
549 | + | ||
550 | + | @Callable(i) | |
551 | + | func exchangeAndReward () = { | |
552 | + | func getAmount () = 1 | |
553 | + | ||
554 | + | let amount = getAmount() | |
555 | + | let doSwap = invoke(WAVES_EXCHANGE_SWAP_ADDRESS, "swap", [1, getEastAssetStr(), toString(this)], [AttachedPayment(unit, amount)]) | |
556 | + | if ((doSwap == doSwap)) | |
557 | + | then { | |
558 | + | let swappedAmount = assetBalance(this, getEastAsset()) | |
559 | + | let doReward = invoke(getEastStakingAddress(), "addStakingRewards", nil, [AttachedPayment(getEastAsset(), swappedAmount)]) | |
560 | + | if ((doReward == doReward)) | |
561 | + | then { | |
562 | + | let totalProfitReceived = (getTotalProfitReceived() + amount) | |
563 | + | let totalRewarded = (getTotalRewarded() + swappedAmount) | |
564 | + | [IntegerEntry(keyTotalProfitReceived(), totalProfitReceived), IntegerEntry(keyTotalRewarded(), totalRewarded)] | |
565 | + | } | |
566 | + | else throw("Strict value is not equal to itself.") | |
567 | + | } | |
568 | + | else throw("Strict value is not equal to itself.") | |
569 | + | } | |
570 | + | ||
571 | + | ||
572 | + | ||
573 | + | @Callable(i) | |
574 | + | func withdrawProfit (_address) = { | |
575 | + | let check = [mustActive(), mustBackend(i)] | |
576 | + | if ((check == check)) | |
577 | + | then { | |
578 | + | let details = wavesBalance(this) | |
579 | + | let rewardsAmt = details.available | |
580 | + | [ScriptTransfer(addressFromStringValue(_address), rewardsAmt, unit)] | |
581 | + | } | |
582 | + | else throw("Strict value is not equal to itself.") | |
583 | + | } | |
584 | + | ||
585 | + | ||
586 | + | @Verifier(tx) | |
587 | + | func verify () = match verifier() { | |
588 | + | case address: String => | |
589 | + | valueOrElse(getBoolean(addressFromStringValue(address), keySigned(toString(this), toBase58String(tx.id))), false) | |
590 | + | case _ => | |
591 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
592 | + | } | |
593 | + |
github/deemru/w8io/169f3d6 29.87 ms ◑