balance

package
v0.175.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheIface

type CacheIface interface {
	GetBalance(account common.Address, chainID uint64, blockNumber *big.Int) *big.Int
	GetNonce(account common.Address, chainID uint64, blockNumber *big.Int) *int64
	AddBalance(account common.Address, chainID uint64, blockNumber *big.Int, balance *big.Int)
	AddNonce(account common.Address, chainID uint64, blockNumber *big.Int, nonce *int64)
	BalanceSize(account common.Address, chainID uint64) int
	NonceSize(account common.Address, chainID uint64) int
	Clear()
}

Interface for cache of balances.

type Cacher

type Cacher interface {
	BalanceAt(ctx context.Context, client Reader, account common.Address, blockNumber *big.Int) (*big.Int, error)
	NonceAt(ctx context.Context, client Reader, account common.Address, blockNumber *big.Int) (*int64, error)
	Clear()
	Cache() CacheIface
}

Cacher interface for caching balance to BalanceCache. Requires BalanceReader to fetch balance.

func NewCacherWithTTL added in v0.168.1

func NewCacherWithTTL(ttl time.Duration) Cacher

func NewSimpleCacher added in v0.168.1

func NewSimpleCacher() Cacher

type Reader

type Reader interface {
	BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
	NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
	HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
	FullTransactionByBlockNumberAndIndex(ctx context.Context, blockNumber *big.Int, index uint) (*chain.FullTransaction, error)
	NetworkID() uint64
}

Reader interface for reading balance at a specified address.

type TestCacher added in v0.172.10

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

func (*TestCacher) BalanceAt added in v0.172.10

func (b *TestCacher) BalanceAt(ctx context.Context, client Reader, account common.Address, blockNumber *big.Int) (*big.Int, error)

func (*TestCacher) Cache added in v0.172.10

func (b *TestCacher) Cache() CacheIface

func (*TestCacher) Clear added in v0.172.10

func (b *TestCacher) Clear()

func (*TestCacher) NonceAt added in v0.172.10

func (b *TestCacher) NonceAt(ctx context.Context, client Reader, account common.Address, blockNumber *big.Int) (*int64, error)

Jump to

Keyboard shortcuts

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