tx · EehjwFDsCHWbdDKDySauexesHbPkYygEJkYocyJBTkXZ 3N6CLJ4fMHut6vG8omQokh8ATSkDQQiXC4E: -0.05000000 Waves 2023.04.18 13:43 [2539886] smart account 3N6CLJ4fMHut6vG8omQokh8ATSkDQQiXC4E > SELF 0.00000000 Waves
{ "type": 13, "id": "EehjwFDsCHWbdDKDySauexesHbPkYygEJkYocyJBTkXZ", "fee": 5000000, "feeAssetId": null, "timestamp": 1681814641271, "version": 2, "chainId": 84, "sender": "3N6CLJ4fMHut6vG8omQokh8ATSkDQQiXC4E", "senderPublicKey": "AGveESHS5KJMCnnoo5ZwxGhizt8qkhQuVrDwWSQ4L3uG", "proofs": [ "2Bzv98zxHcyKBGaX8DCaf9aoWC4TnsN2Q7xTY4u3LDT6osAeeEHfCp8Yc8jaHexB7MNAMxB2QkbMQiVnT88yx5Mt" ], "script": "base64:BgJKCAISAwoBCBIAEgMKAQgSAwoBCBIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQESAwoBARIDCgEBEgMKAQRrAANTRVACAl9fAAVFTVBUWQIAAAlQUkVDSVNJT04AgKCUpY0dAAhERUNJTUFMUwCAwtcvABRERUZBVUxUX01BWF9TTElQUEFHRQkAaAIJAGkCBQlQUkVDSVNJT04AFAATAANEQVkJAGgCCQBoAgA8ADwAGAAEWUVBUgkAaAIFA0RBWQDtAgAPT1JBQ0xFX0RFQ0lNQUxTAMCEPQAISU5GSU5JVFkA//////////9/ABBNSU5fQU1PVU5UX0RFTFRBAOgHABVNQVhfUkFURV9IRUlHSFRfREVMVEEABQARTElRVUlEQVRJT05fQk9OVVMJAGgCCQBpAgUJUFJFQ0lTSU9OAGQABQAYTElRVUlEQVRJT05fUFJPVE9DT0xfRkVFCQBoAgkAaQIFCVBSRUNJU0lPTgBkAAIAFE1BWF9MSVFVSURBVElPTl9QQVJUCQBoAgkAaQIFCVBSRUNJU0lPTgBkADIADVNUQUJJTElUWV9GRUUJAGkCBQl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2ZQAFB19zdGF0dXMFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAEByRtYXRjaDAJAQh2ZXJpZmllcgADCQABAgUHJG1hdGNoMAIGU3RyaW5nBAdhZGRyZXNzBQckbWF0Y2gwCQELdmFsdWVPckVsc2UCCQCbCAIJARFAZXh0ck5hdGl2ZSgxMDYyKQEFB2FkZHJlc3MJAQlrZXlTaWduZWQCCQClCAEFBHRoaXMJANgEAQgFAnR4AmlkBwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tlee87Kgc=", "height": 2539886, "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 isNotTreasury (i) = (i.caller != getTreasuryAddress()) | |
214 | + | ||
215 | + | ||
216 | + | func getMinAmountDelta () = valueOrElse(getInteger(coordinator(), keyMinAmountDelta()), MIN_AMOUNT_DELTA) | |
217 | + | ||
218 | + | ||
219 | + | func getMaxRateHeightDelta () = valueOrElse(getInteger(coordinator(), keyMaxRateHeightDelta()), MAX_RATE_HEIGHT_DELTA) | |
220 | + | ||
221 | + | ||
222 | + | func getLiquidationBonus () = valueOrElse(getInteger(coordinator(), keyLiquidationBonus()), LIQUIDATION_BONUS) | |
223 | + | ||
224 | + | ||
225 | + | func getLiquidationProtocolFee () = valueOrElse(getInteger(coordinator(), keyLiquidationProtocolFee()), LIQUIDATION_PROTOCOL_FEE) | |
226 | + | ||
227 | + | ||
228 | + | func getStabilityFee () = valueOrElse(getInteger(coordinator(), keyStabilityFee()), STABILITY_FEE) | |
229 | + | ||
230 | + | ||
231 | + | func getAssetId () = getStringValue(keyContractAssetId()) | |
232 | + | ||
233 | + | ||
234 | + | func getEastAssetStr () = valueOrErrorMessage(getString(coordinator(), keyEastAsset()), "East asset is not set") | |
235 | + | ||
236 | + | ||
237 | + | func getEastAsset () = fromBase58String(getEastAssetStr()) | |
238 | + | ||
239 | + | ||
240 | + | func isActive () = valueOrElse(getBoolean(coordinator(), keyProtocolActive()), false) | |
241 | + | ||
242 | + | ||
243 | + | func mustActive () = if (if (!(isActive())) | |
244 | + | then true | |
245 | + | else !(isInitialized())) | |
246 | + | then throw("Protocol is disabled. Please contact support.") | |
247 | + | else unit | |
248 | + | ||
249 | + | ||
250 | + | func mustFrontend (i) = if ((i.caller != getFrontendAddress())) | |
251 | + | then throw("Not allowed") | |
252 | + | else unit | |
253 | + | ||
254 | + | ||
255 | + | func mustBackend (i) = if ((i.caller != getBackendAddress())) | |
256 | + | then throw("Not allowed") | |
257 | + | else unit | |
258 | + | ||
259 | + | ||
260 | + | func mustNotVaultOwner (i,address) = if ((toBase58String(i.caller.bytes) == address)) | |
261 | + | then throw("Self invocation not allowed.") | |
262 | + | else unit | |
263 | + | ||
264 | + | ||
265 | + | func mustHaveOnePayment (i) = if ((size(i.payments) != 1)) | |
266 | + | then throw("Only one payment allowed.") | |
267 | + | else unit | |
268 | + | ||
269 | + | ||
270 | + | func mustHaveNoPayment (i) = if ((size(i.payments) != 0)) | |
271 | + | then throw("No payment allowed.") | |
272 | + | else unit | |
273 | + | ||
274 | + | ||
275 | + | func hasOnePayment (i) = (size(i.payments) == 1) | |
276 | + | ||
277 | + | ||
278 | + | func isPositive (number) = if ((0 >= number)) | |
279 | + | then throw("Attribute should be positive or zero.") | |
280 | + | else unit | |
281 | + | ||
282 | + | ||
283 | + | func isNotNegative (number) = if ((0 > number)) | |
284 | + | then throw("Attribute should be positive.") | |
285 | + | else unit | |
286 | + | ||
287 | + | ||
288 | + | func getSubvault (address,asset) = getString(keyVaultAsset(address, asset)) | |
289 | + | ||
290 | + | ||
291 | + | func isSubvaultExists (address,asset) = valueOrErrorMessage(getSubvault(address, asset), "Vault not exists") | |
292 | + | ||
293 | + | ||
294 | + | func getAssetString (p) = match p.assetId { | |
295 | + | case assetId: ByteVector => | |
296 | + | toBase58String(assetId) | |
297 | + | case _: Unit => | |
298 | + | "WAVES" | |
299 | + | case _ => | |
300 | + | throw("Match error") | |
301 | + | } | |
302 | + | ||
303 | + | ||
304 | + | func getAssetIdFromString (assetId) = if ((assetId == "WAVES")) | |
305 | + | then unit | |
306 | + | else fromBase58String(assetId) | |
307 | + | ||
308 | + | ||
309 | + | func isAsset (p,checkingAsset) = { | |
310 | + | let assetId = match checkingAsset { | |
311 | + | case bv: ByteVector => | |
312 | + | bv | |
313 | + | case s: String => | |
314 | + | getAssetIdFromString(s) | |
315 | + | case _: Unit => | |
316 | + | unit | |
317 | + | case _ => | |
318 | + | throw("Match error") | |
319 | + | } | |
320 | + | match assetId { | |
321 | + | case bv: ByteVector => | |
322 | + | let name = match assetInfo(bv) { | |
323 | + | case asset: Asset => | |
324 | + | asset.name | |
325 | + | case _: Unit => | |
326 | + | throw(("Can't find asset " + toBase58String(bv))) | |
327 | + | case _ => | |
328 | + | throw("Match error") | |
329 | + | } | |
330 | + | let err = throw(("Attached payment asset is not " + name)) | |
331 | + | match p.assetId { | |
332 | + | case paymentAsset: ByteVector => | |
333 | + | if ((paymentAsset != assetId)) | |
334 | + | then err | |
335 | + | else unit | |
336 | + | case _: Unit => | |
337 | + | err | |
338 | + | case _ => | |
339 | + | throw("Match error") | |
340 | + | } | |
341 | + | case _: Unit => | |
342 | + | if ((p.assetId != unit)) | |
343 | + | then throw("Attached payment asset is not WAVES") | |
344 | + | else unit | |
345 | + | case _ => | |
346 | + | throw("Match error") | |
347 | + | } | |
348 | + | } | |
349 | + | ||
350 | + | ||
351 | + | func getBackingRatio () = valueOrErrorMessage(getInteger(keyBackingRatio()), "Backing ratio is not set") | |
352 | + | ||
353 | + | ||
354 | + | func getLiquidationRatio () = valueOrErrorMessage(getInteger(keyLiquidationRatio()), "Liquidation ratio is not set") | |
355 | + | ||
356 | + | ||
357 | + | func checkAddress (_address) = match addressFromString(_address) { | |
358 | + | case address: Address => | |
359 | + | true | |
360 | + | case _: Unit => | |
361 | + | throw("Invalid address") | |
362 | + | case _ => | |
363 | + | throw("Match error") | |
364 | + | } | |
365 | + | ||
366 | + | ||
367 | + | func checkTxId (_id) = (size(fromBase58String(_id)) == 32) | |
368 | + | ||
369 | + | ||
370 | + | func getCurrentTimestampSec () = (lastBlock.timestamp / 1000) | |
371 | + | ||
372 | + | ||
373 | + | func mustWavesPayment (i) = { | |
374 | + | let check = mustHaveOnePayment(i) | |
375 | + | if ((check == check)) | |
376 | + | then { | |
377 | + | let pmtAssetId = i.payments[0].assetId | |
378 | + | match pmtAssetId { | |
379 | + | case a: Unit => | |
380 | + | unit | |
381 | + | case _ => | |
382 | + | throw("Only WAVES accepted") | |
383 | + | } | |
384 | + | } | |
385 | + | else throw("Strict value is not equal to itself.") | |
386 | + | } | |
387 | + | ||
388 | + | ||
389 | + | func getAssetInfo (assetId) = match assetId { | |
390 | + | case id: ByteVector => | |
391 | + | let stringId = toBase58String(id) | |
392 | + | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
393 | + | $Tuple3(stringId, info.name, info.decimals) | |
394 | + | case waves: Unit => | |
395 | + | $Tuple3("WAVES", "WAVES", 8) | |
396 | + | case _ => | |
397 | + | throw("Match error") | |
398 | + | } | |
399 | + | ||
400 | + | ||
401 | + | func checkHeightDelta (priceHeight) = { | |
402 | + | let maxHeightDelta = getMaxRateHeightDelta() | |
403 | + | let currentDiff = (lastBlock.height - priceHeight) | |
404 | + | if ((maxHeightDelta >= currentDiff)) | |
405 | + | then unit | |
406 | + | else throw("Large price delta.") | |
407 | + | } | |
408 | + | ||
409 | + | ||
410 | + | func getAssetUsdPrice () = { | |
411 | + | let ticker = getStringValue(this, keyTicker()) | |
412 | + | let oracleAddress = getOracleAddress() | |
413 | + | let priceHeight = getIntegerValue(oracleAddress, keyOracleTickerPriceHeight(ticker)) | |
414 | + | let checkHeight = checkHeightDelta(priceHeight) | |
415 | + | if ((checkHeight == checkHeight)) | |
416 | + | then { | |
417 | + | let price = getIntegerValue(oracleAddress, keyOracleTickerPrice(ticker)) | |
418 | + | fraction(price, PRECISION, ORACLE_DECIMALS) | |
419 | + | } | |
420 | + | else throw("Strict value is not equal to itself.") | |
421 | + | } | |
422 | + | ||
423 | + | ||
424 | + | @Callable(i) | |
425 | + | func setVerifier (_address) = { | |
426 | + | let checks = [mustSelf(i), checkAddress(_address)] | |
427 | + | if ((checks == checks)) | |
428 | + | then if (isDefined(verifier())) | |
429 | + | then throw("Verifier already defined") | |
430 | + | else [StringEntry(keyVerifierAddress(), _address)] | |
431 | + | else throw("Strict value is not equal to itself.") | |
432 | + | } | |
433 | + | ||
434 | + | ||
435 | + | ||
436 | + | @Callable(i) | |
437 | + | func initialize () = { | |
438 | + | let check = [mustNotInitialized(), mustSelf(i)] | |
439 | + | if ((check == check)) | |
440 | + | then [IntegerEntry(keyMaxRateHeightDelta(), MAX_RATE_HEIGHT_DELTA), IntegerEntry(keyMinAmountDelta(), MIN_AMOUNT_DELTA), IntegerEntry(keyLiquidationBonus(), LIQUIDATION_BONUS), IntegerEntry(keyLiquidationProtocolFee(), LIQUIDATION_PROTOCOL_FEE), IntegerEntry(keyStabilityFee(), STABILITY_FEE), IntegerEntry(keyPrecision(), PRECISION), BooleanEntry(keyProtocolActive(), true), BooleanEntry(keyInitialized(), true)] | |
441 | + | else throw("Strict value is not equal to itself.") | |
442 | + | } | |
443 | + | ||
444 | + | ||
445 | + | ||
446 | + | @Callable(i) | |
447 | + | func setMinter (_address) = { | |
448 | + | let check = [mustSelf(i), checkAddress(_address)] | |
449 | + | if ((check == check)) | |
450 | + | then [StringEntry(keyMinterAddress(), _address)] | |
451 | + | else throw("Strict value is not equal to itself.") | |
452 | + | } | |
453 | + | ||
454 | + | ||
455 | + | ||
456 | + | @Callable(i) | |
457 | + | func setFrontend (_address) = { | |
458 | + | let check = [mustSelf(i), checkAddress(_address)] | |
459 | + | if ((check == check)) | |
460 | + | then [StringEntry(keyFrontendAddress(), _address)] | |
461 | + | else throw("Strict value is not equal to itself.") | |
462 | + | } | |
463 | + | ||
464 | + | ||
465 | + | ||
466 | + | @Callable(i) | |
467 | + | func setTreasury (_address) = { | |
468 | + | let check = [mustSelf(i), checkAddress(_address)] | |
469 | + | if ((check == check)) | |
470 | + | then [StringEntry(keyTreasuryAddress(), _address)] | |
471 | + | else throw("Strict value is not equal to itself.") | |
472 | + | } | |
473 | + | ||
474 | + | ||
475 | + | ||
476 | + | @Callable(i) | |
477 | + | func setBackend (_address) = { | |
478 | + | let check = [mustSelf(i), checkAddress(_address)] | |
479 | + | if ((check == check)) | |
480 | + | then [StringEntry(keyBackendAddress(), _address)] | |
481 | + | else throw("Strict value is not equal to itself.") | |
482 | + | } | |
483 | + | ||
484 | + | ||
485 | + | ||
486 | + | @Callable(i) | |
487 | + | func setEastStaking (_address) = { | |
488 | + | let check = [mustSelf(i), checkAddress(_address)] | |
489 | + | if ((check == check)) | |
490 | + | then [StringEntry(keyEastStakingAddress(), _address)] | |
491 | + | else throw("Strict value is not equal to itself.") | |
492 | + | } | |
493 | + | ||
494 | + | ||
495 | + | ||
496 | + | @Callable(i) | |
497 | + | func setOracle (_address) = { | |
498 | + | let check = [mustSelf(i), checkAddress(_address)] | |
499 | + | if ((check == check)) | |
500 | + | then [StringEntry(keyOracleAddress(), _address)] | |
501 | + | else throw("Strict value is not equal to itself.") | |
502 | + | } | |
503 | + | ||
504 | + | ||
505 | + | ||
506 | + | @Callable(i) | |
507 | + | func setExchange (_address) = { | |
508 | + | let check = [mustSelf(i), checkAddress(_address)] | |
509 | + | if ((check == check)) | |
510 | + | then [StringEntry(keyExchangeAddress(), _address)] | |
511 | + | else throw("Strict value is not equal to itself.") | |
512 | + | } | |
513 | + | ||
514 | + | ||
515 | + | ||
516 | + | @Callable(i) | |
517 | + | func setEastAsset (_asset) = { | |
518 | + | let check = [mustSelf(i)] | |
519 | + | if ((check == check)) | |
520 | + | then [StringEntry(keyEastAsset(), _asset)] | |
521 | + | else throw("Strict value is not equal to itself.") | |
522 | + | } | |
523 | + | ||
524 | + | ||
525 | + | ||
526 | + | @Callable(i) | |
527 | + | func setStEastAsset (_asset) = { | |
528 | + | let check = [mustSelf(i)] | |
529 | + | if ((check == check)) | |
530 | + | then [StringEntry(keyStEastAsset(), _asset)] | |
531 | + | else throw("Strict value is not equal to itself.") | |
532 | + | } | |
533 | + | ||
534 | + | ||
535 | + | ||
536 | + | @Callable(i) | |
537 | + | func setMaxRateHeightDelta (_delta) = { | |
538 | + | let check = [mustSelf(i)] | |
539 | + | if ((check == check)) | |
540 | + | then [IntegerEntry(keyMaxRateHeightDelta(), _delta)] | |
541 | + | else throw("Strict value is not equal to itself.") | |
542 | + | } | |
543 | + | ||
544 | + | ||
545 | + | ||
546 | + | @Callable(i) | |
547 | + | func setMinAmountDelta (_delta) = { | |
548 | + | let check = [mustSelf(i)] | |
549 | + | if ((check == check)) | |
550 | + | then [IntegerEntry(keyMinAmountDelta(), _delta)] | |
551 | + | else throw("Strict value is not equal to itself.") | |
552 | + | } | |
553 | + | ||
554 | + | ||
555 | + | ||
556 | + | @Callable(i) | |
557 | + | func setStabilityFee (_fee) = { | |
558 | + | let check = [mustSelf(i)] | |
559 | + | if ((check == check)) | |
560 | + | then { | |
561 | + | let doInvoke = invoke(getFrontendAddress(), "updateFraction", nil, nil) | |
562 | + | if ((doInvoke == doInvoke)) | |
563 | + | then { | |
564 | + | let fee = divp(_fee, 1000) | |
565 | + | [IntegerEntry(keyStabilityFee(), fee)] | |
566 | + | } | |
567 | + | else throw("Strict value is not equal to itself.") | |
568 | + | } | |
569 | + | else throw("Strict value is not equal to itself.") | |
570 | + | } | |
571 | + | ||
572 | + | ||
573 | + | ||
574 | + | @Callable(i) | |
575 | + | func setProtocolActive (_status) = { | |
576 | + | let check = [mustSelf(i)] | |
577 | + | if ((check == check)) | |
578 | + | then [BooleanEntry(keyProtocolActive(), _status)] | |
579 | + | else throw("Strict value is not equal to itself.") | |
580 | + | } | |
581 | + | ||
582 | + | ||
583 | + | @Verifier(tx) | |
584 | + | func verify () = match verifier() { | |
585 | + | case address: String => | |
586 | + | valueOrElse(getBoolean(addressFromStringValue(address), keySigned(toString(this), toBase58String(tx.id))), false) | |
587 | + | case _ => | |
588 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
589 | + | } | |
590 | + |
github/deemru/w8io/169f3d6 35.14 ms ◑