FeeCollector
Inherits: AccessControlEnumerable
Contract to collect fees from the BasketManager and distribute them to sponsors and the protocol treasury
State Variables
_BASKET_TOKEN_ROLE
CONSTANTS ///
bytes32 private constant _BASKET_TOKEN_ROLE = keccak256("BASKET_TOKEN_ROLE");
_FEE_SPLIT_DECIMALS
Fee split is denominated in 1e4. Also used as maximum fee split for the sponsor.
uint16 private constant _FEE_SPLIT_DECIMALS = 1e4;
protocolTreasury
STATE VARIABLES ///
The address of the protocol treasury
address public protocolTreasury;
_basketManager
The BasketManager contract
BasketManager internal immutable _basketManager;
basketTokenSponsors
Mapping of basket tokens to their sponsor addresses
mapping(address basketToken => address sponsor) public basketTokenSponsors;
basketTokenSponsorSplits
Mapping of basket tokens to their sponsor split percentages
mapping(address basketToken => uint16 sponsorSplit) public basketTokenSponsorSplits;
claimableTreasuryFees
Mapping of basket tokens to current claimable treasury fees
mapping(address basketToken => uint256 claimableFees) public claimableTreasuryFees;
claimableSponsorFees
Mapping of basket tokens to the current claimable sponsor fees
mapping(address basketToken => uint256 claimableFees) public claimableSponsorFees;
Functions
constructor
Constructor to set the admin, basket manager, and protocol treasury
constructor(address admin, address basketManager, address treasury) payable;
Parameters
Name | Type | Description |
---|---|---|
admin | address | The address of the admin |
basketManager | address | The address of the BasketManager |
treasury | address | The address of the protocol treasury |
setProtocolTreasury
Set the protocol treasury address
function setProtocolTreasury(address treasury) external onlyRole(DEFAULT_ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
treasury | address | The address of the new protocol treasury |
setSponsor
Set the sponsor for a given basket token
function setSponsor(address basketToken, address sponsor) external onlyRole(DEFAULT_ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
basketToken | address | The address of the basket token |
sponsor | address | The address of the sponsor |
setSponsorSplit
Set the split of management fees given to the sponsor for a given basket token
function setSponsorSplit(address basketToken, uint16 sponsorSplit) external onlyRole(DEFAULT_ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
basketToken | address | The address of the basket token |
sponsorSplit | uint16 | The percentage of fees to give to the sponsor denominated in _FEE_SPLIT_DECIMALS |
notifyHarvestFee
Notify the FeeCollector of the fees collected from the basket token
function notifyHarvestFee(uint256 shares) external;
Parameters
Name | Type | Description |
---|---|---|
shares | uint256 | The amount of shares collected |
claimSponsorFee
Claim the sponsor fee for a given basket token, only callable by the sponsor
function claimSponsorFee(address basketToken) external;
Parameters
Name | Type | Description |
---|---|---|
basketToken | address | The address of the basket token |
claimTreasuryFee
Claim the treasury fee for a given basket token, only callable by the protocol treasury or admin
function claimTreasuryFee(address basketToken) external;
Parameters
Name | Type | Description |
---|---|---|
basketToken | address | The address of the basket token |
_checkIfBasketToken
function _checkIfBasketToken(address token) internal view;
Events
SponsorSet
EVENTS ///
Emitted when the sponsor for a basket token is set.
event SponsorSet(address indexed basketToken, address indexed sponsor);
Parameters
Name | Type | Description |
---|---|---|
basketToken | address | The address of the basket token. |
sponsor | address | The address of the sponsor that was set. |
SponsorSplitSet
Emitted when the sponsor fee split for a basket token is set.
event SponsorSplitSet(address indexed basketToken, uint16 sponsorSplit);
Parameters
Name | Type | Description |
---|---|---|
basketToken | address | The address of the basket token. |
sponsorSplit | uint16 | The percentage of fees allocated to the sponsor, denominated in _FEE_SPLIT_DECIMALS. |
TreasurySet
Emitted when the protocol treasury address is set.
event TreasurySet(address indexed treasury);
Parameters
Name | Type | Description |
---|---|---|
treasury | address | The address of the new protocol treasury. |
Errors
SponsorSplitTooHigh
ERRORS ///
Thrown when attempting to set a sponsor fee split higher than _MAX_FEE.
error SponsorSplitTooHigh();
NoSponsor
Thrown when attempting to set a sponsor fee split for a basket token with no sponsor.
error NoSponsor();
Unauthorized
Thrown when an unauthorized address attempts to call a restricted function.
error Unauthorized();
NotBasketToken
Thrown when attempting to perform an action on an address that is not a basket token.
error NotBasketToken();
NotTreasury
Thrown when attempting to claim treasury fees from an address that is not the protocol treasury.
error NotTreasury();