tx · DagWjPAXneYWi2nGGAJutnYxjGoHbmGswkuX6cMbTDjJ

3MxuKn3ZoWnX58Q4ooAraNxabpcdaAtpufk:  -0.01300000 Waves

2022.10.10 12:40 [2266073] smart account 3MxuKn3ZoWnX58Q4ooAraNxabpcdaAtpufk > SELF 0.00000000 Waves

{ "type": 13, "id": "DagWjPAXneYWi2nGGAJutnYxjGoHbmGswkuX6cMbTDjJ", "fee": 1300000, "feeAssetId": null, "timestamp": 1665394864839, "version": 1, "sender": "3MxuKn3ZoWnX58Q4ooAraNxabpcdaAtpufk", "senderPublicKey": "3GJt6j9wqqWrm9ontm1mnLfeW2wgWZYSqzVb9ueSKL1E", "proofs": [ "5AmmZQTXbRbhrSi6CfnJHb7gJfnENxDV89GWffkweNpZ8pnNRn4eV6vKirT6U3y6VYHvuSS5tj5DwZEyY9aQNiZn" ], "script": "base64:AAIFAAAAAAAAABgIAhIDCgEIEgMKAQgSABIDCgEYEgMKAQgAAAAgAAAAAANTRVACAAAAAl9fAAAAAAVFTVBUWQIAAAAAAAAAAA5pZHhQb29sQWRkcmVzcwAAAAAAAAAAAQAAAAAJaWR4TFBBc0lkAAAAAAAAAAADAAAAAAlpZHhBbUFzSWQAAAAAAAAAAAQAAAAACWlkeFByQXNJZAAAAAAAAAAABQAAAAAPaWR4RmFjdFN0YWtDbnRyAAAAAAAAAAABAQAAAAtrZXlGYWN0Q250cgAAAAACAAAAEyVzX19mYWN0b3J5Q29udHJhY3QBAAAAE2tleU1hbmFnZXJQdWJsaWNLZXkAAAAAAgAAABQlc19fbWFuYWdlclB1YmxpY0tleQEAAAAaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkAAAAAAgAAABslc19fcGVuZGluZ01hbmFnZXJQdWJsaWNLZXkBAAAAC2tleVBvb2xBZGRyAAAAAAIAAAAPJXNfX3Bvb2xBZGRyZXNzAQAAAAtrZXlBbXRBc3NldAAAAAACAAAADyVzX19hbW91bnRBc3NldAEAAAANa2V5UHJpY2VBc3NldA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s", "chainId": 84, "height": 2266073, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FPX2nTLtEv36aBkwFxWVeXCAk3g2i57EvWQ8brFyvSpY Next: 6RfovmyiHxdzcz6WRPzbuqoJ2CtkVURjuwLvoWCAN1GT Diff:
OldNewDifferences
189189
190190
191191 @Callable(i)
192-func unstakeAndGetOneTkn (amount,exchResult,notUsed,outAmount,outAssetId,slippage) = {
193- let checkPayments = if ((size(i.payments) != 0))
194- then throw("No pmnts expd")
195- else true
196- if ((checkPayments == checkPayments))
197- then {
198- let cfg = getPoolConfig()
199- let factoryCfg = getFactoryConfig()
200- let lpAssetId = fromBase58String(cfg[idxLPAsId])
201- let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
202- let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
203- if ((unstakeInv == unstakeInv))
204- then {
205- let getOneTkn = invoke(poolContract, "getOneTkn", [exchResult, notUsed, outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)])
206- if ((getOneTkn == getOneTkn))
207- then nil
208- else throw("Strict value is not equal to itself.")
209- }
210- else throw("Strict value is not equal to itself.")
211- }
212- else throw("Strict value is not equal to itself.")
213- }
214-
215-
216-
217-@Callable(i)
218192 func setAmp (amp) = {
219193 let checkCaller = mustAdmin(i)
220194 if ((checkCaller == checkCaller))
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
1717
1818 func keyFactCntr () = "%s__factoryContract"
1919
2020
2121 func keyManagerPublicKey () = "%s__managerPublicKey"
2222
2323
2424 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
2525
2626
2727 func keyPoolAddr () = "%s__poolAddress"
2828
2929
3030 func keyAmtAsset () = "%s__amountAsset"
3131
3232
3333 func keyPriceAsset () = "%s__priceAsset"
3434
3535
3636 func keyAdminPubKeys () = "%s__adminPubKeys"
3737
3838
3939 func keyAmp () = "%s__amp"
4040
4141
4242 func keyAmpHistory (height) = ("%s%d__amp__" + toString(height))
4343
4444
4545 func keyFactoryConfig () = "%s__factoryConfig"
4646
4747
4848 func keyPoolConfig (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config")
4949
5050
5151 func keyMappingsBaseAsset2internalId (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr)
5252
5353
5454 func keyAllowedLpStableAddonScriptHash () = "%s__allowedLpStableAddonScriptHash"
5555
5656
5757 func getStringOrFail (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
5858
5959
6060 func getIntOrFail (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
6161
6262
6363 let poolContract = addressFromStringValue(getStringOrFail(this, keyPoolAddr()))
6464
6565 let factoryContract = addressFromStringValue(getStringOrFail(poolContract, keyFactCntr()))
6666
6767 func getPoolConfig () = {
6868 let amtAs = getStringOrFail(poolContract, keyAmtAsset())
6969 let priceAs = getStringOrFail(poolContract, keyPriceAsset())
7070 let iPriceAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAs))
7171 let iAmtAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAs))
7272 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAs), toString(iPriceAs))), SEP)
7373 }
7474
7575
7676 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
7777
7878
7979 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
8080 case s: String =>
8181 fromBase58String(s)
8282 case _: Unit =>
8383 unit
8484 case _ =>
8585 throw("Match error")
8686 }
8787
8888
8989 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
9090 case s: String =>
9191 fromBase58String(s)
9292 case _: Unit =>
9393 unit
9494 case _ =>
9595 throw("Match error")
9696 }
9797
9898
9999 func mustManager (i) = {
100100 let pd = throw("Permission denied")
101101 match managerPublicKeyOrUnit() {
102102 case pk: ByteVector =>
103103 if ((i.callerPublicKey == pk))
104104 then true
105105 else pd
106106 case _: Unit =>
107107 if ((i.caller == this))
108108 then true
109109 else pd
110110 case _ =>
111111 throw("Match error")
112112 }
113113 }
114114
115115
116116 func getAdmins () = match getString(keyAdminPubKeys()) {
117117 case s: String =>
118118 if ((size(s) == 0))
119119 then nil
120120 else split(s, SEP)
121121 case _ =>
122122 nil
123123 }
124124
125125
126126 func mustAdmin (i) = if (containsElement(getAdmins(), toBase58String(i.callerPublicKey)))
127127 then true
128128 else mustManager(i)
129129
130130
131131 func mustPool (i) = if ((i.caller == poolContract))
132132 then true
133133 else throw("caller must be the pool")
134134
135135
136136 @Callable(i)
137137 func constructor (poolAddress) = {
138138 let checkCaller = mustManager(i)
139139 if ((checkCaller == checkCaller))
140140 then [StringEntry(keyPoolAddr(), poolAddress)]
141141 else throw("Strict value is not equal to itself.")
142142 }
143143
144144
145145
146146 @Callable(i)
147147 func setManager (pendingManagerPublicKey) = {
148148 let checkCaller = mustManager(i)
149149 if ((checkCaller == checkCaller))
150150 then {
151151 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
152152 if ((checkManagerPublicKey == checkManagerPublicKey))
153153 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
154154 else throw("Strict value is not equal to itself.")
155155 }
156156 else throw("Strict value is not equal to itself.")
157157 }
158158
159159
160160
161161 @Callable(i)
162162 func confirmManager () = {
163163 let pm = pendingManagerPublicKeyOrUnit()
164164 let hasPM = if (isDefined(pm))
165165 then true
166166 else throw("No pending manager")
167167 if ((hasPM == hasPM))
168168 then {
169169 let checkPM = if ((i.callerPublicKey == value(pm)))
170170 then true
171171 else throw("You are not pending manager")
172172 if ((checkPM == checkPM))
173173 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
174174 else throw("Strict value is not equal to itself.")
175175 }
176176 else throw("Strict value is not equal to itself.")
177177 }
178178
179179
180180
181181 @Callable(i)
182182 func setAdmins (adminPubKeys) = {
183183 let checkCaller = mustManager(i)
184184 if ((checkCaller == checkCaller))
185185 then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))]
186186 else throw("Strict value is not equal to itself.")
187187 }
188188
189189
190190
191191 @Callable(i)
192-func unstakeAndGetOneTkn (amount,exchResult,notUsed,outAmount,outAssetId,slippage) = {
193- let checkPayments = if ((size(i.payments) != 0))
194- then throw("No pmnts expd")
195- else true
196- if ((checkPayments == checkPayments))
197- then {
198- let cfg = getPoolConfig()
199- let factoryCfg = getFactoryConfig()
200- let lpAssetId = fromBase58String(cfg[idxLPAsId])
201- let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
202- let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
203- if ((unstakeInv == unstakeInv))
204- then {
205- let getOneTkn = invoke(poolContract, "getOneTkn", [exchResult, notUsed, outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)])
206- if ((getOneTkn == getOneTkn))
207- then nil
208- else throw("Strict value is not equal to itself.")
209- }
210- else throw("Strict value is not equal to itself.")
211- }
212- else throw("Strict value is not equal to itself.")
213- }
214-
215-
216-
217-@Callable(i)
218192 func setAmp (amp) = {
219193 let checkCaller = mustAdmin(i)
220194 if ((checkCaller == checkCaller))
221195 then {
222196 let res1 = invoke(poolContract, "setS", [keyAmp(), amp], nil)
223197 let res2 = invoke(poolContract, "setS", [keyAmpHistory(height), amp], nil)
224198 $Tuple2(nil, $Tuple2(res1, res2))
225199 }
226200 else throw("Strict value is not equal to itself.")
227201 }
228202
229203
230204 @Verifier(tx)
231205 func verify () = {
232206 let targetPublicKey = match managerPublicKeyOrUnit() {
233207 case pk: ByteVector =>
234208 pk
235209 case _: Unit =>
236210 tx.senderPublicKey
237211 case _ =>
238212 throw("Match error")
239213 }
240214 match tx {
241215 case s: SetScriptTransaction =>
242216 let newHash = blake2b256(value(s.script))
243217 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpStableAddonScriptHash())))
244218 let currentHash = scriptHash(this)
245219 if (if ((allowedHash == newHash))
246220 then (currentHash != newHash)
247221 else false)
248222 then true
249223 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
250224 case _ =>
251225 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
252226 }
253227 }
254228

github/deemru/w8io/fabc49c 
33.34 ms