Skip to main content
Helpful?

ProtocolFees

Git Source - Generated with forge doc

Inherits: IProtocolFees, Owned

Contract handling the setting and accrual of protocol fees

State Variables

protocolFeesAccrued

Given a currency address, returns the protocol fees accrued in that currency

mapping(Currency currency => uint256 amount) public protocolFeesAccrued;

protocolFeeController

Returns the current protocol fee controller address

address public protocolFeeController;

Functions

constructor

constructor(address initialOwner) Owned(initialOwner);

setProtocolFeeController

Sets the protocol fee controller

function setProtocolFeeController(address controller) external onlyOwner;

Parameters

NameTypeDescription
controlleraddressThe new protocol fee controller

setProtocolFee

Sets the protocol fee for the given pool

function setProtocolFee(PoolKey memory key, uint24 newProtocolFee) external;

Parameters

NameTypeDescription
keyPoolKeyThe key of the pool to set a protocol fee for
newProtocolFeeuint24The fee to set

collectProtocolFees

Collects the protocol fees for a given recipient and currency, returning the amount collected

This will revert if the contract is unlocked

function collectProtocolFees(address recipient, Currency currency, uint256 amount)
external
returns (uint256 amountCollected);

Parameters

NameTypeDescription
recipientaddressThe address to receive the protocol fees
currencyCurrencyThe currency to withdraw
amountuint256The amount of currency to withdraw

Returns

NameTypeDescription
amountCollecteduint256The amount of currency successfully withdrawn

_isUnlocked

abstract internal function to allow the ProtocolFees contract to access the lock

function _isUnlocked() internal virtual returns (bool);

_getPool

abstract internal function to allow the ProtocolFees contract to access pool state

this is overridden in PoolManager.sol to give access to the _pools mapping

function _getPool(PoolId id) internal virtual returns (Pool.State storage);

_updateProtocolFees

function _updateProtocolFees(Currency currency, uint256 amount) internal;
Helpful?