Build
Architecture
protocol
contracts
evm
ZetaConnectorNonNative.sol
Contract.zetaconnectornonnative

Git Source (opens in a new tab)

Inherits: ZetaConnectorBase

Implementation of ZetaConnectorBase for non-native token handling.

This contract mints and burns Zeta tokens and interacts with the Gateway contract.

maxSupply

Max supply for minting.

uint256 public maxSupply;

initialize

function initialize(
    address gateway_,
    address zetaToken_,
    address tssAddress_,
    address admin_
)
    public
    override
    initializer;

setMaxSupply

Set max supply for minting.

This function can only be called by the TSS address.

function setMaxSupply(uint256 maxSupply_) external onlyRole(TSS_ROLE) whenNotPaused;

Parameters

NameTypeDescription
maxSupply_uint256New max supply.

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, and mints if supply is not reached.

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, and mints if supply is not reached.

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 and burn them.

function receiveTokens(uint256 amount) external override whenNotPaused;

Parameters

NameTypeDescription
amountuint256The amount of tokens received.

_mintTo

mints to provided account and checks if totalSupply will be exceeded

function _mintTo(address to, uint256 amount, bytes32 internalSendHash) private;

MaxSupplyUpdated

Event triggered when max supply is updated.

event MaxSupplyUpdated(uint256 maxSupply);

Parameters

NameTypeDescription
maxSupplyuint256New max supply.

ExceedsMaxSupply

error ExceedsMaxSupply();