You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a bug where calling rust's calc_close_long or calc_close_short when calculating the unrealized value of matured, but not closed, positions. Since the rust functions under the hood returns shares, agent0 converts it back to base using the current vault share price. This is correct when the position isn't matured, but since hyperdrive auto closes matured positions via checkpointing, we should be using the vault share price of when the position matured to convert from shares to base.
This issue is exacerbated when a user asks for shares back when closing (in the case of e.g., steth, where agent0 makes trades using yield), as there is a difference between the shares gotten from rust and the actual shares returned when closed due to the same issue. Here, the solution is:
There's a bug where calling rust's
calc_close_long
orcalc_close_short
when calculating the unrealized value of matured, but not closed, positions. Since the rust functions under the hood returns shares, agent0 converts it back to base using the current vault share price. This is correct when the position isn't matured, but since hyperdrive auto closes matured positions via checkpointing, we should be using the vault share price of when the position matured to convert from shares to base.This issue is exacerbated when a user asks for shares back when closing (in the case of e.g., steth, where agent0 makes trades using yield), as there is a difference between the shares gotten from rust and the actual shares returned when closed due to the same issue. Here, the solution is:
The text was updated successfully, but these errors were encountered: