tx · 9SHEDhoBRCdwgSTXA3kKdPAyqUEDTd3V68UMryvY6Rht

3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq:  -0.01000000 Waves

2024.03.04 11:17 [3003005] smart account 3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq > SELF 0.00000000 Waves

{ "type": 13, "id": "9SHEDhoBRCdwgSTXA3kKdPAyqUEDTd3V68UMryvY6Rht", "fee": 1000000, "feeAssetId": null, "timestamp": 1709540299747, "version": 2, "chainId": 84, "sender": "3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq", "senderPublicKey": "HdwFH8HPYu3HG27yK6bszu1CdR4uik4HgzyTimeSfcYf", "proofs": [ "3HPXAev1kgQJufepGp5fkrfK8vjy6UDDNf7FYJoXhHrcitrFipap9MwE68HLxJ9mBpd2UhZdFNQ4QgDgNyH9ziZc" ], "script": "base64:BgIECAISAA8AEGFtb3VudEFzc2V0SWRLZXkCDWFtb3VudEFzc2V0SWQAD3ByaWNlQXNzZXRJZEtleQIMcHJpY2VBc3NldElkAApmZWVSYXRlS2V5AgdmZWVSYXRlAQpnZXRBc3NldElkAQ1hc3NldElkU3RyaW5nAwkAAAIFDWFzc2V0SWRTdHJpbmcCBVdBVkVTBQR1bml0CQDZBAEFDWFzc2V0SWRTdHJpbmcBD2dldEFzc2V0QmFsYW5jZQEHYXNzZXRJZAQHJG1hdGNoMAUHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAJpZAUHJG1hdGNoMAkA8AcCBQR0aGlzBQJpZAgJAO8HAQUEdGhpcwlhdmFpbGFibGUAE2Ftb3VudEFzc2V0SWRTdHJpbmcJARFAZXh0ck5hdGl2ZSgxMDUzKQIFBHRoaXMFEGFtb3VudEFzc2V0SWRLZXkADWFtb3VudEFzc2V0SWQJAQpnZXRBc3NldElkAQUTYW1vdW50QXNzZXRJZFN0cmluZwASYW1vdW50QXNzZXRCYWxhbmNlCQEPZ2V0QXNzZXRCYWxhbm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MJAAACBQZjaGVja3MFBmNoZWNrcwQNcGF5bWVudEFtb3VudAgJAJEDAggFAWkIcGF5bWVudHMAAAZhbW91bnQECWluaXRBbUJhbAUSYW1vdW50QXNzZXRCYWxhbmNlBAlpbml0UHJCYWwJAGUCBRFwcmljZUFzc2V0QmFsYW5jZQUNcGF5bWVudEFtb3VudAAACQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQFpAQNmb28ACQCUCgIFA25pbAAAAGdtpII=", "height": 3003005, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EHuEL5dcBNBhVagcpHh7GsSmdu4eusog8FgiuB7EvUw2 Next: 9UhDN4m4W8Z4nMWTsQpUhBmiY4Bm5yhsPjNrL8RjgCku Diff:
OldNewDifferences
3737 let feeRate = valueOrElse(getInteger(this, feeRateKey), 1000000)
3838
3939 func calcSendAmount (initAmBal,initPrBal,paymentAmount) = {
40- let initSendAmount = (initAmBal - fraction((initAmBal * initPrBal), SCALE8, (priceAssetBalance * SCALE8)))
40+ let initSendAmount = (initAmBal - fraction((initAmBal * initPrBal), SCALE8, (initPrBal * SCALE8)))
4141 let newAmBal = (initAmBal - initSendAmount)
4242 let newPrBal = (initPrBal + paymentAmount)
4343 let oldK = (initAmBal * initPrBal)
44- let newK = (newAmBal * priceAssetBalance)
44+ let newK = (newAmBal * newPrBal)
4545 $Tuple6(initAmBal, initPrBal, oldK, newAmBal, newPrBal, newK)
4646 }
4747
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 initSendAmount = (initAmBal - fraction((initAmBal * initPrBal), SCALE8, (priceAssetBalance * SCALE8)))
40+ let initSendAmount = (initAmBal - fraction((initAmBal * initPrBal), SCALE8, (initPrBal * SCALE8)))
4141 let newAmBal = (initAmBal - initSendAmount)
4242 let newPrBal = (initPrBal + paymentAmount)
4343 let oldK = (initAmBal * initPrBal)
44- let newK = (newAmBal * priceAssetBalance)
44+ let newK = (newAmBal * newPrBal)
4545 $Tuple6(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 
23.00 ms