tx · 62q9vi4LD3HiJ5WcLB9THCwBaxTnGJojVLAywVhPULra

3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq:  -0.01000000 Waves

2024.03.05 23:54 [3005221] smart account 3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq > SELF 0.00000000 Waves

{ "type": 13, "id": "62q9vi4LD3HiJ5WcLB9THCwBaxTnGJojVLAywVhPULra", "fee": 1000000, "feeAssetId": null, "timestamp": 1709672097201, "version": 2, "chainId": 84, "sender": "3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq", "senderPublicKey": "HdwFH8HPYu3HG27yK6bszu1CdR4uik4HgzyTimeSfcYf", "proofs": [ "2aq6JnDe57FtT28GoyHfVmh2niConaUbXDUoRhiSVS369pJfhjivmb66BmMAbx2w9jKAT71TC92AKrPqqcq2NSig" ], "script": "base64:BgIOCAISABIDCgEBEgMKAQgPABBhbW91bnRBc3NldElkS2V5Ag1hbW91bnRBc3NldElkAA9wcmljZUFzc2V0SWRLZXkCDHByaWNlQXNzZXRJZAAKZmVlUmF0ZUtleQIHZmVlUmF0ZQEKZ2V0QXNzZXRJZAENYXNzZXRJZFN0cmluZwMJAAACBQ1hc3NldElkU3RyaW5nAgVXQVZFUwUEdW5pdAkA2QQBBQ1hc3NldElkU3RyaW5nAQ9nZXRBc3NldEJhbGFuY2UBB2Fzc2V0SWQEByRtYXRjaDAFB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQCaWQFByRtYXRjaDAJAPAHAgUEdGhpcwUCaWQICQDvBwEFBHRoaXMJYXZhaWxhYmxlABNhbW91bnRBc3NldElkU3RyaW5nCQERQGV4dHJOYXRpdmUoMTA1MykCBQR0aGlzBRBhbW91bnRBc3NldElkS2V5AA1hbW91bnRBc3NldElkCQEKZ2V0QXNzZXRJZAEFE2Ftb3VudEFzc2V0SWRTdHJpbmcAEnByaWNlQXNzZXRJZFN0cmluZwkBEUBleHRyTmF0aXZlKDEwNTMp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WkALKVwLA==", "height": 3005221, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AUT1JaVsQcktijNetUsnNgs9p94j3aQHep5BLzF3mtAF Next: 7bLkhTLYM1UZWF91TKLDp9eJNWr2brhKyuzSUiDwWaZY Diff:
OldNewDifferences
5050 let amAssetId = $t013381490._1
5151 let prAssetId = $t013381490._2
5252 let initAmBal = getAssetBalance(amAssetId)
53- let initPrBal = (getAssetBalance(prAssetId) - paymentAmount)
53+ let initPrBal = getAssetBalance(prAssetId)
5454 let rawSendAmount = calcRawSendAmount(initAmBal, initPrBal, paymentAmount)
5555 let feeAmount = fraction(rawSendAmount, feeRate, SCALE8)
5656 let sendAmount = (rawSendAmount - feeAmount)
7171 then {
7272 let paymentAssetId = i.payments[0].assetId
7373 let paymentAmount = i.payments[0].amount
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
74+ let $t025162619 = calcSendAmount(paymentAssetId, paymentAmount)
75+ let sendAmount = $t025162619._1
76+ let feeAmount = $t025162619._2
77+ let sendAssetId = $t025162619._3
78+ let userRealPrice = $t025162619._4
7979 let sendActions = if ((feeAmount > 0))
8080 then [ScriptTransfer(address, sendAmount, sendAssetId)]
8181 else throw("amount is too low")
9292
9393 @Callable(i)
9494 func swapNoLess (minAmount) = {
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
95+ let $t029773029 = swapInternal(i.caller, i)
96+ let sendActions = $t029773029._1
97+ let tuple = $t029773029._2
98+ let $t030343097 = tuple
99+ let sendAmount = $t030343097._1
100+ let feeAmount = $t030343097._2
101+ let sendAssetId = $t030343097._3
102+ let userRealPrice = $t030343097._4
103103 if ((minAmount > sendAmount))
104104 then throw(makeString(["Price slipped. minAmount: ", toString(minAmount), " swapAmount: ", toString(sendAmount)], ""))
105105 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
3535 func calcPrice () = fraction(getAssetBalance(priceAssetId), SCALE8, getAssetBalance(amountAssetId))
3636
3737
3838 func calcRawSendAmount (initAmBal,initPrBal,paymentAmount) = {
3939 let newPrBal = (initPrBal + paymentAmount)
4040 let newAmBal = fraction(initAmBal, initPrBal, newPrBal)
4141 let sendAmount = (initAmBal - newAmBal)
4242 sendAmount
4343 }
4444
4545
4646 func calcSendAmount (paymentAssetId,paymentAmount) = {
4747 let $t013381490 = if ((paymentAssetId == amountAssetId))
4848 then $Tuple2(priceAssetId, amountAssetId)
4949 else $Tuple2(amountAssetId, priceAssetId)
5050 let amAssetId = $t013381490._1
5151 let prAssetId = $t013381490._2
5252 let initAmBal = getAssetBalance(amAssetId)
53- let initPrBal = (getAssetBalance(prAssetId) - paymentAmount)
53+ let initPrBal = getAssetBalance(prAssetId)
5454 let rawSendAmount = calcRawSendAmount(initAmBal, initPrBal, paymentAmount)
5555 let feeAmount = fraction(rawSendAmount, feeRate, SCALE8)
5656 let sendAmount = (rawSendAmount - feeAmount)
5757 let userRealPrice = if ((paymentAssetId == amountAssetId))
5858 then fraction(sendAmount, SCALE8, paymentAmount)
5959 else fraction(paymentAmount, SCALE8, sendAmount)
6060 $Tuple4(sendAmount, feeAmount, amAssetId, userRealPrice)
6161 }
6262
6363
6464 func swapInternal (address,i) = {
6565 let checks = [if ((size(i.payments) > 0))
6666 then true
6767 else throw("should be with 1 payment"), if (containsElement([amountAssetId, priceAssetId], i.payments[0].assetId))
6868 then true
6969 else throw(makeString(["payment assetId should be", amountAssetIdString, "or", priceAssetIdString], " "))]
7070 if ((checks == checks))
7171 then {
7272 let paymentAssetId = i.payments[0].assetId
7373 let paymentAmount = i.payments[0].amount
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
74+ let $t025162619 = calcSendAmount(paymentAssetId, paymentAmount)
75+ let sendAmount = $t025162619._1
76+ let feeAmount = $t025162619._2
77+ let sendAssetId = $t025162619._3
78+ let userRealPrice = $t025162619._4
7979 let sendActions = if ((feeAmount > 0))
8080 then [ScriptTransfer(address, sendAmount, sendAssetId)]
8181 else throw("amount is too low")
8282 $Tuple2(sendActions, $Tuple4(sendAmount, feeAmount, sendAssetId, userRealPrice))
8383 }
8484 else throw("Strict value is not equal to itself.")
8585 }
8686
8787
8888 @Callable(i)
8989 func swap () = swapInternal(i.caller, i)
9090
9191
9292
9393 @Callable(i)
9494 func swapNoLess (minAmount) = {
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
95+ let $t029773029 = swapInternal(i.caller, i)
96+ let sendActions = $t029773029._1
97+ let tuple = $t029773029._2
98+ let $t030343097 = tuple
99+ let sendAmount = $t030343097._1
100+ let feeAmount = $t030343097._2
101+ let sendAssetId = $t030343097._3
102+ let userRealPrice = $t030343097._4
103103 if ((minAmount > sendAmount))
104104 then throw(makeString(["Price slipped. minAmount: ", toString(minAmount), " swapAmount: ", toString(sendAmount)], ""))
105105 else $Tuple2(sendActions, tuple)
106106 }
107107
108108
109109
110110 @Callable(i)
111111 func swapFor (address) = swapInternal(addressFromStringValue(address), i)
112112
113113

github/deemru/w8io/169f3d6 
37.08 ms