Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Position values when held after maturity should use vault share price at time of close #1497

Open
dpaiton opened this issue Sep 13, 2024 · 0 comments

Comments

@dpaiton
Copy link
Member

dpaiton commented Sep 13, 2024

This is also described in delvtech/agent0#1683

Problem

When showing a user's position value after maturity the FE uses our hyperdrive-rs calculate_close_long to estimate the shares returned to the user. This uses the current vault share price and does not account for Hyperdrive auto-closing positions at maturity, which therefore fails to account for zombie interest going to the LPs.

Solution

Ideally we would account for checkpointing, auto-closing positions, and zombie interest in hyperdrive-rs itself (#23).

Until then, you can adjust the value reported to the user pretty easily. Using the share price at maturity (which can be obtained from the corresponding checkpoint event), calculation is user_return_in_shares = rust_shares_returned * maturity_share_price / current_share_price.

If the user wants base back, then you don't do the last conversion: user_return_in_base = rust_shares_returned * maturity_share_price.

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

No branches or pull requests

1 participant