SynapseBridge

Methods

DEFAULT_ADMIN_ROLE

function DEFAULT_ADMIN_ROLE() external view returns (bytes32)

Returns

Name
Type
Description

_0

bytes32

undefined

GOVERNANCE_ROLE

function GOVERNANCE_ROLE() external view returns (bytes32)

Returns

Name
Type
Description

_0

bytes32

undefined

NODEGROUP_ROLE

function NODEGROUP_ROLE() external view returns (bytes32)

Returns

Name
Type
Description

_0

bytes32

undefined

WETH_ADDRESS

Returns

Name
Type
Description

_0

address payable

undefined

addKappas

Parameters

Name
Type
Description

kappas

bytes32[]

undefined

bridgeVersion

Returns

Name
Type
Description

_0

uint256

undefined

chainGasAmount

Returns

Name
Type
Description

_0

uint256

undefined

deposit

Relays to nodes to transfers an ERC20 token cross-chain

Parameters

Name
Type
Description

to

address

address on other chain to bridge assets to

chainId

uint256

which chain to bridge assets onto

token

contract IERC20

ERC20 compatible token to deposit into the bridge

amount

uint256

Amount in native token decimals to transfer cross-chain pre-fees*

depositAndSwap

Relays to nodes to both transfer an ERC20 token cross-chain, and then have the nodes execute a swap through a liquidity pool on behalf of the user.

Parameters

Name
Type
Description

to

address

address on other chain to bridge assets to

chainId

uint256

which chain to bridge assets onto

token

contract IERC20

ERC20 compatible token to deposit into the bridge

amount

uint256

Amount in native token decimals to transfer cross-chain pre-fees

tokenIndexFrom

uint8

the token the user wants to swap from

tokenIndexTo

uint8

the token the user wants to swap to

minDy

uint256

the min amount the user would like to receive, or revert to only minting the SynERC20 token crosschain.

deadline

uint256

latest timestamp to accept this transaction*

getFeeBalance

Parameters

Name
Type
Description

tokenAddress

address

undefined

Returns

Name
Type
Description

_0

uint256

undefined

getRoleAdmin

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

Parameters

Name
Type
Description

role

bytes32

undefined

Returns

Name
Type
Description

_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

Name
Type
Description

role

bytes32

undefined

index

uint256

undefined

Returns

Name
Type
Description

_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

Name
Type
Description

role

bytes32

undefined

Returns

Name
Type
Description

_0

uint256

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

Name
Type
Description

role

bytes32

undefined

account

address

undefined

hasRole

Returns true if account has been granted role.

Parameters

Name
Type
Description

role

bytes32

undefined

account

address

undefined

Returns

Name
Type
Description

_0

bool

undefined

initialize

kappaExists

Parameters

Name
Type
Description

kappa

bytes32

undefined

Returns

Name
Type
Description

_0

bool

undefined

mint

Nodes call this function to mint a SynERC20 (or any asset that the bridge is given minter access to). This is called by the nodes after a TokenDeposit event is emitted.

This means the SynapseBridge.sol contract must have minter access to the token attempting to be minted

Parameters

Name
Type
Description

to

address payable

address on other chain to redeem underlying assets to

token

contract IERC20Mintable

ERC20 compatible token to deposit into the bridge

amount

uint256

Amount in native token decimals to transfer cross-chain post-fees

fee

uint256

Amount in native token decimals to save to the contract as fees

kappa

bytes32

kappa*

mintAndSwap

Nodes call this function to mint a SynERC20 (or any asset that the bridge is given minter access to), and then attempt to swap the SynERC20 into the desired destination asset. This is called by the nodes after a TokenDepositAndSwap event is emitted.

This means the BridgeDeposit.sol contract must have minter access to the token attempting to be minted

Parameters

Name
Type
Description

to

address payable

address on other chain to redeem underlying assets to

token

contract IERC20Mintable

ERC20 compatible token to deposit into the bridge

amount

uint256

Amount in native token decimals to transfer cross-chain post-fees

fee

uint256

Amount in native token decimals to save to the contract as fees

pool

contract ISwap

Destination chain's pool to use to swap SynERC20 -> Asset. The nodes determine this by using PoolConfig.sol.

