config

package
v0.0.0-...-290478e Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteConfig

func WriteConfig(file string, config Config) error

WriteConfig writes the config file

Types

type Account

type Account struct {
	RawBech32Address DoubleQuotedString `yaml:"bech32_address"`
	RawEVMAddress    DoubleQuotedString `yaml:"evm_address"`
	RawPrivateKey    DoubleQuotedString `yaml:"private_key"`
	SolanaAddress    DoubleQuotedString `yaml:"solana_address"`
	SolanaPrivateKey DoubleQuotedString `yaml:"solana_private_key"`
}

Account contains configuration for an account

func (Account) EVMAddress

func (a Account) EVMAddress() ethcommon.Address

func (Account) PrivateKey

func (a Account) PrivateKey() (*ecdsa.PrivateKey, error)

func (Account) Validate

func (a Account) Validate() error

Validate that the address and the private key specified in the config actually match

type AdditionalAccounts

type AdditionalAccounts struct {
	UserLegacyERC20       Account `yaml:"user_legacy_erc20"`
	UserLegacyZeta        Account `yaml:"user_legacy_zeta"`
	UserLegacyZEVMMP      Account `yaml:"user_legacy_zevm_mp"`
	UserLegacyEther       Account `yaml:"user_legacy_ether"`
	UserBitcoinDeposit    Account `yaml:"user_bitcoin_deposit"`
	UserBitcoinWithdraw   Account `yaml:"user_bitcoin_withdraw"`
	UserSolana            Account `yaml:"user_solana"`
	UserSPL               Account `yaml:"user_spl"`
	UserMisc              Account `yaml:"user_misc"`
	UserAdmin             Account `yaml:"user_admin"`
	UserMigration         Account `yaml:"user_migration"` // used for TSS migration, TODO: rename (https://github.com/zeta-chain/node/issues/2780)
	UserPrecompile        Account `yaml:"user_precompile"`
	UserEther             Account `yaml:"user_ether"`
	UserERC20             Account `yaml:"user_erc20"`
	UserEtherRevert       Account `yaml:"user_ether_revert"`
	UserERC20Revert       Account `yaml:"user_erc20_revert"`
	UserEmissionsWithdraw Account `yaml:"user_emissions_withdraw"`
}

AdditionalAccounts are extra accounts required to run specific tests

func (AdditionalAccounts) AsSlice

func (a AdditionalAccounts) AsSlice() []Account

AsSlice gets all accounts as a slice rather than a struct

type BitcoinNetworkType

type BitcoinNetworkType string

BitcoinNetworkType is a custom type to represent allowed network types

const (
	Mainnet  BitcoinNetworkType = "mainnet"
	Testnet3 BitcoinNetworkType = "testnet3"
	Regnet   BitcoinNetworkType = "regnet"
)

Enum values for BitcoinNetworkType

func (BitcoinNetworkType) GetParams

func (bnt BitcoinNetworkType) GetParams() (chaincfg.Params, error)

GetParams returns the chaincfg.Params for the BitcoinNetworkType

type BitcoinRPC

type BitcoinRPC struct {
	User   string             `yaml:"user"`
	Pass   string             `yaml:"pass"`
	Host   string             `yaml:"host"`
	Params BitcoinNetworkType `yaml:"params"`
}

BitcoinRPC contains the configuration for the Bitcoin RPC endpoint

type Config

type Config struct {
	// Default account to use when running tests and running setup
	DefaultAccount          Account                 `yaml:"default_account"`
	AdditionalAccounts      AdditionalAccounts      `yaml:"additional_accounts"`
	PolicyAccounts          PolicyAccounts          `yaml:"policy_accounts"`
	ObserverRelayerAccounts ObserverRelayerAccounts `yaml:"observer_relayer_accounts"`
	RPCs                    RPCs                    `yaml:"rpcs"`
	Contracts               Contracts               `yaml:"contracts"`
	ZetaChainID             string                  `yaml:"zeta_chain_id"`
}

Config contains the configuration for the e2e test

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default config using values for localnet testing

func ReadConfig

func ReadConfig(file string) (config Config, err error)

ReadConfig reads the config file

func (*Config) GenerateKeys

func (c *Config) GenerateKeys() error

GenerateKeys generates new key pairs for all accounts

func (Config) Validate

func (c Config) Validate() error

Validate validates the config

type Contracts

type Contracts struct {
	EVM    EVM    `yaml:"evm"`
	ZEVM   ZEVM   `yaml:"zevm"`
	Solana Solana `yaml:"solana"`
}

Contracts contains the addresses of predeployed contracts

