Closed dpaiton closed 9 months ago
We also see this in our foundry tests, so I think that this calculation is legitimately off. @jrhea Made calculateShortProceeds
more accurate in #685, so we should try this again after landing v0.4.0
to see if the situation has improved.
Relevant crash report for v0.4.0 fuzz_long_short_maturity_values2024_01_10_20_11_34_Z.json
Relevant crash report for v0.5.1 fuzz_long_short_maturity_values2024_01_19_21_25_56_611326_UTC.json
Determined the difference here is due to the variable rate. Solved by added an epsilon of 1e9 wei in the fuzz test for mature shorts.
Crash Report
https://app.rollbar.com/a/delv/fix/item/FirstProject/38/occurrence/385515525734#detail
Same test as https://github.com/delvtech/hyperdrive/issues/697 but looking at the shorts instead of longs
Description
Test: fuzz_long_short_maturity_values.py
Expected Behavior
The trades should have matured from advancing time and an expected amount should have been returned.
actual_base_amount = close_trade_event.base_amount
`interest_accrued = expected_base_amount = ( open_trade_event.bond_amount * (closing_share_price / open_share_price + flat_fee_percent)
Actual Behavior
The expected and actual returned amounts do not match.
Steps to Reproduce
Run the fuzz test
Screenshots or Error Messages
Logs or Stack Traces
fuzz_long_short_maturity_values2023_12_12_18_44_49_Z.json