tokenIndexFrom

uint8

Index of the SynERC20 asset in the pool

tokenIndexTo

uint8

Index of the desired final asset

minDy

uint256

Minumum amount (in final asset decimals) that must be swapped for, otherwise the user will receive the SynERC20.

deadline

uint256

Epoch time of the deadline that the swap is allowed to be executed.

kappa

bytes32

kappa*

pause

paused

Returns true if the contract is paused, and false otherwise.

Returns

Name
Type
Description

_0

bool

undefined

redeem

Relays to nodes that (typically) a wrapped synAsset ERC20 token has been burned and the underlying needs to be redeeemed on the native chain

Parameters

Name
Type
Description

to

address

address on other chain to redeem underlying assets to

chainId

uint256

which underlying chain to bridge assets onto

token

contract ERC20Burnable

ERC20 compatible token to deposit into the bridge

amount

uint256

Amount in native token decimals to transfer cross-chain pre-fees*

redeemAndRemove

Relays to nodes that (typically) a wrapped synAsset ERC20 token has been burned and the underlying needs to be redeeemed on the native chain. This function indicates to the nodes that they should attempt to redeem the LP token for the underlying assets (E.g "swap" out of the LP token)

Parameters

Name
Type
Description

to

address

address on other chain to redeem underlying assets to

chainId

uint256

which underlying chain to bridge assets onto

token

contract ERC20Burnable

ERC20 compatible token to deposit into the bridge

amount

uint256

Amount in native token decimals to transfer cross-chain pre-fees

swapTokenIndex

uint8

Specifies which of the underlying LP assets the nodes should attempt to redeem for

swapMinAmount

uint256

Specifies the minimum amount of the underlying asset needed for the nodes to execute the redeem/swap

swapDeadline

uint256

Specificies the deadline that the nodes are allowed to try to redeem/swap the LP token*

redeemAndSwap

Relays to nodes that (typically) a wrapped synAsset ERC20 token has been burned and the underlying needs to be redeeemed on the native chain. This function indicates to the nodes that they should attempt to redeem the LP token for the underlying assets (E.g "swap" out of the LP token)

Parameters

Name
Type
Description

to

address

address on other chain to redeem underlying assets to

chainId

uint256

which underlying chain to bridge assets onto

token

contract ERC20Burnable

ERC20 compatible token to deposit into the bridge

amount

uint256

Amount in native token decimals to transfer cross-chain pre-fees

tokenIndexFrom

uint8

the token the user wants to swap from

tokenIndexTo

uint8

the token the user wants to swap to

minDy

uint256

the min amount the user would like to receive, or revert to only minting the SynERC20 token crosschain.

deadline

uint256

latest timestamp to accept this transaction*

redeemV2

Relays to nodes that (typically) a wrapped synAsset ERC20 token has been burned and the underlying needs to be redeeemed on the native chain

Parameters

Name
Type
Description

to

bytes32

address on other chain to redeem underlying assets to

chainId

uint256

which underlying chain to bridge assets onto

token

contract ERC20Burnable

ERC20 compatible token to deposit into the bridge

amount

uint256

Amount in native token decimals to transfer cross-chain pre-fees*

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

Name
Type
Description

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

Name
Type
Description

role

bytes32

undefined

account

address

undefined

setChainGasAmount

Parameters

Name
Type
Description

amount

uint256

undefined

setWethAddress

Parameters

Name
Type
Description

_wethAddress

address payable

undefined

startBlockNumber

Returns

Name
Type
Description

_0

uint256

undefined

unpause

withdraw

Function to be called by the node group to withdraw the underlying assets from the contract

Parameters

Name
Type
Description

to

address

address on chain to send underlying assets to

token

contract IERC20

ERC20 compatible token to withdraw from the bridge

amount

uint256

Amount in native token decimals to withdraw

fee

uint256

Amount in native token decimals to save to the contract as fees

kappa

bytes32

kappa*

withdrawAndRemove

Function to be called by the node group to withdraw the underlying assets from the contract

Parameters

Name
Type
Description

to

address

address on chain to send underlying assets to

token

contract IERC20

ERC20 compatible token to withdraw from the bridge

amount

uint256

Amount in native token decimals to withdraw

