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

correctly convert base token denominated values from hyperdrive #38

Conversation

mcclurejt
Copy link
Contributor

Some values received from hyperdrive are denominated in base tokens.

These must be converted to vault shares token denominated values when asBase==true || isWrapped==true in the strategy

@@ -502,8 +502,9 @@ contract EverlongStrategy is BaseStrategy {
// Hyperdrive's minimum transaction amount.
if (
totalPositionValue >
(_targetOutput - output + _poolConfig.minimumTransactionAmount)
.mulUp(ONE + partialPositionClosureBuffer)
(_targetOutput - output + _minimumTransactionAmount()).mulUp(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks right to me. I scrutinized this because I wanted to be sure that we weren't potentially comparing a bond amount to shares. This looks right since it's shares > share, but I do want to point out that if the LHS was in bonds, we would want to use _poolConfig.minimumTransactionAmount rather than _minimumTransactionAmount. Seems like this is being done correctly in the PR though, so this is just a note.

Copy link
Contributor

@jalextowle jalextowle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mcclurejt mcclurejt merged commit e82d8b3 into mcclurejt/feat/wrapped-tokens Dec 15, 2024
3 checks passed
@mcclurejt mcclurejt deleted the mcclurejt/fix/vault-shares-conversions branch December 15, 2024 03:52
github-merge-queue bot pushed a commit that referenced this pull request Dec 15, 2024
* add support for wrapped hyperdrive tokens

This enables support for hyperdrive instances with rebasing tokens since
yearn is unable to support rebasing tokens

* fixes and redeem part of test

* test fix

* fix issues with LPMath library revert on getPoolInfo

* cleanup

* responding to feedback from @jalextowle

* responding to feedback from @jalextowle

* convert "hyperdrive token" language to `execution token` language

* Update contracts/EverlongStrategy.sol

Co-authored-by: Alex Towle <jalextowle@gmail.com>

* correctly convert base token values from hyperdrive (#38)

Some values received from hyperdrive are denominated in base tokens.

These must be converted to vault shares token denominated values when `asBase==true || isWrapped==true` in the strategy

---------

Co-authored-by: Alex Towle <jalextowle@gmail.com>
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.

2 participants