FeeDispatcher
Inherits: IFeeDispatcher
Author: 0xvv @ Kiln
This contract contains functions to dispatch the ETH in a contract upon withdrawal.
State Variables
$feeRecipients
The recipients of the fees upon withdrawal.
Slot: keccak256(bytes("feeDispatcher.1.feeRecipients")) - 1
types.Array internal constant $feeRecipients = types.Array.wrap(0xd681f9d3e640a2dd835404271506ef93f020e2fc065878793505e5ea088fde3d);
$feeSplits
The splits of each recipient of the fees upon withdrawal.
Slot: keccak256(bytes("feeDispatcher.1.feeSplits")) - 1
types.Array internal constant $feeSplits = types.Array.wrap(0x31a3fa329157566a07927d0c2ba92ff801e4db8af2ec73f92eaf3e7f78d587a8);
$locked
The lock to prevent reentrancy
Slot: keccak256(bytes("feeDispatcher.1.locked")) - 1
types.Uint256 internal constant $locked = types.Uint256.wrap(0x8472de2bbf04bc62a7ee894bd625126d381bf5e8b726e5cd498c3a9dad76d85b);
UNLOCKED
The states of the lock, 1 = unlocked, 2 = locked
uint256 internal constant UNLOCKED = 1;
LOCKED
uint256 internal constant LOCKED = 2;
Functions
constructor
constructor();
_initFeeDispatcher
An internal function to set the fee split & unlock the reentrancy lock. Should be called in the initializer of the inheriting contract.
function _initFeeDispatcher(address[] calldata recipients, uint256[] calldata splits) internal;
nonReentrant
Modifier to prevent reentrancy
modifier nonReentrant() virtual;
withdrawCommission
Allows the integrator to withdraw the ETH in the contract.
function withdrawCommission() external nonReentrant;
getCurrentSplit
Returns the current fee split and recipients
This function is not pure as it fetches the current fee split and recipients from storage
function getCurrentSplit() external pure returns (address[] memory, uint256[] memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address[] | feeRecipients The current fee recipients |
<none> | uint256[] | feeSplits The current fee splits |
_setFeeSplit
Internal utility to set the fee distribution upon withdrawal
function _setFeeSplit(address[] calldata recipients, uint256[] calldata splits) internal;
Parameters
| Name | Type | Description |
|---|---|---|
recipients | address[] | The new fee recipients list |
splits | uint256[] | The new split between fee recipients |