BridgeConfigV3

BridgeConfig contract

This token is used for configuring different tokens on the bridge and mapping them across chains.*

Methods

BRIDGEMANAGER_ROLE

function BRIDGEMANAGER_ROLE() external view returns (bytes32)

Returns

NameTypeDescription

_0

bytes32

undefined

DEFAULT_ADMIN_ROLE

function DEFAULT_ADMIN_ROLE() external view returns (bytes32)

Returns

NameTypeDescription

_0

bytes32

undefined

bridgeConfigVersion

function bridgeConfigVersion() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

calculateSwapFee

function calculateSwapFee(string tokenAddress, uint256 chainID, uint256 amount) external view returns (uint256)

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

NameTypeDescription

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

NameTypeDescription

_0

uint256

Fee calculated in token decimals

calculateSwapFee

function calculateSwapFee(address tokenAddress, uint256 chainID, uint256 amount) external view returns (uint256)

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

NameTypeDescription

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

NameTypeDescription

_0

uint256

Fee calculated in token decimals

getAllTokenIDs

function getAllTokenIDs() external view returns (string[] result)

Returns a list of all existing token IDs converted to strings

Returns

NameTypeDescription

result

string[]

undefined

getMaxGasPrice

function getMaxGasPrice(uint256 chainID) external view returns (uint256)

gets the max gas price for a chain

Parameters

NameTypeDescription

chainID

uint256

undefined

Returns

NameTypeDescription

_0

uint256

undefined

getPoolConfig

function getPoolConfig(address tokenAddress, uint256 chainID) external view returns (struct BridgeConfigV3.Pool)

Parameters

NameTypeDescription

tokenAddress

address

undefined

chainID

uint256

undefined

Returns

NameTypeDescription

_0

BridgeConfigV3.Pool

undefined

getRoleAdmin

function getRoleAdmin(bytes32 role) external view returns (bytes32)

Returns the admin role that controls role. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.

Parameters

NameTypeDescription

role

bytes32

undefined

Returns

NameTypeDescription

_0

bytes32

undefined

getRoleMember

function getRoleMember(bytes32 role, uint256 index) external view returns (address)

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

NameTypeDescription

role

bytes32

undefined

index

uint256

undefined

Returns

NameTypeDescription

_0

address

undefined

getRoleMemberCount

function getRoleMemberCount(bytes32 role) external view returns (uint256)

Returns the number of accounts that have role. Can be used together with {getRoleMember} to enumerate all bearers of a role.

Parameters

NameTypeDescription

role

bytes32

undefined

Returns

NameTypeDescription

_0

uint256

undefined

getToken

function getToken(string tokenID, uint256 chainID) external view returns (struct BridgeConfigV3.Token token)

Returns the full token config struct

Parameters

NameTypeDescription

tokenID

string

String input of the token ID for the token

chainID

uint256

Chain ID of which token address + config to get

Returns

NameTypeDescription

token

BridgeConfigV3.Token

undefined

getTokenByAddress

function getTokenByAddress(string tokenAddress, uint256 chainID) external view returns (struct BridgeConfigV3.Token token)

Returns token config struct, given an address and chainID

Parameters

NameTypeDescription

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

NameTypeDescription

token

BridgeConfigV3.Token

undefined

getTokenByEVMAddress

function getTokenByEVMAddress(address tokenAddress, uint256 chainID) external view returns (struct BridgeConfigV3.Token token)

Parameters

NameTypeDescription

tokenAddress

address

undefined

chainID

uint256

undefined

Returns

NameTypeDescription

token

BridgeConfigV3.Token

undefined

getTokenByID

function getTokenByID(string tokenID, uint256 chainID) external view returns (struct BridgeConfigV3.Token token)

Returns the full token config struct

Parameters

NameTypeDescription

tokenID

string

String input of the token ID for the token

chainID

uint256

Chain ID of which token address + config to get

Returns

NameTypeDescription

token

BridgeConfigV3.Token

undefined

getTokenID

function getTokenID(address tokenAddress, uint256 chainID) external view returns (string)

Returns the token ID (string) of the cross-chain token inputted

Parameters

NameTypeDescription

tokenAddress

address

address of token to get ID for

chainID

uint256

chainID of which to get token ID for

