tx · 3AkwLU2kJEjw6Vu2cSbMikZqmHjAVdYKR9Kdh7PSHp4W

3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq:  -0.01300000 Waves

2023.01.31 17:37 [2429251] smart account 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq > SELF 0.00000000 Waves

{ "type": 13, "id": "3AkwLU2kJEjw6Vu2cSbMikZqmHjAVdYKR9Kdh7PSHp4W", "fee": 1300000, "feeAssetId": null, "timestamp": 1675175867944, "version": 1, "sender": "3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq", "senderPublicKey": "2u2wYYcVBQv43Cc71zkhHPPitkqgg6dqTZ3nUMvYJ1uq", "proofs": [ "uWTV6usqYKSRuzj5XfsGrx4ud7N8YyLLt3fc5jfvSnpACCCx83pPQYDr5AWXf6gzuG2bmMZC6hjTf8ZWfhSSXnh" ], "script": "base64:BgIXCAISBQoDAQgIEgUKAwEICBIDCgEIEgAVAANTRVACAl9fAAhmZWVTY2FsZQkAtgIBAKCNBgEPZ2V0U3RyaW5nT3JGYWlsAQNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQR0aGlzBQNrZXkJAKwCAgIVTm8gZGF0YSBmb3IgdGhpcy5rZXk9BQNrZXkADHBvb2xEaXNhYmxlZAkAAgECDVBvb2wgZGlzYWJsZWQADHBvb2xOb3RFeGlzdAkAAgECEVBvb2wgaXMgbm90IGV4aXN0AA5zbGlwcGFnZVRvb0JpZwkAAgECE1NsaXBwYWdlIGlzIHRvbyBiaWcACXRlc3RFcnJvcgkAAgECD1Rlc3QgZXJyb3IgaGVyZQETa2V5TWFuYWdlclB1YmxpY0tleQACFCVzX19tYW5hZ2VyUHVibGljS2V5ARprZXlQZW5kaW5nTWFuYWdlclB1YmxpY0tleQACGyVzX19wZW5kaW5nTWFuYWdlclB1YmxpY0tleQECZmMAAhMlc19fZmFjdG9yeUNvbnRyYWN0AA9mYWN0b3J5Q29udHJhY3QJARFAZXh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ZXRQdWJsaWNLZXkis2EU", "chainId": 84, "height": 2429251, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: A7H6RqSs3FWyF4erSDHv8qyoE2kLqHs7ZLpxhZFrapMQ Next: 8fyTTicxNy8FUm7EdqywTq3einNg2xS3SFpygPNt2VnA Diff:
OldNewDifferences
9999 let ee = if ((0 == 0))
100100 then testError
101101 else testError
102- let $t027583248 = if ((lpNonReverese != unit))
102+ let $t027583264 = if ((lpNonReverese != unit))
103103 then {
104104 let isReverse = false
105105 let pool = {
116116 let pool = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpReverse], nil)
117117 $Tuple2(isReverse, pool)
118118 }
119- else poolNotExist
120- let isReverse = $t027583248._1
121- let pool = $t027583248._2
119+ else testError
120+ let isReverse = $t027583264._1
121+ let pool = $t027583264._2
122122 let isPoolOneTokenOperationsDisabled = {
123123 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
124124 if ($isInstanceOf(@, "Boolean"))
163163 then {
164164 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
165165 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
166- let $t046685158 = if ((lpNonReverese != unit))
166+ let $t046845174 = if ((lpNonReverese != unit))
167167 then {
168168 let isReverse = false
169169 let pool = {
181181 $Tuple2(isReverse, pool)
182182 }
183183 else poolNotExist
184- let isReverse = $t046685158._1
185- let pool = $t046685158._2
184+ let isReverse = $t046845174._1
185+ let pool = $t046845174._2
186186 let isPoolOneTokenOperationsDisabled = {
187187 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
188188 if ($isInstanceOf(@, "Boolean"))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let feeScale = toBigInt(100000)
77
88 func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), ("No data for this.key=" + key))
99
1010
1111 let poolDisabled = throw("Pool disabled")
1212
1313 let poolNotExist = throw("Pool is not exist")
1414
1515 let slippageTooBig = throw("Slippage is too big")
1616
1717 let testError = throw("Test error here")
1818
1919 func keyManagerPublicKey () = "%s__managerPublicKey"
2020
2121
2222 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
2323
2424
2525 func fc () = "%s__factoryContract"
2626
2727
2828 let factoryContract = addressFromStringValue(getStringOrFail(fc()))
2929
3030 func feeLiquidityContractAddress () = makeString(["%s", "feeLiquidityContractAddress"], SEP)
3131
3232
3333 func feeLiquidity () = makeString(["%s", "feeLiquidity"], SEP)
3434
3535
3636 func protocolFee () = makeString(["%s", "protocolFee"], SEP)
3737
3838
3939 func asInt (val) = match val {
4040 case valInt: Int =>
4141 valInt
4242 case _ =>
4343 throw("fail to cast into Int")
4444 }
4545
4646
4747 func dataMappingPoolAssets (internalAmountAssetStr,internalPriceAssetStr) = makeString(["%d%d", toString(internalAmountAssetStr), toString(internalPriceAssetStr)], SEP)
4848
4949
5050 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
5151 case s: String =>
5252 fromBase58String(s)
5353 case _: Unit =>
5454 unit
5555 case _ =>
5656 throw("Match error")
5757 }
5858
5959
6060 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
6161 case s: String =>
6262 fromBase58String(s)
6363 case _: Unit =>
6464 unit
6565 case _ =>
6666 throw("Match error")
6767 }
6868
6969
7070 func isManager (i) = match managerPublicKeyOrUnit() {
7171 case pk: ByteVector =>
7272 (i.callerPublicKey == pk)
7373 case _: Unit =>
7474 (i.caller == this)
7575 case _ =>
7676 throw("Match error")
7777 }
7878
7979
8080 func mustManager (i) = if (isManager(i))
8181 then true
8282 else throw("permission denied")
8383
8484
8585 func getAccBalance (assetId) = if ((assetId == "WAVES"))
8686 then wavesBalance(this).available
8787 else assetBalance(this, fromBase58String(assetId))
8888
8989
9090 @Callable(i)
9191 func swapCalculateREADONLY (amountIn,assetIn,assetOut) = {
9292 let prFee = value(getInteger(protocolFee()))
9393 let feeProtocolAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
9494 let feeLiquidityAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
9595 let amountInToPool = (toBigInt(amountIn) - feeProtocolAmount)
9696 let cleanAmountIn = (amountInToPool - feeLiquidityAmount)
9797 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
9898 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
9999 let ee = if ((0 == 0))
100100 then testError
101101 else testError
102- let $t027583248 = if ((lpNonReverese != unit))
102+ let $t027583264 = if ((lpNonReverese != unit))
103103 then {
104104 let isReverse = false
105105 let pool = {
106106 let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpNonReverese], nil)
107107 if ($isInstanceOf(@, "Address"))
108108 then @
109109 else throw(($getType(@) + " couldn't be cast to Address"))
110110 }
111111 $Tuple2(isReverse, pool)
112112 }
113113 else if ((lpReverse != unit))
114114 then {
115115 let isReverse = true
116116 let pool = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpReverse], nil)
117117 $Tuple2(isReverse, pool)
118118 }
119- else poolNotExist
120- let isReverse = $t027583248._1
121- let pool = $t027583248._2
119+ else testError
120+ let isReverse = $t027583264._1
121+ let pool = $t027583264._2
122122 let isPoolOneTokenOperationsDisabled = {
123123 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
124124 if ($isInstanceOf(@, "Boolean"))
125125 then @
126126 else throw(($getType(@) + " couldn't be cast to Boolean"))
127127 }
128128 let check = if (isPoolOneTokenOperationsDisabled)
129129 then true
130130 else poolDisabled
131131 if ((check == check))
132132 then {
133133 let poolAdr = addressFromStringValue(valueOrElse(pool, ""))
134134 let res = {
135135 let @ = invoke(poolAdr, "calculateAmountOutForSwapREADONLY", [cleanAmountIn, isReverse], nil)
136136 if ($isInstanceOf(@, "Int"))
137137 then @
138138 else throw(($getType(@) + " couldn't be cast to Int"))
139139 }
140140 $Tuple2(nil, res)
141141 }
142142 else throw("Strict value is not equal to itself.")
143143 }
144144
145145
146146
147147 @Callable(i)
148148 func swap (amountOutMin,assetOut,addressTo) = {
149149 let pmt = value(i.payments[0])
150150 let assetIn = if ((pmt.assetId == unit))
151151 then toBytes("WAVES")
152152 else value(pmt.assetId)
153153 let amountIn = value(pmt.amount)
154154 let prFee = value(getInteger(protocolFee()))
155155 let feeProtocolAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
156156 let feeLiquidityAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
157157 let amountInToPool = (toBigInt(amountIn) - feeProtocolAmount)
158158 let cleanAmountIn = (amountInToPool - feeLiquidityAmount)
159159 let checks = [if ((size(i.payments) == 1))
160160 then true
161161 else throw("exactly 1 payment are expected")]
162162 if ((checks == checks))
163163 then {
164164 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
165165 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
166- let $t046685158 = if ((lpNonReverese != unit))
166+ let $t046845174 = if ((lpNonReverese != unit))
167167 then {
168168 let isReverse = false
169169 let pool = {
170170 let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpNonReverese], nil)
171171 if ($isInstanceOf(@, "Address"))
172172 then @
173173 else throw(($getType(@) + " couldn't be cast to Address"))
174174 }
175175 $Tuple2(isReverse, pool)
176176 }
177177 else if ((lpReverse != unit))
178178 then {
179179 let isReverse = true
180180 let pool = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpReverse], nil)
181181 $Tuple2(isReverse, pool)
182182 }
183183 else poolNotExist
184- let isReverse = $t046685158._1
185- let pool = $t046685158._2
184+ let isReverse = $t046845174._1
185+ let pool = $t046845174._2
186186 let isPoolOneTokenOperationsDisabled = {
187187 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
188188 if ($isInstanceOf(@, "Boolean"))
189189 then @
190190 else throw(($getType(@) + " couldn't be cast to Boolean"))
191191 }
192192 let check = if (isPoolOneTokenOperationsDisabled)
193193 then true
194194 else poolDisabled
195195 if ((check == check))
196196 then {
197197 let poolAdr = addressFromStringValue(valueOrElse(pool, ""))
198198 let res = {
199199 let @ = invoke(poolAdr, "calculateAmountOutForSwapAndSendTokens", [cleanAmountIn, isReverse, amountOutMin, addressTo], [AttachedPayment(assetIn, toInt(amountInToPool))])
200200 if ($isInstanceOf(@, "Boolean"))
201201 then @
202202 else throw(($getType(@) + " couldn't be cast to Boolean"))
203203 }
204204 $Tuple2(nil, res)
205205 }
206206 else throw("Strict value is not equal to itself.")
207207 }
208208 else throw("Strict value is not equal to itself.")
209209 }
210210
211211
212212
213213 @Callable(i)
214214 func setManager (pendingManagerPublicKey) = {
215215 let checkCaller = mustManager(i)
216216 if ((checkCaller == checkCaller))
217217 then {
218218 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
219219 if ((checkManagerPublicKey == checkManagerPublicKey))
220220 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
221221 else throw("Strict value is not equal to itself.")
222222 }
223223 else throw("Strict value is not equal to itself.")
224224 }
225225
226226
227227
228228 @Callable(i)
229229 func confirmManager () = {
230230 let pm = pendingManagerPublicKeyOrUnit()
231231 let hasPM = if (isDefined(pm))
232232 then true
233233 else throw("no pending manager")
234234 if ((hasPM == hasPM))
235235 then {
236236 let checkPM = if ((i.callerPublicKey == value(pm)))
237237 then true
238238 else throw("you are not pending manager")
239239 if ((checkPM == checkPM))
240240 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
241241 else throw("Strict value is not equal to itself.")
242242 }
243243 else throw("Strict value is not equal to itself.")
244244 }
245245
246246
247247 @Verifier(tx)
248248 func verify () = {
249249 let targetPublicKey = match managerPublicKeyOrUnit() {
250250 case pk: ByteVector =>
251251 pk
252252 case _: Unit =>
253253 tx.senderPublicKey
254254 case _ =>
255255 throw("Match error")
256256 }
257257 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
258258 }
259259

github/deemru/w8io/026f985 
35.28 ms