protocol fees

This commit is contained in:
tim
2025-10-02 16:43:02 -04:00
parent b7e1b1cac2
commit c002d26daf
5 changed files with 178 additions and 22 deletions

View File

@@ -23,6 +23,14 @@ contract PartyPlanner is IPartyPlanner {
PartyPoolSwapMintImpl private immutable SWAP_MINT_IMPL;
function swapMintImpl() external view returns (PartyPoolSwapMintImpl) { return SWAP_MINT_IMPL; }
/// @notice Protocol fee share (ppm) applied to fees collected by pools created by this planner
uint256 private immutable PROTOCOL_FEE_PPM;
function protocolFeePpm() external view returns (uint256) { return PROTOCOL_FEE_PPM; }
/// @notice Address to receive protocol fees for pools created by this planner (may be address(0))
address private immutable PROTOCOL_FEE_ADDRESS;
function protocolFeeAddress() external view returns (address) { return PROTOCOL_FEE_ADDRESS; }
// On-chain pool indexing
PartyPool[] private _allPools;
IERC20[] private _allTokens;
@@ -32,11 +40,22 @@ contract PartyPlanner is IPartyPlanner {
/// @param _swapMintImpl address of the SwapMint implementation contract to be used by all pools
/// @param _mintImpl address of the Mint implementation contract to be used by all pools
constructor(PartyPoolSwapMintImpl _swapMintImpl, PartyPoolMintImpl _mintImpl) {
/// @param _protocolFeePpm protocol fee share (ppm) to be used for pools created by this planner
/// @param _protocolFeeAddress recipient address for protocol fees for pools created by this planner (may be address(0))
constructor(
PartyPoolSwapMintImpl _swapMintImpl,
PartyPoolMintImpl _mintImpl,
uint256 _protocolFeePpm,
address _protocolFeeAddress
) {
require(address(_swapMintImpl) != address(0), "Planner: swapMintImpl address cannot be zero");
SWAP_MINT_IMPL = _swapMintImpl;
require(address(_mintImpl) != address(0), "Planner: mintImpl address cannot be zero");
MINT_IMPL = _mintImpl;
require(_protocolFeePpm < 1_000_000, "Planner: protocol fee >= ppm");
PROTOCOL_FEE_PPM = _protocolFeePpm;
PROTOCOL_FEE_ADDRESS = _protocolFeeAddress;
}
/// Main newPool variant: accepts kappa directly (preferred).
@@ -75,6 +94,8 @@ contract PartyPlanner is IPartyPlanner {
_kappa,
_swapFeePpm,
_flashFeePpm,
PROTOCOL_FEE_PPM,
PROTOCOL_FEE_ADDRESS,
_stable,
PartyPoolSwapMintImpl(SWAP_MINT_IMPL),
MINT_IMPL