Enables swapping between an xPYT/NYT and its underlying asset by swapping via an external DEX and minting/burning xPYT/NYT.
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 supportUniswapV3Swapper.sol: Swapper that uses Uniswap V3 to swap between xPYTs/NYTsUniswapV3Juggler.sol: Given xPYT/NYT input, computes how much to swap to result in an equal amount of PYT & NYT.lib/: Libraries usedPoolAddress.sol: Provides functions for deriving a Uniswap V3 pool address from the factory, tokens, and the fee
curve-v2/: Curve V2 supportCurveV2Swapper.sol: Swapper that uses Curve V2 to swap between xPYTs/NYTsCurveV2Juggler.sol: Given xPYT/NYT input, computes how much to swap to result in an equal amount of PYT & NYT.
lib/: Helpful librariesApproveMaxIfNeeded.sol: Gives max ERC20 approval to the spender if the current allowance is insufficient.
To install with DappTools:
dapp install timeless-fi/swapper
To install with Foundry:
forge install timeless-fi/swapper
This project uses Foundry as the development framework.
make install
make build
make test