env

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: GPL-3.0, GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImplAddressFor

func ImplAddressFor(name string) (common.Address, error)

ImplAddressFor obtains the address for a core contract

func Libraries

func Libraries() []string

Libraries returns all atlas-blockchain library names

func LibraryAddressFor

func LibraryAddressFor(name string) (common.Address, error)

LibraryAddressFor obtains the address for a core contract

func MustImplAddressFor

func MustImplAddressFor(name string) common.Address

MustImplAddressFor obtains the address for a core contract this variant panics on error

func MustLibraryAddressFor

func MustLibraryAddressFor(name string) common.Address

MustLibraryAddressFor obtains the address for a core contract this variant panics on error

func MustNewMnemonic

func MustNewMnemonic() string

MustNewMnemonic creates a new mnemonic (panics on error)

func MustProxyAddressFor

func MustProxyAddressFor(name string) common.Address

MustProxyAddressFor obtains the address for a core contract proxy this variant panics on error

func NewMnemonic

func NewMnemonic() (string, error)

NewMnemonic creates a new mnemonic

func ProxyAddressFor

func ProxyAddressFor(name string) (common.Address, error)

ProxyAddressFor obtains the address for a core contract proxy

Types

type Account

type Account struct {
	Address    common.Address
	PrivateKey *ecdsa.PrivateKey
}

Account represents a atlas Account

func DeriveAccount

func DeriveAccount(mnemonic string, accountType AccountType, idx int) (*Account, error)

DeriveAccount will derive the account corresponding to (accountType, idx) using the given mnemonic

func DeriveAccountList

func DeriveAccountList(mnemonic string, accountType AccountType, qty int) ([]Account, error)

DeriveAccountList will generate the desired number of accounts using mnemonic & accountType

func GenerateRandomAccount

func GenerateRandomAccount() (Account, error)

GenerateRandomAccount creates a random new account

func MustGenerateRandomAccount

func MustGenerateRandomAccount() Account

MustGenerateRandomAccount creates new account or panics

func NewAccount

func NewAccount(key *ecdsa.PrivateKey) Account

NewAccount creates a new account for the specified private key

func (*Account) BLSG1PublicKey added in v0.5.0

func (a *Account) BLSG1PublicKey() (blscrypto.SerializedG1PublicKey, error)

BLSG1PublicKey returns the bls G1 public key

func (*Account) BLSProofOfPossession

func (a *Account) BLSProofOfPossession() ([]byte, error)

BLSProofOfPossession generates bls proof of possession

func (*Account) BLSPublicKey

func (a *Account) BLSPublicKey() (blscrypto.SerializedPublicKey, error)

BLSPublicKey returns the bls public key

func (Account) MarshalJSON

func (a Account) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Account) MustBLSProofOfPossession

func (a *Account) MustBLSProofOfPossession() []byte

MustBLSProofOfPossession variant of BLSProofOfPossession that panics on error

func (*Account) PrivateKeyHex

func (a *Account) PrivateKeyHex() string

PrivateKeyHex hex representation of the private key

func (*Account) PublicKey

func (a *Account) PublicKey() []byte

PublicKeyHex hex representation of the public key

func (*Account) String

func (a *Account) String() string

func (*Account) UnmarshalJSON

func (a *Account) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler

type AccountType

type AccountType int

AccountType represents the different account types for the generator

var (
	ValidatorAT      AccountType = 0
	DeveloperAT      AccountType = 1 // load test
	TxNodeAT         AccountType = 2
	BootnodeAT       AccountType = 3
	FaucetAT         AccountType = 4
	AttestationAT    AccountType = 5
	PriceOracleAT    AccountType = 6
	ProxyAT          AccountType = 7
	AttestationBotAT AccountType = 8
	VotingBotAT      AccountType = 9
	TxNodePrivateAT  AccountType = 10
	ValidatorGroupAT AccountType = 11 // Not in atlastool (yet)
	AdminAT          AccountType = 12 // Not in atlastool (yet)
	TxFeeRecipientAT AccountType = 13 // Not in atlastool (yet)
)

The difference account types for the generator

func (AccountType) MarshalText

func (accountType AccountType) MarshalText() ([]byte, error)

MarshalText marshall account type into text

func (AccountType) String

func (accountType AccountType) String() string

String implements the stringer interface.

func (*AccountType) UnmarshalText

func (accountType *AccountType) UnmarshalText(text []byte) error

UnmarshalText creates AccountType from string

type AccountsConfig

type AccountsConfig struct {
	Mnemonic             string `json:"mnemonic"`            // Accounts mnemonic
	NumValidators        int    `json:"validators"`          // Number of initial validators
	NumDeveloperAccounts int    `json:"developerAccounts"`   // Number of developers accounts
	UseValidatorAsAdmin  bool   `json:"useValidatorAsAdmin"` // Whether to use the first validator as the admin (for compatibility with monorepo)
}

AccountsConfig represents accounts configuration for the environment

func (*AccountsConfig) Account

func (ac *AccountsConfig) Account(accType AccountType, idx int) (*Account, error)

Account retrieves the account corresponding to the (accountType, idx)

func (*AccountsConfig) AdminAccount

func (ac *AccountsConfig) AdminAccount() *Account

AdminAccount returns the environment's admin account

func (*AccountsConfig) DeveloperAccounts

func (ac *AccountsConfig) DeveloperAccounts() []Account

DeveloperAccounts returns the environment's developers accounts

func (*AccountsConfig) TxFeeRecipientAccounts

func (ac *AccountsConfig) TxFeeRecipientAccounts() []Account

ValidatorAccounts returns the environment's validators accounts

func (*AccountsConfig) ValidatorAccounts

func (ac *AccountsConfig) ValidatorAccounts() []Account

ValidatorAccounts returns the environment's validators accounts

type Config

type Config struct {
	ChainID  *big.Int       `json:"chainId"`  // chainId identifies the current chain and is used for replay protection
	Accounts AccountsConfig `json:"accounts"` // Accounts configuration for the environment
}

Config represents marker environment parameters

type Environment

type Environment struct {
	Config Config
	// contains filtered or unexported fields
}

Environment represents a marker environment which is the home to any marker operation within a computer

func Load

func Load(envpath string) (*Environment, error)

Load will load an environment located in envpath folder

func New

func New(envpath string, cfg *Config) (*Environment, error)

New creates a new environment

func (*Environment) Accounts

func (env *Environment) Accounts() *AccountsConfig

Accounts retrieves accounts config

func (*Environment) GenesisPath

func (env *Environment) GenesisPath() string

GenesisPath returns the paths to the genesis.json file (if present on the environment)

func (*Environment) IPC

func (env *Environment) IPC() string

IPC returns the IPC path to the first validator

func (*Environment) Save

func (env *Environment) Save() error

Save will save environment's config into the environment folder

func (*Environment) SaveGenesis

func (env *Environment) SaveGenesis(genesis *chain.Genesis) error

SaveGenesis writes genesis.json within the env.json

func (*Environment) ValidatorDatadir

func (env *Environment) ValidatorDatadir(idx int) string

ValidatorDatadir returns the datadir that marker uses to run the validator-[idx]

func (*Environment) ValidatorIPC

func (env *Environment) ValidatorIPC(idx int) string

ValidatorIPC returns the ipc path to validator-[idx]

Jump to

Keyboard shortcuts

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