85 lines
4.1 KiB
Solidity
85 lines
4.1 KiB
Solidity
// SPDX-License-Identifier: UNLICENSED
|
|
pragma solidity ^0.8.30;
|
|
|
|
import "./PartyPool.sol";
|
|
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
|
|
/// @title IPartyPlanner
|
|
/// @notice Interface for factory contract for creating and tracking PartyPool instances
|
|
interface IPartyPlanner {
|
|
// Event emitted when a new pool is created
|
|
event PartyStarted(PartyPool indexed pool, string name, string symbol, IERC20[] tokens);
|
|
|
|
/// @notice Creates a new PartyPool instance and initializes it with initial deposits
|
|
/// @param name_ LP token name
|
|
/// @param symbol_ LP token symbol
|
|
/// @param _tokens token addresses (n)
|
|
/// @param _bases scaling bases for each token (n) - used when converting to/from internal 64.64 amounts
|
|
/// @param _tradeFrac trade fraction in 64.64 fixed-point (as used by LMSR)
|
|
/// @param _targetSlippage target slippage in 64.64 fixed-point (as used by LMSR)
|
|
/// @param _swapFeePpm fee in parts-per-million, taken from swap input amounts before LMSR calculations
|
|
/// @param _flashFeePpm fee in parts-per-million, taken for flash loans
|
|
/// @param _stable if true and assets.length==2, then the optimization for 2-asset stablecoin pools is activated
|
|
/// @param payer address that provides the initial token deposits
|
|
/// @param receiver address that receives the minted LP tokens
|
|
/// @param initialDeposits amounts of each token to deposit initially
|
|
/// @param deadline Reverts if nonzero and the current blocktime is later than the deadline
|
|
/// @return pool Address of the newly created and initialized PartyPool
|
|
/// @return lpAmount Amount of LP tokens minted to the receiver
|
|
function createPool(
|
|
// Pool constructor args
|
|
string memory name_,
|
|
string memory symbol_,
|
|
IERC20[] memory _tokens,
|
|
uint256[] memory _bases,
|
|
int128 _tradeFrac,
|
|
int128 _targetSlippage,
|
|
uint256 _swapFeePpm,
|
|
uint256 _flashFeePpm,
|
|
bool _stable,
|
|
// Initial deposit information
|
|
address payer,
|
|
address receiver,
|
|
uint256[] memory initialDeposits,
|
|
uint256 initialLpAmount,
|
|
uint256 deadline
|
|
) external returns (PartyPool pool, uint256 lpAmount);
|
|
|
|
/// @notice Checks if a pool is supported
|
|
/// @param pool The pool address to check
|
|
/// @return bool True if the pool is supported, false otherwise
|
|
function getPoolSupported(address pool) external view returns (bool);
|
|
|
|
/// @notice Returns the total number of pools created
|
|
/// @return The total count of pools
|
|
function poolCount() external view returns (uint256);
|
|
|
|
/// @notice Retrieves a page of pool addresses
|
|
/// @param offset Starting index for pagination
|
|
/// @param limit Maximum number of items to return
|
|
/// @return pools Array of pool addresses for the requested page
|
|
function getAllPools(uint256 offset, uint256 limit) external view returns (PartyPool[] memory pools);
|
|
|
|
/// @notice Returns the total number of unique tokens
|
|
/// @return The total count of unique tokens
|
|
function tokenCount() external view returns (uint256);
|
|
|
|
/// @notice Retrieves a page of token addresses
|
|
/// @param offset Starting index for pagination
|
|
/// @param limit Maximum number of items to return
|
|
/// @return tokens Array of token addresses for the requested page
|
|
function getAllTokens(uint256 offset, uint256 limit) external view returns (address[] memory tokens);
|
|
|
|
/// @notice Returns the total number of pools for a specific token
|
|
/// @param token The token address to query
|
|
/// @return The total count of pools containing the token
|
|
function poolsByTokenCount(IERC20 token) external view returns (uint256);
|
|
|
|
/// @notice Retrieves a page of pool addresses for a specific token
|
|
/// @param token The token address to query pools for
|
|
/// @param offset Starting index for pagination
|
|
/// @param limit Maximum number of items to return
|
|
/// @return pools Array of pool addresses containing the specified token
|
|
function getPoolsByToken(IERC20 token, uint256 offset, uint256 limit) external view returns (PartyPool[] memory pools);
|
|
}
|