FeeManager
Inherits: IFeeManager, ReentrancyGuard
Defines fees for auctions and manages the collection and distribution of fees
State Variables
_FEE_DECIMALS
Fees are in basis points (hundredths of a percent). 1% equals 100.
uint48 internal constant _FEE_DECIMALS = 100e2;
_protocol
Address the protocol receives fees at
address internal _protocol;
fees
Fees charged for each auction type
See Fees struct for more details
mapping(Keycode => Fees) public fees;
rewards
Fees earned by an address, by token
mapping(address => mapping(ERC20 => uint256)) public rewards;
Functions
constructor
constructor(address protocol_);
calculateQuoteFees
Calculates and allocates fees that are collected in the quote token
function calculateQuoteFees(
uint48 protocolFee_,
uint48 referrerFee_,
bool hasReferrer_,
uint256 amount_
) public pure returns (uint256 toReferrer, uint256 toProtocol);
Parameters
Name | Type | Description |
---|---|---|
protocolFee_ | uint48 | Fee charged by the protocol |
referrerFee_ | uint48 | Fee charged by the referrer |
hasReferrer_ | bool | Whether the auction has a referrer |
amount_ | uint256 | Amount to calculate fees for |
Returns
Name | Type | Description |
---|---|---|
toReferrer | uint256 | Amount to send to the referrer |
toProtocol | uint256 | Amount to send to the protocol |
_calculatePayoutFees
Calculates and allocates fees that are collected in the payout token
function _calculatePayoutFees(
bool curated_,
uint48 curatorFee_,
uint256 payout_
) internal pure returns (uint256 toCurator);
setCuratorFee
Sets the fee for a curator (the sender) for a specific auction type
function setCuratorFee(Keycode auctionType_, uint48 fee_) external;
Parameters
Name | Type | Description |
---|---|---|
auctionType_ | Keycode | Auction type to set fees for |
fee_ | uint48 | Fee to charge |
getFees
Gets the fees for a specific auction type
function getFees(
Keycode auctionType_
) external view override returns (uint48 protocol, uint48 maxReferrerFee, uint48 maxCuratorFee);
Parameters
Name | Type | Description |
---|---|---|
auctionType_ | Keycode | Auction type to get fees for |
Returns
Name | Type | Description |
---|---|---|
protocol | uint48 | Fee charged by the protocol |
maxReferrerFee | uint48 | Maximum fee that can be paid to a referrer |
maxCuratorFee | uint48 | Maximum fee that a curator can charge |
getCuratorFee
Gets the fee for a specific auction type and curator
function getCuratorFee(
Keycode auctionType_,
address curator_
) external view override returns (uint48 curatorFee);
Parameters
Name | Type | Description |
---|---|---|
auctionType_ | Keycode | Auction type to get fees for |
curator_ | address | Curator to get fees for |
Returns
Name | Type | Description |
---|---|---|
curatorFee | uint48 | Fee charged by the curator |
claimRewards
Claims the rewards for a specific token and the sender
This function reverts if:
- re-entrancy is detected
function claimRewards(address token_) external nonReentrant;
Parameters
Name | Type | Description |
---|---|---|
token_ | address | Token to claim rewards for |
getRewards
Gets the rewards for a specific recipient and token
function getRewards(
address recipient_,
address token_
) external view override returns (uint256 reward);
Parameters
Name | Type | Description |
---|---|---|
recipient_ | address | Recipient to get rewards for |
token_ | address | Token to get rewards for |
Returns
Name | Type | Description |
---|---|---|
reward | uint256 | Reward amount |
getProtocol
Gets the protocol address
function getProtocol() public view returns (address);