FactoryFeeManager
Git Source Inherits: Ownable2Step, IFactoryFeeManager Author: JA (@ubinatus)State Variables
MAX_TRANSFER_FEE
CONSTANTS Transfer fee is calculated using 18 decimals where 0.05 ether is 5%._feeData
STATE Stores fee related information for collection purposes._upcomingCreationFee
Stores the info necessary for an upcoming change of the global creation fee._upcomingTransferFee
Stores the info necessary for an upcoming change of the global transfer fee._upcomingClaimFee
Stores the info necessary for an upcoming change of the global claim fee._creationFeeByUnderlyingToken
MapsunderlyingTokens to a custom creation fee struct.
_transferFeeByUnderlyingToken
MapsunderlyingTokens to a custom transfer fee struct.
_claimFeeByUnderlyingToken
MapsunderlyingTokens to a custom claim fee struct.
Functions
setFeeCollector
FUNCTIONS *Set address of fee collector. Requirements:msg.senderhas to be the owner of the contract.newFeeCollectorcan’t be address 0x0.*
scheduleGlobalCreationFee
Sets a new global creation fee value, to take effect after 1 hour.scheduleGlobalTransferFee
Sets a new global transfer fee percentage, to take effect after 1 hour. *Percentages and fees are calculated using 18 decimals where 1 ether is 100%. Requirements:newFeePercentagemust be within minTransferFee and maxTransferFee.*
scheduleGlobalClaimFee
Sets a new global claim fee value, to take effect after 1 hour.scheduleCustomCreationFee
Sets a new custom creation fee value for a specific underlying token, to be enabled and take effect after 1 hour from the time of this transaction. *Allows the contract owner to modify the creation fee associated with a specific underlying token. The new fee becomes effective after a delay of 1 hour, aiming to provide a buffer for users to be aware of the upcoming fee change. This function updates the fee and schedules its activation, ensuring transparency and predictability in fee adjustments. The fee is specified in wei, allowing for granular control over the fee structure. Emits aCustomCreationFeeChange event upon successful fee update.
Requirements:
- The caller must have owner privileges to execute this function.*
scheduleCustomTransferFee
Sets a new custom transfer fee percentage for a specific underlying token, to be enabled and take effect after 1 hour from the time of this transaction. *This function allows the contract owner to adjust the transfer fee for an underlying token. The fee adjustment is delayed by 1 hour to provide transparency and predictability. Fees are calculated with precision to 18 decimal places, where 1 ether equals 100% fee. The function enforces fee limits;newFeePercentage must be within the predefined 0-MAX_TRANSFER_FEE bounds.
If the custom fee was previously disabled or set to a different value, this operation schedules the new fee to
take effect after the delay, enabling it if necessary.
Emits a CustomTransferFeeChange event upon successful execution.
Requirements:
- Caller must be the contract owner.
newFeePercentagemust be within the range limited byMAX_TRANSFER_FEE.*
scheduleCustomClaimFee
Sets a new custom claim fee value for a specific underlying token, to be enabled and take effect after 1 hour from the time of this transaction. *Allows the contract owner to modify the claim fee associated with a specific underlying token. The new fee becomes effective after a delay of 1 hour, aiming to provide a buffer for users to be aware of the upcoming fee change. This function updates the fee and schedules its activation, ensuring transparency and predictability in fee adjustments. The fee is specified in wei, allowing for granular control over the fee structure. Emits aCustomClaimFeeChange event upon successful fee update.
Requirements:
- The caller must have owner privileges to execute this function.*
toggleCustomCreationFee
Enables or disables the custom creation fee for a given underlying token, with the change taking effect after 1 hour.toggleCustomTransferFee
Enables or disables the custom transfer fee for a given underlying token, to take effect after 1 hour.toggleCustomClaimFee
Enables or disables the custom claim fee for a given underlying token, with the change taking effect after 1 hour.minTransferFee
Exposes the minimum transfer fee.maxTransferFee
Exposes the maximum transfer fee.feeCollector
Exposes theFeeData.feeCollector to users.
globalCreationFee
Retrieves the current global creation fee to users.globalTransferFee
Retrieves the current global transfer fee percentage to users.globalClaimFee
Retrieves the current global claim fee to users.creationFeeData
Exposes the creation fee for newVestingTokens deployments.
Enabled custom fees overrides the global creation fee.
transferFeeData
Returns the current transfer fee for a specific underlying token, considering any pending updates.claimFeeData
Returns the current claim fee for a specific underlying token, considering any pending updates._getCurrentFee
Calculates the current fee based on global, custom, and upcoming fee data. This function considers the current timestamp and determines the appropriate fee based on whether a custom or upcoming fee should be applied.
Returns
_processCreationFee
Processes the creation fee for a transaction. This function retrieves the creation fee data from the manager contract and, if the creation fee is greater than zero, sends themsg.value to the fee collector address. Reverts if the transferred value is less than the
required creation fee or if the transfer fails.