FeeContract.sol
Deployment Addresses
Implentation: 0x716C2a405A658F96FCe7E7C2eE81C0C718bb3d76 Proxy: 0xe003BdBa0529ED4E1F2B7f40E4E136904fcaD435
Description
This contract serves as a fundamental component in managing the collection and distribution of application fees. It allows the addition, adjustment, and removal of channels, and it facilitates the proper distribution of fees to designated channels.
Fee Setting Mechanism
Content: In the FeeContract, the base application fee (_fee
) is determined by an external Fee Oracle (IFeeOracle
). This fee serves as the benchmark for all transaction-related charges within the platform.
Developers can set their fees based on multiples of this base fee. The allowed range is defined by two parameters: _minDevFeeMultiple
and _maxDevFeeMultiple
. For instance, if the base fee is 10 tokens, and the allowed multiples range from 1 to 3, developers can charge a fee anywhere between 10 to 30 tokens for their services.
Fee Collection
Role: Collecting Application Fees
Content: Application fees are collected automatically during transaction processing. The FeeContract is able to receive fees via its receive()
function, emitting a `FeesReceived` event, and is equipped to store these fees safely. Each transaction contributing to the fee pool is a step towards ensuring the robustness and sustainability of the platform. The collected fees remain in the contract until they are distributed to predefined channels.
Fee Distribution
Role: Distributing Collected Fees
Content: Distribution of collected fees is a crucial aspect of the FeeContract. It employs a weighted distribution mechanism, where fees are allocated to different channels (_channels
) based on their respective weights (_weights
). The distributeFees()
function, when called, distributes the accumulated fees proportionally among these channels. This process ensures a fair and equitable distribution of resources, supporting various stakeholders in the ecosystem.
Contract Functions Relevant to Fees
Title: Core Functions for Fee Management
Content: Several key functions within the FeeContract are crucial for managing application fees:
updateFee()
: Updates the base application fee based on the current directive from the Fee Oracle. Can only be called once per period.setMinFee(uint256 multiple)
: Sets the minimum fee multiple that developers can charge.setMaxFee(uint256 multiple)
: Establishes the maximum fee multiple permissible for developer charges.
These functions ensure that the fee structure remains responsive to the ecosystem's needs and market conditions.
In summary, this contract serves as a sophisticated mechanism for managing, collecting, and distributing application fees within a blockchain-based ecosystem. It offers flexibility for developers to set their own fees within a defined range and ensures an orderly distribution of collected fees to designated channels based on predefined weights.\
Last updated