type DoubleQuotedString

type DoubleQuotedString string

DoubleQuotedString forces a string to be double quoted when marshaling to yaml. This is required because of https://github.com/go-yaml/yaml/issues/847

func (DoubleQuotedString) AsEVMAddress

func (s DoubleQuotedString) AsEVMAddress() (ethcommon.Address, error)

func (DoubleQuotedString) MarshalYAML

func (s DoubleQuotedString) MarshalYAML() (interface{}, error)

func (DoubleQuotedString) String

func (s DoubleQuotedString) String() string

type EVM

type EVM struct {
	ZetaEthAddr      DoubleQuotedString `yaml:"zeta_eth"`
	ConnectorEthAddr DoubleQuotedString `yaml:"connector_eth"`
	CustodyAddr      DoubleQuotedString `yaml:"custody"`
	ERC20            DoubleQuotedString `yaml:"erc20"`
	TestDappAddr     DoubleQuotedString `yaml:"test_dapp"`
	Gateway          DoubleQuotedString `yaml:"gateway"`
	ERC20CustodyNew  DoubleQuotedString `yaml:"erc20_custody_new"`
	TestDAppV2Addr   DoubleQuotedString `yaml:"test_dapp_v2"`
}

EVM contains the addresses of predeployed contracts on the EVM chain

type ObserverRelayerAccounts

type ObserverRelayerAccounts struct {
	// RelayerAccounts contains two relayer accounts used by zetaclient0 and zetaclient1
	RelayerAccounts [2]Account `yaml:"relayer_accounts"`
}

ObserverRelayerAccounts are the accounts used by the observers to interact with gateway contracts in non-EVM chains (e.g. Solana)

type PolicyAccounts

type PolicyAccounts struct {
	EmergencyPolicyAccount   Account `yaml:"emergency_policy_account"`
	OperationalPolicyAccount Account `yaml:"operational_policy_account"`
	AdminPolicyAccount       Account `yaml:"admin_policy_account"`
}

func (PolicyAccounts) AsSlice

func (a PolicyAccounts) AsSlice() []Account

type RPCs

type RPCs struct {
	Zevm              string     `yaml:"zevm"`
	EVM               string     `yaml:"evm"`
	Bitcoin           BitcoinRPC `yaml:"bitcoin"`
	Solana            string     `yaml:"solana"`
	TONSidecarURL     string     `yaml:"ton_sidecar_url"`
	ZetaCoreGRPC      string     `yaml:"zetacore_grpc"`
	ZetaCoreRPC       string     `yaml:"zetacore_rpc"`
	ZetaclientMetrics string     `yaml:"zetaclient_metrics"`
}

RPCs contains the configuration for the RPC endpoints

type Solana

type Solana struct {
	GatewayProgramID DoubleQuotedString `yaml:"gateway_program_id"`
	SPLAddr          DoubleQuotedString `yaml:"spl"`
}

Solana contains the addresses of predeployed contracts and accounts on the Solana chain

type ZEVM

type ZEVM struct {
	SystemContractAddr DoubleQuotedString `yaml:"system_contract"`
	ETHZRC20Addr       DoubleQuotedString `yaml:"eth_zrc20"`
	ERC20ZRC20Addr     DoubleQuotedString `yaml:"erc20_zrc20"`
	BTCZRC20Addr       DoubleQuotedString `yaml:"btc_zrc20"`
	SOLZRC20Addr       DoubleQuotedString `yaml:"sol_zrc20"`
	SPLZRC20Addr       DoubleQuotedString `yaml:"spl_zrc20"`
	TONZRC20Addr       DoubleQuotedString `yaml:"ton_zrc20"`
	UniswapFactoryAddr DoubleQuotedString `yaml:"uniswap_factory"`
	UniswapRouterAddr  DoubleQuotedString `yaml:"uniswap_router"`
	ConnectorZEVMAddr  DoubleQuotedString `yaml:"connector_zevm"`
	WZetaAddr          DoubleQuotedString `yaml:"wzeta"`
	ZEVMSwapAppAddr    DoubleQuotedString `yaml:"zevm_swap_app"`
	ContextAppAddr     DoubleQuotedString `yaml:"context_app"`
	TestDappAddr       DoubleQuotedString `yaml:"test_dapp"`
	Gateway            DoubleQuotedString `yaml:"gateway"`
	TestDAppV2Addr     DoubleQuotedString `yaml:"test_dapp_v2"`
}

ZEVM contains the addresses of predeployed contracts on the zEVM chain

Jump to

Keyboard shortcuts

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