tx · 2TXNUoCatBrgcHKhwMQcQstCekjbmLRbzv2i4wygavVN

3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq:  -0.01000000 Waves

2024.03.04 14:44 [3003221] smart account 3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq > SELF 0.00000000 Waves

{ "type": 13, "id": "2TXNUoCatBrgcHKhwMQcQstCekjbmLRbzv2i4wygavVN", "fee": 1000000, "feeAssetId": null, "timestamp": 1709552664285, "version": 2, "chainId": 84, "sender": "3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq", "senderPublicKey": "HdwFH8HPYu3HG27yK6bszu1CdR4uik4HgzyTimeSfcYf", "proofs": [ "2Ht2LbUff4N4cParJ3doDTykLnYnG7g2rKr5HfnSTjFD1jduZZ9NBPMaXUFaVGDSvs3Ds2UAJ5KDJChR6kPYe7Bo" ], "script": "base64:BgIOCAISABIDCgEBEgMKAQgPABBhbW91bnRBc3NldElkS2V5Ag1hbW91bnRBc3NldElkAA9wcmljZUFzc2V0SWRLZXkCDHByaWNlQXNzZXRJZAAKZmVlUmF0ZUtleQIHZmVlUmF0ZQEKZ2V0QXNzZXRJZAENYXNzZXRJZFN0cmluZwMJAAACBQ1hc3NldElkU3RyaW5nAgVXQVZFUwUEdW5pdAkA2QQBBQ1hc3NldElkU3RyaW5nAQ9nZXRBc3NldEJhbGFuY2UBB2Fzc2V0SWQEByRtYXRjaDAFB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQCaWQFByRtYXRjaDAJAPAHAgUEdGhpcwUCaWQICQDvBwEFBHRoaXMJYXZhaWxhYmxlABNhbW91bnRBc3NldElkU3RyaW5nCQERQGV4dHJOYXRpdmUoMTA1MykCBQR0aGlzBRBhbW91bnRBc3NldElkS2V5AA1hbW91bnRBc3NldElkCQEKZ2V0QXNzZXRJZAEFE2Ftb3VudEFzc2V0SWRTdHJpbmcAEnByaWNlQXNzZXRJZFN0cmluZwkBEUBleHRyTmF0a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YXRpdmUoMTA2MikBBQdhZGRyZXNzBQFpAKqErUs=", "height": 3003221, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7KgSYbDidQ1pC6WWZLTPHFsv2oYMaLdLx6BcXrkuVCGN Next: AUT1JaVsQcktijNetUsnNgs9p94j3aQHep5BLzF3mtAF Diff:
OldNewDifferences
3232
3333 let feeRate = valueOrElse(getInteger(this, feeRateKey), 200000)
3434
35+func calcPrice () = fraction(getAssetBalance(amountAssetId), SCALE8, getAssetBalance(priceAssetId))
36+
37+
3538 func calcRawSendAmount (initAmBal,initPrBal,paymentAmount) = {
3639 let newPrBal = (initPrBal + paymentAmount)
3740 let newAmBal = fraction(initAmBal, initPrBal, newPrBal)
4144
4245
4346 func calcSendAmount (paymentAssetId,paymentAmount) = {
44- let $t012301382 = if ((paymentAssetId == amountAssetId))
47+ let $t013381490 = if ((paymentAssetId == amountAssetId))
4548 then $Tuple2(priceAssetId, amountAssetId)
4649 else $Tuple2(amountAssetId, priceAssetId)
47- let amAssetId = $t012301382._1
48- let prAssetId = $t012301382._2
50+ let amAssetId = $t013381490._1
51+ let prAssetId = $t013381490._2
4952 let initAmBal = getAssetBalance(amAssetId)
5053 let initPrBal = (getAssetBalance(prAssetId) - paymentAmount)
5154 let rawSendAmount = calcRawSendAmount(initAmBal, initPrBal, paymentAmount)
6871 then {
6972 let paymentAssetId = i.payments[0].assetId
7073 let paymentAmount = i.payments[0].amount
71- let $t023592462 = calcSendAmount(paymentAssetId, paymentAmount)
72- let sendAmount = $t023592462._1
73- let feeAmount = $t023592462._2
74- let sendAssetId = $t023592462._3
75- let userRealPrice = $t023592462._4
74+ let $t024672570 = calcSendAmount(paymentAssetId, paymentAmount)
75+ let sendAmount = $t024672570._1
76+ let feeAmount = $t024672570._2
77+ let sendAssetId = $t024672570._3
78+ let userRealPrice = $t024672570._4
7679 let sendActions = if ((feeAmount > 0))
7780 then [ScriptTransfer(address, sendAmount, sendAssetId)]
7881 else throw("amount is too low")
8992
9093 @Callable(i)
9194 func swapNoLess (minAmount) = {
92- let $t028202872 = swapInternal(i.caller, i)
93- let sendActions = $t028202872._1
94- let tuple = $t028202872._2
95- let $t028772940 = tuple
96- let sendAmount = $t028772940._1
97- let feeAmount = $t028772940._2
98- let sendAssetId = $t028772940._3
99- let userRealPrice = $t028772940._4
95+ let $t029282980 = swapInternal(i.caller, i)
96+ let sendActions = $t029282980._1
97+ let tuple = $t029282980._2
98+ let $t029853048 = tuple
99+ let sendAmount = $t029853048._1
100+ let feeAmount = $t029853048._2
101+ let sendAssetId = $t029853048._3
102+ let userRealPrice = $t029853048._4
100103 if ((minAmount > sendAmount))
101104 then throw(makeString(["Price slipped. minAmount: ", toString(minAmount), " swapAmount: ", toString(sendAmount)], ""))
102105 else $Tuple2(sendActions, tuple)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let amountAssetIdKey = "amountAssetId"
55
66 let priceAssetIdKey = "priceAssetId"
77
88 let feeRateKey = "feeRate"
99
1010 func getAssetId (assetIdString) = if ((assetIdString == "WAVES"))
1111 then unit
1212 else fromBase58String(assetIdString)
1313
1414
1515 func getAssetBalance (assetId) = match assetId {
1616 case id: ByteVector =>
1717 assetBalance(this, id)
1818 case _ =>
1919 wavesBalance(this).available
2020 }
2121
2222
2323 let amountAssetIdString = getStringValue(this, amountAssetIdKey)
2424
2525 let amountAssetId = getAssetId(amountAssetIdString)
2626
2727 let priceAssetIdString = getStringValue(this, priceAssetIdKey)
2828
2929 let priceAssetId = getAssetId(priceAssetIdString)
3030
3131 let SCALE8 = 100000000
3232
3333 let feeRate = valueOrElse(getInteger(this, feeRateKey), 200000)
3434
35+func calcPrice () = fraction(getAssetBalance(amountAssetId), SCALE8, getAssetBalance(priceAssetId))
36+
37+
3538 func calcRawSendAmount (initAmBal,initPrBal,paymentAmount) = {
3639 let newPrBal = (initPrBal + paymentAmount)
3740 let newAmBal = fraction(initAmBal, initPrBal, newPrBal)
3841 let sendAmount = (initAmBal - newAmBal)
3942 sendAmount
4043 }
4144
4245
4346 func calcSendAmount (paymentAssetId,paymentAmount) = {
44- let $t012301382 = if ((paymentAssetId == amountAssetId))
47+ let $t013381490 = if ((paymentAssetId == amountAssetId))
4548 then $Tuple2(priceAssetId, amountAssetId)
4649 else $Tuple2(amountAssetId, priceAssetId)
47- let amAssetId = $t012301382._1
48- let prAssetId = $t012301382._2
50+ let amAssetId = $t013381490._1
51+ let prAssetId = $t013381490._2
4952 let initAmBal = getAssetBalance(amAssetId)
5053 let initPrBal = (getAssetBalance(prAssetId) - paymentAmount)
5154 let rawSendAmount = calcRawSendAmount(initAmBal, initPrBal, paymentAmount)
5255 let feeAmount = fraction(rawSendAmount, feeRate, SCALE8)
5356 let sendAmount = (rawSendAmount - feeAmount)
5457 let userRealPrice = if ((paymentAssetId == amountAssetId))
5558 then fraction(sendAmount, SCALE8, paymentAmount)
5659 else fraction(paymentAmount, SCALE8, sendAmount)
5760 $Tuple4(sendAmount, feeAmount, amAssetId, userRealPrice)
5861 }
5962
6063
6164 func swapInternal (address,i) = {
6265 let checks = [if ((size(i.payments) > 0))
6366 then true
6467 else throw("should be with 1 payment"), if (containsElement([amountAssetId, priceAssetId], i.payments[0].assetId))
6568 then true
6669 else throw(makeString(["payment assetId should be", amountAssetIdString, "or", priceAssetIdString], " "))]
6770 if ((checks == checks))
6871 then {
6972 let paymentAssetId = i.payments[0].assetId
7073 let paymentAmount = i.payments[0].amount
71- let $t023592462 = calcSendAmount(paymentAssetId, paymentAmount)
72- let sendAmount = $t023592462._1
73- let feeAmount = $t023592462._2
74- let sendAssetId = $t023592462._3
75- let userRealPrice = $t023592462._4
74+ let $t024672570 = calcSendAmount(paymentAssetId, paymentAmount)
75+ let sendAmount = $t024672570._1
76+ let feeAmount = $t024672570._2
77+ let sendAssetId = $t024672570._3
78+ let userRealPrice = $t024672570._4
7679 let sendActions = if ((feeAmount > 0))
7780 then [ScriptTransfer(address, sendAmount, sendAssetId)]
7881 else throw("amount is too low")
7982 $Tuple2(sendActions, $Tuple4(sendAmount, feeAmount, sendAssetId, userRealPrice))
8083 }
8184 else throw("Strict value is not equal to itself.")
8285 }
8386
8487
8588 @Callable(i)
8689 func swap () = swapInternal(i.caller, i)
8790
8891
8992
9093 @Callable(i)
9194 func swapNoLess (minAmount) = {
92- let $t028202872 = swapInternal(i.caller, i)
93- let sendActions = $t028202872._1
94- let tuple = $t028202872._2
95- let $t028772940 = tuple
96- let sendAmount = $t028772940._1
97- let feeAmount = $t028772940._2
98- let sendAssetId = $t028772940._3
99- let userRealPrice = $t028772940._4
95+ let $t029282980 = swapInternal(i.caller, i)
96+ let sendActions = $t029282980._1
97+ let tuple = $t029282980._2
98+ let $t029853048 = tuple
99+ let sendAmount = $t029853048._1
100+ let feeAmount = $t029853048._2
101+ let sendAssetId = $t029853048._3
102+ let userRealPrice = $t029853048._4
100103 if ((minAmount > sendAmount))
101104 then throw(makeString(["Price slipped. minAmount: ", toString(minAmount), " swapAmount: ", toString(sendAmount)], ""))
102105 else $Tuple2(sendActions, tuple)
103106 }
104107
105108
106109
107110 @Callable(i)
108111 func swapFor (address) = swapInternal(addressFromStringValue(address), i)
109112
110113

github/deemru/w8io/169f3d6 
37.13 ms