The Logic contract is responsible for handling reward calculations and conversions between FUNC tokens and Compute Units (CU) in a blockchain-based ecosystem. It provides functionality to determine FUNC burn amounts, available compute units, and allows for configurable conversion ratios, fee structures, and duration-based discounts.
Key Features
Conversion Logic:
Calculates FUNC burn amounts based on consumed compute units (CU) and dynamic fee structures.
Converts FUNC staked amounts into available compute units.
Configurable Tiers:
Allows dynamic fee structures based on staking tiers.
Provides additional discounts for long-term staking using epoch-based duration tiers.
Configurable Ratios:
Allows updating of the stake-to-CU conversion ratio via admin-controlled functions.
Access Control:
Utilizes role-based access control for secure administration.
Contract Roles
Access Control
The contract uses AccessControl to restrict access to critical functions.
DEFAULT_ADMIN_ROLE:
Grants full control over administrative functions like updating the stake-to-CU ratio and configuring tiers.
GOVERNANCE_ROLE:
Provides governance with permission to update configuration parameters.
State Variables
getStakeToCUNumerator:
Numerator of the stake-to-CU conversion ratio.
Default value: 1.
getStakeToCUDenominator:
Denominator of the stake-to-CU conversion ratio.
Default value: 1.
stakeTiers:
Array of stake tiers defining the minimum stake required and the corresponding final fee (percentage in basis points).
epochDurationTiers:
Array of duration tiers defining the minimum epochs required and the corresponding discount (percentage in basis points).
minEpochsRequired:
The global minimum epochs required for staking eligibility to access lower fees.
Key Functions
Constructor
constructor()
Initializes the contract with default values and assigns the DEFAULT_ADMIN_ROLE to the deployer.