# rocketpool
import "github.com/rocket-pool/rocketpool-go/rocketpool"
# Index
- Constants
- func DecodeAbi(abiEncoded string) (*abi.ABI, error)
- func EncodeAbiStr(abiStr string) (string, error)
- type Contract
- func (c *Contract) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error
- func (c *Contract) GetTransactionEvents(txReceipt *types.Receipt, eventName string, eventPrototype interface{}) ([]interface{}, error)
- func (c *Contract) GetTransactionGasInfo(opts *bind.TransactOpts, method string, params ...interface{}) (GasInfo, error)
- func (c *Contract) GetTransferGasInfo(opts *bind.TransactOpts) (GasInfo, error)
- func (c *Contract) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (common.Hash, error)
- func (c *Contract) Transfer(opts *bind.TransactOpts) (common.Hash, error)
- type GasInfo
- type RocketPool
- func NewRocketPool(client *ethclient.Client, rocketStorageAddress common.Address) (*RocketPool, error)
- func (rp *RocketPool) GetABI(contractName string) (*abi.ABI, error)
- func (rp *RocketPool) GetABIs(contractNames ...string) ([]*abi.ABI, error)
- func (rp *RocketPool) GetAddress(contractName string) (*common.Address, error)
- func (rp *RocketPool) GetAddresses(contractNames ...string) ([]*common.Address, error)
- func (rp *RocketPool) GetContract(contractName string) (*Contract, error)
- func (rp *RocketPool) GetContracts(contractNames ...string) ([]*Contract, error)
- func (rp *RocketPool) MakeContract(contractName string, address common.Address) (*Contract, error)
# Constants
Transaction settings
const (
GasLimitMultiplier float64 = 1.5
MaxGasLimit = 12000000
)
Cache settings
const CacheTTL = 300 // 5 minutes
# func DecodeAbi (opens new window)
func DecodeAbi(abiEncoded string) (*abi.ABI, error)
Decode, decompress and parse a zlib-compressed, base64-encoded ABI
# func EncodeAbiStr (opens new window)
func EncodeAbiStr(abiStr string) (string, error)
zlib-compress and base64-encode an ABI JSON string
# type Contract (opens new window)
Contract type wraps go-ethereum bound contract
type Contract struct {
Contract *bind.BoundContract
Address *common.Address
ABI *abi.ABI
Client *ethclient.Client
}
# func (*Contract) Call (opens new window)
func (c *Contract) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error
Call a contract method
# func (*Contract) GetTransactionEvents (opens new window)
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 (opens new window)
func (c *Contract) GetTransactionGasInfo(opts *bind.TransactOpts, method string, params ...interface{}) (GasInfo, error)
Get Gas Price and Gas Limit for transaction
# func (*Contract) GetTransferGasInfo (opens new window)
func (c *Contract) GetTransferGasInfo(opts *bind.TransactOpts) (GasInfo, error)
Get gas price and gas limit for a transfer call
# func (*Contract) Transact (opens new window)
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 (opens new window)
func (c *Contract) Transfer(opts *bind.TransactOpts) (common.Hash, error)
Transfer ETH to a contract and wait for a receipt
# type GasInfo (opens new window)
Response for gas prices and limits from network and from user request
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 (opens new window)
Rocket Pool contract manager
type RocketPool struct {
Client *ethclient.Client
RocketStorage *contracts.RocketStorage
RocketStorageContract *Contract
// contains filtered or unexported fields
}
# func NewRocketPool (opens new window)
func NewRocketPool(client *ethclient.Client, rocketStorageAddress common.Address) (*RocketPool, error)
Create new contract manager
# func (*RocketPool) GetABI (opens new window)
func (rp *RocketPool) GetABI(contractName string) (*abi.ABI, error)
Load Rocket Pool contract ABIs
# func (*RocketPool) GetABIs (opens new window)
func (rp *RocketPool) GetABIs(contractNames ...string) ([]*abi.ABI, error)
# func (*RocketPool) GetAddress (opens new window)
func (rp *RocketPool) GetAddress(contractName string) (*common.Address, error)
Load Rocket Pool contract addresses
# func (*RocketPool) GetAddresses (opens new window)
func (rp *RocketPool) GetAddresses(contractNames ...string) ([]*common.Address, error)
# func (*RocketPool) GetContract (opens new window)
func (rp *RocketPool) GetContract(contractName string) (*Contract, error)
Load Rocket Pool contracts
# func (*RocketPool) GetContracts (opens new window)
func (rp *RocketPool) GetContracts(contractNames ...string) ([]*Contract, error)
# func (*RocketPool) MakeContract (opens new window)
func (rp *RocketPool) MakeContract(contractName string, address common.Address) (*Contract, error)
Create a Rocket Pool contract instance