Skip to main content
Helpful?

IProtocolFees

Git Source | Generated with forge doc

Interface for all protocol-fee related functions in the pool manager

Functions

protocolFeesAccrued

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

function protocolFeesAccrued(Currency currency) external view returns (uint256 amount);

Parameters

NameTypeDescription
currencyCurrencyThe currency to check

Returns

NameTypeDescription
amountuint256The amount of protocol fees accrued in the currency

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

setProtocolFeeController

Sets the protocol fee controller

function setProtocolFeeController(IProtocolFeeController controller) external;

Parameters

NameTypeDescription
controllerIProtocolFeeControllerThe new protocol fee controller

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

protocolFeeController

Returns the current protocol fee controller address

function protocolFeeController() external view returns (IProtocolFeeController);

Returns

NameTypeDescription
<none>IProtocolFeeControllerIProtocolFeeController The currency protocol fee controller

Events

ProtocolFeeControllerUpdated

Emitted when the protocol fee controller address is updated in setProtocolFeeController.

event ProtocolFeeControllerUpdated(address indexed protocolFeeController);

ProtocolFeeUpdated

Emitted when the protocol fee is updated for a pool.

event ProtocolFeeUpdated(PoolId indexed id, uint24 protocolFee);

Errors

ProtocolFeeCannotBeFetched

Thrown when not enough gas is provided to look up the protocol fee

error ProtocolFeeCannotBeFetched();

ProtocolFeeTooLarge

Thrown when protocol fee is set too high

error ProtocolFeeTooLarge(uint24 fee);

ContractUnlocked

Thrown when the contract is unlocked

error ContractUnlocked();

InvalidCaller

Thrown when collectProtocolFees or setProtocolFee is not called by the controller.

error InvalidCaller();
Helpful?