tx · 8fyTTicxNy8FUm7EdqywTq3einNg2xS3SFpygPNt2VnA

3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq:  -0.01300000 Waves

2023.01.31 17:40 [2429253] smart account 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq > SELF 0.00000000 Waves

{ "type": 13, "id": "8fyTTicxNy8FUm7EdqywTq3einNg2xS3SFpygPNt2VnA", "fee": 1300000, "feeAssetId": null, "timestamp": 1675176068530, "version": 1, "sender": "3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq", "senderPublicKey": "2u2wYYcVBQv43Cc71zkhHPPitkqgg6dqTZ3nUMvYJ1uq", "proofs": [ "iZZWEtRD4hLebGmJK2DmMGf43sq96qtmXB2Crvx5Fc4PZgyvC8rBH9FQu8aqshVeobWK8zrsASqbaAyk6C3Yo5K" ], "script": "base64:BgIXCAISBQoDAQgIEgUKAwEICBIDCgEIEgAVAANTRVACAl9fAAhmZWVTY2FsZQkAtgIBAKCNBgEPZ2V0U3RyaW5nT3JGYWlsAQNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQR0aGlzBQNrZXkJAKwCAgIVTm8gZGF0YSBmb3IgdGhpcy5rZXk9BQNrZXkADHBvb2xEaXNhYmxlZAkAAgECDVBvb2wgZGlzYWJsZWQADHBvb2xOb3RFeGlzdAkAAgECEVBvb2wgaXMgbm90IGV4aXN0AA5zbGlwcGFnZVRvb0JpZwkAAgECE1NsaXBwYWdlIGlzIHRvbyBiaWcACXRlc3RFcnJvcgkAAgECD1Rlc3QgZXJyb3IgaGVyZQETa2V5TWFuYWdlclB1YmxpY0tleQACFCVzX19tYW5hZ2VyUHVibGljS2V5ARprZXlQZW5kaW5nTWFuYWdlclB1YmxpY0tleQACGyVzX19wZW5kaW5nTWFuYWdlclB1YmxpY0tleQECZmMAAhMlc19fZmFjdG9yeUNvbnRyYWN0AA9mYWN0b3J5Q29udHJhY3QJARFAZXh0ck5hdGl2ZSgx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429253, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3AkwLU2kJEjw6Vu2cSbMikZqmHjAVdYKR9Kdh7PSHp4W Next: 7fwdKZDFUwdE91XzWuwWaoYBDXXNTyU9zxYKDdkRUBhn Diff:
OldNewDifferences
9696 let cleanAmountIn = (amountInToPool - feeLiquidityAmount)
9797 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
9898 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
99- let ee = if ((0 == 0))
100- then testError
101- else testError
102- let $t027583264 = if ((lpNonReverese != unit))
99+ let $t027683274 = if ((lpNonReverese != unit))
103100 then {
104101 let isReverse = false
105102 let pool = {
117114 $Tuple2(isReverse, pool)
118115 }
119116 else testError
120- let isReverse = $t027583264._1
121- let pool = $t027583264._2
117+ let isReverse = $t027683274._1
118+ let pool = $t027683274._2
122119 let isPoolOneTokenOperationsDisabled = {
123120 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
124121 if ($isInstanceOf(@, "Boolean"))
163160 then {
164161 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
165162 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
166- let $t046845174 = if ((lpNonReverese != unit))
163+ let $t046945184 = if ((lpNonReverese != unit))
167164 then {
168165 let isReverse = false
169166 let pool = {
181178 $Tuple2(isReverse, pool)
182179 }
183180 else poolNotExist
184- let isReverse = $t046845174._1
185- let pool = $t046845174._2
181+ let isReverse = $t046945184._1
182+ let pool = $t046945184._2
186183 let isPoolOneTokenOperationsDisabled = {
187184 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
188185 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 let testError = throw("Test error here")
1818
1919 func keyManagerPublicKey () = "%s__managerPublicKey"
2020
2121
2222 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
2323
2424
2525 func fc () = "%s__factoryContract"
2626
2727
2828 let factoryContract = addressFromStringValue(getStringOrFail(fc()))
2929
3030 func feeLiquidityContractAddress () = makeString(["%s", "feeLiquidityContractAddress"], SEP)
3131
3232
3333 func feeLiquidity () = makeString(["%s", "feeLiquidity"], SEP)
3434
3535
3636 func protocolFee () = makeString(["%s", "protocolFee"], SEP)
3737
3838
3939 func asInt (val) = match val {
4040 case valInt: Int =>
4141 valInt
4242 case _ =>
4343 throw("fail to cast into Int")
4444 }
4545
4646
4747 func dataMappingPoolAssets (internalAmountAssetStr,internalPriceAssetStr) = makeString(["%d%d", toString(internalAmountAssetStr), toString(internalPriceAssetStr)], SEP)
4848
4949
5050 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
5151 case s: String =>
5252 fromBase58String(s)
5353 case _: Unit =>
5454 unit
5555 case _ =>
5656 throw("Match error")
5757 }
5858
5959
6060 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
6161 case s: String =>
6262 fromBase58String(s)
6363 case _: Unit =>
6464 unit
6565 case _ =>
6666 throw("Match error")
6767 }
6868
6969
7070 func isManager (i) = match managerPublicKeyOrUnit() {
7171 case pk: ByteVector =>
7272 (i.callerPublicKey == pk)
7373 case _: Unit =>
7474 (i.caller == this)
7575 case _ =>
7676 throw("Match error")
7777 }
7878
7979
8080 func mustManager (i) = if (isManager(i))
8181 then true
8282 else throw("permission denied")
8383
8484
8585 func getAccBalance (assetId) = if ((assetId == "WAVES"))
8686 then wavesBalance(this).available
8787 else assetBalance(this, fromBase58String(assetId))
8888
8989
9090 @Callable(i)
9191 func swapCalculateREADONLY (amountIn,assetIn,assetOut) = {
9292 let prFee = value(getInteger(protocolFee()))
9393 let feeProtocolAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
9494 let feeLiquidityAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
9595 let amountInToPool = (toBigInt(amountIn) - feeProtocolAmount)
9696 let cleanAmountIn = (amountInToPool - feeLiquidityAmount)
9797 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
9898 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
99- let ee = if ((0 == 0))
100- then testError
101- else testError
102- let $t027583264 = if ((lpNonReverese != unit))
99+ let $t027683274 = if ((lpNonReverese != unit))
103100 then {
104101 let isReverse = false
105102 let pool = {
106103 let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpNonReverese], nil)
107104 if ($isInstanceOf(@, "Address"))
108105 then @
109106 else throw(($getType(@) + " couldn't be cast to Address"))
110107 }
111108 $Tuple2(isReverse, pool)
112109 }
113110 else if ((lpReverse != unit))
114111 then {
115112 let isReverse = true
116113 let pool = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpReverse], nil)
117114 $Tuple2(isReverse, pool)
118115 }
119116 else testError
120- let isReverse = $t027583264._1
121- let pool = $t027583264._2
117+ let isReverse = $t027683274._1
118+ let pool = $t027683274._2
122119 let isPoolOneTokenOperationsDisabled = {
123120 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
124121 if ($isInstanceOf(@, "Boolean"))
125122 then @
126123 else throw(($getType(@) + " couldn't be cast to Boolean"))
127124 }
128125 let check = if (isPoolOneTokenOperationsDisabled)
129126 then true
130127 else poolDisabled
131128 if ((check == check))
132129 then {
133130 let poolAdr = addressFromStringValue(valueOrElse(pool, ""))
134131 let res = {
135132 let @ = invoke(poolAdr, "calculateAmountOutForSwapREADONLY", [cleanAmountIn, isReverse], nil)
136133 if ($isInstanceOf(@, "Int"))
137134 then @
138135 else throw(($getType(@) + " couldn't be cast to Int"))
139136 }
140137 $Tuple2(nil, res)
141138 }
142139 else throw("Strict value is not equal to itself.")
143140 }
144141
145142
146143
147144 @Callable(i)
148145 func swap (amountOutMin,assetOut,addressTo) = {
149146 let pmt = value(i.payments[0])
150147 let assetIn = if ((pmt.assetId == unit))
151148 then toBytes("WAVES")
152149 else value(pmt.assetId)
153150 let amountIn = value(pmt.amount)
154151 let prFee = value(getInteger(protocolFee()))
155152 let feeProtocolAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
156153 let feeLiquidityAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
157154 let amountInToPool = (toBigInt(amountIn) - feeProtocolAmount)
158155 let cleanAmountIn = (amountInToPool - feeLiquidityAmount)
159156 let checks = [if ((size(i.payments) == 1))
160157 then true
161158 else throw("exactly 1 payment are expected")]
162159 if ((checks == checks))
163160 then {
164161 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
165162 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
166- let $t046845174 = if ((lpNonReverese != unit))
163+ let $t046945184 = if ((lpNonReverese != unit))
167164 then {
168165 let isReverse = false
169166 let pool = {
170167 let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpNonReverese], nil)
171168 if ($isInstanceOf(@, "Address"))
172169 then @
173170 else throw(($getType(@) + " couldn't be cast to Address"))
174171 }
175172 $Tuple2(isReverse, pool)
176173 }
177174 else if ((lpReverse != unit))
178175 then {
179176 let isReverse = true
180177 let pool = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpReverse], nil)
181178 $Tuple2(isReverse, pool)
182179 }
183180 else poolNotExist
184- let isReverse = $t046845174._1
185- let pool = $t046845174._2
181+ let isReverse = $t046945184._1
182+ let pool = $t046945184._2
186183 let isPoolOneTokenOperationsDisabled = {
187184 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
188185 if ($isInstanceOf(@, "Boolean"))
189186 then @
190187 else throw(($getType(@) + " couldn't be cast to Boolean"))
191188 }
192189 let check = if (isPoolOneTokenOperationsDisabled)
193190 then true
194191 else poolDisabled
195192 if ((check == check))
196193 then {
197194 let poolAdr = addressFromStringValue(valueOrElse(pool, ""))
198195 let res = {
199196 let @ = invoke(poolAdr, "calculateAmountOutForSwapAndSendTokens", [cleanAmountIn, isReverse, amountOutMin, addressTo], [AttachedPayment(assetIn, toInt(amountInToPool))])
200197 if ($isInstanceOf(@, "Boolean"))
201198 then @
202199 else throw(($getType(@) + " couldn't be cast to Boolean"))
203200 }
204201 $Tuple2(nil, res)
205202 }
206203 else throw("Strict value is not equal to itself.")
207204 }
208205 else throw("Strict value is not equal to itself.")
209206 }
210207
211208
212209
213210 @Callable(i)
214211 func setManager (pendingManagerPublicKey) = {
215212 let checkCaller = mustManager(i)
216213 if ((checkCaller == checkCaller))
217214 then {
218215 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
219216 if ((checkManagerPublicKey == checkManagerPublicKey))
220217 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
221218 else throw("Strict value is not equal to itself.")
222219 }
223220 else throw("Strict value is not equal to itself.")
224221 }
225222
226223
227224
228225 @Callable(i)
229226 func confirmManager () = {
230227 let pm = pendingManagerPublicKeyOrUnit()
231228 let hasPM = if (isDefined(pm))
232229 then true
233230 else throw("no pending manager")
234231 if ((hasPM == hasPM))
235232 then {
236233 let checkPM = if ((i.callerPublicKey == value(pm)))
237234 then true
238235 else throw("you are not pending manager")
239236 if ((checkPM == checkPM))
240237 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
241238 else throw("Strict value is not equal to itself.")
242239 }
243240 else throw("Strict value is not equal to itself.")
244241 }
245242
246243
247244 @Verifier(tx)
248245 func verify () = {
249246 let targetPublicKey = match managerPublicKeyOrUnit() {
250247 case pk: ByteVector =>
251248 pk
252249 case _: Unit =>
253250 tx.senderPublicKey
254251 case _ =>
255252 throw("Match error")
256253 }
257254 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
258255 }
259256

github/deemru/w8io/026f985 
49.43 ms