delvtech / hyperdrive

An automated market maker for fixed and variable yield with on-demand terms.
Apache License 2.0
33 stars 4 forks source link

Small Decimal Issues #548

Closed jalextowle closed 1 year ago

jalextowle commented 1 year ago

We should have a minimum trade size because Hyperdrive doesn't work well with small inputs.

jrhea commented 1 year ago

This issue can be demonstrated in the following tests:

test_lp_withdrawal_long_short_redemption() test_lp_withdrawal_long_short_redemption_edge_case() test_lp_withdrawal_long_and_short_maturity()

These tests all pass now bc the fixedRate initialization was set to 5% and min trade amounts to 0.1e18; however, if they will fail if you have trade input sizes smaller than 0.01 (maybe 0.1) and/or a fixed rate initialization of 2%. The reason these params impact the test is bc small trades and/or large timestretches create outputs that are within the error of the pow function

jrhea commented 1 year ago

resolved by #577