base

package
v0.0.131 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: MIT Imports: 30 Imported by: 3

Documentation

Overview

Package base contains a common interface to be used by multiple backends. This is kept in a separate package because of the overhead of different backends

Index

Constants

View Source
const (
	VeryLightScryptN = 2
	VeryLightScryptP = 1
)

see: https://git.io/JGsC1 taken from geth, used to speed up tests.

Variables

View Source
var EnableLocalDebug = os.Getenv("CI") == ""

EnableLocalDebug enables local tx debugging. It is exported so it can be disabled and disabled by default to speed up the ci. Note: there's currently a bug causing this to fail if tenderly is disabled.

Functions

func MockAccount added in v0.0.2

func MockAccount(t *testing.T) *keystore.Key

MockAccount creates a new mock account. TODO: dry this up w/ mocks.

func WaitForConfirmation

func WaitForConfirmation(ctx context.Context, client ConfirmationClient, transaction *types.Transaction, timeout time.Duration)

WaitForConfirmation is a helper that can be called by various inheriting funcs. it blocks until the transaction is confirmed. nolint: cyclop

Types

type Backend

type Backend struct {
	// chain is the chain to be used by the backend
	chain.Chain
	// Manager is the nonce manager
	nonce.Manager
	// contains filtered or unexported fields
}

Backend contains common functions across backends and can be used to extend a backend.

func NewBaseBackend

func NewBaseBackend(ctx context.Context, t *testing.T, chn chain.Chain) (*Backend, error)

NewBaseBackend creates a new base backend.

func (*Backend) Client

func (b *Backend) Client() client.EVMClient

Client fetches an eth client fro the backend.

func (*Backend) Context

func (b *Backend) Context() context.Context

Context gets the context from the backend.

func (*Backend) EnableTenderly

func (b *Backend) EnableTenderly() bool

EnableTenderly turns on tenderly on the full chain. Note: tenderly must be installed and you must be logged in.

func (*Backend) ImpersonateAccount added in v0.0.45

func (b *Backend) ImpersonateAccount(_ context.Context, _ common.Address, _ func(opts *bind.TransactOpts) *types.Transaction) error

ImpersonateAccount impersonates an account.

func (*Backend) MockAccount added in v0.0.2

func (b *Backend) MockAccount() *keystore.Key

MockAccount creates a new mock account.

func (*Backend) SetT

func (b *Backend) SetT(t *testing.T)

SetT sets the testing object.

func (*Backend) T

func (b *Backend) T() *testing.T

T returns the testing object.

func (*Backend) VerifyContract

func (b *Backend) VerifyContract(contractType contracts.ContractType, contract contracts.DeployedContract) (resError error)

VerifyContract calls the contract verification hook (e.g. tenderly).

func (*Backend) WaitForConfirmation

func (b *Backend) WaitForConfirmation(parentCtx context.Context, transaction *types.Transaction)

WaitForConfirmation waits for transaction confirmation. nolint: cyclop

type ConfirmationClient

type ConfirmationClient interface {
	ethereum.TransactionReader
	ethereum.TransactionSender
}

ConfirmationClient waits for confirmation.

type InMemoryKeyStore

type InMemoryKeyStore struct {
	// contains filtered or unexported fields
}

InMemoryKeyStore stores accounts.

func NewInMemoryKeyStore

func NewInMemoryKeyStore() *InMemoryKeyStore

NewInMemoryKeyStore exposes a key store.

func (*InMemoryKeyStore) GetAccount

func (i *InMemoryKeyStore) GetAccount(address common.Address) *keystore.Key

GetAccount gets an account from the in memory store. If no account is found, returns nil.

func (*InMemoryKeyStore) Store

func (i *InMemoryKeyStore) Store(key *keystore.Key)

Store stores an ccount.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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