ethereum

package
v0.0.0-...-2ac5be2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TransferLogTopic = strings.ToLower(
	"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
)

TransferLogTopic is the signature of token transfers

Functions

func BigIntFromHex

func BigIntFromHex(s string) (*misc.BigInt, error)

func BigIntFromUint64

func BigIntFromUint64(x uint64) (int *big.Int)

func BigPow

func BigPow(left *big.Rat, count int) *big.Rat

func CalculateEffectiveGasPrice

func CalculateEffectiveGasPrice(baseFeePerGas, maxFeePerGas, maxPriorityFeePerGas *big.Rat) *big.Rat

CalculateEffectiveGasPrice with baseFeePerGas + min(maxFeePerGas - baseFeePerGas, maxPriorityFeePerGas)

func CoerceBoundContractResultsToAddress

func CoerceBoundContractResultsToAddress(results []interface{}) (ethCommon.Address, error)

func CoerceBoundContractResultsToAddresses

func CoerceBoundContractResultsToAddresses(results []interface{}) ([]ethCommon.Address, error)

Wrap CoerceBoundContractResultsToRat to handle an array of results

func CoerceBoundContractResultsToBool

func CoerceBoundContractResultsToBool(results []interface{}) (bool, error)

func CoerceBoundContractResultsToBytes32

func CoerceBoundContractResultsToBytes32(results []interface{}) ([32]byte, error)

func CoerceBoundContractResultsToInt

func CoerceBoundContractResultsToInt(results []interface{}) (*big.Int, error)

func CoerceBoundContractResultsToInt32Pair

func CoerceBoundContractResultsToInt32Pair(results []interface{}) (int32, int32, error)

func CoerceBoundContractResultsToRat

func CoerceBoundContractResultsToRat(results []interface{}) (*big.Rat, error)

func CoerceBoundContractResultsToRats

func CoerceBoundContractResultsToRats(results []interface{}) ([]*big.Rat, error)

Wrap CoerceBoundContractResultsToRat to handle an array of results

func CoerceBoundContractResultsToUInt16

func CoerceBoundContractResultsToUInt16(results []interface{}) (uint16, error)

func CoerceBoundContractResultsToUint8

func CoerceBoundContractResultsToUint8(results []interface{}) (uint8, error)

func ConvertGethAddress

func ConvertGethAddress(address ethCommon.Address) ethereum.Address

ConvertGethAddress from the ethereum definition into its internal type equivalent

func ConvertGethHash

func ConvertGethHash(hash ethCommon.Hash) ethereum.Hash

ConvertGethHash from the ethereum definition into its internal type equivalent

func ConvertGethHeader

func ConvertGethHeader(oldHeader *ethTypes.Header) ethereum.BlockHeader

ConvertGethHeader from the ethereum definition into its internal type equivalent

func ConvertGethLog

func ConvertGethLog(log ethTypes.Log) ethereum.Log

ConvertGethLog from the ethereum definition into its internal type equivalent

func ConvertGethLogs

func ConvertGethLogs(logs []*ethTypes.Log) []ethereum.Log

ConvertGethLogs converts an array of geth logs to its internal type equivalent

func ConvertGethReceipt

func ConvertGethReceipt(receipt ethTypes.Receipt) ethereum.Receipt

func ConvertInternalAddress

func ConvertInternalAddress(address ethereum.Address) ethCommon.Address

ConvertInternalAddress from the internal definition into its geth type equivalent

func ConvertInternalHash

func ConvertInternalHash(hash ethereum.Hash) ethCommon.Hash

ConvertInternalHash from the internal definition into its geth type equivalent

func EstimateGas

func EstimateGas(client *ethclient.Client, contractAbi *abi.ABI, opts *ethAbiBind.TransactOpts, contractAddress *common.Address, method string, args ...interface{}) (uint64, error)

func GetApplicationTransfers

func GetApplicationTransfers(logs []ethereum.Log, transactions []ethereum.Transaction, blockHash ethereum.Hash, applicationContracts map[ethereum.Address]applications.Application) map[ethereum.Hash][]worker.EthereumApplicationTransfer

GetApplicationTransfers to use the passed function to classify individual logs and their respective transactions as generated by an application we support, to be processed later

func GetGasPriceTipHardhat

func GetGasPriceTipHardhat(ctx context.Context, client *ethclient.Client) (*big.Int, error)

GetGasPriceTipHardhat to accomodate hardhat's bug with the gas price

func GetReceipt

func GetReceipt(gethClient *ethClient.Client, transactionHash ethereum.Hash) (*ethereum.Receipt, error)

func GetTransfers

func GetTransfers(logs []ethereum.Log, transactions []ethereum.Transaction, blockHash ethereum.Hash, fluidContractAddress ethCommon.Address, utilities map[ethereum.Address]applications.UtilityName) []worker.EthereumDecoratedTransfer

Get transfer receipts

func IsTransferLogTopic

func IsTransferLogTopic(topic string) bool

IsTransferLogTopic returns whether given string matches signature of the fluid transfer ABI

func MakeTransaction

func MakeTransaction(contract *ethAbiBind.BoundContract, opts *ethAbiBind.TransactOpts, method string, args ...interface{}) (*ethTypes.Transaction, error)

Calls a method on a bound contract, first simulating it to see if it reverts

func NewTransactionOptions

func NewTransactionOptions(client *ethclient.Client, privateKey *ecdsa.PrivateKey) (*ethAbiBind.TransactOpts, error)

NewTransactionOptions created using the user's private key, figuring out the chain id using the client.

func StaticCall

func StaticCall(client *ethClient.Client, address ethCommon.Address, abi ethAbi.ABI, method string, args ...interface{}) ([]interface{}, error)

func UpdateGasAmounts

func UpdateGasAmounts(ctx context.Context, client *ethclient.Client, options *ethAbiBind.TransactOpts) error

UpdateGasAmounts by suggesting the gas tip cap then setting the gas limit to a fixed amount

func UpdateValue

func UpdateValue(options *ethAbiBind.TransactOpts)

UpdateValue sets the Value field in the transaction options to 0

Types

type TokenDetailsEthereum

type TokenDetailsEthereum struct {
	FluidAddress  ethCommon.Address
	TokenName     string
	TokenDecimals *big.Rat
	Amount        float64

	// address is the optional parameter for the underlying token address
	// (required for AAVE lookup) OR the flux oracle address (for Aurora)
	Address ethCommon.Address

	Backend string
}

TokenDetailsEthereum containing information about tokens that we unpacked using the environment variables

func GetTokensListEthereum

func GetTokensListEthereum(tokensList_ string) []TokenDetailsEthereum

GetTokensListEthereum to parse a string list into separated token information

Jump to

Keyboard shortcuts

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