tx · 3g5NcMPY9HAShJa14jcya7jbSGYd2nEV69qgeRrpajxG

3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq:  -0.01300000 Waves

2023.02.03 13:50 [2433343] smart account 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq > SELF 0.00000000 Waves

{ "type": 13, "id": "3g5NcMPY9HAShJa14jcya7jbSGYd2nEV69qgeRrpajxG", "fee": 1300000, "feeAssetId": null, "timestamp": 1675421476152, "version": 1, "sender": "3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq", "senderPublicKey": "2u2wYYcVBQv43Cc71zkhHPPitkqgg6dqTZ3nUMvYJ1uq", "proofs": [ "5Yf8ZiHaseqdRh5yHUvLmPyzQXhF2GHUMRQmt8r46wiCDs3NAXMdPorDPbkJ68JyN9ZMk6hYEvtQCW92kdFdJRoQ" ], "script": "base64:BgIXCAISBQoDAQgIEgUKAwEICBIDCgEIEgAUAANTRVACAl9fAAhmZWVTY2FsZQkAtgIBAKCNBgEPZ2V0U3RyaW5nT3JGYWlsAQNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQR0aGlzBQNrZXkJAKwCAgIVTm8gZGF0YSBmb3IgdGhpcy5rZXk9BQNrZXkADHBvb2xEaXNhYmxlZAkAAgECDVBvb2wgZGlzYWJsZWQADHBvb2xOb3RFeGlzdAkAAgECEVBvb2wgaXMgbm90IGV4aXN0AA5zbGlwcGFnZVRvb0JpZwkAAgECE1NsaXBwYWdlIGlzIHRvbyBiaWcBE2tleU1hbmFnZXJQdWJsaWNLZXkAAhQlc19fbWFuYWdlclB1YmxpY0tleQEaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkAAhslc19fcGVuZGluZ01hbmFnZXJQdWJsaWNLZXkBAmZjAAITJXNfX2ZhY3RvcnlDb250cmFjdAAPZmFjdG9yeUNvbnRyYWN0CQERQGV4dHJOYXRpdmUoMTA2MikBCQEPZ2V0U3RyaW5nT3JGYWlsA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diff:
OldNewDifferences
9494 let cleanAmountIn = (amountInToPool - feeLiquidityAmount)
9595 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
9696 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
97- let $t026413131 = if ((lpNonReverese != unit))
97+ let $t026413114 = if ((lpNonReverese != unit))
9898 then {
9999 let isReverse = false
100- let pool = {
101- let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpNonReverese], nil)
102- if ($isInstanceOf(@, "Address"))
103- then @
104- else throw(($getType(@) + " couldn't be cast to Address"))
105- }
100+ let pool = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpNonReverese], nil)
106101 $Tuple2(isReverse, pool)
107102 }
108103 else if ((lpReverse != unit))
112107 $Tuple2(isReverse, pool)
113108 }
114109 else poolNotExist
115- let isReverse = $t026413131._1
116- let pool = $t026413131._2
110+ let isReverse = $t026413114._1
111+ let pool = $t026413114._2
117112 let isPoolOneTokenOperationsDisabled = {
118113 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
119114 if ($isInstanceOf(@, "Boolean"))
158153 then {
159154 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
160155 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
161- let $t045515041 = if ((lpNonReverese != unit))
156+ let $t045345024 = if ((lpNonReverese != unit))
162157 then {
163158 let isReverse = false
164159 let pool = {
176171 $Tuple2(isReverse, pool)
177172 }
178173 else poolNotExist
179- let isReverse = $t045515041._1
180- let pool = $t045515041._2
174+ let isReverse = $t045345024._1
175+ let pool = $t045345024._2
181176 let isPoolOneTokenOperationsDisabled = {
182177 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
183178 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)
97- let $t026413131 = if ((lpNonReverese != unit))
97+ let $t026413114 = if ((lpNonReverese != unit))
9898 then {
9999 let isReverse = false
100- let pool = {
101- let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpNonReverese], nil)
102- if ($isInstanceOf(@, "Address"))
103- then @
104- else throw(($getType(@) + " couldn't be cast to Address"))
105- }
100+ let pool = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpNonReverese], nil)
106101 $Tuple2(isReverse, pool)
107102 }
108103 else if ((lpReverse != unit))
109104 then {
110105 let isReverse = true
111106 let pool = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpReverse], nil)
112107 $Tuple2(isReverse, pool)
113108 }
114109 else poolNotExist
115- let isReverse = $t026413131._1
116- let pool = $t026413131._2
110+ let isReverse = $t026413114._1
111+ let pool = $t026413114._2
117112 let isPoolOneTokenOperationsDisabled = {
118113 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
119114 if ($isInstanceOf(@, "Boolean"))
120115 then @
121116 else throw(($getType(@) + " couldn't be cast to Boolean"))
122117 }
123118 let check = if (isPoolOneTokenOperationsDisabled)
124119 then true
125120 else poolDisabled
126121 if ((check == check))
127122 then {
128123 let poolAdr = addressFromStringValue(valueOrElse(pool, ""))
129124 let res = {
130125 let @ = invoke(poolAdr, "calculateAmountOutForSwapREADONLY", [cleanAmountIn, isReverse], nil)
131126 if ($isInstanceOf(@, "Int"))
132127 then @
133128 else throw(($getType(@) + " couldn't be cast to Int"))
134129 }
135130 $Tuple2(nil, res)
136131 }
137132 else throw("Strict value is not equal to itself.")
138133 }
139134
140135
141136
142137 @Callable(i)
143138 func swap (amountOutMin,assetOut,addressTo) = {
144139 let pmt = value(i.payments[0])
145140 let assetIn = if ((pmt.assetId == unit))
146141 then toBytes("WAVES")
147142 else value(pmt.assetId)
148143 let amountIn = value(pmt.amount)
149144 let prFee = value(getInteger(protocolFee()))
150145 let feeProtocolAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
151146 let feeLiquidityAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale)
152147 let amountInToPool = (toBigInt(amountIn) - feeProtocolAmount)
153148 let cleanAmountIn = (amountInToPool - feeLiquidityAmount)
154149 let checks = [if ((size(i.payments) == 1))
155150 then true
156151 else throw("exactly 1 payment are expected")]
157152 if ((checks == checks))
158153 then {
159154 let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil)
160155 let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil)
161- let $t045515041 = if ((lpNonReverese != unit))
156+ let $t045345024 = if ((lpNonReverese != unit))
162157 then {
163158 let isReverse = false
164159 let pool = {
165160 let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpNonReverese], nil)
166161 if ($isInstanceOf(@, "Address"))
167162 then @
168163 else throw(($getType(@) + " couldn't be cast to Address"))
169164 }
170165 $Tuple2(isReverse, pool)
171166 }
172167 else if ((lpReverse != unit))
173168 then {
174169 let isReverse = true
175170 let pool = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpReverse], nil)
176171 $Tuple2(isReverse, pool)
177172 }
178173 else poolNotExist
179- let isReverse = $t045515041._1
180- let pool = $t045515041._2
174+ let isReverse = $t045345024._1
175+ let pool = $t045345024._2
181176 let isPoolOneTokenOperationsDisabled = {
182177 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil)
183178 if ($isInstanceOf(@, "Boolean"))
184179 then @
185180 else throw(($getType(@) + " couldn't be cast to Boolean"))
186181 }
187182 let check = if (isPoolOneTokenOperationsDisabled)
188183 then true
189184 else poolDisabled
190185 if ((check == check))
191186 then {
192187 let poolAdr = addressFromStringValue(valueOrElse(pool, ""))
193188 let res = {
194189 let @ = invoke(poolAdr, "calculateAmountOutForSwapAndSendTokens", [cleanAmountIn, isReverse, amountOutMin, addressTo], [AttachedPayment(assetIn, toInt(amountInToPool))])
195190 if ($isInstanceOf(@, "Boolean"))
196191 then @
197192 else throw(($getType(@) + " couldn't be cast to Boolean"))
198193 }
199194 $Tuple2(nil, res)
200195 }
201196 else throw("Strict value is not equal to itself.")
202197 }
203198 else throw("Strict value is not equal to itself.")
204199 }
205200
206201
207202
208203 @Callable(i)
209204 func setManager (pendingManagerPublicKey) = {
210205 let checkCaller = mustManager(i)
211206 if ((checkCaller == checkCaller))
212207 then {
213208 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
214209 if ((checkManagerPublicKey == checkManagerPublicKey))
215210 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
216211 else throw("Strict value is not equal to itself.")
217212 }
218213 else throw("Strict value is not equal to itself.")
219214 }
220215
221216
222217
223218 @Callable(i)
224219 func confirmManager () = {
225220 let pm = pendingManagerPublicKeyOrUnit()
226221 let hasPM = if (isDefined(pm))
227222 then true
228223 else throw("no pending manager")
229224 if ((hasPM == hasPM))
230225 then {
231226 let checkPM = if ((i.callerPublicKey == value(pm)))
232227 then true
233228 else throw("you are not pending manager")
234229 if ((checkPM == checkPM))
235230 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
236231 else throw("Strict value is not equal to itself.")
237232 }
238233 else throw("Strict value is not equal to itself.")
239234 }
240235
241236
242237 @Verifier(tx)
243238 func verify () = {
244239 let targetPublicKey = match managerPublicKeyOrUnit() {
245240 case pk: ByteVector =>
246241 pk
247242 case _: Unit =>
248243 tx.senderPublicKey
249244 case _ =>
250245 throw("Match error")
251246 }
252247 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
253248 }
254249

github/deemru/w8io/026f985 
35.95 ms