Documentation
¶
Index ¶
- Constants
- func EstimateSendTransactionGas(client rocketpool.ExecutionClient, toAddress common.Address, data []byte, ...) (rocketpool.GasInfo, error)
- func EthToWei(eth float64) *big.Int
- func EthToWeiWithDecimals(amountRaw float64, decimals uint8) *big.Int
- func FilterContractLogs(rp *rocketpool.RocketPool, contractName string, q FilterQuery, ...) ([]types.Log, error)
- func GetLogs(rp *rocketpool.RocketPool, addressFilter []common.Address, ...) ([]types.Log, error)
- func GweiToWei(gwei float64) *big.Int
- func SendTransaction(client rocketpool.ExecutionClient, toAddress common.Address, chainID *big.Int, ...) (common.Hash, error)
- func WeiToEth(wei *big.Int) float64
- func WeiToEthWithDecimals(amount *big.Int, decimals uint8) float64
- func WeiToGwei(wei *big.Int) float64
- type Erc20Contract
- func (c *Erc20Contract) BalanceOf(address common.Address, opts *bind.CallOpts) (*big.Int, error)
- func (c *Erc20Contract) EstimateTransferGas(to common.Address, amount *big.Int, opts *bind.TransactOpts) (rocketpool.GasInfo, error)
- func (c *Erc20Contract) GetDecimals(opts *bind.CallOpts) (uint8, error)
- func (c *Erc20Contract) GetName(opts *bind.CallOpts) (string, error)
- func (c *Erc20Contract) GetSymbol(opts *bind.CallOpts) (string, error)
- func (c *Erc20Contract) Transfer(to common.Address, amount *big.Int, opts *bind.TransactOpts) (*types.Transaction, error)
- type FilterQuery
Constants ¶
View Source
const ( WeiPerEth float64 = 1e18 WeiPerGwei float64 = 1e9 )
Conversion factors
View Source
const (
Erc20AbiString string = `` /* 1089-byte string literal not displayed */
)
Variables ¶
This section is empty.
Functions ¶
func EstimateSendTransactionGas ¶
func EstimateSendTransactionGas(client rocketpool.ExecutionClient, toAddress common.Address, data []byte, useSafeGasLimit bool, opts *bind.TransactOpts) (rocketpool.GasInfo, error)
Estimate the gas of SendTransaction
func EthToWeiWithDecimals ¶
Converts float amount to big.Int considering a token's decimals
func FilterContractLogs ¶
func FilterContractLogs(rp *rocketpool.RocketPool, contractName string, q FilterQuery, intervalSize *big.Int, opts *bind.CallOpts) ([]types.Log, error)
func GetLogs ¶
func GetLogs(rp *rocketpool.RocketPool, addressFilter []common.Address, topicFilter [][]common.Hash, intervalSize, fromBlock, toBlock *big.Int, blockHash *common.Hash) ([]types.Log, error)
Gets the logs for a particular log request, breaking the calls into batches if necessary
func SendTransaction ¶
func SendTransaction(client rocketpool.ExecutionClient, toAddress common.Address, chainID *big.Int, data []byte, useSafeGasLimit bool, opts *bind.TransactOpts) (common.Hash, error)
Send a transaction to an address useSafeGasLimit will amplify the estimated gas limit to by 50% for safety (no effect if the gas limit in opts is already set).
func WeiToEthWithDecimals ¶
Converts big.Int to float64 considering a token's decimals
Types ¶
type Erc20Contract ¶
type Erc20Contract struct {
Name string
Symbol string
Decimals uint8
// contains filtered or unexported fields
}
func NewErc20Contract ¶
func NewErc20Contract(address common.Address, client rocketpool.ExecutionClient, opts *bind.CallOpts) (*Erc20Contract, error)
Creates a contract wrapper for the ERC20 at the given address
func (*Erc20Contract) EstimateTransferGas ¶
func (c *Erc20Contract) EstimateTransferGas(to common.Address, amount *big.Int, opts *bind.TransactOpts) (rocketpool.GasInfo, error)
Estimate the gas for transferring an ERC20 to another address
func (*Erc20Contract) GetDecimals ¶
func (c *Erc20Contract) GetDecimals(opts *bind.CallOpts) (uint8, error)
Get the token decimals
func (*Erc20Contract) GetName ¶
func (c *Erc20Contract) GetName(opts *bind.CallOpts) (string, error)
Get the token name
func (*Erc20Contract) GetSymbol ¶
func (c *Erc20Contract) GetSymbol(opts *bind.CallOpts) (string, error)
Get the token symbol
func (*Erc20Contract) Transfer ¶
func (c *Erc20Contract) Transfer(to common.Address, amount *big.Int, opts *bind.TransactOpts) (*types.Transaction, error)
Transfer an ERC20 to another address
Click to show internal directories.
Click to hide internal directories.