ethereum

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultGasLimit = 10e5
	DefaultGasPrice = 300e9

	EthChainId = msg.ChainId(2)
)

Variables

View Source
var (
	BlockRetryInterval = time.Second * 5
)
View Source
var ZeroAddress = common.HexToAddress("0x0000000000000000000000000000000000000000")

Functions

This section is empty.

Types

type Config

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

Config encapsulates all necessary parameters in ethereum compatible forms

func ParseChainConfig

func ParseChainConfig(chainCfg *core.ChainConfig) (*Config, error)

parseChainConfig uses a core.ChainConfig to construct a corresponding Config

func (*Config) BlockstorePath

func (c *Config) BlockstorePath() string

func (*Config) BridgeContract

func (c *Config) BridgeContract() common.Address

func (*Config) ChainId

func (c *Config) ChainId() msg.ChainId

func (*Config) Erc20HandlerContract

func (c *Config) Erc20HandlerContract() common.Address

func (*Config) FreshStart

func (c *Config) FreshStart() bool

func (*Config) From

func (c *Config) From() string

func (*Config) KeystorePath

func (c *Config) KeystorePath() string

func (*Config) SetStartBlock

func (c *Config) SetStartBlock(blk *big.Int)

func (*Config) StartBlock

func (c *Config) StartBlock() *big.Int

type Connection

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

func NewConnection

func NewConnection(cfg *Config, kp *secp256k1.Keypair, log log15.Logger) *Connection

NewConnection returns an uninitialized connection, must call Connection.Connect() before using.

func (*Connection) CallOpts

func (c *Connection) CallOpts() *bind.CallOpts

func (*Connection) Client

func (c *Connection) Client() *ethclient.Client

func (*Connection) Close

func (c *Connection) Close()

Close terminates the client connection and stops any running routines

func (*Connection) Connect

func (c *Connection) Connect() error

Connect starts the ethereum WS connection

func (*Connection) EnsureHasBytecode

func (c *Connection) EnsureHasBytecode(addr ethcommon.Address) error

EnsureHasBytecode asserts if contract code exists at the specified address

func (*Connection) Keypair

func (c *Connection) Keypair() *secp256k1.Keypair

func (*Connection) LatestBlock

func (c *Connection) LatestBlock() (*big.Int, error)

LatestBlock returns the latest block from the current chain

func (*Connection) LockAndUpdateOpts

func (c *Connection) LockAndUpdateOpts() error

LockAndUpdateOpts acquires a lock on the opts before updating the nonce and gas price.

func (*Connection) Opts

func (c *Connection) Opts() *bind.TransactOpts

func (*Connection) SafeEstimateGas

func (c *Connection) SafeEstimateGas(ctx context.Context) (*big.Int, error)

func (*Connection) UnlockOpts

func (c *Connection) UnlockOpts()

func (*Connection) WaitForBlock

func (c *Connection) WaitForBlock(block *big.Int) error

WaitForBlock will poll for the block number until the current block is equal or greater than

type GasRes

type GasRes struct {
	Status  string `json:"status"`
	Message string `json:"message"`
	Result  struct {
		LastBlock       string `json:"LastBlock"`
		SafeGasPrice    string `json:"SafeGasPrice"`
		ProposeGasPrice string `json:"ProposeGasPrice"`
		FastGasPrice    string `json:"FastGasPrice"`
	} `json:"result"`
}

Jump to

Keyboard shortcuts

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