Skip to content

rocketpool

go
import "github.com/rocket-pool/rocketpool-go/rocketpool"

Index

Constants

Transaction settings

go
const (
    GasLimitMultiplier float64 = 1.5
    MaxGasLimit                = 12000000
)

Cache settings

go
const CacheTTL = 300 // 5 minutes

func DecodeAbi

go
func DecodeAbi(abiEncoded string) (*abi.ABI, error)

Decode, decompress and parse a zlib-compressed, base64-encoded ABI

func EncodeAbiStr

go
func EncodeAbiStr(abiStr string) (string, error)

zlib-compress and base64-encode an ABI JSON string

type Contract

Contract type wraps go-ethereum bound contract

go
type Contract struct {
    Contract *bind.BoundContract
    Address  *common.Address
    ABI      *abi.ABI
    Client   *ethclient.Client
}

func (*Contract) Call

go
func (c *Contract) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error

Call a contract method

func (*Contract) GetTransactionEvents

go
func (c *Contract) GetTransactionEvents(txReceipt *types.Receipt, eventName string, eventPrototype interface{}) ([]interface{}, error)

Get contract events from a transaction eventPrototype must be an event struct type Returns a slice of untyped values; assert returned events to event struct type

func (*Contract) GetTransactionGasInfo

go
func (c *Contract) GetTransactionGasInfo(opts *bind.TransactOpts, method string, params ...interface{}) (GasInfo, error)

Get Gas Price and Gas Limit for transaction

func (*Contract) GetTransferGasInfo

go
func (c *Contract) GetTransferGasInfo(opts *bind.TransactOpts) (GasInfo, error)

Get gas price and gas limit for a transfer call

func (*Contract) Transact

go
func (c *Contract) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (common.Hash, error)

Transact on a contract method and wait for a receipt

func (*Contract) Transfer

go
func (c *Contract) Transfer(opts *bind.TransactOpts) (common.Hash, error)

Transfer ETH to a contract and wait for a receipt

type GasInfo

Response for gas prices and limits from network and from user request

go
type GasInfo struct {
    EstGasPrice  *big.Int `json:"estGasPrice"`
    EstGasLimit  uint64   `json:"estGasLimit"`
    SafeGasLimit uint64   `json:"safeGasLimit"`
    ReqGasPrice  *big.Int `json:"reqGasPrice"`
    ReqGasLimit  uint64   `json:"reqGasLimit"`
}

type RocketPool

Rocket Pool contract manager

go
type RocketPool struct {
    Client                *ethclient.Client
    RocketStorage         *contracts.RocketStorage
    RocketStorageContract *Contract
    // contains filtered or unexported fields
}

func NewRocketPool

go
func NewRocketPool(client *ethclient.Client, rocketStorageAddress common.Address) (*RocketPool, error)

Create new contract manager

func (*RocketPool) GetABI

go
func (rp *RocketPool) GetABI(contractName string) (*abi.ABI, error)

Load Rocket Pool contract ABIs

func (*RocketPool) GetABIs

go
func (rp *RocketPool) GetABIs(contractNames ...string) ([]*abi.ABI, error)

func (*RocketPool) GetAddress

go
func (rp *RocketPool) GetAddress(contractName string) (*common.Address, error)

Load Rocket Pool contract addresses

func (*RocketPool) GetAddresses

go
func (rp *RocketPool) GetAddresses(contractNames ...string) ([]*common.Address, error)

func (*RocketPool) GetContract

go
func (rp *RocketPool) GetContract(contractName string) (*Contract, error)

Load Rocket Pool contracts

func (*RocketPool) GetContracts

go
func (rp *RocketPool) GetContracts(contractNames ...string) ([]*Contract, error)

func (*RocketPool) MakeContract

go
func (rp *RocketPool) MakeContract(contractName string, address common.Address) (*Contract, error)

Create a Rocket Pool contract instance