Skip to content

ERC4626 vault for auto-compounding perpetual yield tokens

License

Notifications You must be signed in to change notification settings

timeless-fi/xPYT

Repository files navigation

xPYT

xPYT is a permissionless vault framework for auto-compounding the yield earned by Timeless perpetual yield tokens (PYT) into more PYT. It is introduced for two reasons:

  1. Makes it easier to build yield-leveraging strategies.
  2. xPYT has better composability with other protocols that don't expect to claim the yield earned by PYT. (e.g. Rari Fuse, Uniswap, cross-chain bridges) If raw PYT is used instead of xPYT in contracts without Timeless support, the yield accrued to the contract will be lost, so xPYT should be used instead.

xPYT has the following features:

  • Permissionless deployment: Anyone can use the xPYTFactory contract to deploy xPYT vaults.
  • Permissionless auto-compounding: Rather than relying on centralized strategists/harvesters to perform the auto-compounding, xPYT makes the auto-compounding executable by anyone, and the caller would receive a portion of the claimed yield as reward. This means xPYT vaults can rely on MEV bots to perform the auto-compounding, rather than having to build out centralized infrastructure.
  • Minimal sandwiching losses: xPYT uses a TWAP oracle to make sure that when it auto-compounds yield into PYT the price it gets doesn't deviate too much from the TWAP, minimizing losses from sandwiching attacks.

Architecture

Installation

To install with DappTools:

dapp install timeless-fi/xPYT

To install with Foundry:

forge install timeless-fi/xPYT

Local development

This project uses Foundry as the development framework.

Dependencies

make install

Compilation

make build

Testing

make test

Known issues

pound() can be sandwich attacked

Since calling pound() is (intentionally) permissionless, an attacker can sandwich attack the swap that occurs during the call to extract profit. Realistically it's not a problem since the amount of yield being compounded is usually small (on the same order of magnitude as the gas cost).

About

ERC4626 vault for auto-compounding perpetual yield tokens

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages