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
Name | Type | Description |
---|---|---|
controller | address | The new protocol fee controller |
setProtocolFee
Sets the protocol fee for the given pool
function setProtocolFee(PoolKey memory key, uint24 newProtocolFee) external;
Parameters
Name | Type | Description |
---|---|---|
key | PoolKey | The key of the pool to set a protocol fee for |
newProtocolFee | uint24 | The 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
Name | Type | Description |
---|---|---|
recipient | address | The address to receive the protocol fees |
currency | Currency | The currency to withdraw |
amount | uint256 | The amount of currency to withdraw |
Returns
Name | Type | Description |
---|---|---|
amountCollected | uint256 | The 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;