Routers

This section contains a full API reference of all public functions & events related to routers and router liquidity management.

Events

RouterAdded

event RouterAdded(address router, address caller)

Emitted when a new router is added

Parameters

RouterRemoved

event RouterRemoved(address router, address caller)

Emitted when an existing router is removed

Parameters

RouterRecipientSet

event RouterRecipientSet(address router, address prevRecipient, address newRecipient)

Emitted when the recipient of router is updated

Parameters

RouterOwnerProposed

event RouterOwnerProposed(address router, address prevProposed, address newProposed)

Emitted when the owner of router is proposed

Parameters

RouterOwnerAccepted

event RouterOwnerAccepted(address router, address prevOwner, address newOwner)

Emitted when the owner of router is accepted

Parameters

RouterLiquidityAdded

event RouterLiquidityAdded(address router, address local, bytes32 key, uint256 amount, address caller)

Emitted when a router adds liquidity to the contract

Parameters

RouterLiquidityRemoved

event RouterLiquidityRemoved(address router, address to, address local, bytes32 key, uint256 amount, address caller)

Emitted when a router withdraws liquidity from the contract

Parameters


Getters

getRouterApproval

function getRouterApproval(address _router) public view returns (bool)

Returns the approval status of a router for the given router address.

Parameters

Return Values

getRouterRecipient

function getRouterRecipient(address _router) public view returns (address)

Returns the recipient for the specified router

The recipient (if set) receives all funds when router liquidity is removed

Parameters

Return Values

getRouterOwner

function getRouterOwner(address _router) public view returns (address)

Returns the router owner if it is set, or the router itself if not

Uses logic function here to handle the case where router owner is not set. Other getters within this interface use explicitly the stored value

Parameters

Return Values

getProposedRouterOwner

function getProposedRouterOwner(address _router) public view returns (address)

Returns the currently proposed router owner

All routers must wait for the delay timeout before accepting a new owner

Parameters

Return Values

getProposedRouterOwnerTimestamp

function getProposedRouterOwnerTimestamp(address _router) public view returns (uint256)

Returns the currently proposed router owner timestamp

All routers must wait for the delay timeout before accepting a new owner

Parameters

Return Values

routerBalances

function routerBalances(address _router, address _asset) public view returns (uint256)

Gets balance of asset for the specified router.

Parameters

Return Values


Functions

setupRouter

function setupRouter(address router, address owner, address recipient) external

Used to set router initial properties

Parameters

removeRouter

function removeRouter(address router) external

Used to remove routers that can transact crosschain

Parameters

setRouterRecipient

function setRouterRecipient(address router, address recipient) external

Sets the designated recipient for a router

Router should only be able to set this once otherwise if router key compromised, no problem is solved since attacker could just update recipient

Parameters

proposeRouterOwner

function proposeRouterOwner(address router, address proposed) external

Current owner or router may propose a new router owner

Parameters

acceptProposedRouterOwner

function acceptProposedRouterOwner(address router) external

New router owner must accept role, or previous if proposed is 0x0

Parameters

addRouterLiquidityFor

function addRouterLiquidityFor(uint256 _amount, address _local, address _router) external payable

This is used by anyone to increase a router's available liquidity for a given asset.

The liquidity will be held in the local asset, which is the representation if you are not on the canonical domain, and the canonical asset otherwise.

Parameters

addRouterLiquidity

function addRouterLiquidity(uint256 _amount, address _local) external payable

This is used by any router to increase their available liquidity for a given asset.

The liquidity will be held in the local asset, which is the representation if you are not on the canonical domain, and the canonical asset otherwise.

Parameters

removeRouterLiquidityFor

function removeRouterLiquidityFor(uint256 _amount, address _local, address payable _to, address _router) external

This is used by any router owner to decrease their available liquidity for a given asset.

Parameters

removeRouterLiquidity

function removeRouterLiquidity(uint256 _amount, address _local, address payable _to) external

This is used by any router to decrease their available liquidity for a given asset.

Parameters

Last updated