Build
Architecture
protocol
contracts
evm
ZetaConnectorBase.sol
Abstract.zetaconnectorbase

Git Source (opens in a new tab)

Inherits: IZetaConnectorEvents, ReentrancyGuard, Pausable, AccessControl

Abstract base contract for ZetaConnector.

This contract implements basic functionality for handling tokens and interacting with the Gateway contract.

gateway

The Gateway contract used for executing cross-chain calls.

IGatewayEVM public immutable gateway;

zetaToken

The address of the Zeta token.

address public immutable zetaToken;

WITHDRAWER_ROLE

New role identifier for withdrawer role.

bytes32 public constant WITHDRAWER_ROLE = keccak256("WITHDRAWER_ROLE");

PAUSER_ROLE

New role identifier for pauser role.

bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");

TSS_ROLE

New role identifier for tss role.

bytes32 public constant TSS_ROLE = keccak256("TSS_ROLE");

constructor

Constructor for ZetaConnectors.

Set admin as default admin and pauser, and tssAddress as tss role.

constructor(address gateway_, address zetaToken_, address tssAddress_, address admin_);

pause

Pause contract.

function pause() external onlyRole(PAUSER_ROLE);

unpause

Unpause contract.

function unpause() external onlyRole(PAUSER_ROLE);

withdraw

Withdraw tokens to a specified address.

function withdraw(address to, uint256 amount, bytes32 internalSendHash) external virtual;

Parameters

NameTypeDescription
toaddressThe address to withdraw tokens to.
amountuint256The amount of tokens to withdraw.
internalSendHashbytes32A hash used for internal tracking of the transaction.

withdrawAndCall

Withdraw tokens and call a contract through Gateway.

function withdrawAndCall(address to, uint256 amount, bytes calldata data, bytes32 internalSendHash) external virtual;

Parameters

NameTypeDescription
toaddressThe address to withdraw tokens to.
amountuint256The amount of tokens to withdraw.
databytesThe calldata to pass to the contract call.
internalSendHashbytes32A hash used for internal tracking of the transaction.

withdrawAndRevert

Withdraw tokens and call a contract with a revert callback through Gateway.

function withdrawAndRevert(
    address to,
    uint256 amount,
    bytes calldata data,
    bytes32 internalSendHash,
    RevertContext calldata revertContext
)
    external
    virtual;

Parameters

NameTypeDescription
toaddressThe address to withdraw tokens to.
amountuint256The amount of tokens to withdraw.
databytesThe calldata to pass to the contract call.
internalSendHashbytes32A hash used for internal tracking of the transaction.
revertContextRevertContextRevert context to pass to onRevert.

receiveTokens

Handle received tokens.

function receiveTokens(uint256 amount) external virtual;

Parameters

NameTypeDescription
amountuint256The amount of tokens received.

ZeroAddress

Error indicating that a zero address was provided.

error ZeroAddress();