The GatewayRegistry contract serves as a management system for gateways, facilitating their registration, staking, metadata updates, and lifecycle operations. It ensures secure, role-based access and maintains an organized registry of gateways.
Key Features
Gateway Registration:
Allows users to register gateways with unique identifiers and metadata.
Supports optional FUNC token staking during registration.
Metadata Management:
Provides functions to update metadata associated with gateways.
Lifecycle Operations:
Supports activation, deactivation, and wind-down of gateways.
Access Control:
Enforces role-based access for administrative functions.
Restricts gateway-specific actions to their respective owners.
Event Logging:
Logs key events such as gateway registration, updates, and lifecycle changes.
Contract Roles
Access Control
The contract uses OpenZeppelin's AccessControl to implement role-based permissions.
DEFAULT_ADMIN_ROLE:
Grants access to administrative functions like toggling auto-whitelist.
Modifiers
onlyRegisteredGatewayOwner:
Restricts certain actions to the owner of a registered gateway.
Data Structures
Gateway
Represents a registered gateway.
owner: Address of the gateway's owner.
id: Unique identifier for the gateway.
registeredAt: Block number when the gateway was registered.
metadata: Metadata string associated with the gateway.
active: Boolean indicating whether the gateway is active.
Key Functions
Constructor
Initializes the GatewayRegistry contract with references to the FUNC token and Router contract.