Router

View Source: @nomisma/elektro-protocol-aux/contracts/delegate/Router.sol

↗ Extends: RoleAware ↘ Derived Contracts: ElektroEventEmitterRouter, ElektroRegistryRouter, ElektroRouter, FundLockRouter, TokenManagerRouter

Router

Contracts that extend {Router} contract serves as data storage. {Router} delegates all calls based on mapping found in Resolver. All calls are executed in context of calling router and for every functionality/proxy modules, Router's address is being used as an entry point and represents functionality of the module (full module's ABI is tied to the respective Router's address). This contract is not being deployed, but inherited by specific Router contracts of each module.

IMPORTANT: A signature for any external or public function added to this contract needs to be present in Resolver contract as a constant and be checked against during register() process. {Router} functions can NOT be shadowed by any other contracts!

Contract Members

Constants & Variables

bytes32 private constant GOVERNOR_ROLE_NAME;

contract Resolver public resolver;

Functions

  • ()

  • ()

  • setResolver(address _resolver)

  • initRouter(address _resolver, address _roleManager)

Default fallback functions that intercepts/accepts all calls. Method signature found in Resolver is used to get address of contract to call. Next delegatecall is executed to call resolved contract address.

IMPORTANT: This function gets called ONLY when no functions with the needed name are present in this contract!

function () external payable

Arguments

function () external payable

Arguments

setResolver

Setting {Resolver} contract used for routing calls. This address is one of the main key points of each Router contract, since this address will be used to figure out where to route calls for each module.

IMPORTANT! This function should not exist on implementation interfaces or implementation logic contracts! This would cause a potential shadowing problem that might arise. We should ONLY call this function on a particular {Router} contract DIRECTLY, and not through an implementation interface it is used with!

function setResolver(address _resolver) public nonpayable onlyRole 

Arguments

NameTypeDescription

_resolver

address

address of {Resolver} contract to be set for {Router}

initRouter

{Router} initialization function that sets resolver and governance role

function initRouter(address _resolver, address _roleManager) internal nonpayable

Arguments

NameTypeDescription

_resolver

address

address of {Resolver} contract to be set for {Router}

_roleManager

address

Last updated