Documentation
¶
Index ¶
- Variables
- func CalculateSelector(functionSignature string) [4]byte
- func CloneBigInt(original *big.Int) *big.Int
- func CloneBigInt2(original [2]*big.Int) [2]*big.Int
- func CloneBigInt4(original [4]*big.Int) [4]*big.Int
- func CloneBigIntSlice(original []*big.Int) []*big.Int
- func CloneSliceBigInt2(original [][2]*big.Int) [][2]*big.Int
- func SleepWithContext(ctx context.Context, delay time.Duration) error
- func SlowReturn(ctx context.Context, delay time.Duration, value bool) bool
- func StringToBytes32(str string) (b [32]byte)
- type Contracts
- type Ethereum
- type GethClient
- type Updater
Constants ¶
This section is empty.
Variables ¶
var ( ErrAccountNotFound = errors.New("could not find specified account") ErrKeysNotFound = errors.New("account either not found or not unlocked") ErrPasscodeNotFound = errors.New("could not find specified passcode") )
Ethereum specific errors
Functions ¶
func CalculateSelector ¶
CalculateSelector calculates the hash of the supplied function signature
func CloneBigInt ¶
CloneBigInt makes a deep copy of a big.Int
func CloneBigInt2 ¶
CloneBigInt2 makes a deep copy of an array [2] of big.Int's
func CloneBigInt4 ¶
CloneBigInt4 makes a deep copy of a array [4] of big.Int's
func CloneBigIntSlice ¶
CloneBigIntSlice makes a deep copy of a slice of big.Int's
func CloneSliceBigInt2 ¶
CloneSliceBigInt2 makes a deep copy of a slice of array [2] of big.Int's
func SleepWithContext ¶
SleepWithContext sleeps for a specified duration, unless the provided context completes earlier
func SlowReturn ¶
SlowReturn combines Sleep with returning specified bool value
func StringToBytes32 ¶
StringToBytes32 is useful for convert a Go string into a bytes32 useful calling Solidity
Types ¶
type Contracts ¶
type Contracts struct {
Crypto *bindings.Crypto
CryptoAddress common.Address
Deposit *bindings.Deposit
DepositAddress common.Address
Ethdkg *bindings.ETHDKG
EthdkgAddress common.Address
Participants *bindings.Participants
Registry *bindings.Registry
RegistryAddress common.Address
Snapshots *bindings.Snapshots
Staking *bindings.Staking
StakingToken *bindings.Token
StakingTokenAddress common.Address
UtilityToken *bindings.Token
UtilityTokenAddress common.Address
Validators *bindings.Validators
ValidatorsAddress common.Address
// contains filtered or unexported fields
}
Contracts contains bindings to smart contract system
type Ethereum ¶
type Ethereum interface {
// Extensions for use with simulator
Close() error
Commit()
IsEthereumAccessible() bool
GetCallOpts(context.Context, accounts.Account) *bind.CallOpts
GetTransactionOpts(context.Context, accounts.Account) (*bind.TransactOpts, error)
LoadAccounts(string)
LoadPasscodes(string) error
UnlockAccount(accounts.Account) error
TransferEther(common.Address, common.Address, *big.Int) error
GetAccount(common.Address) (accounts.Account, error)
GetAccountKeys(addr common.Address) (*keystore.Key, error)
GetBalance(common.Address) (*big.Int, error)
GetGethClient() GethClient
GetCoinbaseAddress() common.Address
GetCurrentHeight(context.Context) (uint64, error)
GetDefaultAccount() accounts.Account
GetEndpoint() string
GetEvents(ctx context.Context, firstBlock uint64, lastBlock uint64, addresses []common.Address) ([]types.Log, error)
GetFinalizedHeight(context.Context) (uint64, error)
GetPeerCount(context.Context) (uint64, error)
GetSnapshot() ([]byte, error)
GetSyncProgress() (bool, *geth.SyncProgress, error)
GetTimeoutContext() (context.Context, context.CancelFunc)
GetValidators() ([]common.Address, error)
WaitForReceipt(context.Context, *types.Transaction) (*types.Receipt, error)
RetryCount() int
RetryDelay() time.Duration
Timeout() time.Duration
Contracts() *Contracts
}
Ethereum contains state information about a connection to Ethereum
type GethClient ¶
type GethClient interface {
// geth.ChainReader
BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)
TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (geth.Subscription, error)
// geth.TransactionReader
TransactionByHash(ctx context.Context, txHash common.Hash) (tx *types.Transaction, isPending bool, err error)
TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
// geth.ChainStateReader
BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error)
CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
// bind.ContractBackend
// -- bind.ContractCaller
// CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)
CallContract(ctx context.Context, call geth.CallMsg, blockNumber *big.Int) ([]byte, error)
// -- bind.ContractTransactor
PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
SuggestGasPrice(ctx context.Context) (*big.Int, error)
EstimateGas(ctx context.Context, call geth.CallMsg) (gas uint64, err error)
SendTransaction(ctx context.Context, tx *types.Transaction) error
// -- bind.ContractFilterer
FilterLogs(ctx context.Context, query geth.FilterQuery) ([]types.Log, error)
SubscribeFilterLogs(ctx context.Context, query geth.FilterQuery, ch chan<- types.Log) (geth.Subscription, error)
}
GethClient is an amalgamation of the geth interfaces used