tx · A8AfQzN6byh92CM4dK4aYvXDsh7Tix48KSmp1qdz5SYy 3N8bnD2caKnxdcTqvrJUEkDe3XebgfwWjSV: -0.01300000 Waves 2022.10.20 11:14 [2280469] smart account 3N8bnD2caKnxdcTqvrJUEkDe3XebgfwWjSV > SELF 0.00000000 Waves
{ "type": 13, "id": "A8AfQzN6byh92CM4dK4aYvXDsh7Tix48KSmp1qdz5SYy", "fee": 1300000, "feeAssetId": null, "timestamp": 1666253776783, "version": 1, "sender": "3N8bnD2caKnxdcTqvrJUEkDe3XebgfwWjSV", "senderPublicKey": "8KXPjDuC8ffL9qjNuDBLnkvJKbMojhZYcnm2o75UCyun", "proofs": [ "42ty3k8X1vDBej9XdA548B38Mazz6L84ZGa4hxgXzaHpwGJfteDFArkykjfzpTicCAHDTqPGx8odVFHWoiT1axMZ" ], "script": "base64:AAIFAAAAAAAAAzQIAhIDCgEIEgMKAQgSABIDCgEYEgMKAQgiA1NFUCIFRU1QVFkiDmlkeFBvb2xBZGRyZXNzIglpZHhMUEFzSWQiCWlkeEFtQXNJZCIJaWR4UHJBc0lkIg9pZHhGYWN0U3Rha0NudHIiC2tleUZhY3RDbnRyIhNrZXlNYW5hZ2VyUHVibGljS2V5IhprZXlQZW5kaW5nTWFuYWdlclB1YmxpY0tleSILa2V5UG9vbEFkZHIiC2tleUFtdEFzc2V0Ig1rZXlQcmljZUFzc2V0Ig9rZXlBZG1pblB1YktleXMiBmtleUFtcCINa2V5QW1wSGlzdG9yeSIGaGVpZ2h0IhBrZXlGYWN0b3J5Q29uZmlnIg1rZXlQb29sQ29uZmlnIgZpQW10QXMiBWlQckFzIh9rZXlNYXBwaW5nc0Jhc2VBc3NldDJpbnRlcm5hbElkIgViQVN0ciIha2V5QWxsb3dlZExwU3RhYmxlQWRkb25TY3JpcHRIYXNoIg9nZXRTdHJpbmdPckZhaWwiBGFkZHIiA2tleSIMZ2V0SW50T3JGYWlsIgxwb29sQ29udHJhY3QiD2ZhY3RvcnlDb250cmFjd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FkBQAAAAJhZQkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABAAAAAmFmAQAAAAJhZwAAAAAEAAAAAmFoBAAAAAFLCQEAAAABSgAAAAADCQAAAQAAAAIFAAAAAUsCAAAACkJ5dGVWZWN0b3IEAAAAAVEFAAAAAUsFAAAAAVEDCQAAAQAAAAIFAAAAAUsCAAAABFVuaXQIBQAAAAJhZgAAAA9zZW5kZXJQdWJsaWNLZXkJAAACAAAAAQIAAAALTWF0Y2ggZXJyb3IEAAAAAUsFAAAAAmFmAwkAAAEAAAACBQAAAAFLAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAABTAUAAAABSwQAAAACYWkJAAH2AAAAAQkBAAAABXZhbHVlAAAAAQgFAAAAAUwAAAAGc2NyaXB0BAAAAAJhagkAAlsAAAABCQEAAAAFdmFsdWUAAAABCQAEHQAAAAIFAAAAAUQJAQAAAAF4AAAAAAQAAAACYWsJAAPxAAAAAQUAAAAEdGhpcwMDCQAAAAAAAAIFAAAAAmFqBQAAAAJhaQkBAAAAAiE9AAAAAgUAAAACYWsFAAAAAmFpBwYJAAH0AAAAAwgFAAAAAmFmAAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACYWYAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAAJhaAkAAfQAAAADCAUAAAACYWYAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJhZgAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAAmFosNzZsg==", "chainId": 84, "height": 2280469, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ANasxk5k8isdGPnbR8LzoQmwtqMKdpqMtowKow5KqHGb Next: HZYAqc2SURZZJ86aVv8VNkMinZSoySw3H3ovzPxUaGTE Diff:
Old | New | Differences | |
---|---|---|---|
194 | 194 | if ((checkCaller == checkCaller)) | |
195 | 195 | then { | |
196 | 196 | let res1 = invoke(poolContract, "setS", [keyAmp(), amp], nil) | |
197 | - | let res2 = invoke(poolContract, "setS", [keyAmpHistory( | |
197 | + | let res2 = invoke(poolContract, "setS", [keyAmpHistory(q), amp], nil) | |
198 | 198 | $Tuple2(nil, $Tuple2(res1, res2)) | |
199 | 199 | } | |
200 | 200 | else throw("Strict value is not equal to itself.") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let EMPTY = "" | |
7 | 7 | ||
8 | 8 | let idxPoolAddress = 1 | |
9 | 9 | ||
10 | 10 | let idxLPAsId = 3 | |
11 | 11 | ||
12 | 12 | let idxAmAsId = 4 | |
13 | 13 | ||
14 | 14 | let idxPrAsId = 5 | |
15 | 15 | ||
16 | 16 | let idxFactStakCntr = 1 | |
17 | 17 | ||
18 | 18 | func keyFactCntr () = "%s__factoryContract" | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func keyPoolAddr () = "%s__poolAddress" | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func keyAmtAsset () = "%s__amountAsset" | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func keyPriceAsset () = "%s__priceAsset" | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func keyAdminPubKeys () = "%s__adminPubKeys" | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func keyAmp () = "%s__amp" | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func keyAmpHistory (height) = ("%s%d__amp__" + toString(height)) | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func keyFactoryConfig () = "%s__factoryConfig" | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func keyPoolConfig (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config") | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func keyMappingsBaseAsset2internalId (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr) | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func keyAllowedLpStableAddonScriptHash () = "%s__allowedLpStableAddonScriptHash" | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func getStringOrFail (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func getIntOrFail (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | let poolContract = addressFromStringValue(getStringOrFail(this, keyPoolAddr())) | |
64 | 64 | ||
65 | 65 | let factoryContract = addressFromStringValue(getStringOrFail(poolContract, keyFactCntr())) | |
66 | 66 | ||
67 | 67 | func getPoolConfig () = { | |
68 | 68 | let amtAs = getStringOrFail(poolContract, keyAmtAsset()) | |
69 | 69 | let priceAs = getStringOrFail(poolContract, keyPriceAsset()) | |
70 | 70 | let iPriceAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAs)) | |
71 | 71 | let iAmtAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAs)) | |
72 | 72 | split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAs), toString(iPriceAs))), SEP) | |
73 | 73 | } | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP) | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
80 | 80 | case s: String => | |
81 | 81 | fromBase58String(s) | |
82 | 82 | case _: Unit => | |
83 | 83 | unit | |
84 | 84 | case _ => | |
85 | 85 | throw("Match error") | |
86 | 86 | } | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
90 | 90 | case s: String => | |
91 | 91 | fromBase58String(s) | |
92 | 92 | case _: Unit => | |
93 | 93 | unit | |
94 | 94 | case _ => | |
95 | 95 | throw("Match error") | |
96 | 96 | } | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func mustManager (i) = { | |
100 | 100 | let pd = throw("Permission denied") | |
101 | 101 | match managerPublicKeyOrUnit() { | |
102 | 102 | case pk: ByteVector => | |
103 | 103 | if ((i.callerPublicKey == pk)) | |
104 | 104 | then true | |
105 | 105 | else pd | |
106 | 106 | case _: Unit => | |
107 | 107 | if ((i.caller == this)) | |
108 | 108 | then true | |
109 | 109 | else pd | |
110 | 110 | case _ => | |
111 | 111 | throw("Match error") | |
112 | 112 | } | |
113 | 113 | } | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func getAdmins () = match getString(keyAdminPubKeys()) { | |
117 | 117 | case s: String => | |
118 | 118 | if ((size(s) == 0)) | |
119 | 119 | then nil | |
120 | 120 | else split(s, SEP) | |
121 | 121 | case _ => | |
122 | 122 | nil | |
123 | 123 | } | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | func mustAdmin (i) = if (containsElement(getAdmins(), toBase58String(i.callerPublicKey))) | |
127 | 127 | then true | |
128 | 128 | else mustManager(i) | |
129 | 129 | ||
130 | 130 | ||
131 | 131 | func mustPool (i) = if ((i.caller == poolContract)) | |
132 | 132 | then true | |
133 | 133 | else throw("caller must be the pool") | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | @Callable(i) | |
137 | 137 | func constructor (poolAddress) = { | |
138 | 138 | let checkCaller = mustManager(i) | |
139 | 139 | if ((checkCaller == checkCaller)) | |
140 | 140 | then [StringEntry(keyPoolAddr(), poolAddress)] | |
141 | 141 | else throw("Strict value is not equal to itself.") | |
142 | 142 | } | |
143 | 143 | ||
144 | 144 | ||
145 | 145 | ||
146 | 146 | @Callable(i) | |
147 | 147 | func setManager (pendingManagerPublicKey) = { | |
148 | 148 | let checkCaller = mustManager(i) | |
149 | 149 | if ((checkCaller == checkCaller)) | |
150 | 150 | then { | |
151 | 151 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
152 | 152 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
153 | 153 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
154 | 154 | else throw("Strict value is not equal to itself.") | |
155 | 155 | } | |
156 | 156 | else throw("Strict value is not equal to itself.") | |
157 | 157 | } | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | ||
161 | 161 | @Callable(i) | |
162 | 162 | func confirmManager () = { | |
163 | 163 | let pm = pendingManagerPublicKeyOrUnit() | |
164 | 164 | let hasPM = if (isDefined(pm)) | |
165 | 165 | then true | |
166 | 166 | else throw("No pending manager") | |
167 | 167 | if ((hasPM == hasPM)) | |
168 | 168 | then { | |
169 | 169 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
170 | 170 | then true | |
171 | 171 | else throw("You are not pending manager") | |
172 | 172 | if ((checkPM == checkPM)) | |
173 | 173 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
174 | 174 | else throw("Strict value is not equal to itself.") | |
175 | 175 | } | |
176 | 176 | else throw("Strict value is not equal to itself.") | |
177 | 177 | } | |
178 | 178 | ||
179 | 179 | ||
180 | 180 | ||
181 | 181 | @Callable(i) | |
182 | 182 | func setAdmins (adminPubKeys) = { | |
183 | 183 | let checkCaller = mustManager(i) | |
184 | 184 | if ((checkCaller == checkCaller)) | |
185 | 185 | then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))] | |
186 | 186 | else throw("Strict value is not equal to itself.") | |
187 | 187 | } | |
188 | 188 | ||
189 | 189 | ||
190 | 190 | ||
191 | 191 | @Callable(i) | |
192 | 192 | func setAmp (amp) = { | |
193 | 193 | let checkCaller = mustAdmin(i) | |
194 | 194 | if ((checkCaller == checkCaller)) | |
195 | 195 | then { | |
196 | 196 | let res1 = invoke(poolContract, "setS", [keyAmp(), amp], nil) | |
197 | - | let res2 = invoke(poolContract, "setS", [keyAmpHistory( | |
197 | + | let res2 = invoke(poolContract, "setS", [keyAmpHistory(q), amp], nil) | |
198 | 198 | $Tuple2(nil, $Tuple2(res1, res2)) | |
199 | 199 | } | |
200 | 200 | else throw("Strict value is not equal to itself.") | |
201 | 201 | } | |
202 | 202 | ||
203 | 203 | ||
204 | 204 | @Verifier(tx) | |
205 | 205 | func verify () = { | |
206 | 206 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
207 | 207 | case pk: ByteVector => | |
208 | 208 | pk | |
209 | 209 | case _: Unit => | |
210 | 210 | tx.senderPublicKey | |
211 | 211 | case _ => | |
212 | 212 | throw("Match error") | |
213 | 213 | } | |
214 | 214 | match tx { | |
215 | 215 | case s: SetScriptTransaction => | |
216 | 216 | let newHash = blake2b256(value(s.script)) | |
217 | 217 | let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpStableAddonScriptHash()))) | |
218 | 218 | let currentHash = scriptHash(this) | |
219 | 219 | if (if ((allowedHash == newHash)) | |
220 | 220 | then (currentHash != newHash) | |
221 | 221 | else false) | |
222 | 222 | then true | |
223 | 223 | else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
224 | 224 | case _ => | |
225 | 225 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
226 | 226 | } | |
227 | 227 | } | |
228 | 228 |
github/deemru/w8io/026f985 50.75 ms ◑