config

package
v0.0.0-...-2da98db Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 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"`
}

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 {
	UserERC20      Account `yaml:"user_erc20"`
	UserZetaTest   Account `yaml:"user_zeta_test"`
	UserZEVMMPTest Account `yaml:"user_zevm_mp_test"`
	UserBitcoin    Account `yaml:"user_bitcoin"`
	UserEther      Account `yaml:"user_ether"`
	UserMisc       Account `yaml:"user_misc"`
	UserAdmin      Account `yaml:"user_admin"`
	UserMigration  Account `yaml:"user_migration"`
}

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"`
	HTTPPostMode bool               `yaml:"http_post_mode"`
	DisableTLS   bool               `yaml:"disable_tls"`
	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"`
	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"`
}

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"`
}

EVM contains the addresses of predeployed contracts on the EVM chain

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"`
	ZetaCoreGRPC string     `yaml:"zetacore_grpc"`
	ZetaCoreRPC  string     `yaml:"zetacore_rpc"`
}

RPCs contains the configuration for the RPC endpoints

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"`
	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"`
}

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