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.
Functions
initialize
function initialize(
address gateway_,
address zetaToken_,
address tssAddress_,
address admin_
)
public
override
initializer;
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
Name | Type | Description |
---|---|---|
to | address | The address to withdraw tokens to. |
amount | uint256 | The amount of tokens to withdraw. |
internalSendHash | bytes32 | A 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
Name | Type | Description |
---|---|---|
to | address | The address to withdraw tokens to. |
amount | uint256 | The amount of tokens to withdraw. |
data | bytes | The calldata to pass to the contract call. |
internalSendHash | bytes32 | A 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
Name | Type | Description |
---|---|---|
to | address | The address to withdraw tokens to. |
amount | uint256 | The amount of tokens to withdraw. |
data | bytes | The calldata to pass to the contract call. |
internalSendHash | bytes32 | A hash used for internal tracking of the transaction. |
revertContext | RevertContext | Revert context to pass to onRevert. |
receiveTokens
Handle received tokens.
function receiveTokens(uint256 amount) external override whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | The amount of tokens received. |