
InfinityPoolsFactory an UpgradeableBeacon. When InfinityPools are deployed, they are deployed as BeaconProxies. Each BeaconProxy queries the UpgradeableBeacon for the current InfinityPool implementation and then uses delegateCall to that implementation.delegateCall to the same updated contract.UUPSUpgradeable contract. Its implementation can be changed by the same owner of the InfinityPoolsFactory.Users interact with InfinityPools through InfinityPoolsPeriphery for both liquidity management and swapper creation. InfinityPoolsPeriphery mints liquidity providers and traders unique NFTs that represent their positions.
Based on the provided token0, token1 and splits, InfinityPoolsPeriphery determines the correct InfinityPool by calling getPool from InfinityPoolsFactory.
For adding liquidity, the user calls the addLiquidity function, passing these arguments
struct AddLiquidityParams {
address token0;
address token1;
int256 splits;
int256 startEdge;
int256 stopEdge;
uint256 amount0Desired;
uint256 amount1Desired;
uint256 amount0Min;
uint256 amount1Min;
}
The (startEdge, stopEdge) identifies a range where the liquidity should be added
The amount0Min, amount0Desired and amount1Min, amount1Desired define the ranges of the token0 and token1 amounts for the LPing TX to succeed
For creating a swapper, the user calls the newLoan function.
tap()earnEracollect() functioncollect() which allows for withdrawing both the principal and accumulated yield if any remaining