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
func DecodeAbi(abiEncoded string) (*abi.ABI, error)
Decode, decompress and parse a zlib-compressed, base64-encoded ABI
func EncodeAbiStr
func EncodeAbiStr(abiStr string) (string, error)
zlib-compress and base64-encode an ABI JSON string
type Contract
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
func (c *Contract) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error
Call a contract method
func (*Contract) GetTransactionEvents
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
func (c *Contract) GetTransactionGasInfo(opts *bind.TransactOpts, method string, params ...interface{}) (GasInfo, error)
Get Gas Price and Gas Limit for transaction
func (*Contract) GetTransferGasInfo
func (c *Contract) GetTransferGasInfo(opts *bind.TransactOpts) (GasInfo, error)
Get gas price and gas limit for a transfer call
func (*Contract) Transact
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
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
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
type RocketPool struct {
Client *ethclient.Client
RocketStorage *contracts.RocketStorage
RocketStorageContract *Contract
// contains filtered or unexported fields
}
func NewRocketPool
func NewRocketPool(client *ethclient.Client, rocketStorageAddress common.Address) (*RocketPool, error)
Create new contract manager
func (*RocketPool) GetABI
func (rp *RocketPool) GetABI(contractName string) (*abi.ABI, error)
Load Rocket Pool contract ABIs
func (*RocketPool) GetABIs
func (rp *RocketPool) GetABIs(contractNames ...string) ([]*abi.ABI, error)
func (*RocketPool) GetAddress
func (rp *RocketPool) GetAddress(contractName string) (*common.Address, error)
Load Rocket Pool contract addresses
func (*RocketPool) GetAddresses
func (rp *RocketPool) GetAddresses(contractNames ...string) ([]*common.Address, error)
func (*RocketPool) GetContract
func (rp *RocketPool) GetContract(contractName string) (*Contract, error)
Load Rocket Pool contracts
func (*RocketPool) GetContracts
func (rp *RocketPool) GetContracts(contractNames ...string) ([]*Contract, error)
func (*RocketPool) MakeContract
func (rp *RocketPool) MakeContract(contractName string, address common.Address) (*Contract, error)
Create a Rocket Pool contract instance