tx · 7fwdKZDFUwdE91XzWuwWaoYBDXXNTyU9zxYKDdkRUBhn

3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq:  -0.01300000 Waves

2023.02.03 10:10 [2433121] smart account 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq > SELF 0.00000000 Waves

{ "type": 13, "id": "7fwdKZDFUwdE91XzWuwWaoYBDXXNTyU9zxYKDdkRUBhn", "fee": 1300000, "feeAssetId": null, "timestamp": 1675408301289, "version": 1, "sender": "3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq", "senderPublicKey": "2u2wYYcVBQv43Cc71zkhHPPitkqgg6dqTZ3nUMvYJ1uq", "proofs": [ "4BXt34owmTmgaDDBU2rPdH9tXEPQJPYc9ctcdaMRgUwjznbYtpyZZcFrGpvBkvPnknvAjqskPjcoRK7hx6b8X79y" ], "script": "base64:BgIXCAISBQoDAQgIEgUKAwEICBIDCgEIEgAUAANTRVACAl9fAAhmZWVTY2FsZQkAtgIBAKCNBgEPZ2V0U3RyaW5nT3JGYWlsAQNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQR0aGlzBQNrZXkJAKwCAgIVTm8gZGF0YSBmb3IgdGhpcy5rZXk9BQNrZXkADHBvb2xEaXNhYmxlZAkAAgECDVBvb2wgZGlzYWJsZWQADHBvb2xOb3RFeGlzdAkAAgECEVBvb2wgaXMgbm90IGV4aXN0AA5zbGlwcGFnZVRvb0JpZwkAAgECE1NsaXBwYWdlIGlzIHRvbyBiaWcBE2tleU1hbmFnZXJQdWJsaWNLZXkAAhQlc19fbWFuYWdlclB1YmxpY0tleQEaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkAAhslc19fcGVuZGluZ01hbmFnZXJQdWJsaWNLZXkBAmZjAAITJXNfX2ZhY3RvcnlDb250cmFjdAAPZmFjdG9yeUNvbnRyYWN0CQERQGV4dHJOYXRpdmUoMTA2MikBCQEPZ2V0U3RyaW5nT3JGYWl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Bub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgFpAQ5jb25maXJtTWFuYWdlcgAEAnBtCQEdcGVuZGluZ01hbmFnZXJQdWJsaWNLZXlPclVuaXQABAVoYXNQTQMJAQlpc0RlZmluZWQBBQJwbQYJAAIBAhJubyBwZW5kaW5nIG1hbmFnZXIDCQAAAgUFaGFzUE0FBWhhc1BNBAdjaGVja1BNAwkAAAIIBQFpD2NhbGxlclB1YmxpY0tleQkBBXZhbHVlAQUCcG0GCQACAQIbeW91IGFyZSBub3QgcGVuZGluZyBtYW5hZ2VyAwkAAAIFB2NoZWNrUE0FB2NoZWNrUE0JAMwIAgkBC1N0cmluZ0VudHJ5AgkBE2tleU1hbmFnZXJQdWJsaWNLZXkACQDYBAEJAQV2YWx1ZQEFAnBtCQDMCAIJAQtEZWxldGVFbnRyeQEJARprZXlQZW5kaW5nTWFuYWdlclB1YmxpY0tleQAFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAED3RhcmdldFB1YmxpY0tleQQHJG1hdGNoMAkBFm1hbmFnZXJQdWJsaWNLZXlPclVuaXQAAwkAAQIFByRtYXRjaDACCkJ5dGVWZWN0b3IEAnBrBQckbWF0Y2gwBQJwawMJAAECBQckbWF0Y2gwAgRVbml0CAUCdHgPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFD3RhcmdldFB1YmxpY0tleRToe7g=", "chainId": 84, "height": 2433121, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8fyTTicxNy8FUm7EdqywTq3einNg2xS3SFpygPNt2VnA Next: 3g5NcMPY9HAShJa14jcya7jbSGYd2nEV69qgeRrpajxG Diff:
OldNewDifferences
1313 let poolNotExist = throw("Pool is not exist")
1414
1515 let slippageTooBig = throw("Slippage is too big")
16-
17-let testError = throw("Test error here")
1816
1917 func keyManagerPublicKey () = "%s__managerPublicKey"
2018
9694 let cleanAmountIn = (amountInToPool - feeLiquidityAmount)
9795 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
9896 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
99- let $t027683274 = if ((lpNonReverese != unit))
97+ let $t026413131 = if ((lpNonReverese != unit))
10098 then {
10199 let isReverse = false
102100 let pool = {
113111 let pool = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpReverse], nil)
114112 $Tuple2(isReverse, pool)
115113 }
116- else testError
117- let isReverse = $t027683274._1
118- let pool = $t027683274._2
114+ else poolNotExist
115+ let isReverse = $t026413131._1
116+ let pool = $t026413131._2
119117 let isPoolOneTokenOperationsDisabled = {
120118 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
121119 if ($isInstanceOf(@, "Boolean"))
160158 then {
161159 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
162160 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
163- let $t046945184 = if ((lpNonReverese != unit))
161+ let $t045515041 = if ((lpNonReverese != unit))
164162 then {
165163 let isReverse = false
166164 let pool = {
178176 $Tuple2(isReverse, pool)
179177 }
180178 else poolNotExist
181- let isReverse = $t046945184._1
182- let pool = $t046945184._2
179+ let isReverse = $t045515041._1
180+ let pool = $t045515041._2
183181 let isPoolOneTokenOperationsDisabled = {
184182 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
185183 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")
16-
17-let testError = throw("Test error here")
1816
1917 func keyManagerPublicKey () = "%s__managerPublicKey"
2018
2119
2220 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
2321
2422
2523 func fc () = "%s__factoryContract"
2624
2725
2826 let factoryContract = addressFromStringValue(getStringOrFail(fc()))
2927
3028 func feeLiquidityContractAddress () = makeString(["%s", "feeLiquidityContractAddress"], SEP)
3129
3230
3331 func feeLiquidity () = makeString(["%s", "feeLiquidity"], SEP)
3432
3533
3634 func protocolFee () = makeString(["%s", "protocolFee"], SEP)
3735
3836
3937 func asInt (val) = match val {
4038 case valInt: Int =>
4139 valInt
4240 case _ =>
4341 throw("fail to cast into Int")
4442 }
4543
4644
4745 func dataMappingPoolAssets (internalAmountAssetStr,internalPriceAssetStr) = makeString(["%d%d", toString(internalAmountAssetStr), toString(internalPriceAssetStr)], SEP)
4846
4947
5048 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
5149 case s: String =>
5250 fromBase58String(s)
5351 case _: Unit =>
5452 unit
5553 case _ =>
5654 throw("Match error")
5755 }
5856
5957
6058 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
6159 case s: String =>
6260 fromBase58String(s)
6361 case _: Unit =>
6462 unit
6563 case _ =>
6664 throw("Match error")
6765 }
6866
6967
7068 func isManager (i) = match managerPublicKeyOrUnit() {
7169 case pk: ByteVector =>
7270 (i.callerPublicKey == pk)
7371 case _: Unit =>
7472 (i.caller == this)
7573 case _ =>
7674 throw("Match error")
7775 }
7876
7977
8078 func mustManager (i) = if (isManager(i))
8179 then true
8280 else throw("permission denied")
8381
8482
8583 func getAccBalance (assetId) = if ((assetId == "WAVES"))
8684 then wavesBalance(this).available
8785 else assetBalance(this, fromBase58String(assetId))
8886
8987
9088 @Callable(i)
9189 func swapCalculateREADONLY (amountIn,assetIn,assetOut) = {
9290 let prFee = value(getInteger(protocolFee()))
9391 let feeProtocolAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
9492 let feeLiquidityAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
9593 let amountInToPool = (toBigInt(amountIn) - feeProtocolAmount)
9694 let cleanAmountIn = (amountInToPool - feeLiquidityAmount)
9795 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
9896 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
99- let $t027683274 = if ((lpNonReverese != unit))
97+ let $t026413131 = if ((lpNonReverese != unit))
10098 then {
10199 let isReverse = false
102100 let pool = {
103101 let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpNonReverese], nil)
104102 if ($isInstanceOf(@, "Address"))
105103 then @
106104 else throw(($getType(@) + " couldn't be cast to Address"))
107105 }
108106 $Tuple2(isReverse, pool)
109107 }
110108 else if ((lpReverse != unit))
111109 then {
112110 let isReverse = true
113111 let pool = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpReverse], nil)
114112 $Tuple2(isReverse, pool)
115113 }
116- else testError
117- let isReverse = $t027683274._1
118- let pool = $t027683274._2
114+ else poolNotExist
115+ let isReverse = $t026413131._1
116+ let pool = $t026413131._2
119117 let isPoolOneTokenOperationsDisabled = {
120118 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
121119 if ($isInstanceOf(@, "Boolean"))
122120 then @
123121 else throw(($getType(@) + " couldn't be cast to Boolean"))
124122 }
125123 let check = if (isPoolOneTokenOperationsDisabled)
126124 then true
127125 else poolDisabled
128126 if ((check == check))
129127 then {
130128 let poolAdr = addressFromStringValue(valueOrElse(pool, ""))
131129 let res = {
132130 let @ = invoke(poolAdr, "calculateAmountOutForSwapREADONLY", [cleanAmountIn, isReverse], nil)
133131 if ($isInstanceOf(@, "Int"))
134132 then @
135133 else throw(($getType(@) + " couldn't be cast to Int"))
136134 }
137135 $Tuple2(nil, res)
138136 }
139137 else throw("Strict value is not equal to itself.")
140138 }
141139
142140
143141
144142 @Callable(i)
145143 func swap (amountOutMin,assetOut,addressTo) = {
146144 let pmt = value(i.payments[0])
147145 let assetIn = if ((pmt.assetId == unit))
148146 then toBytes("WAVES")
149147 else value(pmt.assetId)
150148 let amountIn = value(pmt.amount)
151149 let prFee = value(getInteger(protocolFee()))
152150 let feeProtocolAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
153151 let feeLiquidityAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
154152 let amountInToPool = (toBigInt(amountIn) - feeProtocolAmount)
155153 let cleanAmountIn = (amountInToPool - feeLiquidityAmount)
156154 let checks = [if ((size(i.payments) == 1))
157155 then true
158156 else throw("exactly 1 payment are expected")]
159157 if ((checks == checks))
160158 then {
161159 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
162160 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
163- let $t046945184 = if ((lpNonReverese != unit))
161+ let $t045515041 = if ((lpNonReverese != unit))
164162 then {
165163 let isReverse = false
166164 let pool = {
167165 let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpNonReverese], nil)
168166 if ($isInstanceOf(@, "Address"))
169167 then @
170168 else throw(($getType(@) + " couldn't be cast to Address"))
171169 }
172170 $Tuple2(isReverse, pool)
173171 }
174172 else if ((lpReverse != unit))
175173 then {
176174 let isReverse = true
177175 let pool = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpReverse], nil)
178176 $Tuple2(isReverse, pool)
179177 }
180178 else poolNotExist
181- let isReverse = $t046945184._1
182- let pool = $t046945184._2
179+ let isReverse = $t045515041._1
180+ let pool = $t045515041._2
183181 let isPoolOneTokenOperationsDisabled = {
184182 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
185183 if ($isInstanceOf(@, "Boolean"))
186184 then @
187185 else throw(($getType(@) + " couldn't be cast to Boolean"))
188186 }
189187 let check = if (isPoolOneTokenOperationsDisabled)
190188 then true
191189 else poolDisabled
192190 if ((check == check))
193191 then {
194192 let poolAdr = addressFromStringValue(valueOrElse(pool, ""))
195193 let res = {
196194 let @ = invoke(poolAdr, "calculateAmountOutForSwapAndSendTokens", [cleanAmountIn, isReverse, amountOutMin, addressTo], [AttachedPayment(assetIn, toInt(amountInToPool))])
197195 if ($isInstanceOf(@, "Boolean"))
198196 then @
199197 else throw(($getType(@) + " couldn't be cast to Boolean"))
200198 }
201199 $Tuple2(nil, res)
202200 }
203201 else throw("Strict value is not equal to itself.")
204202 }
205203 else throw("Strict value is not equal to itself.")
206204 }
207205
208206
209207
210208 @Callable(i)
211209 func setManager (pendingManagerPublicKey) = {
212210 let checkCaller = mustManager(i)
213211 if ((checkCaller == checkCaller))
214212 then {
215213 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
216214 if ((checkManagerPublicKey == checkManagerPublicKey))
217215 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
218216 else throw("Strict value is not equal to itself.")
219217 }
220218 else throw("Strict value is not equal to itself.")
221219 }
222220
223221
224222
225223 @Callable(i)
226224 func confirmManager () = {
227225 let pm = pendingManagerPublicKeyOrUnit()
228226 let hasPM = if (isDefined(pm))
229227 then true
230228 else throw("no pending manager")
231229 if ((hasPM == hasPM))
232230 then {
233231 let checkPM = if ((i.callerPublicKey == value(pm)))
234232 then true
235233 else throw("you are not pending manager")
236234 if ((checkPM == checkPM))
237235 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
238236 else throw("Strict value is not equal to itself.")
239237 }
240238 else throw("Strict value is not equal to itself.")
241239 }
242240
243241
244242 @Verifier(tx)
245243 func verify () = {
246244 let targetPublicKey = match managerPublicKeyOrUnit() {
247245 case pk: ByteVector =>
248246 pk
249247 case _: Unit =>
250248 tx.senderPublicKey
251249 case _ =>
252250 throw("Match error")
253251 }
254252 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
255253 }
256254

github/deemru/w8io/026f985 
53.61 ms