IAssetsRouter

Git Source

Functions

route

Deposit tokens into the router and optionally forward them to the active recipient.

Pulls tokens from msg.sender into this contract. If auto-route is enabled, immediately forwards them to _activeRecipient.

function route(address _token, uint256 _amount) external;

Parameters

NameTypeDescription
_tokenaddressThe ERC20 token address being routed.
_amountuint256The amount of tokens to transfer.

getRouteRecipients

Returns the list of approved route recipients.

Returns the full list of route recipients currently registered in the router.

function getRouteRecipients() external view returns (address[] memory routeRecipients_);

Returns

NameTypeDescription
routeRecipients_address[]The array of all registered recipient addresses.

isRouteRecipient

Checks if an address is a valid route recipient.

Checks if a given address is a registered route recipient.

function isRouteRecipient(address _addr) external view returns (bool);

Parameters

NameTypeDescription
_addraddressThe address to check.

Returns

NameTypeDescription
<none>boolTrue if the address is a valid route recipient, otherwise false.

getActiveRecipient

Returns the currently active route recipient.

Returns the currently active route recipient where assets are routed automatically.

function getActiveRecipient() external view returns (address activeRecipient_);

Returns

NameTypeDescription
activeRecipient_addressThe address of the active route recipient.

isAutoRouteEnabled

Returns whether auto-routing is enabled.

Indicates whether automatic routing is currently enabled.

function isAutoRouteEnabled() external view returns (bool enabled_);

Returns

NameTypeDescription
enabled_boolBoolean flag, true if auto-routing is enabled, false otherwise.

Events

RouteRecipientAdded

Emitted when a new route recipient is added

event RouteRecipientAdded(address indexed recipient);

Parameters

NameTypeDescription
recipientaddressThe address of the recipient added

RouteRecipientRemoved

Emitted when a route recipient is removed

event RouteRecipientRemoved(address indexed recipient);

Parameters

NameTypeDescription
recipientaddressThe address of the recipient removed

SetAutoRouteEnabled

Emitted when auto-routing is enabled or disabled

event SetAutoRouteEnabled(bool enabled);

Parameters

NameTypeDescription
enabledboolTrue if auto-routing is enabled, false otherwise

SetActiveRecipient

Emitted when the active recipient is changed

event SetActiveRecipient(address indexed recipient);

Parameters

NameTypeDescription
recipientaddressThe new active recipient address

AssetsReceived

Emitted when assets are received by the contract

event AssetsReceived(address indexed token, address indexed recipient, uint256 amount);

Parameters

NameTypeDescription
tokenaddressThe ERC20 token address received
recipientaddressThe address sending the assets
amountuint256The amount of tokens received

AssetsRouted

Emitted when assets are routed to a recipient

event AssetsRouted(address indexed token, address indexed recipient, uint256 amount);

Parameters

NameTypeDescription
tokenaddressThe ERC20 token address routed
recipientaddressThe address receiving the routed assets
amountuint256The amount of tokens routed