Returns

NameTypeDescription

_0

string

undefined

getTokenID

function getTokenID(string tokenAddress, uint256 chainID) external view returns (string)

Parameters

NameTypeDescription

tokenAddress

string

undefined

chainID

uint256

undefined

Returns

NameTypeDescription

_0

string

undefined

getUnderlyingToken

function getUnderlyingToken(string tokenID) external view returns (struct BridgeConfigV3.Token token)

Returns which token is the underlying token to withdraw

Parameters

NameTypeDescription

tokenID

string

string token ID

Returns

NameTypeDescription

token

BridgeConfigV3.Token

undefined

grantRole

function grantRole(bytes32 role, address account) external nonpayable

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

NameTypeDescription

role

bytes32

undefined

account

address

undefined

hasRole

function hasRole(bytes32 role, address account) external view returns (bool)

Returns true if account has been granted role.

Parameters

NameTypeDescription

role

bytes32

undefined

account

address

undefined

Returns

NameTypeDescription

_0

bool

undefined

hasUnderlyingToken

function hasUnderlyingToken(string tokenID) external view returns (bool)

Returns true if the token has an underlying token -- meaning the token is deposited into the bridge

Parameters

NameTypeDescription

tokenID

string

String to check if it is a withdraw/underlying token

Returns

NameTypeDescription

_0

bool

undefined

isTokenIDExist

function isTokenIDExist(string tokenID) external view returns (bool)

Public function returning if token ID exists given a string

Parameters

NameTypeDescription

tokenID

string

undefined

Returns

NameTypeDescription

_0

bool

undefined

renounceRole

function renounceRole(bytes32 role, address account) external nonpayable

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

NameTypeDescription

role

bytes32

undefined

account

address

undefined

revokeRole

function revokeRole(bytes32 role, address account) external nonpayable

Revokes role from account. If account had been granted role, emits a {RoleRevoked} event. Requirements: - the caller must have role's admin role.

Parameters

NameTypeDescription

role

bytes32

undefined

account

address

undefined

setMaxGasPrice

function setMaxGasPrice(uint256 chainID, uint256 maxPrice) external nonpayable

sets the max gas price for a chain

Parameters

NameTypeDescription

chainID

uint256

undefined

maxPrice

uint256

undefined

setPoolConfig

function setPoolConfig(address tokenAddress, uint256 chainID, address poolAddress, bool metaswap) external nonpayable returns (struct BridgeConfigV3.Pool)

Parameters

NameTypeDescription

tokenAddress

address

undefined

chainID

uint256

undefined

poolAddress

address

undefined

metaswap

bool

undefined

Returns

NameTypeDescription

_0

BridgeConfigV3.Pool

undefined

setTokenConfig

function setTokenConfig(string tokenID, uint256 chainID, address tokenAddress, uint8 tokenDecimals, uint256 maxSwap, uint256 minSwap, uint256 swapFee, uint256 maxSwapFee, uint256 minSwapFee, bool hasUnderlying, bool isUnderlying) external nonpayable returns (bool)

Main write function of this contract - Handles creating the struct and passing it to the internal logic function

Parameters

NameTypeDescription

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

NameTypeDescription

_0

bool

undefined

setTokenConfig

function setTokenConfig(string tokenID, uint256 chainID, string tokenAddress, uint8 tokenDecimals, uint256 maxSwap, uint256 minSwap, uint256 swapFee, uint256 maxSwapFee, uint256 minSwapFee, bool hasUnderlying, bool isUnderlying) external nonpayable returns (bool)

Main write function of this contract - Handles creating the struct and passing it to the internal logic function

Parameters

NameTypeDescription

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

NameTypeDescription

_0

bool

undefined

Events

RoleAdminChanged

event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)

Parameters

NameTypeDescription

role indexed

bytes32

undefined

previousAdminRole indexed

bytes32

undefined

newAdminRole indexed

bytes32

undefined

RoleGranted

event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)

Parameters

NameTypeDescription

role indexed

bytes32

undefined

account indexed

address

undefined

sender indexed

address

undefined

RoleRevoked

event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)

Parameters

NameTypeDescription

role indexed

bytes32

undefined

account indexed

address

undefined

sender indexed

address

undefined

Last updated