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

EverLong vault spec #1027

Closed wakamex closed 1 month ago

wakamex commented 2 months ago

Spec out the business logic of a Hyperdrive vault that takes base token as deposit and continuously opens Hyperdrive Longs.

Requirements:

wakamex commented 1 month ago
  1. Parameters:
    • uninvested amount X as percentage of total assets
    • target weighted average maturity (WAM) Y duration (seconds, months, etc.)
    • Greatly benefits from having a choice between two terms (3m and 6m terms)
  2. Invest if uninvested amount is <X%
  3. On investment:
    • If WAM < target, open long on longer term
    • If WAM > target, open long on shorter term
  4. On withdrawal, pay out from uninvested amount
    • If uninvested amount is not enough, close longs
    • All else equal, prefer closing longs closer to maturity
    • If WAM < target, close long on shorter term
    • If WAM > target, close long on longer term
  5. On maturity, funds go to uninvested amount
    • Possibly ping() to withdraw matured amounts
  6. Possible rebalance() function:
    • If WAM < target, close long close to maturity, open long on longer term
    • If WAM > target, close long far from maturity, open long on shorter term