Build
Architecture
protocol
contracts
evm
ZetaConnectorNative.sol
Contract.zetaconnectornative

Git Source (opens in a new tab)

Inherits: ZetaConnectorBase

Implementation of ZetaConnectorBase for native token handling.

This contract directly transfers Zeta tokens and interacts with the Gateway contract.

constructor

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

withdraw

Withdraw tokens to a specified address.

This function can only be called by the TSS address.

function withdraw(
    address to,
    uint256 amount,
    bytes32 internalSendHash
)
    external
    override
    nonReentrant
    onlyRole(WITHDRAWER_ROLE)
    whenNotPaused;

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.

This function can only be called by the TSS address.

function withdrawAndCall(
    address to,
    uint256 amount,
    bytes calldata data,
    bytes32 internalSendHash
)
    external
    override
    nonReentrant
    onlyRole(WITHDRAWER_ROLE)
    whenNotPaused;

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.

This function can only be called by the TSS address.

function withdrawAndRevert(
    address to,
    uint256 amount,
    bytes calldata data,
    bytes32 internalSendHash,
    RevertContext calldata revertContext
)
    external
    override
    nonReentrant
    onlyRole(WITHDRAWER_ROLE)
    whenNotPaused;

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 override whenNotPaused;

Parameters

NameTypeDescription
amountuint256The amount of tokens received.