BridgeConfigV3
BridgeConfig contract
This token is used for configuring different tokens on the bridge and mapping them across chains.*
Methods
BRIDGEMANAGER_ROLE
Returns
_0
bytes32
undefined
DEFAULT_ADMIN_ROLE
Returns
_0
bytes32
undefined
bridgeConfigVersion
Returns
_0
uint256
undefined
calculateSwapFee
Calculates bridge swap fee based on the destination chain's token transfer.
This means the fee should be calculated based on the chain that the nodes emit a tx on
Parameters
tokenAddress
string
address of the destination token to query token config for
chainID
uint256
destination chain ID to query the token config for
amount
uint256
in native token decimals
Returns
_0
uint256
Fee calculated in token decimals
calculateSwapFee
Calculates bridge swap fee based on the destination chain's token transfer.
This means the fee should be calculated based on the chain that the nodes emit a tx on
Parameters
tokenAddress
address
address of the destination token to query token config for
chainID
uint256
destination chain ID to query the token config for
amount
uint256
in native token decimals
Returns
_0
uint256
Fee calculated in token decimals
getAllTokenIDs
Returns a list of all existing token IDs converted to strings
Returns
result
string[]
undefined
getMaxGasPrice
gets the max gas price for a chain
Parameters
chainID
uint256
undefined
Returns
_0
uint256
undefined
getPoolConfig
Parameters
tokenAddress
address
undefined
chainID
uint256
undefined
Returns
_0
BridgeConfigV3.Pool
undefined
getRoleAdmin
Returns the admin role that controls role
. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.
Parameters
role
bytes32
undefined
Returns
_0
bytes32
undefined
getRoleMember
Returns one of the accounts that have role
. index
must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.
Parameters
role
bytes32
undefined
index
uint256
undefined
Returns
_0
address
undefined
getRoleMemberCount
Returns the number of accounts that have role
. Can be used together with {getRoleMember} to enumerate all bearers of a role.
Parameters
role
bytes32
undefined
Returns
_0
uint256
undefined
getToken
Returns the full token config struct
Parameters
tokenID
string
String input of the token ID for the token
chainID
uint256
Chain ID of which token address + config to get
Returns
token
BridgeConfigV3.Token
undefined
getTokenByAddress
Returns token config struct, given an address and chainID
Parameters
tokenAddress
string
Matches the token ID by using a combo of address + chain ID
chainID
uint256
Chain ID of which token to get config for
Returns
token
BridgeConfigV3.Token
undefined
getTokenByEVMAddress
Parameters
tokenAddress
address
undefined
chainID
uint256
undefined
Returns
token
BridgeConfigV3.Token
undefined
getTokenByID
Returns the full token config struct
Parameters
tokenID
string
String input of the token ID for the token
chainID
uint256
Chain ID of which token address + config to get
Returns
token
BridgeConfigV3.Token
undefined
getTokenID
Returns the token ID (string) of the cross-chain token inputted
Parameters
tokenAddress
address
address of token to get ID for
chainID
uint256
chainID of which to get token ID for
Returns
_0
string
undefined
getTokenID
Parameters
tokenAddress
string
undefined
chainID
uint256
undefined
Returns
_0
string
undefined
getUnderlyingToken
Returns which token is the underlying token to withdraw
Parameters
tokenID
string
string token ID
Returns
token
BridgeConfigV3.Token
undefined
grantRole
Grants role
to account
. If account
had not been already granted role
, emits a {RoleGranted} event. Requirements: - the caller must have role
's admin role.
Parameters
role
bytes32
undefined
account
address
undefined
hasRole
Returns true
if account
has been granted role
.
Parameters
role
bytes32
undefined
account
address
undefined
Returns
_0
bool
undefined
hasUnderlyingToken
Returns true if the token has an underlying token -- meaning the token is deposited into the bridge
Parameters
tokenID
string
String to check if it is a withdraw/underlying token
Returns
_0
bool
undefined
isTokenIDExist
Public function returning if token ID exists given a string
Parameters
tokenID
string
undefined
Returns
_0
bool
undefined
renounceRole
Revokes role
from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted role
, emits a {RoleRevoked} event. Requirements: - the caller must be account
.
Parameters
role
bytes32
undefined
account
address
undefined
revokeRole
Revokes role
from account
. If account
had been granted role
, emits a {RoleRevoked} event. Requirements: - the caller must have role
's admin role.
Parameters
role
bytes32
undefined
account
address
undefined
setMaxGasPrice
sets the max gas price for a chain
Parameters
chainID
uint256
undefined
maxPrice
uint256
undefined
setPoolConfig
Parameters
tokenAddress
address
undefined
chainID
uint256
undefined
poolAddress
address
undefined
metaswap
bool
undefined
Returns
_0
BridgeConfigV3.Pool
undefined
setTokenConfig
Main write function of this contract - Handles creating the struct and passing it to the internal logic function
Parameters
tokenID
string
string ID to set the token config object form
chainID
uint256
chain ID to use for the token config object
tokenAddress
address
token address of the token on the given chain
tokenDecimals
uint8
decimals of token
maxSwap
uint256
maximum amount of token allowed to be transferred at once - in native token decimals
minSwap
uint256
minimum amount of token needed to be transferred at once - in native token decimals
swapFee
uint256
percent based swap fee -- 10e6 == 10bps
maxSwapFee
uint256
max swap fee to be charged - in native token decimals
minSwapFee
uint256
min swap fee to be charged - in native token decimals - especially useful for mainnet ETH
hasUnderlying
bool
bool which represents whether this is a global mint token or one to withdraw()
isUnderlying
bool
bool which represents if this token is the one to withdraw on the given chain
Returns
_0
bool
undefined
setTokenConfig
Main write function of this contract - Handles creating the struct and passing it to the internal logic function
Parameters
tokenID
string
string ID to set the token config object form
chainID
uint256
chain ID to use for the token config object
tokenAddress
string
token address of the token on the given chain
tokenDecimals
uint8
decimals of token
maxSwap
uint256
maximum amount of token allowed to be transferred at once - in native token decimals
minSwap
uint256
minimum amount of token needed to be transferred at once - in native token decimals
swapFee
uint256
percent based swap fee -- 10e6 == 10bps
maxSwapFee
uint256
max swap fee to be charged - in native token decimals
minSwapFee
uint256
min swap fee to be charged - in native token decimals - especially useful for mainnet ETH
hasUnderlying
bool
bool which represents whether this is a global mint token or one to withdraw()
isUnderlying
bool
bool which represents if this token is the one to withdraw on the given chain
Returns
_0
bool
undefined
Events
RoleAdminChanged
Parameters
role indexed
bytes32
undefined
previousAdminRole indexed
bytes32
undefined
newAdminRole indexed
bytes32
undefined
RoleGranted
Parameters
role indexed
bytes32
undefined
account indexed
address
undefined
sender indexed
address
undefined
RoleRevoked
Parameters
role indexed
bytes32
undefined
account indexed
address
undefined
sender indexed
address
undefined
Last updated