fee

uint256

Amount in native token decimals to save to the contract as fees

pool

contract ISwap

Destination chain's pool to use to swap SynERC20 -> Asset. The nodes determine this by using PoolConfig.sol.

swapTokenIndex

uint8

Specifies which of the underlying LP assets the nodes should attempt to redeem for

swapMinAmount

uint256

Specifies the minimum amount of the underlying asset needed for the nodes to execute the redeem/swap

swapDeadline

uint256

Specificies the deadline that the nodes are allowed to try to redeem/swap the LP token

kappa

bytes32

kappa*

withdrawFees

withdraw specified ERC20 token fees to a given address

Parameters

Name
Type
Description

token

contract IERC20

ERC20 token in which fees acccumulated to transfer

to

address

Address to send the fees to

Events

Paused

Parameters

Name
Type
Description

account

address

undefined

RoleAdminChanged

Parameters

Name
Type
Description

role indexed

bytes32

undefined

previousAdminRole indexed

bytes32

undefined

newAdminRole indexed

bytes32

undefined

RoleGranted

Parameters

Name
Type
Description

role indexed

bytes32

undefined

account indexed

address

undefined

sender indexed

address

undefined

RoleRevoked

Parameters

Name
Type
Description

role indexed

bytes32

undefined

account indexed

address

undefined

sender indexed

address

undefined

TokenDeposit

Parameters

Name
Type
Description

to indexed

address

undefined

chainId

uint256

undefined

token

contract IERC20

undefined

amount

uint256

undefined

TokenDepositAndSwap

Parameters

Name
Type
Description

to indexed

address

undefined

chainId

uint256

undefined

token

contract IERC20

undefined

amount

uint256

undefined

tokenIndexFrom

uint8

undefined

tokenIndexTo

uint8

undefined

minDy

uint256

undefined

deadline

uint256

undefined

TokenMint

Parameters

Name
Type
Description

to indexed

address

undefined

token

contract IERC20Mintable

undefined

amount

uint256

undefined

fee

uint256

undefined

kappa indexed

bytes32

undefined

TokenMintAndSwap

Parameters

Name
Type
Description

to indexed

address

undefined

token

contract IERC20Mintable

undefined

amount

uint256

undefined

fee

uint256

undefined

tokenIndexFrom

uint8

undefined

tokenIndexTo

uint8

undefined

minDy

uint256

undefined

deadline

uint256

undefined

swapSuccess

bool

undefined

kappa indexed

bytes32

undefined

TokenRedeem

Parameters

Name
Type
Description

to indexed

address

undefined

chainId

uint256

undefined

token

contract IERC20

undefined

amount

uint256

undefined

TokenRedeemAndRemove

Parameters

Name
Type
Description

to indexed

address

undefined

chainId

uint256

undefined

token

contract IERC20

undefined

amount

uint256

undefined

swapTokenIndex

uint8

undefined

swapMinAmount

uint256

undefined

swapDeadline

uint256

undefined

TokenRedeemAndSwap

Parameters

Name
Type
Description

to indexed

address

undefined

chainId

uint256

undefined

token

contract IERC20

undefined

amount

uint256

undefined

tokenIndexFrom

uint8

undefined

tokenIndexTo

uint8

undefined

minDy

uint256

undefined

deadline

uint256

undefined

TokenRedeemV2

Parameters

Name
Type
Description

to indexed

bytes32

undefined

chainId

uint256

undefined

token

contract IERC20

undefined

amount

uint256

undefined

TokenWithdraw

Parameters

Name
Type
Description

to indexed

address

undefined

token

contract IERC20

undefined

amount

uint256

undefined

fee

uint256

undefined

kappa indexed

bytes32

undefined

TokenWithdrawAndRemove

Parameters

Name
Type
Description

to indexed

address

undefined

token

contract IERC20

undefined

amount

uint256

undefined

fee

uint256

undefined

swapTokenIndex

uint8

undefined

swapMinAmount

uint256

undefined

swapDeadline

uint256

undefined

swapSuccess

bool

undefined

kappa indexed

bytes32

undefined

Unpaused

Parameters

Name
Type
Description

account

address

undefined

Last updated

Was this helpful?