Routers
This section contains a full API reference of all public functions & events related to routers and router liquidity management.
Events
RouterAdded
Emitted when a new router is added
Parameters
router
address
- The address of the added router
caller
address
- The account that called the function
RouterRemoved
Emitted when an existing router is removed
Parameters
router
address
- The address of the removed router
caller
address
- The account that called the function
RouterRecipientSet
Emitted when the recipient of router is updated
Parameters
router
address
- The address of the added router
prevRecipient
address
- The address of the previous recipient of the router
newRecipient
address
- The address of the new recipient of the router
RouterOwnerProposed
Emitted when the owner of router is proposed
Parameters
router
address
- The address of the added router
prevProposed
address
- The address of the previous proposed
newProposed
address
- The address of the new proposed
RouterOwnerAccepted
Emitted when the owner of router is accepted
Parameters
router
address
- The address of the added router
prevOwner
address
- The address of the previous owner of the router
newOwner
address
- The address of the new owner of the router
RouterLiquidityAdded
Emitted when a router adds liquidity to the contract
Parameters
router
address
- The address of the router the funds were credited to
local
address
- The address of the token added (all liquidity held in local asset)
key
bytes32
- The hash of the canonical id and domain
amount
uint256
- The amount of liquidity added
caller
address
- The account that called the function
RouterLiquidityRemoved
Emitted when a router withdraws liquidity from the contract
Parameters
router
address
- The router you are removing liquidity from
to
address
- The address the funds were withdrawn to
local
address
- The address of the token withdrawn
key
bytes32
amount
uint256
- The amount of liquidity withdrawn
caller
address
- The account that called the function
Getters
getRouterApproval
Returns the approval status of a router for the given router address.
Parameters
_router
address
The relevant router address
Return Values
[0]
bool
True if router is approved
getRouterRecipient
Returns the recipient for the specified router
The recipient (if set) receives all funds when router liquidity is removed
Parameters
_router
address
The relevant router address
Return Values
[0]
address
Recipient address for router
getRouterOwner
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
_router
address
The relevant router address
Return Values
[0]
address
Owner address of router
getProposedRouterOwner
Returns the currently proposed router owner
All routers must wait for the delay timeout before accepting a new owner
Parameters
_router
address
The relevant router address
Return Values
[0]
address
Proposed owner address of router
getProposedRouterOwnerTimestamp
Returns the currently proposed router owner timestamp
All routers must wait for the delay timeout before accepting a new owner
Parameters
_router
address
The relevant router address
Return Values
[0]
uint256
Currently proposed router owner timestamp
routerBalances
Gets balance of asset for the specified router.
Parameters
_router
address
The relevant router address
_asset
address
The relevant asset
Return Values
[0]
uint256
Balance the router owns of asset
Functions
setupRouter
Used to set router initial properties
Parameters
router
address
Router address to setup
owner
address
Initial Owner of router
recipient
address
Initial Recipient of router
removeRouter
Used to remove routers that can transact crosschain
Parameters
router
address
Router address to remove
setRouterRecipient
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
router
address
Router address to set recipient
recipient
address
Recipient Address to set to router
proposeRouterOwner
Current owner or router may propose a new router owner
Parameters
router
address
Router address to set recipient
proposed
address
Proposed owner Address to set to router
acceptProposedRouterOwner
New router owner must accept role, or previous if proposed is 0x0
Parameters
router
address
Router address to set recipient
addRouterLiquidityFor
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
_amount
uint256
- The amount of liquidity to add for the router
_local
address
- The address of the asset you're adding liquidity for. If adding liquidity of the native asset, routers may use address(0)
or the wrapped asset
_router
address
The router you are adding liquidity on behalf of
addRouterLiquidity
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
_amount
uint256
- The amount of liquidity to add for the router
_local
address
- The address of the asset you're adding liquidity for. If adding liquidity of the native asset, routers may use address(0)
or the wrapped asset
removeRouterLiquidityFor
This is used by any router owner to decrease their available liquidity for a given asset.
Parameters
_amount
uint256
- The amount of liquidity to remove for the router
_local
address
- The address of the asset you're removing liquidity from. If removing liquidity of the native asset, routers may use address(0)
or the wrapped asset
_to
address payable
The address that will receive the liquidity being removed
_router
address
The address of the router
removeRouterLiquidity
This is used by any router to decrease their available liquidity for a given asset.
Parameters
_amount
uint256
- The amount of liquidity to remove for the router
_local
address
- The address of the asset you're removing liquidity from. If removing liquidity of the native asset, routers may use address(0)
or the wrapped asset
_to
address payable
The address that will receive the liquidity being removed if no router recipient exists.
Last updated