tx · D19hCqgMgnsU22KXdQST57REuJFQmDbxebpQpXzo8E7n

3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq:  -0.01000000 Waves

2024.03.04 11:21 [3003009] smart account 3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq > SELF 0.00000000 Waves

{ "type": 13, "id": "D19hCqgMgnsU22KXdQST57REuJFQmDbxebpQpXzo8E7n", "fee": 1000000, "feeAssetId": null, "timestamp": 1709540473665, "version": 2, "chainId": 84, "sender": "3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq", "senderPublicKey": "HdwFH8HPYu3HG27yK6bszu1CdR4uik4HgzyTimeSfcYf", "proofs": [ "4EwXkLdq6zoqsLWabTxjDoPgfnwtswNpHhfEfWNKNPJWBofgKJdoyASYhyTEj2i8mjUsQ1KSH8aDap3mTG96e639" ], "script": "base64:BgIECAISAA8AEGFtb3VudEFzc2V0SWRLZXkCDWFtb3VudEFzc2V0SWQAD3ByaWNlQXNzZXRJZEtleQIMcHJpY2VBc3NldElkAApmZWVSYXRlS2V5AgdmZWVSYXRlAQpnZXRBc3NldElkAQ1hc3NldElkU3RyaW5nAwkAAAIFDWFzc2V0SWRTdHJpbmcCBVdBVkVTBQR1bml0CQDZBAEFDWFzc2V0SWRTdHJpbmcBD2dldEFzc2V0QmFsYW5jZQEHYXNzZXRJZAQHJG1hdGNoMAUHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAJpZAUHJG1hdGNoMAkA8AcCBQR0aGlzBQJpZAgJAO8HAQUEdGhpcwlhdmFpbGFibGUAE2Ftb3VudEFzc2V0SWRTdHJpbmcJARFAZXh0ck5hdGl2ZSgxMDUzKQIFBHRoaXMFEGFtb3VudEFzc2V0SWRLZXkADWFtb3VudEFzc2V0SWQJAQpnZXRBc3NldElkAQUTYW1vdW50QXNzZXRJZFN0cmluZwASYW1vdW50QXNzZXRCYWxhbmNlCQEPZ2V0QXNzZXRCYWxhbmNlAQUNYW1vd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GY2hlY2tzBA1wYXltZW50QW1vdW50CAkAkQMCCAUBaQhwYXltZW50cwAABmFtb3VudAQJaW5pdEFtQmFsBRJhbW91bnRBc3NldEJhbGFuY2UECWluaXRQckJhbAkAZQIFEXByaWNlQXNzZXRCYWxhbmNlBQ1wYXltZW50QW1vdW50AAAJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAWkBA2ZvbwAJAJQKAgUDbmlsAAAAQWNTUw==", "height": 3003009, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5pdCPCDyatDLkfxt8mLnER4YMzvntECsNYP3WBDqMhRD Next: 2nivHmoga7eHVqiQMFBLchp1TyeJGedErJ4CZQN3mQ5M Diff:
OldNewDifferences
3737 let feeRate = valueOrElse(getInteger(this, feeRateKey), 1000000)
3838
3939 func calcSendAmount (initAmBal,initPrBal,paymentAmount) = {
40- let sendAmount = (initAmBal - fraction(initAmBal, initPrBal, initPrBal))
40+ let sendAmount = (initAmBal - fraction(initAmBal, initPrBal, (initPrBal + paymentAmount)))
4141 let newAmBal = (initAmBal - sendAmount)
4242 let newPrBal = (initPrBal + paymentAmount)
4343 let oldK = (initAmBal * initPrBal)
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 amountAssetBalance = getAssetBalance(amountAssetId)
2828
2929 let priceAssetIdString = getStringValue(this, priceAssetIdKey)
3030
3131 let priceAssetId = getAssetId(priceAssetIdString)
3232
3333 let priceAssetBalance = getAssetBalance(priceAssetId)
3434
3535 let SCALE8 = 100000000
3636
3737 let feeRate = valueOrElse(getInteger(this, feeRateKey), 1000000)
3838
3939 func calcSendAmount (initAmBal,initPrBal,paymentAmount) = {
40- let sendAmount = (initAmBal - fraction(initAmBal, initPrBal, initPrBal))
40+ let sendAmount = (initAmBal - fraction(initAmBal, initPrBal, (initPrBal + paymentAmount)))
4141 let newAmBal = (initAmBal - sendAmount)
4242 let newPrBal = (initPrBal + paymentAmount)
4343 let oldK = (initAmBal * initPrBal)
4444 let newK = (newAmBal * newPrBal)
4545 $Tuple7(sendAmount, initAmBal, initPrBal, oldK, newAmBal, newPrBal, newK)
4646 }
4747
4848
4949 func swap (i) = {
5050 let checks = [if ((size(i.payments) > 0))
5151 then true
5252 else throw("should be with 1 payment"), if ((i.payments[0].assetId == priceAssetId))
5353 then true
5454 else throw(makeString(["payment assetId should be: ", priceAssetIdString], " "))]
5555 if ((checks == checks))
5656 then {
5757 let paymentAmount = i.payments[0].amount
5858 let initAmBal = amountAssetBalance
5959 let initPrBal = (priceAssetBalance - paymentAmount)
6060 0
6161 }
6262 else throw("Strict value is not equal to itself.")
6363 }
6464
6565
6666 @Callable(i)
6767 func foo () = $Tuple2(nil, 0)
6868
6969

github/deemru/w8io/169f3d6 
36.83 ms