Router.sol
The Router contract serves as the central registry for key FUNC system contracts, managing their addresses and ensuring seamless integration and communication between components.
Key Features
Centralized Management:
Stores and manages addresses of all core contracts within the FUNC ecosystem.
Role-Based Access Control:
Ensures only authorized entities can update the stored contract addresses.
Initializable Design:
Supports initialization to securely set up the contract with required addresses.
Provider Staking Management:
Links staking pools with models and facilitates updates.
Roles and Access Control
DEFAULT_ADMIN_ROLE:Full administrative control over the contract.
Can update the addresses of core system contracts and staking pools.
State Variables
Core Contracts
providerStakingFactory: Factory contract for creating provider staking pools.providerRegistry: Registry for managing providers.providerCheckpoint: Tracks provider state history and checkpoints.gatewayStaking: Manages staking operations for gateways.gatewayRegistry: Registry for managing gateways.gatewayCheckpoint: Tracks gateway state history and checkpoints.epochController: Handles epoch-based logic and scheduling.permissions: Manages permissions for providers and gateways.treasury: Treasury contract for managing funds.model: Model contract for managing models.logic: Logic contract for managing computation and reward functions.
Provider Staking Pools
providerStakingPools: Mapping of model IDs to their associated staking pools.
Key Functions
Initialization
initialize
initializeInitializes the Router contract with addresses of all core contracts.
Parameters:
_initializeAddresses: A struct containing the addresses of all required contracts.
Contract Address Management
setProviderStakingFactory
setProviderStakingFactoryUpdates the ProviderStakingFactory address.
Access:
DEFAULT_ADMIN_ROLEParameters:
_providerStakingFactory: New address of theProviderStakingFactory.
setProviderCheckpoint
setProviderCheckpointUpdates the ProviderCheckpoint address.
Access:
DEFAULT_ADMIN_ROLEParameters:
_providerCheckpoint: New address of theProviderCheckpoint.
setProviderRegistry
setProviderRegistryUpdates the ProviderRegistry address.
Access:
DEFAULT_ADMIN_ROLEParameters:
_providerRegistry: New address of theProviderRegistry.
setGatewayStaking
setGatewayStakingUpdates the GatewayStaking address.
Access:
DEFAULT_ADMIN_ROLEParameters:
_gatewayStaking: New address of theGatewayStaking.
setGatewayCheckpoint
setGatewayCheckpointUpdates the GatewayCheckpoint address.
Access:
DEFAULT_ADMIN_ROLEParameters:
_gatewayCheckpoint: New address of theGatewayCheckpoint.
setGatewayRegistry
setGatewayRegistryUpdates the GatewayRegistry address.
Access:
DEFAULT_ADMIN_ROLEParameters:
_gatewayRegistry: New address of theGatewayRegistry.
setEpochController
setEpochControllerUpdates the EpochController address.
Access:
DEFAULT_ADMIN_ROLEParameters:
_epochController: New address of theEpochController.
setTreasury
setTreasuryUpdates the Treasury address.
Access:
DEFAULT_ADMIN_ROLEParameters:
_treasury: New address of theTreasury.
setPermissions
setPermissionsUpdates the Permissions address.
Access:
DEFAULT_ADMIN_ROLEParameters:
_permissions: New address of thePermissions.
setLogic
setLogicUpdates the Logic address.
Access:
DEFAULT_ADMIN_ROLEParameters:
_logic: New address of theLogic.
setModel
setModelUpdates the Model address.
Access:
DEFAULT_ADMIN_ROLEParameters:
_model: New address of theModel.
Provider Staking Pool Management
providerStaking
providerStakingRetrieves the staking pool associated with a given model ID.
Parameters:
_modelId: Model ID to retrieve the staking pool for.
Returns: Address of the associated
ProviderStakingcontract.
setStakingPool
setStakingPoolUpdates the staking pool associated with a given model ID.
Access:
DEFAULT_ADMIN_ROLEorModelcontract.Parameters:
_modelId: Model ID to update._stakingPool: New staking pool address.
Events
ProviderStakingFactoryUpdated(IProviderStakingFactory providerStakingFactory):Emitted when the
ProviderStakingFactoryaddress is updated.
ProviderCheckpointUpdated(IProviderCheckpoint providerCheckpoint):Emitted when the
ProviderCheckpointaddress is updated.
ProviderRegistryUpdated(IProviderRegistry providerRegistry):Emitted when the
ProviderRegistryaddress is updated.
GatewayStakingUpdated(IGatewayStaking gatewayStaking):Emitted when the
GatewayStakingaddress is updated.
GatewayCheckpointUpdated(IGatewayCheckpoint gatewayCheckpoint):Emitted when the
GatewayCheckpointaddress is updated.
GatewayRegistryUpdated(IGatewayRegistry gatewayRegistry):Emitted when the
GatewayRegistryaddress is updated.
EpochControllerUpdated(IEpochController epochController):Emitted when the
EpochControlleraddress is updated.
TreasuryUpdated(ITreasury treasury):Emitted when the
Treasuryaddress is updated.
PermissionsUpdated(IPermissions permissions):Emitted when the
Permissionsaddress is updated.
LogicUpdated(ILogic logic):Emitted when the
Logicaddress is updated.
ModelUpdated(IModel model):Emitted when the
Modeladdress is updated.
ProviderStakingUpdated(uint256 modelId, IProviderStaking stakingPool):Emitted when the staking pool for a model is updated.
Fallback Functions
receive(): Rejects Ether transfers.fallback(): Rejects Ether transfers and invalid calls.
Last updated