Skip to main content

IFeeManager

Git Source

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

NameTypeDescription
protocolFee_uint48Fee charged by the protocol
referrerFee_uint48Fee charged by the referrer
hasReferrer_boolWhether the auction has a referrer
amount_uint256Amount to calculate fees for

Returns

NameTypeDescription
toReferreruint256Amount to send to the referrer
toProtocoluint256Amount 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

NameTypeDescription
auctionType_KeycodeAuction type to set fees for
fee_uint48Fee 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

NameTypeDescription
auctionType_KeycodeAuction type to get fees for

Returns

NameTypeDescription
protocoluint48Fee charged by the protocol
maxReferrerFeeuint48Maximum fee that can be paid to a referrer
maxCuratorFeeuint48Maximum 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

NameTypeDescription
auctionType_KeycodeAuction type to get fees for
curator_addressCurator to get fees for

Returns

NameTypeDescription
curatorFeeuint48Fee charged by the curator

claimRewards

Claims the rewards for a specific token and the sender

function claimRewards(address token_) external;

Parameters

NameTypeDescription
token_addressToken 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

NameTypeDescription
recipient_addressRecipient to get rewards for
token_addressToken to get rewards for

Returns

NameTypeDescription
rewarduint256Reward 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

NameTypeDescription
auctionType_KeycodeAuction type to set fees for
type_FeeTypeType of fee to set
fee_uint48Fee to charge

setProtocol

Sets the protocol address

Access controlled: only owner

function setProtocol(address protocol_) external;

Parameters

NameTypeDescription
protocol_addressAddress 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

NameTypeDescription
protocoluint48Fee charged by the protocol
maxReferrerFeeuint48Maximum fee that can be paid to a referrer
maxCuratorFeeuint48Maximum fee that a curator can charge
curatormapping(address => uint48)Fee charged by a specific curator

Enums

FeeType

Defines the type of fee to set

enum FeeType {
Protocol,
MaxReferrer,
MaxCurator
}