Skip to content

Conversation

@mcclurejt
Copy link
Contributor

@mcclurejt mcclurejt commented Dec 31, 2024

Currently, closePositions(..) does not check whether a partial closure will result in a position value less than the minimum transaction amount.

This PR adds the necessary logic for this check as well as a test to ensure it is behaving as expected.

issue

depends on changes from the fix for 4

Hyperdrive returns the minimum transaction amount in base and rounds up
when handling conversions.

Previously, it was not being converted in some places and values were
rounded down.

This pr unifies the minimum transaction amount calculation and adds a
buffer to overestimate it.
@mcclurejt mcclurejt changed the title 5 - closePositions respects minimumTransactionAmount 5 - closePositions respects minimumTransactionAmount (depends on 4) Dec 31, 2024
Remove additional conversion for wrapped tokens since the wrapped token
denominations are the same as hyperdrive's vault shares token.
Currently, `closePositions(..)` does not check whether a partial closure
will result in a position value less than the minimum transaction
amount.

This PR adds the necessary logic for this check as well as a test to
ensure it is behaving as expected.

[issue](https://cantina.xyz/code/4f25dfd5-d3e6-4e7a-9481-d7306b795f2b/findings/5)
@mcclurejt mcclurejt force-pushed the mcclurejt/fix/close-positions-respect-min-tx-amount branch from e6060fd to 8464f8c Compare January 7, 2025 12:05
No conversions are needed for min tx amount when closing longs since
it's denominated in bonds not execution tokens
@mcclurejt mcclurejt requested a review from MrToph January 7, 2025 12:49
Base automatically changed from mcclurejt/fix/min-tx-amount-buffer to main March 18, 2025 15:15
@Sean329 Sean329 enabled auto-merge March 18, 2025 20:43
@Sean329 Sean329 added this pull request to the merge queue Mar 19, 2025
Merged via the queue into main with commit 4b31c75 Mar 19, 2025
3 checks passed
@Sean329 Sean329 deleted the mcclurejt/fix/close-positions-respect-min-tx-amount branch March 19, 2025 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants