tx · BDp6Sd7xTrJk3wKmZsqxViCAZue26BYRzb2iYCALeEyd

3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq:  -0.01300000 Waves

2023.02.03 14:55 [2433411] smart account 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq > SELF 0.00000000 Waves

{ "type": 13, "id": "BDp6Sd7xTrJk3wKmZsqxViCAZue26BYRzb2iYCALeEyd", "fee": 1300000, "feeAssetId": null, "timestamp": 1675425389547, "version": 1, "sender": "3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq", "senderPublicKey": "2u2wYYcVBQv43Cc71zkhHPPitkqgg6dqTZ3nUMvYJ1uq", "proofs": [ "4BMD2PiKNnzZAC9Jssyt6aQevQ6vTU5TFqDjUpdMZEeRndWxuLRQKi96yNjSZrcM6MCYUUXdcNi4rANsgceTLADH" ], "script": "base64:BgIXCAISBQoDAQgIEgUKAwEICBIDCgEIEgAUAANTRVACAl9fAAhmZWVTY2FsZQkAtgIBAKCNBgEPZ2V0U3RyaW5nT3JGYWlsAQNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQR0aGlzBQNrZXkJAKwCAgIVTm8gZGF0YSBmb3IgdGhpcy5rZXk9BQNrZXkADHBvb2xEaXNhYmxlZAkAAgECDVBvb2wgZGlzYWJsZWQADHBvb2xOb3RFeGlzdAkAAgECEVBvb2wgaXMgbm90IGV4aXN0AA5zbGlwcGFnZVRvb0JpZwkAAgECE1NsaXBwYWdlIGlzIHRvbyBiaWcBE2tleU1hbmFnZXJQdWJsaWNLZXkAAhQlc19fbWFuYWdlclB1YmxpY0tleQEaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkAAhslc19fcGVuZGluZ01hbmFnZXJQdWJsaWNLZXkBAmZjAAITJXNfX2ZhY3RvcnlDb250cmFjdAAPZmFjdG9yeUNvbnRyYWN0CQERQGV4dHJOYXRpdmUoMTA2MikBCQEPZ2V0U3RyaW5nT3JGYWlsAQk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kFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgFpAQ5jb25maXJtTWFuYWdlcgAEAnBtCQEdcGVuZGluZ01hbmFnZXJQdWJsaWNLZXlPclVuaXQABAVoYXNQTQMJAQlpc0RlZmluZWQBBQJwbQYJAAIBAhJubyBwZW5kaW5nIG1hbmFnZXIDCQAAAgUFaGFzUE0FBWhhc1BNBAdjaGVja1BNAwkAAAIIBQFpD2NhbGxlclB1YmxpY0tleQkBBXZhbHVlAQUCcG0GCQACAQIbeW91IGFyZSBub3QgcGVuZGluZyBtYW5hZ2VyAwkAAAIFB2NoZWNrUE0FB2NoZWNrUE0JAMwIAgkBC1N0cmluZ0VudHJ5AgkBE2tleU1hbmFnZXJQdWJsaWNLZXkACQDYBAEJAQV2YWx1ZQEFAnBtCQDMCAIJAQtEZWxldGVFbnRyeQEJARprZXlQZW5kaW5nTWFuYWdlclB1YmxpY0tleQAFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAED3RhcmdldFB1YmxpY0tleQQHJG1hdGNoMAkBFm1hbmFnZXJQdWJsaWNLZXlPclVuaXQAAwkAAQIFByRtYXRjaDACCkJ5dGVWZWN0b3IEAnBrBQckbWF0Y2gwBQJwawMJAAECBQckbWF0Y2gwAgRVbml0CAUCdHgPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFD3RhcmdldFB1YmxpY0tleXI7o8U=", "chainId": 84, "height": 2433411, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: B8b7iHeRE9qu6GQM5Aq68ZYcPugkRoqZmh4rn72e6XQN Next: 33MSPGrFxtMnbcVYSL7zRpjJWGNhAsy8VmSsK22dinba Diff:
OldNewDifferences
131131 if ((check == check))
132132 then {
133133 let poolAdr = addressFromStringValue(valueOrElse(pool, ""))
134- let check777 = if (false)
135- then true
136- else throw("here here here")
137- if ((check777 == check777))
138- then {
139- let res = {
140- let @ = invoke(poolAdr, "calculateAmountOutForSwapREADONLY", [cleanAmountIn, isReverse], nil)
141- if ($isInstanceOf(@, "Int"))
142- then @
143- else throw(($getType(@) + " couldn't be cast to Int"))
144- }
145- $Tuple2(nil, res)
146- }
147- else throw("Strict value is not equal to itself.")
134+ let res = {
135+ let @ = invoke(poolAdr, "calculateAmountOutForSwapREADONLY", [cleanAmountIn, isReverse], nil)
136+ if ($isInstanceOf(@, "Int"))
137+ then @
138+ else throw(($getType(@) + " couldn't be cast to Int"))
139+ }
140+ $Tuple2(nil, res)
148141 }
149142 else throw("Strict value is not equal to itself.")
150143 }
170163 then {
171164 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
172165 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
173- let $t047895279 = if ((lpNonReverese != unit))
166+ let $t047915281 = if ((lpNonReverese != unit))
174167 then {
175168 let isReverse = false
176169 let pool = {
188181 $Tuple2(isReverse, pool)
189182 }
190183 else poolNotExist
191- let isReverse = $t047895279._1
192- let pool = $t047895279._2
184+ let isReverse = $t047915281._1
185+ let pool = $t047915281._2
193186 let isPoolOneTokenOperationsDisabled = {
194187 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
195188 if ($isInstanceOf(@, "Boolean"))
203196 then {
204197 let poolAdr = addressFromStringValue(valueOrElse(pool, ""))
205198 let res = {
206- let @ = invoke(poolAdr, "calculateAmountOutForSwapAndSendTokens", [cleanAmountIn, isReverse, amountOutMin, addressTo], [AttachedPayment(assetIn, toInt(amountInToPool))])
199+ let @ = invoke(poolAdr, "calculateAmountOutForSwapAndSendTokens", [toInt(cleanAmountIn), isReverse, amountOutMin, addressTo], [AttachedPayment(assetIn, toInt(amountInToPool))])
207200 if ($isInstanceOf(@, "Boolean"))
208201 then @
209202 else throw(($getType(@) + " couldn't be cast to 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 func keyManagerPublicKey () = "%s__managerPublicKey"
1818
1919
2020 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
2121
2222
2323 func fc () = "%s__factoryContract"
2424
2525
2626 let factoryContract = addressFromStringValue(getStringOrFail(fc()))
2727
2828 func feeLiquidityContractAddress () = makeString(["%s", "feeLiquidityContractAddress"], SEP)
2929
3030
3131 func feeLiquidity () = makeString(["%s", "feeLiquidity"], SEP)
3232
3333
3434 func protocolFee () = makeString(["%d", "protocolFee"], SEP)
3535
3636
3737 func asInt (val) = match val {
3838 case valInt: Int =>
3939 valInt
4040 case _ =>
4141 throw("fail to cast into Int")
4242 }
4343
4444
4545 func dataMappingPoolAssets (internalAmountAssetStr,internalPriceAssetStr) = makeString(["%d%d", toString(internalAmountAssetStr), toString(internalPriceAssetStr)], SEP)
4646
4747
4848 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
4949 case s: String =>
5050 fromBase58String(s)
5151 case _: Unit =>
5252 unit
5353 case _ =>
5454 throw("Match error")
5555 }
5656
5757
5858 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
5959 case s: String =>
6060 fromBase58String(s)
6161 case _: Unit =>
6262 unit
6363 case _ =>
6464 throw("Match error")
6565 }
6666
6767
6868 func isManager (i) = match managerPublicKeyOrUnit() {
6969 case pk: ByteVector =>
7070 (i.callerPublicKey == pk)
7171 case _: Unit =>
7272 (i.caller == this)
7373 case _ =>
7474 throw("Match error")
7575 }
7676
7777
7878 func mustManager (i) = if (isManager(i))
7979 then true
8080 else throw("permission denied")
8181
8282
8383 func getAccBalance (assetId) = if ((assetId == "WAVES"))
8484 then wavesBalance(this).available
8585 else assetBalance(this, fromBase58String(assetId))
8686
8787
8888 @Callable(i)
8989 func swapCalculateREADONLY (amountIn,assetIn,assetOut) = {
9090 let prFee = value(getInteger(protocolFee()))
9191 let feeProtocolAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
9292 let feeLiquidityAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
9393 let amountInToPool = (toBigInt(amountIn) - feeProtocolAmount)
9494 let cleanAmountIn = (amountInToPool - feeLiquidityAmount)
9595 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
9696 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
9797 let $t027103329 = if ((lpNonReverese != unit))
9898 then {
9999 let isReverse = false
100100 let pool = {
101101 let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpNonReverese], nil)
102102 if ($isInstanceOf(@, "String"))
103103 then @
104104 else throw(($getType(@) + " couldn't be cast to String"))
105105 }
106106 $Tuple2(isReverse, pool)
107107 }
108108 else if ((lpReverse != unit))
109109 then {
110110 let isReverse = true
111111 let pool = {
112112 let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpReverse], nil)
113113 if ($isInstanceOf(@, "String"))
114114 then @
115115 else throw(($getType(@) + " couldn't be cast to String"))
116116 }
117117 $Tuple2(isReverse, pool)
118118 }
119119 else poolNotExist
120120 let isReverse = $t027103329._1
121121 let pool = $t027103329._2
122122 let poolStatus = {
123123 let @ = invoke(factoryContract, "getPoolStatusREADONLY", [pool], nil)
124124 if ($isInstanceOf(@, "Int"))
125125 then @
126126 else throw(($getType(@) + " couldn't be cast to Int"))
127127 }
128128 let check = if ((poolStatus == 1))
129129 then true
130130 else poolDisabled
131131 if ((check == check))
132132 then {
133133 let poolAdr = addressFromStringValue(valueOrElse(pool, ""))
134- let check777 = if (false)
135- then true
136- else throw("here here here")
137- if ((check777 == check777))
138- then {
139- let res = {
140- let @ = invoke(poolAdr, "calculateAmountOutForSwapREADONLY", [cleanAmountIn, isReverse], nil)
141- if ($isInstanceOf(@, "Int"))
142- then @
143- else throw(($getType(@) + " couldn't be cast to Int"))
144- }
145- $Tuple2(nil, res)
146- }
147- else throw("Strict value is not equal to itself.")
134+ let res = {
135+ let @ = invoke(poolAdr, "calculateAmountOutForSwapREADONLY", [cleanAmountIn, isReverse], nil)
136+ if ($isInstanceOf(@, "Int"))
137+ then @
138+ else throw(($getType(@) + " couldn't be cast to Int"))
139+ }
140+ $Tuple2(nil, res)
148141 }
149142 else throw("Strict value is not equal to itself.")
150143 }
151144
152145
153146
154147 @Callable(i)
155148 func swap (amountOutMin,assetOut,addressTo) = {
156149 let pmt = value(i.payments[0])
157150 let assetIn = if ((pmt.assetId == unit))
158151 then toBytes("WAVES")
159152 else value(pmt.assetId)
160153 let amountIn = value(pmt.amount)
161154 let prFee = value(getInteger(protocolFee()))
162155 let feeProtocolAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
163156 let feeLiquidityAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
164157 let amountInToPool = (toBigInt(amountIn) - feeProtocolAmount)
165158 let cleanAmountIn = (amountInToPool - feeLiquidityAmount)
166159 let checks = [if ((size(i.payments) == 1))
167160 then true
168161 else throw("exactly 1 payment are expected")]
169162 if ((checks == checks))
170163 then {
171164 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
172165 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
173- let $t047895279 = if ((lpNonReverese != unit))
166+ let $t047915281 = if ((lpNonReverese != unit))
174167 then {
175168 let isReverse = false
176169 let pool = {
177170 let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpNonReverese], nil)
178171 if ($isInstanceOf(@, "Address"))
179172 then @
180173 else throw(($getType(@) + " couldn't be cast to Address"))
181174 }
182175 $Tuple2(isReverse, pool)
183176 }
184177 else if ((lpReverse != unit))
185178 then {
186179 let isReverse = true
187180 let pool = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpReverse], nil)
188181 $Tuple2(isReverse, pool)
189182 }
190183 else poolNotExist
191- let isReverse = $t047895279._1
192- let pool = $t047895279._2
184+ let isReverse = $t047915281._1
185+ let pool = $t047915281._2
193186 let isPoolOneTokenOperationsDisabled = {
194187 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
195188 if ($isInstanceOf(@, "Boolean"))
196189 then @
197190 else throw(($getType(@) + " couldn't be cast to Boolean"))
198191 }
199192 let check = if (isPoolOneTokenOperationsDisabled)
200193 then true
201194 else poolDisabled
202195 if ((check == check))
203196 then {
204197 let poolAdr = addressFromStringValue(valueOrElse(pool, ""))
205198 let res = {
206- let @ = invoke(poolAdr, "calculateAmountOutForSwapAndSendTokens", [cleanAmountIn, isReverse, amountOutMin, addressTo], [AttachedPayment(assetIn, toInt(amountInToPool))])
199+ let @ = invoke(poolAdr, "calculateAmountOutForSwapAndSendTokens", [toInt(cleanAmountIn), isReverse, amountOutMin, addressTo], [AttachedPayment(assetIn, toInt(amountInToPool))])
207200 if ($isInstanceOf(@, "Boolean"))
208201 then @
209202 else throw(($getType(@) + " couldn't be cast to Boolean"))
210203 }
211204 $Tuple2(nil, res)
212205 }
213206 else throw("Strict value is not equal to itself.")
214207 }
215208 else throw("Strict value is not equal to itself.")
216209 }
217210
218211
219212
220213 @Callable(i)
221214 func setManager (pendingManagerPublicKey) = {
222215 let checkCaller = mustManager(i)
223216 if ((checkCaller == checkCaller))
224217 then {
225218 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
226219 if ((checkManagerPublicKey == checkManagerPublicKey))
227220 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
228221 else throw("Strict value is not equal to itself.")
229222 }
230223 else throw("Strict value is not equal to itself.")
231224 }
232225
233226
234227
235228 @Callable(i)
236229 func confirmManager () = {
237230 let pm = pendingManagerPublicKeyOrUnit()
238231 let hasPM = if (isDefined(pm))
239232 then true
240233 else throw("no pending manager")
241234 if ((hasPM == hasPM))
242235 then {
243236 let checkPM = if ((i.callerPublicKey == value(pm)))
244237 then true
245238 else throw("you are not pending manager")
246239 if ((checkPM == checkPM))
247240 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
248241 else throw("Strict value is not equal to itself.")
249242 }
250243 else throw("Strict value is not equal to itself.")
251244 }
252245
253246
254247 @Verifier(tx)
255248 func verify () = {
256249 let targetPublicKey = match managerPublicKeyOrUnit() {
257250 case pk: ByteVector =>
258251 pk
259252 case _: Unit =>
260253 tx.senderPublicKey
261254 case _ =>
262255 throw("Match error")
263256 }
264257 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
265258 }
266259

github/deemru/w8io/169f3d6 
60.70 ms