tx · HekPHHP92aciJwYgQwZ4f8i2kX6Kdj6oEyD72yEJ3DgS

3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq:  -0.01300000 Waves

2023.02.13 09:07 [2447449] smart account 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq > SELF 0.00000000 Waves

{ "type": 13, "id": "HekPHHP92aciJwYgQwZ4f8i2kX6Kdj6oEyD72yEJ3DgS", "fee": 1300000, "feeAssetId": null, "timestamp": 1676268447531, "version": 2, "chainId": 84, "sender": "3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq", "senderPublicKey": "2u2wYYcVBQv43Cc71zkhHPPitkqgg6dqTZ3nUMvYJ1uq", "proofs": [ "2PHnud4jC4mcE4Tey1gzrN9bDZNPN7VLxW6VUGUfrxzuHLnNaG63ZPK9TVXS1BqV1Tiadu6KTfRmiz5U6VaviY8w" ], "script": "base64:BgIXCAISBQoDAQgIEgUKAwEICBIDCgEIEgAWAANTRVACAl9fAAhmZWVTY2FsZQkAtgIBAIDC1y8BD2dldFN0cmluZ09yRmFpbAEDa2V5CQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJ0IAgUEdGhpcwUDa2V5CQCsAgICFU5vIGRhdGEgZm9yIHRoaXMua2V5PQUDa2V5AAxwb29sRGlzYWJsZWQJAAIBAg1Qb29sIGRpc2FibGVkAAxwb29sTm90RXhpc3QJAAIBAhFQb29sIGlzIG5vdCBleGlzdAAOc2xpcHBhZ2VUb29CaWcJAAIBAhNTbGlwcGFnZSBpcyB0b28gYmlnARNrZXlNYW5hZ2VyUHVibGljS2V5AAIUJXNfX21hbmFnZXJQdWJsaWNLZXkBGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS2V5AAIbJXNfX3BlbmRpbmdNYW5hZ2VyUHVibGljS2V5AQJmYwACEyVzX19mYWN0b3J5Q29udHJhY3QAD2ZhY3RvcnlDb250cmFjdAkBEUBleHRyTmF0aXZlKDEwNjIpAQkBD2dldFN0cmluZ09yRm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ggZXJyb3IJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFD3RhcmdldFB1YmxpY0tleWN7Ywc=", "height": 2447449, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Ex3yP4fpy6K8gL1QAdsxKbXPJ9BvbET2VWDKGewvBKrA Next: 3mrufDkoHKzzESv7NXcZSGk5zhWC6qoV8if8Etj8mGBi Diff:
OldNewDifferences
171171 let feePoolAmount = if ((toInt(feePoolAmountCalc) == 0))
172172 then toBigInt(1)
173173 else feePoolAmountCalc
174- let cleanAmountIn = ((toBigInt(amountIn) - feeProtocolAmount) - feePoolAmountCalc)
174+ let cleanAmountIn = ((toBigInt(amountIn) - feeProtocolAmount) - feePoolAmount)
175175 let checks = [if ((size(i.payments) == 1))
176176 then true
177177 else throw("exactly 1 payment are expected")]
189189 then @
190190 else unit
191191 }
192- let $t052386005 = if ((lpNonReverse != unit))
192+ let $t052345836 = if ((lpNonReverse != unit))
193193 then {
194194 let isReverse = false
195195 let pool = {
211211 }
212212 $Tuple2(isReverse, pool)
213213 }
214- else throw(((((("pool is not exist: assetIn=" + assetIn) + " assetOut=") + assetOut) + " lpReverse=") + (if ((lpReverse == unit))
215- then "unit"
216- else ((value(lpReverse) + " lpNonReverse=") + (if ((lpNonReverse == unit))
217- then "unit"
218- else (value(lpNonReverse) + ""))))))
219- let isReverse = $t052386005._1
220- let pool = $t052386005._2
214+ else throw(((("pool is not exist: assetIn=" + assetIn) + " assetOut=") + assetOut))
215+ let isReverse = $t052345836._1
216+ let pool = $t052345836._2
221217 let poolStatus = {
222218 let @ = invoke(factoryContract, "getPoolStatusREADONLY", [pool], nil)
223219 if ($isInstanceOf(@, "Int"))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let feeScale = toBigInt(100000000)
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 protocolFee () = makeString(["%s", "protocolFee"], SEP)
2929
3030
3131 func poolFee () = makeString(["%s", "poolFee"], SEP)
3232
3333
3434 func getStringOrFailFromAddress (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
3535
3636
3737 let keyFeeCollectorAddress = "%s__feeCollectorAddress"
3838
3939 let feeCollectorAddress = addressFromStringValue(getStringOrFailFromAddress(factoryContract, keyFeeCollectorAddress))
4040
4141 func asInt (val) = match val {
4242 case valInt: Int =>
4343 valInt
4444 case _ =>
4545 throw("fail to cast into Int")
4646 }
4747
4848
4949 func dataMappingPoolAssets (internalAmountAssetStr,internalPriceAssetStr) = makeString(["%d%d", toString(internalAmountAssetStr), toString(internalPriceAssetStr)], SEP)
5050
5151
5252 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
5353 case s: String =>
5454 fromBase58String(s)
5555 case _: Unit =>
5656 unit
5757 case _ =>
5858 throw("Match error")
5959 }
6060
6161
6262 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
6363 case s: String =>
6464 fromBase58String(s)
6565 case _: Unit =>
6666 unit
6767 case _ =>
6868 throw("Match error")
6969 }
7070
7171
7272 func isManager (i) = match managerPublicKeyOrUnit() {
7373 case pk: ByteVector =>
7474 (i.callerPublicKey == pk)
7575 case _: Unit =>
7676 (i.caller == this)
7777 case _ =>
7878 throw("Match error")
7979 }
8080
8181
8282 func mustManager (i) = if (isManager(i))
8383 then true
8484 else throw("permission denied")
8585
8686
8787 func getAccBalance (assetId) = if ((assetId == "WAVES"))
8888 then wavesBalance(this).available
8989 else assetBalance(this, fromBase58String(assetId))
9090
9191
9292 @Callable(i)
9393 func swapCalculateREADONLY (amountIn,assetIn,assetOut) = {
9494 let prFee = value(getInteger(protocolFee()))
9595 let feeProtocolAmountCalc = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
9696 let plFee = value(getInteger(poolFee()))
9797 let feePoolAmountCalc = fraction(toBigInt(amountIn), toBigInt(plFee), feeScale)
9898 let feeProtocolAmount = if ((toInt(feeProtocolAmountCalc) == 0))
9999 then toBigInt(1)
100100 else feeProtocolAmountCalc
101101 let feePoolAmount = if ((toInt(feePoolAmountCalc) == 0))
102102 then toBigInt(1)
103103 else feePoolAmountCalc
104104 let cleanAmountIn = ((toBigInt(amountIn) - feeProtocolAmount) - feePoolAmountCalc)
105105 let lpNonReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
106106 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
107107 let $t031263629 = if ((lpNonReverse != unit))
108108 then {
109109 let isReverse = false
110110 let pool = {
111111 let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpNonReverse], nil)
112112 if ($isInstanceOf(@, "String"))
113113 then @
114114 else throw(($getType(@) + " couldn't be cast to String"))
115115 }
116116 $Tuple2(isReverse, pool)
117117 }
118118 else if ((lpReverse != unit))
119119 then {
120120 let isReverse = true
121121 let pool = {
122122 let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpReverse], nil)
123123 if ($isInstanceOf(@, "String"))
124124 then @
125125 else throw(($getType(@) + " couldn't be cast to String"))
126126 }
127127 $Tuple2(isReverse, pool)
128128 }
129129 else poolNotExist
130130 let isReverse = $t031263629._1
131131 let pool = $t031263629._2
132132 let poolStatus = {
133133 let @ = invoke(factoryContract, "getPoolStatusREADONLY", [pool], nil)
134134 if ($isInstanceOf(@, "Int"))
135135 then @
136136 else throw(($getType(@) + " couldn't be cast to Int"))
137137 }
138138 let check = if ((poolStatus == 1))
139139 then true
140140 else poolDisabled
141141 if ((check == check))
142142 then {
143143 let poolAdr = addressFromStringValue(valueOrElse(pool, ""))
144144 let res = {
145145 let @ = invoke(poolAdr, "calculateAmountOutForSwapREADONLY", [toInt(cleanAmountIn), isReverse], nil)
146146 if ($isInstanceOf(@, "Int"))
147147 then @
148148 else throw(($getType(@) + " couldn't be cast to Int"))
149149 }
150150 $Tuple2(nil, res)
151151 }
152152 else throw("Strict value is not equal to itself.")
153153 }
154154
155155
156156
157157 @Callable(i)
158158 func swap (amountOutMin,assetOut,addressTo) = {
159159 let pmt = value(i.payments[0])
160160 let assetIn = if ((pmt.assetId == unit))
161161 then "WAVES"
162162 else toBase58String(value(pmt.assetId))
163163 let amountIn = value(pmt.amount)
164164 let prFee = value(getInteger(protocolFee()))
165165 let feeProtocolAmountCalc = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
166166 let plFee = value(getInteger(poolFee()))
167167 let feePoolAmountCalc = fraction(toBigInt(amountIn), toBigInt(plFee), feeScale)
168168 let feeProtocolAmount = if ((toInt(feeProtocolAmountCalc) == 0))
169169 then toBigInt(1)
170170 else feeProtocolAmountCalc
171171 let feePoolAmount = if ((toInt(feePoolAmountCalc) == 0))
172172 then toBigInt(1)
173173 else feePoolAmountCalc
174- let cleanAmountIn = ((toBigInt(amountIn) - feeProtocolAmount) - feePoolAmountCalc)
174+ let cleanAmountIn = ((toBigInt(amountIn) - feeProtocolAmount) - feePoolAmount)
175175 let checks = [if ((size(i.payments) == 1))
176176 then true
177177 else throw("exactly 1 payment are expected")]
178178 if ((checks == checks))
179179 then {
180180 let lpNonReverse = {
181181 let @ = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
182182 if ($isInstanceOf(@, "String"))
183183 then @
184184 else unit
185185 }
186186 let lpReverse = {
187187 let @ = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
188188 if ($isInstanceOf(@, "String"))
189189 then @
190190 else unit
191191 }
192- let $t052386005 = if ((lpNonReverse != unit))
192+ let $t052345836 = if ((lpNonReverse != unit))
193193 then {
194194 let isReverse = false
195195 let pool = {
196196 let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [value(lpNonReverse)], nil)
197197 if ($isInstanceOf(@, "String"))
198198 then @
199199 else throw(($getType(@) + " couldn't be cast to String"))
200200 }
201201 $Tuple2(isReverse, pool)
202202 }
203203 else if ((lpReverse != unit))
204204 then {
205205 let isReverse = true
206206 let pool = {
207207 let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [value(lpReverse)], nil)
208208 if ($isInstanceOf(@, "String"))
209209 then @
210210 else throw(($getType(@) + " couldn't be cast to String"))
211211 }
212212 $Tuple2(isReverse, pool)
213213 }
214- else throw(((((("pool is not exist: assetIn=" + assetIn) + " assetOut=") + assetOut) + " lpReverse=") + (if ((lpReverse == unit))
215- then "unit"
216- else ((value(lpReverse) + " lpNonReverse=") + (if ((lpNonReverse == unit))
217- then "unit"
218- else (value(lpNonReverse) + ""))))))
219- let isReverse = $t052386005._1
220- let pool = $t052386005._2
214+ else throw(((("pool is not exist: assetIn=" + assetIn) + " assetOut=") + assetOut))
215+ let isReverse = $t052345836._1
216+ let pool = $t052345836._2
221217 let poolStatus = {
222218 let @ = invoke(factoryContract, "getPoolStatusREADONLY", [pool], nil)
223219 if ($isInstanceOf(@, "Int"))
224220 then @
225221 else throw(($getType(@) + " couldn't be cast to Int"))
226222 }
227223 let check = if ((poolStatus == 1))
228224 then true
229225 else poolDisabled
230226 if ((check == check))
231227 then {
232228 let poolAdr = addressFromStringValue(pool)
233229 let assetInAttachedPayment = if ((assetIn == "WAVES"))
234230 then unit
235231 else fromBase58String(assetIn)
236232 let totalGetRaw = {
237233 let @ = invoke(poolAdr, "calculateAmountOutForSwapAndSendTokens", [toInt(cleanAmountIn), isReverse, amountOutMin, addressTo], [AttachedPayment(assetInAttachedPayment, toInt(cleanAmountIn))])
238234 if ($isInstanceOf(@, "Int"))
239235 then @
240236 else throw(($getType(@) + " couldn't be cast to Int"))
241237 }
242238 $Tuple2([ScriptTransfer(feeCollectorAddress, toInt(feeProtocolAmount), assetInAttachedPayment), ScriptTransfer(poolAdr, toInt(feePoolAmount), assetInAttachedPayment)], totalGetRaw)
243239 }
244240 else throw("Strict value is not equal to itself.")
245241 }
246242 else throw("Strict value is not equal to itself.")
247243 }
248244
249245
250246
251247 @Callable(i)
252248 func setManager (pendingManagerPublicKey) = {
253249 let checkCaller = mustManager(i)
254250 if ((checkCaller == checkCaller))
255251 then {
256252 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
257253 if ((checkManagerPublicKey == checkManagerPublicKey))
258254 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
259255 else throw("Strict value is not equal to itself.")
260256 }
261257 else throw("Strict value is not equal to itself.")
262258 }
263259
264260
265261
266262 @Callable(i)
267263 func confirmManager () = {
268264 let pm = pendingManagerPublicKeyOrUnit()
269265 let hasPM = if (isDefined(pm))
270266 then true
271267 else throw("no pending manager")
272268 if ((hasPM == hasPM))
273269 then {
274270 let checkPM = if ((i.callerPublicKey == value(pm)))
275271 then true
276272 else throw("you are not pending manager")
277273 if ((checkPM == checkPM))
278274 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
279275 else throw("Strict value is not equal to itself.")
280276 }
281277 else throw("Strict value is not equal to itself.")
282278 }
283279
284280
285281 @Verifier(tx)
286282 func verify () = {
287283 let targetPublicKey = match managerPublicKeyOrUnit() {
288284 case pk: ByteVector =>
289285 pk
290286 case _: Unit =>
291287 tx.senderPublicKey
292288 case _ =>
293289 throw("Match error")
294290 }
295291 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
296292 }
297293

github/deemru/w8io/169f3d6 
54.00 ms