evm

package
v0.0.0-...-1929ff6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OutboundInclusionTimeout is the timeout for waiting for an outbound to be included in a block
	OutboundInclusionTimeout = 20 * time.Minute

	// ReorgProtectBlockCount is confirmations count to protect against reorg
	// Short 1~2 block reorgs could happen often on Ethereum due to network congestion or block production race conditions
	ReorgProtectBlockCount = 2

	// OutboundTrackerReportTimeout is the timeout for waiting for an outbound tracker report
	OutboundTrackerReportTimeout = 10 * time.Minute

	// EthTransferGasLimit is the gas limit for a standard ETH transfer
	EthTransferGasLimit = 21000

	// TopicsZetaSent is the number of topics for a Zeta sent event
	// [signature, zetaTxSenderAddress, destinationChainId]
	// https://github.com/zeta-chain/protocol-contracts/blob/d65814debf17648a6c67d757ba03646415842790/contracts/evm/ZetaConnector.base.sol#L34
	TopicsZetaSent = 3

	// TopicsZetaReceived is the number of topics for a Zeta received event
	// [signature, sourceChainId, destinationAddress, internalSendHash]
	// https://github.com/zeta-chain/protocol-contracts/blob/d65814debf17648a6c67d757ba03646415842790/contracts/evm/ZetaConnector.base.sol#L45
	TopicsZetaReceived = 4

	// TopicsZetaReverted is the number of topics for a Zeta reverted event
	// [signature, destinationChainId, internalSendHash]
	// https://github.com/zeta-chain/protocol-contracts/blob/d65814debf17648a6c67d757ba03646415842790/contracts/evm/ZetaConnector.base.sol#L54
	TopicsZetaReverted = 3

	// TopicsWithdrawn is the number of topics for a withdrawn event
	// [signature, recipient, asset]
	// https://github.com/zeta-chain/protocol-contracts/blob/d65814debf17648a6c67d757ba03646415842790/contracts/evm/ERC20Custody.sol#L43
	TopicsWithdrawn = 3

	// TopicsDeposited is the number of topics for a deposited event
	// [signature, asset]
	// https://github.com/zeta-chain/protocol-contracts/blob/d65814debf17648a6c67d757ba03646415842790/contracts/evm/ERC20Custody.sol#L42
	TopicsDeposited = 2

	// TopicsGatewayDeposit is the number of topics for a gateway deposit event
	// [signature, sender, receiver]
	TopicsGatewayDeposit = 3

	// TopicsGatewayCall is the number of topics for a gateway call event
	// [signature, sender, receiver]
	TopicsGatewayCall = 3

	// TopicsGatewayExecuted is the number of topics for a gateway executed event
	// [signature, destination]
	TopicsGatewayExecuted = 2

	// TopicsGatewayExecutedWithERC20 is the number of topics for a gateway executed with ERC20 event
	// [signature, token, destination]
	TopicsGatewayExecutedWithERC20 = 3

	// TopicsGatewayReverted is the number of topics for a reverted event
	// [signature, destination]
	TopicsGatewayReverted = 3

	// TopicsERC20CustodyWithdraw is the number of topics for an ERC20 custody withdraw event
	// [signature, recipient, asset]
	TopicsERC20CustodyWithdraw = 3

	// TopicsERC20CustodyWithdrawAndCall is the number of topics for an ERC20 custody withdraw and call event
	// [signature, recipient, asset]
	TopicsERC20CustodyWithdrawAndCall = 3
)

Variables

This section is empty.

Functions

func ValidateEvmTransaction

func ValidateEvmTransaction(tx *ethrpc.Transaction) error

ValidateEvmTransaction checks the basics of an EVM transaction Note: these checks are to ensure the transaction is well-formed and can be safely used for further processing by zetaclient

func ValidateEvmTxLog

func ValidateEvmTxLog(vLog *ethtypes.Log, wantAddress ethcommon.Address, wantHash string, wantTopics int) error

ValidateEvmTxLog checks the basics of an EVM tx log

Types

type OutboundType

type OutboundType int

OutboundType enumerate the different types of outbound transactions NOTE: only used for v2 protocol contracts and currently excludes ZETA withdraws

const (
	// OutboundTypeUnknown is an unknown outbound transaction
	OutboundTypeUnknown OutboundType = iota

	// OutboundTypeGasWithdraw is a gas withdraw transaction
	OutboundTypeGasWithdraw

	// OutboundTypeERC20Withdraw is an ERC20 withdraw transaction
	OutboundTypeERC20Withdraw

	// OutboundTypeGasWithdrawAndCall is a gas withdraw and call transaction
	OutboundTypeGasWithdrawAndCall

	// OutboundTypeERC20WithdrawAndCall is an ERC20 withdraw and call transaction
	OutboundTypeERC20WithdrawAndCall

	// OutboundTypeCall is a no-asset call transaction
	OutboundTypeCall

	// OutboundTypeGasWithdrawRevert is a gas withdraw revert
	OutboundTypeGasWithdrawRevert

	// OutboundTypeGasWithdrawRevertAndCallOnRevert is a gas withdraw revert and call on revert
	OutboundTypeGasWithdrawRevertAndCallOnRevert

	// OutboundTypeERC20WithdrawRevert is an ERC20 withdraw revert
	OutboundTypeERC20WithdrawRevert

	// OutboundTypeERC20WithdrawRevertAndCallOnRevert is an ERC20 withdraw revert and call on revert
	OutboundTypeERC20WithdrawRevertAndCallOnRevert
)

func ParseOutboundTypeFromCCTX

func ParseOutboundTypeFromCCTX(cctx types.CrossChainTx) OutboundType

ParseOutboundTypeFromCCTX returns the outbound type from the CCTX

Directories

Path Synopsis
Package observer implements the EVM chain observer
Package observer implements the EVM chain observer
Package signer implements the ChainSigner interface for EVM chains
Package signer implements the ChainSigner interface for EVM chains

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL