tx · DRsCAzND1K5tHYDMpGhjmPzmMZ96t7aNabc9saYnFcuJ 3N396XmhkJT9e88pHTJk6Mayk8LUkGDam5a: -0.05000000 Waves 2023.04.18 13:43 [2539886] smart account 3N396XmhkJT9e88pHTJk6Mayk8LUkGDam5a > SELF 0.00000000 Waves
{ "type": 13, "id": "DRsCAzND1K5tHYDMpGhjmPzmMZ96t7aNabc9saYnFcuJ", "fee": 5000000, "feeAssetId": null, "timestamp": 1681814635867, "version": 2, "chainId": 84, "sender": "3N396XmhkJT9e88pHTJk6Mayk8LUkGDam5a", "senderPublicKey": "5KURymiqxZYVrD1dohssGFnfe1WQ5oC6ESSLPNzGW99R", "proofs": [ "5ZzNoKteNndcAd4yNHFE5S7jc4VAVEcQtVDwGn4qj8z2Z2i4GYp8i433gB6QumHEQ1HzYCciY7jAZkrU72y2Lmt7" ], "script": "base64:BgIWCAISAwoBCBIDCgEBEgMKAQgSAwoBCHIAA1NFUAICX18ABUVNUFRZAgAACVBSRUNJU0lPTgCAoJSljR0ACERFQ0lNQUxTAIDC1y8AFERFRkFVTFRfTUFYX1NMSVBQQUdFCQBoAgkAaQIFCVBSRUNJU0lPTgAUABMAA0RBWQkAaAIJAGgCADwAPAAYAARZRUFSCQBoAgUDREFZAO0CAA9PUkFDTEVfREVDSU1BTFMAwIQ9AAhJTkZJTklUWQD//////////38AEE1JTl9BTU9VTlRfREVMVEEA6AcAFU1BWF9SQVRFX0hFSUdIVF9ERUxUQQAFABFMSVFVSURBVElPTl9CT05VUwkAaAIJAGkCBQlQUkVDSVNJT04AZAAFABhMSVFVSURBVElPTl9QUk9UT0NPTF9GRUUJAGgCCQBpAgUJUFJFQ0lTSU9OAGQAAgAUTUFYX0xJUVVJREFUSU9OX1BBUlQJAGgCCQBpAgUJUFJFQ0lTSU9OAGQAMgANU1RBQklMSVRZX0ZFRQkAaQIFCVBSRUNJU0lPTgBkAAdFTkFCTEVEAgdFTkFCTEVEAAhESVNBQkxFRAIIRElTQUJMRUQAEklk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MY2hlY2tBZGRyZXNzAQUIX2FkZHJlc3MJAMwIAgkBE2NoZWNrQWRkcmVzc0VuYWJsZWQBBQhfYWRkcmVzcwUDbmlsAwkAAAIFBmNoZWNrcwUGY2hlY2tzCQDMCAIJAQxCb29sZWFuRW50cnkCCQERa2V5QWxsb3dlZEFkZHJlc3MBBQhfYWRkcmVzcwcFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAEByRtYXRjaDAJAQh2ZXJpZmllcgADCQABAgUHJG1hdGNoMAIGU3RyaW5nBAdhZGRyZXNzBQckbWF0Y2gwCQELdmFsdWVPckVsc2UCCQCbCAIJARFAZXh0ck5hdGl2ZSgxMDYyKQEFB2FkZHJlc3MJAQlrZXlTaWduZWQCCQClCAEFBHRoaXMJANgEAQgFAnR4AmlkBwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tledlmW70=", "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 | + | let ASSET_NAME = "EAST" | |
425 | + | ||
426 | + | let DESCRIPTION = "EAST — Enterprise Algorithmic Stable Token built on the Waves Enterprise and Waves mainnet. Ensured both by significant overcollateralization and well-defined liquidation mechanisms. https://east.finance/" | |
427 | + | ||
428 | + | func keyAllowedAddress (_address) = join(["%s%s", "allowedAddress", _address]) | |
429 | + | ||
430 | + | ||
431 | + | func isAddressEnabled (_address) = valueOrElse(getBoolean(this, keyAllowedAddress(_address)), false) | |
432 | + | ||
433 | + | ||
434 | + | func mustAllowedAddress (i) = { | |
435 | + | let callerAddressStr = toBase58String(i.caller.bytes) | |
436 | + | let isEnabled = isAddressEnabled(callerAddressStr) | |
437 | + | if (isEnabled) | |
438 | + | then unit | |
439 | + | else throw(((("Unknown caller address. " + toString(i.caller)) + " ") + toBase58String(i.caller.bytes))) | |
440 | + | } | |
441 | + | ||
442 | + | ||
443 | + | func checkAddressEnabled (_address) = if (isAddressEnabled(_address)) | |
444 | + | then unit | |
445 | + | else throw("Address already disabled") | |
446 | + | ||
447 | + | ||
448 | + | func checkAddressDisabled (_address) = if (isAddressEnabled(_address)) | |
449 | + | then throw("Address already enabled") | |
450 | + | else unit | |
451 | + | ||
452 | + | ||
453 | + | @Callable(i) | |
454 | + | func initialize (_coordinatorAddress) = { | |
455 | + | let checks = [mustNotInitialized(), checkAddress(_coordinatorAddress)] | |
456 | + | if ((checks == checks)) | |
457 | + | then { | |
458 | + | let east = Issue(ASSET_NAME, DESCRIPTION, 0, 8, true, unit, 0) | |
459 | + | let eastAssetId = calculateAssetId(east) | |
460 | + | [StringEntry(keyCoordinatorAddress(), _coordinatorAddress), StringEntry(keyEastAsset(), toBase58String(eastAssetId)), BooleanEntry(keyInitialized(), true), east] | |
461 | + | } | |
462 | + | else throw("Strict value is not equal to itself.") | |
463 | + | } | |
464 | + | ||
465 | + | ||
466 | + | ||
467 | + | @Callable(i) | |
468 | + | func issue (_eastAmount) = { | |
469 | + | let checks = [mustActive(), mustAllowedAddress(i)] | |
470 | + | if ((checks == checks)) | |
471 | + | then { | |
472 | + | let eastAsset = getEastAsset() | |
473 | + | [Reissue(eastAsset, _eastAmount, true), ScriptTransfer(i.caller, _eastAmount, eastAsset)] | |
474 | + | } | |
475 | + | else throw("Strict value is not equal to itself.") | |
476 | + | } | |
477 | + | ||
478 | + | ||
479 | + | ||
480 | + | @Callable(i) | |
481 | + | func addAddress (_address) = { | |
482 | + | let checks = [mustInitialized(), mustSelf(i), checkAddress(_address), checkAddressDisabled(_address)] | |
483 | + | if ((checks == checks)) | |
484 | + | then [BooleanEntry(keyAllowedAddress(_address), true)] | |
485 | + | else throw("Strict value is not equal to itself.") | |
486 | + | } | |
487 | + | ||
488 | + | ||
489 | + | ||
490 | + | @Callable(i) | |
491 | + | func removeAddress (_address) = { | |
492 | + | let checks = [mustInitialized(), mustSelf(i), checkAddress(_address), checkAddressEnabled(_address)] | |
493 | + | if ((checks == checks)) | |
494 | + | then [BooleanEntry(keyAllowedAddress(_address), false)] | |
495 | + | else throw("Strict value is not equal to itself.") | |
496 | + | } | |
497 | + | ||
498 | + | ||
499 | + | @Verifier(tx) | |
500 | + | func verify () = match verifier() { | |
501 | + | case address: String => | |
502 | + | valueOrElse(getBoolean(addressFromStringValue(address), keySigned(toString(this), toBase58String(tx.id))), false) | |
503 | + | case _ => | |
504 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
505 | + | } | |
506 | + |
github/deemru/w8io/169f3d6 26.24 ms ◑