The GatewayStaking contract facilitates staking of FUNC tokens for gateways, enabling operations like staking, unstaking, usage tracking, and balance management. It integrates with other ecosystem components for secure and efficient functionality.
Key Features
FUNC Token Staking:
Users can stake FUNC tokens for specific gateways.
Supports secure and efficient staking with role-based access controls.
Gateway Lifecycle Management:
Includes operations to wind down gateways, restart them, and track their states.
Overdraw Handling:
Tracks overdrawn stakes for gateways and adjusts balances accordingly.
Burn Functionality:
Implements optional burning of FUNC tokens during gateway operations.
Integration with Ecosystem:
Interacts with Router, GatewayRegistry, and GatewayCheckpoint contracts.
Contract Roles
Access Control
The contract uses AccessControlledPausable for role-based access and pause functionality.
DEFAULT_ADMIN_ROLE:
Grants access to administrative functions like toggling burn functionality.
onlyCheckpoint Modifier:
Restricts certain functions to the GatewayCheckpoint contract.
Data Structures
Gateway State
gatewayShutdownEpochs: Tracks shutdown epochs for gateways.
gatewayMostRecentStakeEpochs: Tracks the most recent staked epoch for gateways.
gatewayStakeOverdrawn: Tracks overdrawn FUNC amounts for gateways.
gatewayStakes: Tracks staked FUNC balances for gateways.