Documentation ¶
Index ¶
- func ImplAddressFor(name string) (common.Address, error)
- func Libraries() []string
- func LibraryAddressFor(name string) (common.Address, error)
- func MustImplAddressFor(name string) common.Address
- func MustLibraryAddressFor(name string) common.Address
- func MustNewMnemonic() string
- func MustProxyAddressFor(name string) common.Address
- func NewMnemonic() (string, error)
- func ProxyAddressFor(name string) (common.Address, error)
- type Account
- func DeriveAccount(mnemonic string, accountType AccountType, idx int) (*Account, error)
- func DeriveAccountList(mnemonic string, accountType AccountType, qty int) ([]Account, error)
- func GenerateRandomAccount() (Account, error)
- func MustGenerateRandomAccount() Account
- func NewAccount(key *ecdsa.PrivateKey) Account
- func (a *Account) BLSProofOfPossession() ([]byte, error)
- func (a *Account) BLSPublicKey() (blscrypto.SerializedPublicKey, error)
- func (a Account) MarshalJSON() ([]byte, error)
- func (a *Account) MustBLSProofOfPossession() []byte
- func (a *Account) PrivateKeyHex() string
- func (a *Account) PublicKey() []byte
- func (a *Account) String() string
- func (a *Account) UnmarshalJSON(b []byte) error
- type AccountType
- type AccountsConfig
- func (ac *AccountsConfig) Account(accType AccountType, idx int) (*Account, error)
- func (ac *AccountsConfig) AdminAccount() *Account
- func (ac *AccountsConfig) DeveloperAccounts() []Account
- func (ac *AccountsConfig) NumValidatorGroups() int
- func (ac *AccountsConfig) TxFeeRecipientAccounts() []Account
- func (ac *AccountsConfig) ValidatorAccounts() []Account
- func (ac *AccountsConfig) ValidatorGroupAccounts() []Account
- func (ac *AccountsConfig) ValidatorGroups() []ValidatorGroup
- type Config
- type Environment
- func (env *Environment) Accounts() *AccountsConfig
- func (env *Environment) GenesisPath() string
- func (env *Environment) IPC() string
- func (env *Environment) Save() error
- func (env *Environment) SaveGenesis(genesis *core.Genesis) error
- func (env *Environment) ValidatorDatadir(idx int) string
- func (env *Environment) ValidatorIPC(idx int) string
- type ValidatorGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImplAddressFor ¶
ImplAddressFor obtains the address for a core contract
func LibraryAddressFor ¶
LibraryAddressFor obtains the address for a core contract
func MustImplAddressFor ¶
MustImplAddressFor obtains the address for a core contract this variant panics on error
func MustLibraryAddressFor ¶
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 ¶
MustProxyAddressFor obtains the address for a core contract proxy this variant panics on error
Types ¶
type Account ¶
type Account struct { Address common.Address PrivateKey *ecdsa.PrivateKey }
Account represents a Celo 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 ¶
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) BLSProofOfPossession ¶
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 ¶
MarshalJSON implements json.Marshaler
func (*Account) MustBLSProofOfPossession ¶
MustBLSProofOfPossession variant of BLSProofOfPossession that panics on error
func (*Account) PrivateKeyHex ¶
PrivateKeyHex hex representation of the private key
func (*Account) UnmarshalJSON ¶
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 celotool (yet) AdminAT AccountType = 12 // Not in celotool (yet) TxFeeRecipientAT AccountType = 13 // Not in celotool (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 ValidatorsPerGroup int `json:"validatorsPerGroup"` // Number of validators per group in the initial set 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) NumValidatorGroups ¶
func (ac *AccountsConfig) NumValidatorGroups() int
NumValidatorGroups retrieves the number of validator groups for the genesis
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
func (*AccountsConfig) ValidatorGroupAccounts ¶
func (ac *AccountsConfig) ValidatorGroupAccounts() []Account
ValidatorGroupAccounts returns the environment's validators group accounts
func (*AccountsConfig) ValidatorGroups ¶
func (ac *AccountsConfig) ValidatorGroups() []ValidatorGroup
ValidatorGroups return the list of validator groups on genesis
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 mycelo environment parameters
type Environment ¶
type Environment struct { Config Config // contains filtered or unexported fields }
Environment represents a mycelo environment which is the home to any mycelo 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 *core.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 mycelo uses to run the validator-[idx]
func (*Environment) ValidatorIPC ¶
func (env *Environment) ValidatorIPC(idx int) string
ValidatorIPC returns the ipc path to validator-[idx]
type ValidatorGroup ¶
ValidatorGroup represents a group plus its validators members