utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultGasLimit = 6721975
View Source
const DefaultMaxGasPrice = 20000000000

Variables

View Source
var (
	RelayerAddresses = []common.Address{
		common.HexToAddress(keystore.TestKeyRing.EthereumKeys[keystore.AliceKey].Address()),
		common.HexToAddress(keystore.TestKeyRing.EthereumKeys[keystore.BobKey].Address()),
		common.HexToAddress(keystore.TestKeyRing.EthereumKeys[keystore.CharlieKey].Address()),
		common.HexToAddress(keystore.TestKeyRing.EthereumKeys[keystore.DaveKey].Address()),
		common.HexToAddress(keystore.TestKeyRing.EthereumKeys[keystore.EveKey].Address()),
	}

	ZeroAddress = common.HexToAddress("0x0000000000000000000000000000000000000000")
)
View Source
var ExpectedBlockTime = time.Second

Functions

func AddRelayer

func AddRelayer(client *Client, bridge, relayer common.Address) error

func ConstructErc20DepositData

func ConstructErc20DepositData(destRecipient []byte, amount *big.Int) []byte

func CreateErc20Deposit

func CreateErc20Deposit(client *Client, bridge common.Address, destId msg.ChainId, recipient []byte, amount *big.Int, rId msg.ResourceId) error

func Erc20AddMinter

func Erc20AddMinter(client *Client, erc20Contract, handler common.Address) error

func Erc20Approve

func Erc20Approve(client *Client, erc20Contract, recipient common.Address, amount *big.Int) error

func Erc20GetAllowance

func Erc20GetAllowance(client *Client, erc20Contract, owner, spender common.Address) (*big.Int, error)

func Erc20GetBalance

func Erc20GetBalance(client *Client, erc20Contract, account common.Address) (*big.Int, error)

func Erc20GetResourceId

func Erc20GetResourceId(client *Client, handler common.Address, rId msg.ResourceId) (common.Address, error)

func GetDepositNonce

func GetDepositNonce(client *Client, bridge common.Address, chain msg.ChainId) (uint64, error)

func Hash

func Hash(data []byte) [32]byte

func IDAndNonce

func IDAndNonce(srcId msg.ChainId, nonce msg.Nonce) *big.Int

func SetResourceAndBurnable

func SetResourceAndBurnable(client *Client, bridge, handler common.Address, rIds [][32]byte, tokenContractAddresses, burnablTokenContractAddresses []common.Address) error

func UpdateNonce

func UpdateNonce(client *Client) error

func WaitForTx

func WaitForTx(client *Client, tx *ethtypes.Transaction) error

WaitForTx will query the chain at ExpectedBlockTime intervals, until a receipt is returned. Returns an error if the tx failed.

Types

type Client

type Client struct {
	Client   *ethclient.Client
	Opts     *bind.TransactOpts
	CallOpts *bind.CallOpts
	// contains filtered or unexported fields
}

func NewClient

func NewClient(endpoint string, kp *secp256k1.Keypair) (*Client, error)

func (*Client) LockNonceAndUpdate

func (c *Client) LockNonceAndUpdate() error

func (*Client) UnlockNonce

func (c *Client) UnlockNonce()

type DeployedContracts

type DeployedContracts struct {
	BridgeAddress       common.Address
	ERC20HandlerAddress common.Address
}

type EventSig

type EventSig string
const (
	Deposit EventSig = "Deposit(uint8,bytes32,uint64)"
)

func (EventSig) GetTopic

func (es EventSig) GetTopic() common.Hash

type ProposalStatus

type ProposalStatus int
const (
	Inactive ProposalStatus = iota
	Active
	Executed
	Cancelled
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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