Skip to main content

V4FeeAdapter

Git Source

Inherits: Owned

Triggers the collection of protocol fees to a predefined token jar.

State Variables

POOL_MANAGER

IPoolManager public immutable POOL_MANAGER

tokenJar

address public tokenJar

merkleRoot

bytes32 public merkleRoot

Functions

constructor

constructor(address _poolManager, address _tokenJar, address _owner) Owned(_owner);

collect

Collects the protocol fees for the given currencies to the token jar.

function collect(
Currency[] calldata currency,
uint256[] calldata amountRequested,
uint256[] calldata amountExpected
) external;

Parameters

NameTypeDescription
currencyCurrency[]The currencies to collect fees for.
amountRequesteduint256[]The amount of each currency to request.
amountExpecteduint256[]The amount of each currency that is expected to be collected.

setMerkleRoot

Sets the merkle root for the fee adapter.

only callable by owner

function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner;

Parameters

NameTypeDescription
_merkleRootbytes32The merkle root to set.

triggerFeeUpdate

Triggers the fee update for the given pool key.

function triggerFeeUpdate(
PoolKey calldata _poolKey,
uint24 newProtocolFee,
bytes32[] calldata proof
) external;

Parameters

NameTypeDescription
_poolKeyPoolKeyThe pool key to update the fee for.
newProtocolFeeuint24The new protocol fee to set.
proofbytes32[]The merkle proof corresponding to the set merkle root. Merkle root is generated from leaves of keccak256(abi.encode(poolKey, protocolFee)).

Errors

AmountCollectedTooLow

Thrown when the amount collected is less than the amount expected.

error AmountCollectedTooLow(uint256 amountCollected, uint256 amountExpected);

InvalidProof

Thrown when the merkle proof is invalid.

error InvalidProof();