delvtech / hyperdrive

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

fix calculate_implied_rate to scale according to position duration #1006

Closed MazyGio closed 2 months ago

MazyGio commented 2 months ago

Resolved Issues

Fixes #1003

Description

Fixes calculate_implied_rate to adjust the variable rate according to the term duration and compounding frequency.

We should probably add a test with a position duration different than 1 year, but I couldn't easily figure out how to.

Review Checklists

Please check each item before approving the pull request. While going through the checklist, it is recommended to leave comments on items that are referenced in the checklist to make sure that they are reviewed. If there are multiple reviewers, copy the checklists into sections titled ## [Reviewer Name]. If the PR doesn't touch Solidity and/or Rust, the corresponding checklist can be removed.

[[Reviewer Name]]

Rust