tx · HjFvv3j35e5TwwEtYV7so2ejtp5X22c6tViDxACXxUxr 3NCWKEwSkNpCDpFkDSF7Pg1yv8Pqrgdph3D: -0.05000000 Waves 2023.07.12 15:24 [2662676] smart account 3NCWKEwSkNpCDpFkDSF7Pg1yv8Pqrgdph3D > SELF 0.00000000 Waves
{ "type": 13, "id": "HjFvv3j35e5TwwEtYV7so2ejtp5X22c6tViDxACXxUxr", "fee": 5000000, "feeAssetId": null, "timestamp": 1689164702931, "version": 2, "chainId": 84, "sender": "3NCWKEwSkNpCDpFkDSF7Pg1yv8Pqrgdph3D", "senderPublicKey": "6de3x4WyduDERSi3R1DZofPec5fJbTN1aF19RGvPkz6v", "proofs": [ "2XqCpE5p6PwfzReu4ptyw7vdtzbNE6jmAe6ZHaeWEpzfUxhzvnCnGFrJn5rPsFjq4isKz6mHsVmawAmCGExboZxe" ], "script": "base64:BgLHBAgCEgMKAQgSAwoBARIDCgEIEgMKAQgiA1NFUCIEam9pbiICYXIiDmtleUluaXRpYWxpemVkIhVrZXlDb29yZGluYXRvckFkZHJlc3MiEmtleVZlcmlmaWVyQWRkcmVzcyIMa2V5RWFzdEFzc2V0IglrZXlTaWduZWQiCF9hZGRyZXNzIgVfdHhJZCIRa2V5UHJvdG9jb2xBY3RpdmUiDWlzSW5pdGlhbGl6ZWQiD211c3RJbml0aWFsaXplZCISbXVzdE5vdEluaXRpYWxpemVkIghtdXN0U2VsZiIBaSILY29vcmRpbmF0b3IiCHZlcmlmaWVyIgckbWF0Y2gwIgFzIg9nZXRFYXN0QXNzZXRTdHIiDGdldEVhc3RBc3NldCIIaXNBY3RpdmUiCm11c3RBY3RpdmUiCmlzUG9zaXRpdmUiBm51bWJlciIMY2hlY2tBZGRyZXNzIgdhZGRyZXNzIgpBU1NFVF9OQU1FIgtERVNDUklQVElPTiIRa2V5QWxsb3dlZEFkZHJlc3MiEGlzQWRkcmVzc0VuYWJsZWQiEm11c3RBbGxvd2VkQWRkcmVzcyIQY2FsbGVyQWRkc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DMCAIJAQFKAQUBaQUDbmlsAwkAAAIFAU0FAU0JAMwIAgkBDEJvb2xlYW5FbnRyeQIJAQFFAQUBaQcFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgEBUgEBUwAEAXMJAQFyAAMJAAECBQFzAgZTdHJpbmcEAUIFAXMJAQt2YWx1ZU9yRWxzZQIJAJsIAgkBEUBleHRyTmF0aXZlKDEwNjIpAQUBQgkBAWgCCQClCAEFBHRoaXMJANgEAQgFAVICaWQHCQD0AwMIBQFSCWJvZHlCeXRlcwkAkQMCCAUBUgZwcm9vZnMAAAgFAVIPc2VuZGVyUHVibGljS2V5OcT3Iw==", "height": 2662676, "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 | + | func join (ar) = makeString(ar, SEP) | |
7 | + | ||
8 | + | ||
9 | + | func keyInitialized () = join(["%s", "initialized"]) | |
10 | + | ||
11 | + | ||
12 | + | func keyCoordinatorAddress () = join(["%s", "coordinatorAddress"]) | |
13 | + | ||
14 | + | ||
15 | + | func keyVerifierAddress () = join(["%s", "verifierAddress"]) | |
16 | + | ||
17 | + | ||
18 | + | func keyEastAsset () = join(["%s", "eastAsset"]) | |
19 | + | ||
20 | + | ||
21 | + | func keySigned (_address,_txId) = join(["%s%s%s", "signed", _address, _txId]) | |
22 | + | ||
23 | + | ||
24 | + | func keyProtocolActive () = join(["%s", "protocolActive"]) | |
25 | + | ||
26 | + | ||
27 | + | func isInitialized () = valueOrElse(getBoolean(this, keyInitialized()), false) | |
28 | + | ||
29 | + | ||
30 | + | func mustInitialized () = if (!(isInitialized())) | |
31 | + | then throw("Not initialized") | |
32 | + | else unit | |
33 | + | ||
34 | + | ||
35 | + | func mustNotInitialized () = if (isInitialized()) | |
36 | + | then throw("Already initialized") | |
37 | + | else unit | |
38 | + | ||
39 | + | ||
40 | + | func mustSelf (i) = if ((i.caller != this)) | |
41 | + | then throw("Only self invocation allowed.") | |
42 | + | else unit | |
43 | + | ||
44 | + | ||
45 | + | func coordinator () = addressFromStringValue(valueOrErrorMessage(getString(keyCoordinatorAddress()), "Coordinator is not set")) | |
46 | + | ||
47 | + | ||
48 | + | func verifier () = match getString(keyCoordinatorAddress()) { | |
49 | + | case s: String => | |
50 | + | getString(addressFromStringValue(s), keyVerifierAddress()) | |
51 | + | case _: Unit => | |
52 | + | unit | |
53 | + | case _ => | |
54 | + | throw("Match error") | |
55 | + | } | |
56 | + | ||
57 | + | ||
58 | + | func getEastAssetStr () = valueOrErrorMessage(getString(coordinator(), keyEastAsset()), "East asset is not set") | |
59 | + | ||
60 | + | ||
61 | + | func getEastAsset () = fromBase58String(getEastAssetStr()) | |
62 | + | ||
63 | + | ||
64 | + | func isActive () = valueOrElse(getBoolean(coordinator(), keyProtocolActive()), false) | |
65 | + | ||
66 | + | ||
67 | + | func mustActive () = if (if (!(isActive())) | |
68 | + | then true | |
69 | + | else !(isInitialized())) | |
70 | + | then throw("Protocol is disabled. Please contact support.") | |
71 | + | else unit | |
72 | + | ||
73 | + | ||
74 | + | func isPositive (number) = if ((0 >= number)) | |
75 | + | then throw("Attribute should be positive.") | |
76 | + | else unit | |
77 | + | ||
78 | + | ||
79 | + | func checkAddress (_address) = match addressFromString(_address) { | |
80 | + | case address: Address => | |
81 | + | true | |
82 | + | case _: Unit => | |
83 | + | throw("Invalid address") | |
84 | + | case _ => | |
85 | + | throw("Match error") | |
86 | + | } | |
87 | + | ||
88 | + | ||
89 | + | let ASSET_NAME = "EAST" | |
90 | + | ||
91 | + | 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/" | |
92 | + | ||
93 | + | func keyAllowedAddress (_address) = join(["%s%s", "allowedAddress", _address]) | |
94 | + | ||
95 | + | ||
96 | + | func isAddressEnabled (_address) = valueOrElse(getBoolean(this, keyAllowedAddress(_address)), false) | |
97 | + | ||
98 | + | ||
99 | + | func mustAllowedAddress (i) = { | |
100 | + | let callerAddressStr = toBase58String(i.caller.bytes) | |
101 | + | let isEnabled = isAddressEnabled(callerAddressStr) | |
102 | + | if (isEnabled) | |
103 | + | then unit | |
104 | + | else throw(((("Unknown caller address. " + toString(i.caller)) + " ") + toBase58String(i.caller.bytes))) | |
105 | + | } | |
106 | + | ||
107 | + | ||
108 | + | func checkAddressEnabled (_address) = if (isAddressEnabled(_address)) | |
109 | + | then unit | |
110 | + | else throw("Address already disabled") | |
111 | + | ||
112 | + | ||
113 | + | func checkAddressDisabled (_address) = if (isAddressEnabled(_address)) | |
114 | + | then throw("Address already enabled") | |
115 | + | else unit | |
116 | + | ||
117 | + | ||
118 | + | @Callable(i) | |
119 | + | func initialize (_coordinatorAddress) = { | |
120 | + | let checks = [mustSelf(i), mustNotInitialized(), checkAddress(_coordinatorAddress)] | |
121 | + | if ((checks == checks)) | |
122 | + | then { | |
123 | + | let east = Issue(ASSET_NAME, DESCRIPTION, 0, 6, true, unit, 0) | |
124 | + | let eastAssetId = calculateAssetId(east) | |
125 | + | [StringEntry(keyCoordinatorAddress(), _coordinatorAddress), StringEntry(keyEastAsset(), toBase58String(eastAssetId)), BooleanEntry(keyInitialized(), true), east] | |
126 | + | } | |
127 | + | else throw("Strict value is not equal to itself.") | |
128 | + | } | |
129 | + | ||
130 | + | ||
131 | + | ||
132 | + | @Callable(i) | |
133 | + | func issue (_amount) = { | |
134 | + | let checks = [mustActive(), mustAllowedAddress(i), isPositive(_amount)] | |
135 | + | if ((checks == checks)) | |
136 | + | then { | |
137 | + | let asset = getEastAsset() | |
138 | + | [Reissue(asset, _amount, true), ScriptTransfer(i.caller, _amount, asset)] | |
139 | + | } | |
140 | + | else throw("Strict value is not equal to itself.") | |
141 | + | } | |
142 | + | ||
143 | + | ||
144 | + | ||
145 | + | @Callable(i) | |
146 | + | func addAddress (_address) = { | |
147 | + | let checks = [mustInitialized(), mustSelf(i), checkAddress(_address), checkAddressDisabled(_address)] | |
148 | + | if ((checks == checks)) | |
149 | + | then [BooleanEntry(keyAllowedAddress(_address), true)] | |
150 | + | else throw("Strict value is not equal to itself.") | |
151 | + | } | |
152 | + | ||
153 | + | ||
154 | + | ||
155 | + | @Callable(i) | |
156 | + | func removeAddress (_address) = { | |
157 | + | let checks = [mustInitialized(), mustSelf(i), checkAddress(_address), checkAddressEnabled(_address)] | |
158 | + | if ((checks == checks)) | |
159 | + | then [BooleanEntry(keyAllowedAddress(_address), false)] | |
160 | + | else throw("Strict value is not equal to itself.") | |
161 | + | } | |
162 | + | ||
163 | + | ||
164 | + | @Verifier(tx) | |
165 | + | func verify () = match verifier() { | |
166 | + | case address: String => | |
167 | + | valueOrElse(getBoolean(addressFromStringValue(address), keySigned(toString(this), toBase58String(tx.id))), false) | |
168 | + | case _ => | |
169 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
170 | + | } | |
171 | + |
github/deemru/w8io/169f3d6 23.94 ms ◑