Router
The Fira Router is a diamond-like proxy that delegates user calls to specialized action facets via selector-to-facet mappings.
Last updated
The Fira Router is a diamond-like proxy that delegates user calls to specialized action facets via selector-to-facet mappings.
The router is the single entry point for all user-facing protocol operations. It uses a diamond-like proxy pattern where each function selector maps to an action facet contract via delegatecall.
Since all facets share storage via delegatecall, RouterStorage uses ERC-7201 storage namespacing to avoid collisions.
Extends OpenZeppelin's Proxy and overrides _implementation() to look up CoreStorage.selectorToFacet[msg.sig]. If no facet is registered, it reverts with INVALID_SELECTOR.
The constructor hard-wires the setSelectorToFacets and selectorToFacet selectors to the ActionStorageV4 facet, allowing the owner to configure all other mappings post-deployment.
ActionBorrow — Fixed-rate borrow and repay
ActionSwapBT — BT swap operations
ActionSwapCT — Synthesized CT swaps
ActionAddRemoveLiq — Liquidity operations
ActionMisc — FW/BC minting, exits, multicall
ActionSimple — Gas-optimized on-chain approximation
All facets inherit from ActionBase, which provides:
FW mint/redeem orchestration
BT/CT swap orchestration with limit order support
Flash-callback encoding/decoding via CallbackHelper
Delegation to ActionSimple when on-chain approximation suffices
Last updated