Skip to content

Enables swapping between an xPYT/NYT and its underlying asset by swapping via an external DEX and minting/burning xPYT/NYT.

License

Notifications You must be signed in to change notification settings

timeless-fi/swapper

Repository files navigation

Swapper

Enables swapping between an xPYT/NYT and its underlying asset by swapping via an external DEX and minting/burning xPYT/NYT.

Architecture

  • Swapper.sol: Abstract contract for swapping between xPYTs/NYTs and their underlying asset by swapping via an external DEX and minting/burning xPYT/NYT.
  • uniswap-v3/: Uniswap V3 support
    • UniswapV3Swapper.sol: Swapper that uses Uniswap V3 to swap between xPYTs/NYTs
    • UniswapV3Juggler.sol: Given xPYT/NYT input, computes how much to swap to result in an equal amount of PYT & NYT.
    • lib/: Libraries used
      • PoolAddress.sol: Provides functions for deriving a Uniswap V3 pool address from the factory, tokens, and the fee
  • curve-v2/: Curve V2 support
    • CurveV2Swapper.sol: Swapper that uses Curve V2 to swap between xPYTs/NYTs
    • CurveV2Juggler.sol: Given xPYT/NYT input, computes how much to swap to result in an equal amount of PYT & NYT.
  • lib/: Helpful libraries

Installation

To install with DappTools:

dapp install timeless-fi/swapper

To install with Foundry:

forge install timeless-fi/swapper

Local development

This project uses Foundry as the development framework.

Dependencies

make install

Compilation

make build

Testing

make test

About

Enables swapping between an xPYT/NYT and its underlying asset by swapping via an external DEX and minting/burning xPYT/NYT.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published