base

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 31 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 AddToVerificationBlacklist added in v0.1.7

func AddToVerificationBlacklist(c contracts.ContractType)

AddToVerificationBlacklist adds a contract to a verification blacklist for the remained of the process. this should be used sparingly or not at all. This only exists for USDT since it has no combined json owing to it coming from solidity 0.4.0

This method is not documented to discourage use.

func IsVerificationBlacklisted added in v0.1.7

func IsVerificationBlacklisted(c contracts.ContractType) bool

IsVerificationBlacklisted checks if a contract is blacklisted for verification.

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

func WalletToKey added in v0.1.7

func WalletToKey(tb testing.TB, wall wallet.Wallet) *keystore.Key

WalletToKey converts a wallet into a storable key TODO: test me

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) GetAccount added in v0.1.7

func (b *Backend) GetAccount(a common.Address) *keystore.Key

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) Store added in v0.1.7

func (b *Backend) Store(key *keystore.Key)

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
	ethereum.ChainStateReader
}

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.

type VerifiedContract added in v0.2.0

type VerifiedContract struct {
	contracts.ContractType
	contracts.DeployedContract
}

VerifiedContract is a contract that has been verified.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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