SynapseBridge

Methods

DEFAULT_ADMIN_ROLE

function DEFAULT_ADMIN_ROLE() external view returns (bytes32)

Returns

GOVERNANCE_ROLE

function GOVERNANCE_ROLE() external view returns (bytes32)

Returns

NODEGROUP_ROLE

function NODEGROUP_ROLE() external view returns (bytes32)

Returns

WETH_ADDRESS

function WETH_ADDRESS() external view returns (address payable)

Returns

addKappas

function addKappas(bytes32[] kappas) external nonpayable

Parameters

bridgeVersion

function bridgeVersion() external view returns (uint256)

Returns

chainGasAmount

function chainGasAmount() external view returns (uint256)

Returns

deposit

function deposit(address to, uint256 chainId, contract IERC20 token, uint256 amount) external nonpayable

Relays to nodes to transfers an ERC20 token cross-chain

Parameters

depositAndSwap

function depositAndSwap(address to, uint256 chainId, contract IERC20 token, uint256 amount, uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 minDy, uint256 deadline) external nonpayable

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

getFeeBalance

function getFeeBalance(address tokenAddress) external view returns (uint256)

Parameters

Returns

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

Returns

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

Returns

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

Returns

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

hasRole

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

Returns true if account has been granted role.

Parameters

Returns

initialize

function initialize() external nonpayable

kappaExists

function kappaExists(bytes32 kappa) external view returns (bool)

Parameters

Returns

mint

function mint(address payable to, contract IERC20Mintable token, uint256 amount, uint256 fee, bytes32 kappa) external nonpayable

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

mintAndSwap

function mintAndSwap(address payable to, contract IERC20Mintable token, uint256 amount, uint256 fee, contract ISwap pool, uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 minDy, uint256 deadline, bytes32 kappa) external nonpayable

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

pause

function pause() external nonpayable

paused

function paused() external view returns (bool)

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

Returns

redeem

function redeem(address to, uint256 chainId, contract ERC20Burnable token, uint256 amount) external nonpayable

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

redeemAndRemove

function redeemAndRemove(address to, uint256 chainId, contract ERC20Burnable token, uint256 amount, uint8 swapTokenIndex, uint256 swapMinAmount, uint256 swapDeadline) external nonpayable

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

redeemAndSwap

function redeemAndSwap(address to, uint256 chainId, contract ERC20Burnable token, uint256 amount, uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 minDy, uint256 deadline) external nonpayable

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

redeemV2

function redeemV2(bytes32 to, uint256 chainId, contract ERC20Burnable token, uint256 amount) external nonpayable

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

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

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

setChainGasAmount

function setChainGasAmount(uint256 amount) external nonpayable

Parameters

setWethAddress

function setWethAddress(address payable _wethAddress) external nonpayable

Parameters

startBlockNumber

function startBlockNumber() external view returns (uint256)

Returns

unpause

function unpause() external nonpayable

withdraw

function withdraw(address to, contract IERC20 token, uint256 amount, uint256 fee, bytes32 kappa) external nonpayable

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

Parameters

withdrawAndRemove

function withdrawAndRemove(address to, contract IERC20 token, uint256 amount, uint256 fee, contract ISwap pool, uint8 swapTokenIndex, uint256 swapMinAmount, uint256 swapDeadline, bytes32 kappa) external nonpayable

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

Parameters

withdrawFees

function withdrawFees(contract IERC20 token, address to) external nonpayable

withdraw specified ERC20 token fees to a given address

Parameters

Events

Paused

event Paused(address account)

Parameters

RoleAdminChanged

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

Parameters

RoleGranted

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

Parameters

RoleRevoked

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

Parameters

TokenDeposit

event TokenDeposit(address indexed to, uint256 chainId, contract IERC20 token, uint256 amount)

Parameters

TokenDepositAndSwap

event TokenDepositAndSwap(address indexed to, uint256 chainId, contract IERC20 token, uint256 amount, uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 minDy, uint256 deadline)

Parameters

TokenMint

event TokenMint(address indexed to, contract IERC20Mintable token, uint256 amount, uint256 fee, bytes32 indexed kappa)

Parameters

TokenMintAndSwap

event TokenMintAndSwap(address indexed to, contract IERC20Mintable token, uint256 amount, uint256 fee, uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 minDy, uint256 deadline, bool swapSuccess, bytes32 indexed kappa)

Parameters

TokenRedeem

event TokenRedeem(address indexed to, uint256 chainId, contract IERC20 token, uint256 amount)

Parameters

TokenRedeemAndRemove

event TokenRedeemAndRemove(address indexed to, uint256 chainId, contract IERC20 token, uint256 amount, uint8 swapTokenIndex, uint256 swapMinAmount, uint256 swapDeadline)

Parameters

TokenRedeemAndSwap

event TokenRedeemAndSwap(address indexed to, uint256 chainId, contract IERC20 token, uint256 amount, uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 minDy, uint256 deadline)

Parameters

TokenRedeemV2

event TokenRedeemV2(bytes32 indexed to, uint256 chainId, contract IERC20 token, uint256 amount)

Parameters

TokenWithdraw

event TokenWithdraw(address indexed to, contract IERC20 token, uint256 amount, uint256 fee, bytes32 indexed kappa)

Parameters

TokenWithdrawAndRemove

event TokenWithdrawAndRemove(address indexed to, contract IERC20 token, uint256 amount, uint256 fee, uint8 swapTokenIndex, uint256 swapMinAmount, uint256 swapDeadline, bool swapSuccess, bytes32 indexed kappa)

Parameters

Unpaused

event Unpaused(address account)

Parameters

Last updated