tx · Du9MnSQgpyPbQwWYedpZtyYCXY1VT5on6PeXuV9H1A8B

3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq:  -0.01300000 Waves

2023.02.03 14:43 [2433399] smart account 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq > SELF 0.00000000 Waves

{ "type": 13, "id": "Du9MnSQgpyPbQwWYedpZtyYCXY1VT5on6PeXuV9H1A8B", "fee": 1300000, "feeAssetId": null, "timestamp": 1675424625087, "version": 1, "sender": "3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq", "senderPublicKey": "2u2wYYcVBQv43Cc71zkhHPPitkqgg6dqTZ3nUMvYJ1uq", "proofs": [ "4qmtXidJ7Xw1NYhVRw4sZKr7NVXb537sdGsdYegkJ1UMZgRwa93gE2VmusY8j1LfjMEFVeLrtzddqSczwfzHgWpU" ], "script": "base64:BgIXCAISBQoDAQgIEgUKAwEICBIDCgEIEgAUAANTRVACAl9fAAhmZWVTY2FsZQkAtgIBAKCNBgEPZ2V0U3RyaW5nT3JGYWlsAQNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQR0aGlzBQNrZXkJAKwCAgIVTm8gZGF0YSBmb3IgdGhpcy5rZXk9BQNrZXkADHBvb2xEaXNhYmxlZAkAAgECDVBvb2wgZGlzYWJsZWQADHBvb2xOb3RFeGlzdAkAAgECEVBvb2wgaXMgbm90IGV4aXN0AA5zbGlwcGFnZVRvb0JpZwkAAgECE1NsaXBwYWdlIGlzIHRvbyBiaWcBE2tleU1hbmFnZXJQdWJsaWNLZXkAAhQlc19fbWFuYWdlclB1YmxpY0tleQEaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkAAhslc19fcGVuZGluZ01hbmFnZXJQdWJsaWNLZXkBAmZjAAITJXNfX2ZhY3RvcnlDb250cmFjdAAPZmFjdG9yeUNvbnRyYWN0CQERQGV4dHJOYXRpdmUoMTA2MikBCQEPZ2V0U3RyaW5nT3JGYWlsA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succeeded", "spentComplexity": 0 } View: original | compacted Prev: sFW4Lnewh68RQPhByb6LEKLMUDmUhtSb7yMb6Koz9qP Next: HJqFZpaBMhLm3G4BdVKKXHMPp8ceWftWeG4yfTrzdRi7 Diff:
OldNewDifferences
119119 else poolNotExist
120120 let isReverse = $t026413260._1
121121 let pool = $t026413260._2
122- let isPoolOneTokenOperationsDisabled = {
123- let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", ["3MqGtuaL3yJbKHqUxnSihJmYroyPf6QDp1x"], nil)
124- if ($isInstanceOf(@, "Boolean"))
122+ let poolStatus = {
123+ let @ = invoke(factoryContract, "getPoolStatusREADONLY", ["3MqGtuaL3yJbKHqUxnSihJmYroyPf6QDp1x"], nil)
124+ if ($isInstanceOf(@, "Int"))
125125 then @
126- else throw(($getType(@) + " couldn't be cast to Boolean"))
126+ else throw(($getType(@) + " couldn't be cast to Int"))
127127 }
128- let check = if (isPoolOneTokenOperationsDisabled)
128+ let check = if ((poolStatus == 1))
129129 then true
130130 else poolDisabled
131131 if ((check == check))
163163 then {
164164 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
165165 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
166- let $t047295219 = if ((lpNonReverese != unit))
166+ let $t046675157 = if ((lpNonReverese != unit))
167167 then {
168168 let isReverse = false
169169 let pool = {
181181 $Tuple2(isReverse, pool)
182182 }
183183 else poolNotExist
184- let isReverse = $t047295219._1
185- let pool = $t047295219._2
184+ let isReverse = $t046675157._1
185+ let pool = $t046675157._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 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(["%s", "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 $t026413260 = 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 = $t026413260._1
121121 let pool = $t026413260._2
122- let isPoolOneTokenOperationsDisabled = {
123- let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", ["3MqGtuaL3yJbKHqUxnSihJmYroyPf6QDp1x"], nil)
124- if ($isInstanceOf(@, "Boolean"))
122+ let poolStatus = {
123+ let @ = invoke(factoryContract, "getPoolStatusREADONLY", ["3MqGtuaL3yJbKHqUxnSihJmYroyPf6QDp1x"], nil)
124+ if ($isInstanceOf(@, "Int"))
125125 then @
126- else throw(($getType(@) + " couldn't be cast to Boolean"))
126+ else throw(($getType(@) + " couldn't be cast to Int"))
127127 }
128- let check = if (isPoolOneTokenOperationsDisabled)
128+ let check = if ((poolStatus == 1))
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 $t047295219 = if ((lpNonReverese != unit))
166+ let $t046675157 = 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 = $t047295219._1
185- let pool = $t047295219._2
184+ let isReverse = $t046675157._1
185+ let pool = $t046675157._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 
42.82 ms