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
- Variables
- func AddToVerificationBlacklist(c contracts.ContractType)
- func IsVerificationBlacklisted(c contracts.ContractType) bool
- func MockAccount(t *testing.T) *keystore.Key
- func WaitForConfirmation(ctx context.Context, client ConfirmationClient, transaction *types.Transaction, ...)
- func WalletToKey(tb testing.TB, wall wallet.Wallet) *keystore.Key
- type Backend
- func (b *Backend) Client() client.EVMClient
- func (b *Backend) Context() context.Context
- func (b *Backend) GetAccount(a common.Address) *keystore.Key
- func (b *Backend) ImpersonateAccount(_ context.Context, _ common.Address, ...) error
- func (b *Backend) MockAccount() *keystore.Key
- func (b *Backend) SetT(t *testing.T)
- func (b *Backend) Store(key *keystore.Key)
- func (b *Backend) T() *testing.T
- func (b *Backend) VerifyContract(contractType contracts.ContractType, contract contracts.DeployedContract) (resError error)
- func (b *Backend) WaitForConfirmation(parentCtx context.Context, transaction *types.Transaction)
- type ConfirmationClient
- type InMemoryKeyStore
Constants ¶
const ( VeryLightScryptN = 2 VeryLightScryptP = 1 )
see: https://git.io/JGsC1 taken from geth, used to speed up tests.
Variables ¶
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
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 ¶
NewBaseBackend creates a new base backend.
func (*Backend) GetAccount ¶ added in v0.1.7
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
MockAccount creates a new mock account.
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.