IFeeManager
Defines the interface to interact with auction fees
Functions
calculateQuoteFees
Calculates and allocates fees that are collected in the quote token
function calculateQuoteFees(
uint48 protocolFee_,
uint48 referrerFee_,
bool hasReferrer_,
uint256 amount_
) external view 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 |
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 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 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
function claimRewards(address token_) external;
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 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 |
setFee
Sets the protocol fee, referrer fee, or max curator fee for a specific auction type
Access controlled: only owner
function setFee(Keycode auctionType_, FeeType type_, uint48 fee_) external;
Parameters
Name | Type | Description |
---|---|---|
auctionType_ | Keycode | Auction type to set fees for |
type_ | FeeType | Type of fee to set |
fee_ | uint48 | Fee to charge |
setProtocol
Sets the protocol address
Access controlled: only owner
function setProtocol(address protocol_) external;
Parameters
Name | Type | Description |
---|---|---|
protocol_ | address | Address of the protocol |
getProtocol
Gets the protocol address
function getProtocol() external view returns (address);
Errors
InvalidFee
error InvalidFee();
Structs
Fees
Collection of fees charged for a specific auction type in basis points (3 decimals).
Protocol and referrer fees are taken in the quoteToken and accumulate in the contract. These are set by the protocol.
Curator fees are taken in the payoutToken and are sent when the auction is settled / purchase is made. Curators can set these up to the configured maximum.
There are some situations where the fees may round down to zero if quantity of baseToken is < 100e2 wei (can happen with big price differences on small decimal tokens). This is purely a theoretical edge case, as the amount would not be practical.
struct Fees {
uint48 protocol;
uint48 maxReferrerFee;
uint48 maxCuratorFee;
mapping(address => uint48) curator;
}
Properties
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 |
curator | mapping(address => uint48) | Fee charged by a specific curator |
Enums
FeeType
Defines the type of fee to set
enum FeeType {
Protocol,
MaxReferrer,
MaxCurator
}