ethereum_gravity

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GasLimit uint64 = 7000000
)

Variables

This section is empty.

Functions

func ApproveErc20Transfer

func ApproveErc20Transfer(erc20, gravityContract string, privKey *ecdsa.PrivateKey, client *jsonrpc.Client) (*web3.Hash, error)

func CheckErc20Approved

func CheckErc20Approved(erc20, ownAddress, targetContract string, client *jsonrpc.Client) (bool, error)

func CheckForEvents

func CheckForEvents(startBlock, endBlock uint64, contractAddr []string, events []string, client *jsonrpc.Client) ([]*web3.Log, error)

func DeployErc20

func DeployErc20(
	cosmosDenom,
	erc20Name,
	erc20Symbol string,
	decimals uint8,
	gravityContract common.Address,
	client *jsonrpc.Client,
	waitTimeout time.Duration,
	senderSecret *ecdsa.PrivateKey,
) (*web3.Hash, error)

func GetEventNonce

func GetEventNonce(contractAddr string, ourEthereumAddress common.Address, client *jsonrpc.Client) (uint64, error)

func GetGravityId

func GetGravityId(contractAddr string, ourEthereumAddress common.Address, client *jsonrpc.Client) ([]byte, error)

func GetTxBatchNonce

func GetTxBatchNonce(contractAddr string, erc20Addr, ourEthereumAddress common.Address, client *jsonrpc.Client) (uint64, error)

func GetValSetNonce

func GetValSetNonce(contractAddr string, ourEthereumAddress common.Address, client *jsonrpc.Client) (uint64, error)

func SendEthTransactionBatch

func SendEthTransactionBatch(
	currentValset types.ValSet,
	batch types.TransactionBatch,
	confirms []types.BatchConfirmResponse,
	client *jsonrpc.Client,
	timeout time.Duration,
	gravityContractAddr string,
	gravityId string,
	EthKey *ecdsa.PrivateKey,
) error

func SendEthValsetUpdate

func SendEthValsetUpdate(
	newValset,
	oldValset types.ValSet,
	confirms []types.ValsetConfirmResponse,
	client *jsonrpc.Client,
	timeout time.Duration,
	gravityContractAddr string,
	gravityId string,
	ethKey *ecdsa.PrivateKey,
) error

func SendToCosmos

func SendToCosmos(erc20, gravityContract string,
	amount *big.Int,
	cosmosDestination common.Address,
	senderSecret *ecdsa.PrivateKey,
	waitTimeout time.Duration,
	client *jsonrpc.Client,
) (*web3.Hash, error)

func SendTransaction

func SendTransaction(
	client *jsonrpc.Client,
	toAddress string,
	data []byte,
	value *big.Int,
	ownAddress string,
	secret *ecdsa.PrivateKey,
) (*web3.Hash, error)

func WaitForEvent

func WaitForEvent(timeout time.Duration, contractAddress, event string, topics []*web3.Hash, client *jsonrpc.Client) ([]*web3.Log, error)

func WaitForTransaction

func WaitForTransaction(client *jsonrpc.Client, hash *web3.Hash, timeout time.Duration, blocksToWait *big.Int) (*web3.Transaction, error)

Types

type GasCost

type GasCost struct {
	Gas      *big.Int
	GasPrice *big.Int
}

func EstimateValsetCost

func EstimateValsetCost(
	latestCosmosValset,
	currentValSet types.ValSet,
	latestCosmosConfirmed []types.ValsetConfirmResponse,
	client *jsonrpc.Client,
	contractAddr,
	gravityId string,
	ethKey *ecdsa.PrivateKey,
) (GasCost, error)

func (GasCost) GetTotal

func (gc GasCost) GetTotal() *big.Int

Jump to

Keyboard shortcuts

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