tx · 8ymj6hzeVJHuMzMvKGZC62TPWBytjr1WRWoRtavBd6WH 3N8bnD2caKnxdcTqvrJUEkDe3XebgfwWjSV: -0.01500000 Waves 2022.09.02 11:04 [2211254] smart account 3N8bnD2caKnxdcTqvrJUEkDe3XebgfwWjSV > SELF 0.00000000 Waves
{ "type": 13, "id": "8ymj6hzeVJHuMzMvKGZC62TPWBytjr1WRWoRtavBd6WH", "fee": 1500000, "feeAssetId": null, "timestamp": 1662105862730, "version": 2, "chainId": 84, "sender": "3N8bnD2caKnxdcTqvrJUEkDe3XebgfwWjSV", "senderPublicKey": "8KXPjDuC8ffL9qjNuDBLnkvJKbMojhZYcnm2o75UCyun", "proofs": [ "33fzBK5fDRraXg5NbePFgxJWwKjx3wrzhozPvprnYmwBC8NejAYq9G6n2hkqZq94gu2ZJ1PaAUpLYDrhRHftFMA7" ], "script": "base64:AAIFAAAAAAAAACwIAhIDCgEIEgMKAQgSABIDCgEYEggKBgEBAQEIARIDCgEIEgMKAQgSAwoBCAAAACMAAAAAA1NFUAIAAAACX18AAAAABUVNUFRZAgAAAAAAAAAADmlkeFBvb2xBZGRyZXNzAAAAAAAAAAABAAAAAAlpZHhMUEFzSWQAAAAAAAAAAAMAAAAACWlkeEFtQXNJZAAAAAAAAAAABAAAAAAJaWR4UHJBc0lkAAAAAAAAAAAFAAAAAA9pZHhGYWN0U3Rha0NudHIAAAAAAAAAAAEAAAAABWRlbGF5AgAAAAklc19fZGVsYXkBAAAAC2tleUZhY3RDbnRyAAAAAAIAAAATJXNfX2ZhY3RvcnlDb250cmFjdAEAAAATa2V5TWFuYWdlclB1YmxpY0tleQAAAAACAAAAFCVzX19tYW5hZ2VyUHVibGljS2V5AQAAABprZXlQZW5kaW5nTWFuYWdlclB1YmxpY0tleQAAAAACAAAAGyVzX19wZW5kaW5nTWFuYWdlclB1YmxpY0tleQEAAAALa2V5UG9vbEFkZHIAAAAAAgAAAA8lc19fcG9vbEFkZHJlc3MBAAAAC2tleUFtdEFzc2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WN0aW9uBAAAAAFzBQAAAAckbWF0Y2gwBAAAAAduZXdIYXNoCQAB9gAAAAEJAQAAAAV2YWx1ZQAAAAEIBQAAAAFzAAAABnNjcmlwdAQAAAALYWxsb3dlZEhhc2gJAAJbAAAAAQkBAAAABXZhbHVlAAAAAQkABB0AAAACBQAAAA9mYWN0b3J5Q29udHJhY3QJAQAAACFrZXlBbGxvd2VkTHBTdGFibGVBZGRvblNjcmlwdEhhc2gAAAAABAAAAAtjdXJyZW50SGFzaAkAA/EAAAABBQAAAAR0aGlzAwMJAAAAAAAAAgUAAAALYWxsb3dlZEhhc2gFAAAAB25ld0hhc2gJAQAAAAIhPQAAAAIFAAAAC2N1cnJlbnRIYXNoBQAAAAduZXdIYXNoBwYJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA90YXJnZXRQdWJsaWNLZXkJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA90YXJnZXRQdWJsaWNLZXkEAUwr", "height": 2211254, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HGW6D3CpavRxM9jodJHUydkjwT4bSZPe9Q7FqUJwMTMd Next: 8ejagzni4ZP8hdKbfST6QzK9ZvUgYoDjpHGNPqeJDwb4 Diff:
Old | New | Differences | |
---|---|---|---|
14 | 14 | let idxPrAsId = 5 | |
15 | 15 | ||
16 | 16 | let idxFactStakCntr = 1 | |
17 | + | ||
18 | + | let delay = "%s__delay" | |
17 | 19 | ||
18 | 20 | func keyFactCntr () = "%s__factoryContract" | |
19 | 21 | ||
42 | 44 | func keyAmpHistory (height) = ("%s%d__amp__" + toString(height)) | |
43 | 45 | ||
44 | 46 | ||
47 | + | func lastGetOneTknCall (caller) = makeString(["%s%s__lastGetOneTknCall", caller], SEP) | |
48 | + | ||
49 | + | ||
50 | + | func lastPutOneTknCall (caller) = makeString(["%s%s__lastPutOneTknCall", caller], SEP) | |
51 | + | ||
52 | + | ||
45 | 53 | func keyFactoryConfig () = "%s__factoryConfig" | |
46 | 54 | ||
47 | 55 | ||
49 | 57 | ||
50 | 58 | ||
51 | 59 | func keyMappingsBaseAsset2internalId (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr) | |
60 | + | ||
61 | + | ||
62 | + | func keyAllowedLpStableAddonScriptHash () = "%s__allowedLpStableAddonScriptHash" | |
52 | 63 | ||
53 | 64 | ||
54 | 65 | func getStringOrFail (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
199 | 210 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
200 | 211 | if ((unstakeInv == unstakeInv)) | |
201 | 212 | then { | |
202 | - | let getOneTkn = | |
213 | + | let getOneTkn = reentrantInvoke(poolContract, "getOneTkn", [exchResult, notUsed, outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)]) | |
203 | 214 | if ((getOneTkn == getOneTkn)) | |
204 | 215 | then nil | |
205 | 216 | else throw("Strict value is not equal to itself.") | |
224 | 235 | } | |
225 | 236 | ||
226 | 237 | ||
238 | + | ||
239 | + | @Callable(i) | |
240 | + | func ensureCanGetOneTkn (caller) = { | |
241 | + | let checkCaller = mustPool(i) | |
242 | + | if ((checkCaller == checkCaller)) | |
243 | + | then { | |
244 | + | let ensureCanPut = match getInteger(poolContract, lastPutOneTknCall(caller)) { | |
245 | + | case int: Int => | |
246 | + | let permittedHeight = (int + value(getInteger(poolContract, delay))) | |
247 | + | let isReadyforPutOneTkn = (height >= permittedHeight) | |
248 | + | let needBlocks = (permittedHeight - height) | |
249 | + | if (isReadyforPutOneTkn) | |
250 | + | then true | |
251 | + | else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " ")) | |
252 | + | case _ => | |
253 | + | true | |
254 | + | } | |
255 | + | if ((ensureCanPut == ensureCanPut)) | |
256 | + | then { | |
257 | + | let ensureCanGet = match getInteger(poolContract, lastGetOneTknCall(caller)) { | |
258 | + | case int: Int => | |
259 | + | let permittedHeight = (int + value(getInteger(poolContract, delay))) | |
260 | + | let isReadyforGetOneTkn = (height >= permittedHeight) | |
261 | + | let needBlocks = (permittedHeight - height) | |
262 | + | if (isReadyforGetOneTkn) | |
263 | + | then true | |
264 | + | else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " ")) | |
265 | + | case _ => | |
266 | + | true | |
267 | + | } | |
268 | + | if ((ensureCanGet == ensureCanGet)) | |
269 | + | then { | |
270 | + | let setI = invoke(poolContract, "setI", [lastPutOneTknCall(caller), height], nil) | |
271 | + | if ((setI == setI)) | |
272 | + | then nil | |
273 | + | else throw("Strict value is not equal to itself.") | |
274 | + | } | |
275 | + | else throw("Strict value is not equal to itself.") | |
276 | + | } | |
277 | + | else throw("Strict value is not equal to itself.") | |
278 | + | } | |
279 | + | else throw("Strict value is not equal to itself.") | |
280 | + | } | |
281 | + | ||
282 | + | ||
283 | + | ||
284 | + | @Callable(i) | |
285 | + | func ensureCanPutOneTkn (caller) = { | |
286 | + | let checkCaller = mustPool(i) | |
287 | + | if ((checkCaller == checkCaller)) | |
288 | + | then { | |
289 | + | let ensureCanPut = match getInteger(poolContract, lastPutOneTknCall(caller)) { | |
290 | + | case int: Int => | |
291 | + | let permittedHeight = (int + value(getInteger(poolContract, delay))) | |
292 | + | let isReadyforPutOneTkn = (height >= permittedHeight) | |
293 | + | let needBlocks = (permittedHeight - height) | |
294 | + | if (isReadyforPutOneTkn) | |
295 | + | then true | |
296 | + | else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " ")) | |
297 | + | case _ => | |
298 | + | true | |
299 | + | } | |
300 | + | if ((ensureCanPut == ensureCanPut)) | |
301 | + | then { | |
302 | + | let ensureCanGet = match getInteger(poolContract, lastGetOneTknCall(caller)) { | |
303 | + | case int: Int => | |
304 | + | let permittedHeight = (int + value(getInteger(poolContract, delay))) | |
305 | + | let isReadyforGetOneTkn = (height >= permittedHeight) | |
306 | + | let needBlocks = (permittedHeight - height) | |
307 | + | if (isReadyforGetOneTkn) | |
308 | + | then true | |
309 | + | else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " ")) | |
310 | + | case _ => | |
311 | + | true | |
312 | + | } | |
313 | + | if ((ensureCanGet == ensureCanGet)) | |
314 | + | then { | |
315 | + | let setI = invoke(poolContract, "setI", [lastPutOneTknCall(caller), height], nil) | |
316 | + | if ((setI == setI)) | |
317 | + | then nil | |
318 | + | else throw("Strict value is not equal to itself.") | |
319 | + | } | |
320 | + | else throw("Strict value is not equal to itself.") | |
321 | + | } | |
322 | + | else throw("Strict value is not equal to itself.") | |
323 | + | } | |
324 | + | else throw("Strict value is not equal to itself.") | |
325 | + | } | |
326 | + | ||
327 | + | ||
227 | 328 | @Verifier(tx) | |
228 | 329 | func verify () = { | |
229 | 330 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
234 | 335 | case _ => | |
235 | 336 | throw("Match error") | |
236 | 337 | } | |
237 | - | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
338 | + | match tx { | |
339 | + | case s: SetScriptTransaction => | |
340 | + | let newHash = blake2b256(value(s.script)) | |
341 | + | let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpStableAddonScriptHash()))) | |
342 | + | let currentHash = scriptHash(this) | |
343 | + | if (if ((allowedHash == newHash)) | |
344 | + | then (currentHash != newHash) | |
345 | + | else false) | |
346 | + | then true | |
347 | + | else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
348 | + | case _ => | |
349 | + | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
350 | + | } | |
238 | 351 | } | |
239 | 352 |
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 | + | ||
18 | + | let delay = "%s__delay" | |
17 | 19 | ||
18 | 20 | func keyFactCntr () = "%s__factoryContract" | |
19 | 21 | ||
20 | 22 | ||
21 | 23 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
22 | 24 | ||
23 | 25 | ||
24 | 26 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
25 | 27 | ||
26 | 28 | ||
27 | 29 | func keyPoolAddr () = "%s__poolAddress" | |
28 | 30 | ||
29 | 31 | ||
30 | 32 | func keyAmtAsset () = "%s__amountAsset" | |
31 | 33 | ||
32 | 34 | ||
33 | 35 | func keyPriceAsset () = "%s__priceAsset" | |
34 | 36 | ||
35 | 37 | ||
36 | 38 | func keyAdminPubKeys () = "%s__adminPubKeys" | |
37 | 39 | ||
38 | 40 | ||
39 | 41 | func keyAmp () = "%s__amp" | |
40 | 42 | ||
41 | 43 | ||
42 | 44 | func keyAmpHistory (height) = ("%s%d__amp__" + toString(height)) | |
43 | 45 | ||
44 | 46 | ||
47 | + | func lastGetOneTknCall (caller) = makeString(["%s%s__lastGetOneTknCall", caller], SEP) | |
48 | + | ||
49 | + | ||
50 | + | func lastPutOneTknCall (caller) = makeString(["%s%s__lastPutOneTknCall", caller], SEP) | |
51 | + | ||
52 | + | ||
45 | 53 | func keyFactoryConfig () = "%s__factoryConfig" | |
46 | 54 | ||
47 | 55 | ||
48 | 56 | func keyPoolConfig (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config") | |
49 | 57 | ||
50 | 58 | ||
51 | 59 | func keyMappingsBaseAsset2internalId (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr) | |
60 | + | ||
61 | + | ||
62 | + | func keyAllowedLpStableAddonScriptHash () = "%s__allowedLpStableAddonScriptHash" | |
52 | 63 | ||
53 | 64 | ||
54 | 65 | func getStringOrFail (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
55 | 66 | ||
56 | 67 | ||
57 | 68 | func getIntOrFail (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
58 | 69 | ||
59 | 70 | ||
60 | 71 | let poolContract = addressFromStringValue(getStringOrFail(this, keyPoolAddr())) | |
61 | 72 | ||
62 | 73 | let factoryContract = addressFromStringValue(getStringOrFail(poolContract, keyFactCntr())) | |
63 | 74 | ||
64 | 75 | func getPoolConfig () = { | |
65 | 76 | let amtAs = getStringOrFail(poolContract, keyAmtAsset()) | |
66 | 77 | let priceAs = getStringOrFail(poolContract, keyPriceAsset()) | |
67 | 78 | let iPriceAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAs)) | |
68 | 79 | let iAmtAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAs)) | |
69 | 80 | split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAs), toString(iPriceAs))), SEP) | |
70 | 81 | } | |
71 | 82 | ||
72 | 83 | ||
73 | 84 | func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP) | |
74 | 85 | ||
75 | 86 | ||
76 | 87 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
77 | 88 | case s: String => | |
78 | 89 | fromBase58String(s) | |
79 | 90 | case _: Unit => | |
80 | 91 | unit | |
81 | 92 | case _ => | |
82 | 93 | throw("Match error") | |
83 | 94 | } | |
84 | 95 | ||
85 | 96 | ||
86 | 97 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
87 | 98 | case s: String => | |
88 | 99 | fromBase58String(s) | |
89 | 100 | case _: Unit => | |
90 | 101 | unit | |
91 | 102 | case _ => | |
92 | 103 | throw("Match error") | |
93 | 104 | } | |
94 | 105 | ||
95 | 106 | ||
96 | 107 | func mustManager (i) = { | |
97 | 108 | let pd = throw("Permission denied") | |
98 | 109 | match managerPublicKeyOrUnit() { | |
99 | 110 | case pk: ByteVector => | |
100 | 111 | if ((i.callerPublicKey == pk)) | |
101 | 112 | then true | |
102 | 113 | else pd | |
103 | 114 | case _: Unit => | |
104 | 115 | if ((i.caller == this)) | |
105 | 116 | then true | |
106 | 117 | else pd | |
107 | 118 | case _ => | |
108 | 119 | throw("Match error") | |
109 | 120 | } | |
110 | 121 | } | |
111 | 122 | ||
112 | 123 | ||
113 | 124 | func getAdmins () = match getString(keyAdminPubKeys()) { | |
114 | 125 | case s: String => | |
115 | 126 | if ((size(s) == 0)) | |
116 | 127 | then nil | |
117 | 128 | else split(s, SEP) | |
118 | 129 | case _ => | |
119 | 130 | nil | |
120 | 131 | } | |
121 | 132 | ||
122 | 133 | ||
123 | 134 | func mustAdmin (i) = if (containsElement(getAdmins(), toBase58String(i.callerPublicKey))) | |
124 | 135 | then true | |
125 | 136 | else mustManager(i) | |
126 | 137 | ||
127 | 138 | ||
128 | 139 | func mustPool (i) = if ((i.caller == poolContract)) | |
129 | 140 | then true | |
130 | 141 | else throw("caller must be the pool") | |
131 | 142 | ||
132 | 143 | ||
133 | 144 | @Callable(i) | |
134 | 145 | func constructor (poolAddress) = { | |
135 | 146 | let checkCaller = mustManager(i) | |
136 | 147 | if ((checkCaller == checkCaller)) | |
137 | 148 | then [StringEntry(keyPoolAddr(), poolAddress)] | |
138 | 149 | else throw("Strict value is not equal to itself.") | |
139 | 150 | } | |
140 | 151 | ||
141 | 152 | ||
142 | 153 | ||
143 | 154 | @Callable(i) | |
144 | 155 | func setManager (pendingManagerPublicKey) = { | |
145 | 156 | let checkCaller = mustManager(i) | |
146 | 157 | if ((checkCaller == checkCaller)) | |
147 | 158 | then { | |
148 | 159 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
149 | 160 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
150 | 161 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
151 | 162 | else throw("Strict value is not equal to itself.") | |
152 | 163 | } | |
153 | 164 | else throw("Strict value is not equal to itself.") | |
154 | 165 | } | |
155 | 166 | ||
156 | 167 | ||
157 | 168 | ||
158 | 169 | @Callable(i) | |
159 | 170 | func confirmManager () = { | |
160 | 171 | let pm = pendingManagerPublicKeyOrUnit() | |
161 | 172 | let hasPM = if (isDefined(pm)) | |
162 | 173 | then true | |
163 | 174 | else throw("No pending manager") | |
164 | 175 | if ((hasPM == hasPM)) | |
165 | 176 | then { | |
166 | 177 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
167 | 178 | then true | |
168 | 179 | else throw("You are not pending manager") | |
169 | 180 | if ((checkPM == checkPM)) | |
170 | 181 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
171 | 182 | else throw("Strict value is not equal to itself.") | |
172 | 183 | } | |
173 | 184 | else throw("Strict value is not equal to itself.") | |
174 | 185 | } | |
175 | 186 | ||
176 | 187 | ||
177 | 188 | ||
178 | 189 | @Callable(i) | |
179 | 190 | func setAdmins (adminPubKeys) = { | |
180 | 191 | let checkCaller = mustManager(i) | |
181 | 192 | if ((checkCaller == checkCaller)) | |
182 | 193 | then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))] | |
183 | 194 | else throw("Strict value is not equal to itself.") | |
184 | 195 | } | |
185 | 196 | ||
186 | 197 | ||
187 | 198 | ||
188 | 199 | @Callable(i) | |
189 | 200 | func unstakeAndGetOneTkn (amount,exchResult,notUsed,outAmount,outAssetId,slippage) = { | |
190 | 201 | let checkPayments = if ((size(i.payments) != 0)) | |
191 | 202 | then throw("No pmnts expd") | |
192 | 203 | else true | |
193 | 204 | if ((checkPayments == checkPayments)) | |
194 | 205 | then { | |
195 | 206 | let cfg = getPoolConfig() | |
196 | 207 | let factoryCfg = getFactoryConfig() | |
197 | 208 | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
198 | 209 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
199 | 210 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
200 | 211 | if ((unstakeInv == unstakeInv)) | |
201 | 212 | then { | |
202 | - | let getOneTkn = | |
213 | + | let getOneTkn = reentrantInvoke(poolContract, "getOneTkn", [exchResult, notUsed, outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)]) | |
203 | 214 | if ((getOneTkn == getOneTkn)) | |
204 | 215 | then nil | |
205 | 216 | else throw("Strict value is not equal to itself.") | |
206 | 217 | } | |
207 | 218 | else throw("Strict value is not equal to itself.") | |
208 | 219 | } | |
209 | 220 | else throw("Strict value is not equal to itself.") | |
210 | 221 | } | |
211 | 222 | ||
212 | 223 | ||
213 | 224 | ||
214 | 225 | @Callable(i) | |
215 | 226 | func setAmp (amp) = { | |
216 | 227 | let checkCaller = mustAdmin(i) | |
217 | 228 | if ((checkCaller == checkCaller)) | |
218 | 229 | then { | |
219 | 230 | let res1 = invoke(poolContract, "setS", [keyAmp(), amp], nil) | |
220 | 231 | let res2 = invoke(poolContract, "setS", [keyAmpHistory(height), amp], nil) | |
221 | 232 | $Tuple2(nil, $Tuple2(res1, res2)) | |
222 | 233 | } | |
223 | 234 | else throw("Strict value is not equal to itself.") | |
224 | 235 | } | |
225 | 236 | ||
226 | 237 | ||
238 | + | ||
239 | + | @Callable(i) | |
240 | + | func ensureCanGetOneTkn (caller) = { | |
241 | + | let checkCaller = mustPool(i) | |
242 | + | if ((checkCaller == checkCaller)) | |
243 | + | then { | |
244 | + | let ensureCanPut = match getInteger(poolContract, lastPutOneTknCall(caller)) { | |
245 | + | case int: Int => | |
246 | + | let permittedHeight = (int + value(getInteger(poolContract, delay))) | |
247 | + | let isReadyforPutOneTkn = (height >= permittedHeight) | |
248 | + | let needBlocks = (permittedHeight - height) | |
249 | + | if (isReadyforPutOneTkn) | |
250 | + | then true | |
251 | + | else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " ")) | |
252 | + | case _ => | |
253 | + | true | |
254 | + | } | |
255 | + | if ((ensureCanPut == ensureCanPut)) | |
256 | + | then { | |
257 | + | let ensureCanGet = match getInteger(poolContract, lastGetOneTknCall(caller)) { | |
258 | + | case int: Int => | |
259 | + | let permittedHeight = (int + value(getInteger(poolContract, delay))) | |
260 | + | let isReadyforGetOneTkn = (height >= permittedHeight) | |
261 | + | let needBlocks = (permittedHeight - height) | |
262 | + | if (isReadyforGetOneTkn) | |
263 | + | then true | |
264 | + | else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " ")) | |
265 | + | case _ => | |
266 | + | true | |
267 | + | } | |
268 | + | if ((ensureCanGet == ensureCanGet)) | |
269 | + | then { | |
270 | + | let setI = invoke(poolContract, "setI", [lastPutOneTknCall(caller), height], nil) | |
271 | + | if ((setI == setI)) | |
272 | + | then nil | |
273 | + | else throw("Strict value is not equal to itself.") | |
274 | + | } | |
275 | + | else throw("Strict value is not equal to itself.") | |
276 | + | } | |
277 | + | else throw("Strict value is not equal to itself.") | |
278 | + | } | |
279 | + | else throw("Strict value is not equal to itself.") | |
280 | + | } | |
281 | + | ||
282 | + | ||
283 | + | ||
284 | + | @Callable(i) | |
285 | + | func ensureCanPutOneTkn (caller) = { | |
286 | + | let checkCaller = mustPool(i) | |
287 | + | if ((checkCaller == checkCaller)) | |
288 | + | then { | |
289 | + | let ensureCanPut = match getInteger(poolContract, lastPutOneTknCall(caller)) { | |
290 | + | case int: Int => | |
291 | + | let permittedHeight = (int + value(getInteger(poolContract, delay))) | |
292 | + | let isReadyforPutOneTkn = (height >= permittedHeight) | |
293 | + | let needBlocks = (permittedHeight - height) | |
294 | + | if (isReadyforPutOneTkn) | |
295 | + | then true | |
296 | + | else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " ")) | |
297 | + | case _ => | |
298 | + | true | |
299 | + | } | |
300 | + | if ((ensureCanPut == ensureCanPut)) | |
301 | + | then { | |
302 | + | let ensureCanGet = match getInteger(poolContract, lastGetOneTknCall(caller)) { | |
303 | + | case int: Int => | |
304 | + | let permittedHeight = (int + value(getInteger(poolContract, delay))) | |
305 | + | let isReadyforGetOneTkn = (height >= permittedHeight) | |
306 | + | let needBlocks = (permittedHeight - height) | |
307 | + | if (isReadyforGetOneTkn) | |
308 | + | then true | |
309 | + | else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " ")) | |
310 | + | case _ => | |
311 | + | true | |
312 | + | } | |
313 | + | if ((ensureCanGet == ensureCanGet)) | |
314 | + | then { | |
315 | + | let setI = invoke(poolContract, "setI", [lastPutOneTknCall(caller), height], nil) | |
316 | + | if ((setI == setI)) | |
317 | + | then nil | |
318 | + | else throw("Strict value is not equal to itself.") | |
319 | + | } | |
320 | + | else throw("Strict value is not equal to itself.") | |
321 | + | } | |
322 | + | else throw("Strict value is not equal to itself.") | |
323 | + | } | |
324 | + | else throw("Strict value is not equal to itself.") | |
325 | + | } | |
326 | + | ||
327 | + | ||
227 | 328 | @Verifier(tx) | |
228 | 329 | func verify () = { | |
229 | 330 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
230 | 331 | case pk: ByteVector => | |
231 | 332 | pk | |
232 | 333 | case _: Unit => | |
233 | 334 | tx.senderPublicKey | |
234 | 335 | case _ => | |
235 | 336 | throw("Match error") | |
236 | 337 | } | |
237 | - | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
338 | + | match tx { | |
339 | + | case s: SetScriptTransaction => | |
340 | + | let newHash = blake2b256(value(s.script)) | |
341 | + | let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpStableAddonScriptHash()))) | |
342 | + | let currentHash = scriptHash(this) | |
343 | + | if (if ((allowedHash == newHash)) | |
344 | + | then (currentHash != newHash) | |
345 | + | else false) | |
346 | + | then true | |
347 | + | else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
348 | + | case _ => | |
349 | + | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
350 | + | } | |
238 | 351 | } | |
239 | 352 |
github/deemru/w8io/169f3d6 37.46 ms ◑