tx · 3mrufDkoHKzzESv7NXcZSGk5zhWC6qoV8if8Etj8mGBi

3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq:  -0.01300000 Waves

2023.02.13 09:08 [2447450] smart account 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq > SELF 0.00000000 Waves

{ "type": 13, "id": "3mrufDkoHKzzESv7NXcZSGk5zhWC6qoV8if8Etj8mGBi", "fee": 1300000, "feeAssetId": null, "timestamp": 1676268561783, "version": 2, "chainId": 84, "sender": "3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq", "senderPublicKey": "2u2wYYcVBQv43Cc71zkhHPPitkqgg6dqTZ3nUMvYJ1uq", "proofs": [ "2TfFnuAkT8XN3B5CHxCFX9MS1oeipCCd4UrHMi5d2cnMquL2Ht34q6bxCchEh64cGwFWqoenQ3ukzZ66xYavD5Zb" ], "script": "base64:BgIXCAISBQoDAQgIEgUKAwEICBIDCgEIEgAWAANTRVACAl9fAAhmZWVTY2FsZQkAtgIBAIDC1y8BD2dldFN0cmluZ09yRmFpbAEDa2V5CQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJ0IAgUEdGhpcwUDa2V5CQCsAgICFU5vIGRhdGEgZm9yIHRoaXMua2V5PQUDa2V5AAxwb29sRGlzYWJsZWQJAAIBAg1Qb29sIGRpc2FibGVkAAxwb29sTm90RXhpc3QJAAIBAhFQb29sIGlzIG5vdCBleGlzdAAOc2xpcHBhZ2VUb29CaWcJAAIBAhNTbGlwcGFnZSBpcyB0b28gYmlnARNrZXlNYW5hZ2VyUHVibGljS2V5AAIUJXNfX21hbmFnZXJQdWJsaWNLZXkBGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS2V5AAIbJXNfX3BlbmRpbmdNYW5hZ2VyUHVibGljS2V5AQJmYwACEyVzX19mYWN0b3J5Q29udHJhY3QAD2ZhY3RvcnlDb250cmFjdAkBEUBleHRyTmF0aXZlKDEwNjIpAQkBD2dldFN0cmluZ09yRmFpbAE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A9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAUPdGFyZ2V0UHVibGljS2V5g0zV9A==", "height": 2447450, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HekPHHP92aciJwYgQwZ4f8i2kX6Kdj6oEyD72yEJ3DgS Next: ALnuBBV9sSqPtwwqrSwPmNEpknEHcjw3jb5QgSmSnuE8 Diff:
OldNewDifferences
101101 let feePoolAmount = if ((toInt(feePoolAmountCalc) == 0))
102102 then toBigInt(1)
103103 else feePoolAmountCalc
104- let cleanAmountIn = ((toBigInt(amountIn) - feeProtocolAmount) - feePoolAmountCalc)
104+ let cleanAmountIn = ((toBigInt(amountIn) - feeProtocolAmount) - feePoolAmount)
105105 let lpNonReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
106106 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
107- let $t031263629 = if ((lpNonReverse != unit))
107+ let $t031223625 = if ((lpNonReverse != unit))
108108 then {
109109 let isReverse = false
110110 let pool = {
127127 $Tuple2(isReverse, pool)
128128 }
129129 else poolNotExist
130- let isReverse = $t031263629._1
131- let pool = $t031263629._2
130+ let isReverse = $t031223625._1
131+ let pool = $t031223625._2
132132 let poolStatus = {
133133 let @ = invoke(factoryContract, "getPoolStatusREADONLY", [pool], nil)
134134 if ($isInstanceOf(@, "Int"))
189189 then @
190190 else unit
191191 }
192- let $t052345836 = if ((lpNonReverse != unit))
192+ let $t052305832 = if ((lpNonReverse != unit))
193193 then {
194194 let isReverse = false
195195 let pool = {
212212 $Tuple2(isReverse, pool)
213213 }
214214 else throw(((("pool is not exist: assetIn=" + assetIn) + " assetOut=") + assetOut))
215- let isReverse = $t052345836._1
216- let pool = $t052345836._2
215+ let isReverse = $t052305832._1
216+ let pool = $t052305832._2
217217 let poolStatus = {
218218 let @ = invoke(factoryContract, "getPoolStatusREADONLY", [pool], nil)
219219 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
104- let cleanAmountIn = ((toBigInt(amountIn) - feeProtocolAmount) - feePoolAmountCalc)
104+ let cleanAmountIn = ((toBigInt(amountIn) - feeProtocolAmount) - feePoolAmount)
105105 let lpNonReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
106106 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
107- let $t031263629 = if ((lpNonReverse != unit))
107+ let $t031223625 = 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
130- let isReverse = $t031263629._1
131- let pool = $t031263629._2
130+ let isReverse = $t031223625._1
131+ let pool = $t031223625._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
174174 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 $t052345836 = if ((lpNonReverse != unit))
192+ let $t052305832 = 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 }
214214 else throw(((("pool is not exist: assetIn=" + assetIn) + " assetOut=") + assetOut))
215- let isReverse = $t052345836._1
216- let pool = $t052345836._2
215+ let isReverse = $t052305832._1
216+ let pool = $t052305832._2
217217 let poolStatus = {
218218 let @ = invoke(factoryContract, "getPoolStatusREADONLY", [pool], nil)
219219 if ($isInstanceOf(@, "Int"))
220220 then @
221221 else throw(($getType(@) + " couldn't be cast to Int"))
222222 }
223223 let check = if ((poolStatus == 1))
224224 then true
225225 else poolDisabled
226226 if ((check == check))
227227 then {
228228 let poolAdr = addressFromStringValue(pool)
229229 let assetInAttachedPayment = if ((assetIn == "WAVES"))
230230 then unit
231231 else fromBase58String(assetIn)
232232 let totalGetRaw = {
233233 let @ = invoke(poolAdr, "calculateAmountOutForSwapAndSendTokens", [toInt(cleanAmountIn), isReverse, amountOutMin, addressTo], [AttachedPayment(assetInAttachedPayment, toInt(cleanAmountIn))])
234234 if ($isInstanceOf(@, "Int"))
235235 then @
236236 else throw(($getType(@) + " couldn't be cast to Int"))
237237 }
238238 $Tuple2([ScriptTransfer(feeCollectorAddress, toInt(feeProtocolAmount), assetInAttachedPayment), ScriptTransfer(poolAdr, toInt(feePoolAmount), assetInAttachedPayment)], totalGetRaw)
239239 }
240240 else throw("Strict value is not equal to itself.")
241241 }
242242 else throw("Strict value is not equal to itself.")
243243 }
244244
245245
246246
247247 @Callable(i)
248248 func setManager (pendingManagerPublicKey) = {
249249 let checkCaller = mustManager(i)
250250 if ((checkCaller == checkCaller))
251251 then {
252252 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
253253 if ((checkManagerPublicKey == checkManagerPublicKey))
254254 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
255255 else throw("Strict value is not equal to itself.")
256256 }
257257 else throw("Strict value is not equal to itself.")
258258 }
259259
260260
261261
262262 @Callable(i)
263263 func confirmManager () = {
264264 let pm = pendingManagerPublicKeyOrUnit()
265265 let hasPM = if (isDefined(pm))
266266 then true
267267 else throw("no pending manager")
268268 if ((hasPM == hasPM))
269269 then {
270270 let checkPM = if ((i.callerPublicKey == value(pm)))
271271 then true
272272 else throw("you are not pending manager")
273273 if ((checkPM == checkPM))
274274 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
275275 else throw("Strict value is not equal to itself.")
276276 }
277277 else throw("Strict value is not equal to itself.")
278278 }
279279
280280
281281 @Verifier(tx)
282282 func verify () = {
283283 let targetPublicKey = match managerPublicKeyOrUnit() {
284284 case pk: ByteVector =>
285285 pk
286286 case _: Unit =>
287287 tx.senderPublicKey
288288 case _ =>
289289 throw("Match error")
290290 }
291291 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
292292 }
293293

github/deemru/w8io/026f985 
56.48 ms