tx · 3Z1Zvao5GeyGN8x7UaqTUv6QLvcYUFfwDxMkNfKgYNNY 3MxFe3s73gp41RZFPPC348rhkmny3Vnvqun: -0.05000000 Waves 2023.04.25 16:41 [2550145] smart account 3MxFe3s73gp41RZFPPC348rhkmny3Vnvqun > SELF 0.00000000 Waves
{ "type": 13, "id": "3Z1Zvao5GeyGN8x7UaqTUv6QLvcYUFfwDxMkNfKgYNNY", "fee": 5000000, "feeAssetId": null, "timestamp": 1682430095352, "version": 2, "chainId": 84, "sender": "3MxFe3s73gp41RZFPPC348rhkmny3Vnvqun", "senderPublicKey": "3he9bs4PrpKWxoiZYehJpmgDXbFJjtw2ytjtifGMpCoh", "proofs": [ "49v7ktVUoFJP45hLZonjGavrvY1QbDaC8XZgvCDSHqkYPiiWaJ8zWA5Ph4FsavYLgjcDTMoYk55juBXz9DnddMyB" ], "script": "base64:BgJFCAISAwoBCBIAEgMKAQgSAwoBCBIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSAwoBCBIDCgEBEgMKAQESAwoBARIDCgEEbAADU0VQAgJfXwAFRU1QVFkCAAAJUFJFQ0lTSU9OAICglKWNHQAIREVDSU1BTFMAgMLXLwAUREVGQVVMVF9NQVhfU0xJUFBBR0UJAGgCCQBpAgUJUFJFQ0lTSU9OABQAEwADREFZCQBoAgkAaAIAPAA8ABgABFlFQVIJAGgCBQNEQVkA7QIAD09SQUNMRV9ERUNJTUFMUwDAhD0ACElORklOSVRZAP//////////fwAQTUlOX0FNT1VOVF9ERUxUQQDoBwAVTUFYX1JBVEVfSEVJR0hUX0RFTFRBAAUAEUxJUVVJREFUSU9OX0JPTlVTCQBoAgkAaQIFCVBSRUNJU0lPTgBkAAUAGExJUVVJREFUSU9OX1BST1RPQ09MX0ZFRQkAaAIJAGkCBQlQUkVDSVNJT04AZAACABRNQVhfTElRVUlEQVRJT05fUEFSVAkAaAIJAGkCBQlQUkVDSVNJT04AZAAyAA1TVEFCSUxJVFlfRkVFCQBpAgUJUFJFQ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kZHJlc3MFByRtYXRjaDAJAQt2YWx1ZU9yRWxzZQIJAJsIAgkBEUBleHRyTmF0aXZlKDEwNjIpAQUHYWRkcmVzcwkBCWtleVNpZ25lZAIJAKUIAQUEdGhpcwkA2AQBCAUCdHgCaWQHCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5VY7uog==", "height": 2550145, "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 | + | @Callable(i) | |
428 | + | func setVerifier (_address) = { | |
429 | + | let checks = [mustSelf(i), checkAddress(_address)] | |
430 | + | if ((checks == checks)) | |
431 | + | then if (isDefined(verifier())) | |
432 | + | then throw("Verifier already defined") | |
433 | + | else [StringEntry(keyVerifierAddress(), _address)] | |
434 | + | else throw("Strict value is not equal to itself.") | |
435 | + | } | |
436 | + | ||
437 | + | ||
438 | + | ||
439 | + | @Callable(i) | |
440 | + | func initialize () = { | |
441 | + | let check = [mustNotInitialized(), mustSelf(i)] | |
442 | + | if ((check == check)) | |
443 | + | 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)] | |
444 | + | else throw("Strict value is not equal to itself.") | |
445 | + | } | |
446 | + | ||
447 | + | ||
448 | + | ||
449 | + | @Callable(i) | |
450 | + | func setMinter (_address) = { | |
451 | + | let check = [mustSelf(i), checkAddress(_address)] | |
452 | + | if ((check == check)) | |
453 | + | then [StringEntry(keyMinterAddress(), _address)] | |
454 | + | else throw("Strict value is not equal to itself.") | |
455 | + | } | |
456 | + | ||
457 | + | ||
458 | + | ||
459 | + | @Callable(i) | |
460 | + | func setFrontend (_address) = { | |
461 | + | let check = [mustSelf(i), checkAddress(_address)] | |
462 | + | if ((check == check)) | |
463 | + | then [StringEntry(keyFrontendAddress(), _address)] | |
464 | + | else throw("Strict value is not equal to itself.") | |
465 | + | } | |
466 | + | ||
467 | + | ||
468 | + | ||
469 | + | @Callable(i) | |
470 | + | func setTreasury (_address) = { | |
471 | + | let check = [mustSelf(i), checkAddress(_address)] | |
472 | + | if ((check == check)) | |
473 | + | then [StringEntry(keyTreasuryAddress(), _address)] | |
474 | + | else throw("Strict value is not equal to itself.") | |
475 | + | } | |
476 | + | ||
477 | + | ||
478 | + | ||
479 | + | @Callable(i) | |
480 | + | func setEastStaking (_address) = { | |
481 | + | let check = [mustSelf(i), checkAddress(_address)] | |
482 | + | if ((check == check)) | |
483 | + | then [StringEntry(keyEastStakingAddress(), _address)] | |
484 | + | else throw("Strict value is not equal to itself.") | |
485 | + | } | |
486 | + | ||
487 | + | ||
488 | + | ||
489 | + | @Callable(i) | |
490 | + | func setOracle (_address) = { | |
491 | + | let check = [mustSelf(i), checkAddress(_address)] | |
492 | + | if ((check == check)) | |
493 | + | then [StringEntry(keyOracleAddress(), _address)] | |
494 | + | else throw("Strict value is not equal to itself.") | |
495 | + | } | |
496 | + | ||
497 | + | ||
498 | + | ||
499 | + | @Callable(i) | |
500 | + | func setExchange (_address) = { | |
501 | + | let check = [mustSelf(i), checkAddress(_address)] | |
502 | + | if ((check == check)) | |
503 | + | then [StringEntry(keyExchangeAddress(), _address)] | |
504 | + | else throw("Strict value is not equal to itself.") | |
505 | + | } | |
506 | + | ||
507 | + | ||
508 | + | ||
509 | + | @Callable(i) | |
510 | + | func setEastAsset (_asset) = { | |
511 | + | let check = [mustSelf(i)] | |
512 | + | if ((check == check)) | |
513 | + | then [StringEntry(keyEastAsset(), _asset)] | |
514 | + | else throw("Strict value is not equal to itself.") | |
515 | + | } | |
516 | + | ||
517 | + | ||
518 | + | ||
519 | + | @Callable(i) | |
520 | + | func setStEastAsset (_asset) = { | |
521 | + | let check = [mustSelf(i)] | |
522 | + | if ((check == check)) | |
523 | + | then [StringEntry(keyStEastAsset(), _asset)] | |
524 | + | else throw("Strict value is not equal to itself.") | |
525 | + | } | |
526 | + | ||
527 | + | ||
528 | + | ||
529 | + | @Callable(i) | |
530 | + | func setMaxRateHeightDelta (_delta) = { | |
531 | + | let check = [mustSelf(i)] | |
532 | + | if ((check == check)) | |
533 | + | then [IntegerEntry(keyMaxRateHeightDelta(), _delta)] | |
534 | + | else throw("Strict value is not equal to itself.") | |
535 | + | } | |
536 | + | ||
537 | + | ||
538 | + | ||
539 | + | @Callable(i) | |
540 | + | func setMinAmountDelta (_delta) = { | |
541 | + | let check = [mustSelf(i)] | |
542 | + | if ((check == check)) | |
543 | + | then [IntegerEntry(keyMinAmountDelta(), _delta)] | |
544 | + | else throw("Strict value is not equal to itself.") | |
545 | + | } | |
546 | + | ||
547 | + | ||
548 | + | ||
549 | + | @Callable(i) | |
550 | + | func setStabilityFee (_fee) = { | |
551 | + | let check = [mustSelf(i)] | |
552 | + | if ((check == check)) | |
553 | + | then { | |
554 | + | let doInvoke = invoke(getFrontendAddress(), "updateFraction", nil, nil) | |
555 | + | if ((doInvoke == doInvoke)) | |
556 | + | then { | |
557 | + | let fee = divp(_fee, 1000) | |
558 | + | [IntegerEntry(keyStabilityFee(), fee)] | |
559 | + | } | |
560 | + | else throw("Strict value is not equal to itself.") | |
561 | + | } | |
562 | + | else throw("Strict value is not equal to itself.") | |
563 | + | } | |
564 | + | ||
565 | + | ||
566 | + | ||
567 | + | @Callable(i) | |
568 | + | func setProtocolActive (_status) = { | |
569 | + | let check = [mustSelf(i)] | |
570 | + | if ((check == check)) | |
571 | + | then [BooleanEntry(keyProtocolActive(), _status)] | |
572 | + | else throw("Strict value is not equal to itself.") | |
573 | + | } | |
574 | + | ||
575 | + | ||
576 | + | @Verifier(tx) | |
577 | + | func verify () = match verifier() { | |
578 | + | case address: String => | |
579 | + | valueOrElse(getBoolean(addressFromStringValue(address), keySigned(toString(this), toBase58String(tx.id))), false) | |
580 | + | case _ => | |
581 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
582 | + | } | |
583 | + |
github/deemru/w8io/026f985 31.66 ms ◑