tx · 9vhLxQdSAY3SetWv3diVfWXmg1sZkDmkEMC7ho7C6sWc

3MxuKn3ZoWnX58Q4ooAraNxabpcdaAtpufk:  -0.01300000 Waves

2022.08.15 17:50 [2185722] smart account 3MxuKn3ZoWnX58Q4ooAraNxabpcdaAtpufk > SELF 0.00000000 Waves

{ "type": 13, "id": "9vhLxQdSAY3SetWv3diVfWXmg1sZkDmkEMC7ho7C6sWc", "fee": 1300000, "feeAssetId": null, "timestamp": 1660575022102, "version": 1, "sender": "3MxuKn3ZoWnX58Q4ooAraNxabpcdaAtpufk", "senderPublicKey": "3GJt6j9wqqWrm9ontm1mnLfeW2wgWZYSqzVb9ueSKL1E", "proofs": [ "323AsPxyxkmaMGkhJwtTGiUWRZmRnnZL4NC5piJ1pTdp6uRd1HbwQRJSXuWQdabU2PDh9iLbkAtgGokSKxmTudE7" ], "script": "base64:AAIFAAAAAAAAACIIAhIDCgEIEgMKAQgSABIDCgEYEggKBgEBAQEIARIDCgEIAAAAHwAAAAADU0VQAgAAAAJfXwAAAAAFRU1QVFkCAAAAAAAAAAAOaWR4UG9vbEFkZHJlc3MAAAAAAAAAAAEAAAAACWlkeExQQXNJZAAAAAAAAAAAAwAAAAAJaWR4QW1Bc0lkAAAAAAAAAAAEAAAAAAlpZHhQckFzSWQAAAAAAAAAAAUAAAAAD2lkeEZhY3RTdGFrQ250cgAAAAAAAAAAAQEAAAALa2V5RmFjdENudHIAAAAAAgAAABMlc19fZmFjdG9yeUNvbnRyYWN0AQAAABNrZXlNYW5hZ2VyUHVibGljS2V5AAAAAAIAAAAUJXNfX21hbmFnZXJQdWJsaWNLZXkBAAAAGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS2V5AAAAAAIAAAAbJXNfX3BlbmRpbmdNYW5hZ2VyUHVibGljS2V5AQAAAAtrZXlQb29sQWRkcgAAAAACAAAADyVzX19wb29sQWRkcmVzcwEAAAALa2V5QW10QXNzZXQAAAAAAgAAAA8lc19fYW1vdW50QXNzZXQBAAAAD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CQEAAAAGa2V5QW1wAAAAAAkABEwAAAACBQAAAANhbXAFAAAAA25pbAUAAAADbmlsBAAAAARyZXMyCQAD/AAAAAQFAAAADHBvb2xDb250cmFjdAIAAAAEc2V0UwkABEwAAAACCQEAAAANa2V5QW1wSGlzdG9yeQAAAAEFAAAABmhlaWdodAkABEwAAAACBQAAAANhbXAFAAAAA25pbAUAAAADbmlsCQAFFAAAAAIFAAAAA25pbAkABRQAAAACBQAAAARyZXMxBQAAAARyZXMyCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAD3RhcmdldFB1YmxpY0tleQQAAAAHJG1hdGNoMAkBAAAAFm1hbmFnZXJQdWJsaWNLZXlPclVuaXQAAAAAAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAApCeXRlVmVjdG9yBAAAAAJwawUAAAAHJG1hdGNoMAUAAAACcGsDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABFVuaXQIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkJAAACAAAAAQIAAAALTWF0Y2ggZXJyb3IJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA90YXJnZXRQdWJsaWNLZXmJkpk6", "chainId": 84, "height": 2185722, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FHsWQ3J5Vr3ESWgXKQ59YrmA5ePcv2pVEV9YqnCBmu8M Next: CG64n7rCuE1Txdx4cfXx9eVLUUzsBXcDbPpohcVbRZfa Diff:
OldNewDifferences
1414 let idxPrAsId = 5
1515
1616 let idxFactStakCntr = 1
17-
18-let delay = "%s__delay"
1917
2018 func keyFactCntr () = "%s__factoryContract"
2119
4240
4341
4442 func keyAmpHistory (height) = ("%s%d__amp__" + toString(height))
45-
46-
47-func lastGetOneTknCall (caller) = makeString(["%s%s__lastGetOneTknCall", caller], SEP)
48-
49-
50-func lastPutOneTknCall (caller) = makeString(["%s%s__lastPutOneTknCall", caller], SEP)
5143
5244
5345 func keyFactoryConfig () = "%s__factoryConfig"
207199 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
208200 if ((unstakeInv == unstakeInv))
209201 then {
210- let getOneTkn = reentrantInvoke(poolContract, "getOneTkn", [exchResult, notUsed, outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)])
202+ let getOneTkn = invoke(poolContract, "getOneTkn", [exchResult, notUsed, outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)])
211203 if ((getOneTkn == getOneTkn))
212204 then nil
213205 else throw("Strict value is not equal to itself.")
232224 }
233225
234226
235-
236-@Callable(i)
237-func ensureCanGetOneTkn (caller) = {
238- let checkCaller = mustPool(i)
239- if ((checkCaller == checkCaller))
240- then {
241- let ensureCanPut = match getInteger(poolContract, lastPutOneTknCall(caller)) {
242- case int: Int =>
243- let permittedHeight = (int + value(getInteger(poolContract, delay)))
244- let isReadyforPutOneTkn = (height >= permittedHeight)
245- let needBlocks = (permittedHeight - height)
246- if (isReadyforPutOneTkn)
247- then true
248- else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " "))
249- case _ =>
250- true
251- }
252- if ((ensureCanPut == ensureCanPut))
253- then {
254- let ensureCanGet = match getInteger(poolContract, lastGetOneTknCall(caller)) {
255- case int: Int =>
256- let permittedHeight = (int + value(getInteger(poolContract, delay)))
257- let isReadyforGetOneTkn = (height >= permittedHeight)
258- let needBlocks = (permittedHeight - height)
259- if (isReadyforGetOneTkn)
260- then true
261- else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " "))
262- case _ =>
263- true
264- }
265- if ((ensureCanGet == ensureCanGet))
266- then {
267- let setI = invoke(poolContract, "setI", [lastPutOneTknCall(caller), height], nil)
268- if ((setI == setI))
269- then nil
270- else throw("Strict value is not equal to itself.")
271- }
272- else throw("Strict value is not equal to itself.")
273- }
274- else throw("Strict value is not equal to itself.")
275- }
276- else throw("Strict value is not equal to itself.")
277- }
278-
279-
280-
281-@Callable(i)
282-func ensureCanPutOneTkn (caller) = {
283- let checkCaller = mustPool(i)
284- if ((checkCaller == checkCaller))
285- then {
286- let ensureCanPut = match getInteger(poolContract, lastPutOneTknCall(caller)) {
287- case int: Int =>
288- let permittedHeight = (int + value(getInteger(poolContract, delay)))
289- let isReadyforPutOneTkn = (height >= permittedHeight)
290- let needBlocks = (permittedHeight - height)
291- if (isReadyforPutOneTkn)
292- then true
293- else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " "))
294- case _ =>
295- true
296- }
297- if ((ensureCanPut == ensureCanPut))
298- then {
299- let ensureCanGet = match getInteger(poolContract, lastGetOneTknCall(caller)) {
300- case int: Int =>
301- let permittedHeight = (int + value(getInteger(poolContract, delay)))
302- let isReadyforGetOneTkn = (height >= permittedHeight)
303- let needBlocks = (permittedHeight - height)
304- if (isReadyforGetOneTkn)
305- then true
306- else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " "))
307- case _ =>
308- true
309- }
310- if ((ensureCanGet == ensureCanGet))
311- then {
312- let setI = invoke(poolContract, "setI", [lastPutOneTknCall(caller), height], nil)
313- if ((setI == setI))
314- then nil
315- else throw("Strict value is not equal to itself.")
316- }
317- else throw("Strict value is not equal to itself.")
318- }
319- else throw("Strict value is not equal to itself.")
320- }
321- else throw("Strict value is not equal to itself.")
322- }
323-
324-
325227 @Verifier(tx)
326228 func verify () = {
327229 let targetPublicKey = match managerPublicKeyOrUnit() {
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let EMPTY = ""
77
88 let idxPoolAddress = 1
99
1010 let idxLPAsId = 3
1111
1212 let idxAmAsId = 4
1313
1414 let idxPrAsId = 5
1515
1616 let idxFactStakCntr = 1
17-
18-let delay = "%s__delay"
1917
2018 func keyFactCntr () = "%s__factoryContract"
2119
2220
2321 func keyManagerPublicKey () = "%s__managerPublicKey"
2422
2523
2624 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
2725
2826
2927 func keyPoolAddr () = "%s__poolAddress"
3028
3129
3230 func keyAmtAsset () = "%s__amountAsset"
3331
3432
3533 func keyPriceAsset () = "%s__priceAsset"
3634
3735
3836 func keyAdminPubKeys () = "%s__adminPubKeys"
3937
4038
4139 func keyAmp () = "%s__amp"
4240
4341
4442 func keyAmpHistory (height) = ("%s%d__amp__" + toString(height))
45-
46-
47-func lastGetOneTknCall (caller) = makeString(["%s%s__lastGetOneTknCall", caller], SEP)
48-
49-
50-func lastPutOneTknCall (caller) = makeString(["%s%s__lastPutOneTknCall", caller], SEP)
5143
5244
5345 func keyFactoryConfig () = "%s__factoryConfig"
5446
5547
5648 func keyPoolConfig (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config")
5749
5850
5951 func keyMappingsBaseAsset2internalId (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr)
6052
6153
6254 func getStringOrFail (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
6355
6456
6557 func getIntOrFail (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
6658
6759
6860 let poolContract = addressFromStringValue(getStringOrFail(this, keyPoolAddr()))
6961
7062 let factoryContract = addressFromStringValue(getStringOrFail(poolContract, keyFactCntr()))
7163
7264 func getPoolConfig () = {
7365 let amtAs = getStringOrFail(poolContract, keyAmtAsset())
7466 let priceAs = getStringOrFail(poolContract, keyPriceAsset())
7567 let iPriceAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAs))
7668 let iAmtAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAs))
7769 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAs), toString(iPriceAs))), SEP)
7870 }
7971
8072
8173 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
8274
8375
8476 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
8577 case s: String =>
8678 fromBase58String(s)
8779 case _: Unit =>
8880 unit
8981 case _ =>
9082 throw("Match error")
9183 }
9284
9385
9486 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
9587 case s: String =>
9688 fromBase58String(s)
9789 case _: Unit =>
9890 unit
9991 case _ =>
10092 throw("Match error")
10193 }
10294
10395
10496 func mustManager (i) = {
10597 let pd = throw("Permission denied")
10698 match managerPublicKeyOrUnit() {
10799 case pk: ByteVector =>
108100 if ((i.callerPublicKey == pk))
109101 then true
110102 else pd
111103 case _: Unit =>
112104 if ((i.caller == this))
113105 then true
114106 else pd
115107 case _ =>
116108 throw("Match error")
117109 }
118110 }
119111
120112
121113 func getAdmins () = match getString(keyAdminPubKeys()) {
122114 case s: String =>
123115 if ((size(s) == 0))
124116 then nil
125117 else split(s, SEP)
126118 case _ =>
127119 nil
128120 }
129121
130122
131123 func mustAdmin (i) = if (containsElement(getAdmins(), toBase58String(i.callerPublicKey)))
132124 then true
133125 else mustManager(i)
134126
135127
136128 func mustPool (i) = if ((i.caller == poolContract))
137129 then true
138130 else throw("caller must be the pool")
139131
140132
141133 @Callable(i)
142134 func constructor (poolAddress) = {
143135 let checkCaller = mustManager(i)
144136 if ((checkCaller == checkCaller))
145137 then [StringEntry(keyPoolAddr(), poolAddress)]
146138 else throw("Strict value is not equal to itself.")
147139 }
148140
149141
150142
151143 @Callable(i)
152144 func setManager (pendingManagerPublicKey) = {
153145 let checkCaller = mustManager(i)
154146 if ((checkCaller == checkCaller))
155147 then {
156148 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
157149 if ((checkManagerPublicKey == checkManagerPublicKey))
158150 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
159151 else throw("Strict value is not equal to itself.")
160152 }
161153 else throw("Strict value is not equal to itself.")
162154 }
163155
164156
165157
166158 @Callable(i)
167159 func confirmManager () = {
168160 let pm = pendingManagerPublicKeyOrUnit()
169161 let hasPM = if (isDefined(pm))
170162 then true
171163 else throw("No pending manager")
172164 if ((hasPM == hasPM))
173165 then {
174166 let checkPM = if ((i.callerPublicKey == value(pm)))
175167 then true
176168 else throw("You are not pending manager")
177169 if ((checkPM == checkPM))
178170 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
179171 else throw("Strict value is not equal to itself.")
180172 }
181173 else throw("Strict value is not equal to itself.")
182174 }
183175
184176
185177
186178 @Callable(i)
187179 func setAdmins (adminPubKeys) = {
188180 let checkCaller = mustManager(i)
189181 if ((checkCaller == checkCaller))
190182 then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))]
191183 else throw("Strict value is not equal to itself.")
192184 }
193185
194186
195187
196188 @Callable(i)
197189 func unstakeAndGetOneTkn (amount,exchResult,notUsed,outAmount,outAssetId,slippage) = {
198190 let checkPayments = if ((size(i.payments) != 0))
199191 then throw("No pmnts expd")
200192 else true
201193 if ((checkPayments == checkPayments))
202194 then {
203195 let cfg = getPoolConfig()
204196 let factoryCfg = getFactoryConfig()
205197 let lpAssetId = fromBase58String(cfg[idxLPAsId])
206198 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
207199 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
208200 if ((unstakeInv == unstakeInv))
209201 then {
210- let getOneTkn = reentrantInvoke(poolContract, "getOneTkn", [exchResult, notUsed, outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)])
202+ let getOneTkn = invoke(poolContract, "getOneTkn", [exchResult, notUsed, outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)])
211203 if ((getOneTkn == getOneTkn))
212204 then nil
213205 else throw("Strict value is not equal to itself.")
214206 }
215207 else throw("Strict value is not equal to itself.")
216208 }
217209 else throw("Strict value is not equal to itself.")
218210 }
219211
220212
221213
222214 @Callable(i)
223215 func setAmp (amp) = {
224216 let checkCaller = mustAdmin(i)
225217 if ((checkCaller == checkCaller))
226218 then {
227219 let res1 = invoke(poolContract, "setS", [keyAmp(), amp], nil)
228220 let res2 = invoke(poolContract, "setS", [keyAmpHistory(height), amp], nil)
229221 $Tuple2(nil, $Tuple2(res1, res2))
230222 }
231223 else throw("Strict value is not equal to itself.")
232224 }
233225
234226
235-
236-@Callable(i)
237-func ensureCanGetOneTkn (caller) = {
238- let checkCaller = mustPool(i)
239- if ((checkCaller == checkCaller))
240- then {
241- let ensureCanPut = match getInteger(poolContract, lastPutOneTknCall(caller)) {
242- case int: Int =>
243- let permittedHeight = (int + value(getInteger(poolContract, delay)))
244- let isReadyforPutOneTkn = (height >= permittedHeight)
245- let needBlocks = (permittedHeight - height)
246- if (isReadyforPutOneTkn)
247- then true
248- else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " "))
249- case _ =>
250- true
251- }
252- if ((ensureCanPut == ensureCanPut))
253- then {
254- let ensureCanGet = match getInteger(poolContract, lastGetOneTknCall(caller)) {
255- case int: Int =>
256- let permittedHeight = (int + value(getInteger(poolContract, delay)))
257- let isReadyforGetOneTkn = (height >= permittedHeight)
258- let needBlocks = (permittedHeight - height)
259- if (isReadyforGetOneTkn)
260- then true
261- else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " "))
262- case _ =>
263- true
264- }
265- if ((ensureCanGet == ensureCanGet))
266- then {
267- let setI = invoke(poolContract, "setI", [lastPutOneTknCall(caller), height], nil)
268- if ((setI == setI))
269- then nil
270- else throw("Strict value is not equal to itself.")
271- }
272- else throw("Strict value is not equal to itself.")
273- }
274- else throw("Strict value is not equal to itself.")
275- }
276- else throw("Strict value is not equal to itself.")
277- }
278-
279-
280-
281-@Callable(i)
282-func ensureCanPutOneTkn (caller) = {
283- let checkCaller = mustPool(i)
284- if ((checkCaller == checkCaller))
285- then {
286- let ensureCanPut = match getInteger(poolContract, lastPutOneTknCall(caller)) {
287- case int: Int =>
288- let permittedHeight = (int + value(getInteger(poolContract, delay)))
289- let isReadyforPutOneTkn = (height >= permittedHeight)
290- let needBlocks = (permittedHeight - height)
291- if (isReadyforPutOneTkn)
292- then true
293- else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " "))
294- case _ =>
295- true
296- }
297- if ((ensureCanPut == ensureCanPut))
298- then {
299- let ensureCanGet = match getInteger(poolContract, lastGetOneTknCall(caller)) {
300- case int: Int =>
301- let permittedHeight = (int + value(getInteger(poolContract, delay)))
302- let isReadyforGetOneTkn = (height >= permittedHeight)
303- let needBlocks = (permittedHeight - height)
304- if (isReadyforGetOneTkn)
305- then true
306- else throw(makeString(["you should wait", toString(needBlocks), "blocks more to perform the action"], " "))
307- case _ =>
308- true
309- }
310- if ((ensureCanGet == ensureCanGet))
311- then {
312- let setI = invoke(poolContract, "setI", [lastPutOneTknCall(caller), height], nil)
313- if ((setI == setI))
314- then nil
315- else throw("Strict value is not equal to itself.")
316- }
317- else throw("Strict value is not equal to itself.")
318- }
319- else throw("Strict value is not equal to itself.")
320- }
321- else throw("Strict value is not equal to itself.")
322- }
323-
324-
325227 @Verifier(tx)
326228 func verify () = {
327229 let targetPublicKey = match managerPublicKeyOrUnit() {
328230 case pk: ByteVector =>
329231 pk
330232 case _: Unit =>
331233 tx.senderPublicKey
332234 case _ =>
333235 throw("Match error")
334236 }
335237 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
336238 }
337239

github/deemru/w8io/169f3d6 
43.95 ms