peggy

package
v1.38.2 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ValsetCheckpointABIJSON checks the ETH ABI for compatability of the Valset update message
	ValsetCheckpointABIJSON = `` /* 747-byte string literal not displayed */

	OutgoingBatchTxConfirmABIJSON = `` /* 863-byte string literal not displayed */

)

Variables

View Source
var ErrInsufficientVotingPowerToPass = errors.New("insufficient voting power")

Functions

func EncodeTxBatchConfirm

func EncodeTxBatchConfirm(peggyID common.Hash, batch *types.OutgoingTxBatch) common.Hash

EncodeTxBatchConfirm takes the required input data and produces the required signature to confirm a transaction batch on the Peggy Ethereum contract. This value will then be signed before being submitted to Cosmos, verified, and then relayed to Ethereum

func EncodeValsetConfirm

func EncodeValsetConfirm(peggyID common.Hash, valset *types.Valset) common.Hash

/ EncodeValsetConfirm takes the required input data and produces the required signature to confirm a validator / set update on the Peggy Ethereum contract. This value will then be signed before being / submitted to Cosmos, verified, and then relayed to Ethereum

func IsBatchOrValsetUpdateTx added in v1.9.0

func IsBatchOrValsetUpdateTx(inputData hexutil.Bytes) bool

Types

type PeggyContract

type PeggyContract interface {
	committer.EVMCommitter

	Address() common.Address

	SendToCosmos(
		ctx context.Context,
		erc20 common.Address,
		amount *big.Int,
		cosmosAccAddress sdk.AccAddress,
		senderAddress common.Address,
	) (*common.Hash, error)

	SendTransactionBatch(
		ctx context.Context,
		currentValset *types.Valset,
		batch *types.OutgoingTxBatch,
		confirms []*types.MsgConfirmBatch,
	) (*common.Hash, error)

	SendEthValsetUpdate(
		ctx context.Context,
		oldValset *types.Valset,
		newValset *types.Valset,
		confirms []*types.MsgValsetConfirm,
	) (*common.Hash, error)

	GetTxBatchNonce(
		ctx context.Context,
		erc20ContractAddress common.Address,
		callerAddress common.Address,
	) (*big.Int, error)

	GetValsetNonce(
		ctx context.Context,
		callerAddress common.Address,
	) (*big.Int, error)

	GetPeggyID(
		ctx context.Context,
		callerAddress common.Address,
	) (common.Hash, error)

	GetERC20Symbol(
		ctx context.Context,
		erc20ContractAddress common.Address,
		callerAddress common.Address,
	) (symbol string, err error)

	SubscribeToPendingTxs(
		alchemyWebsocketURL string)
}

func NewPeggyContract

func NewPeggyContract(
	ethCommitter committer.EVMCommitter,
	peggyAddress common.Address,
	pendingTxInputList PendingTxInputList,
	pendingTxWaitDuration time.Duration,
) (PeggyContract, error)

type PendingTxInput added in v1.9.0

type PendingTxInput struct {
	InputData    hexutil.Bytes
	ReceivedTime time.Time
}

type PendingTxInputList added in v1.9.0

type PendingTxInputList []PendingTxInput

func (*PendingTxInputList) AddPendingTxInput added in v1.9.0

func (p *PendingTxInputList) AddPendingTxInput(pendingTx *RPCTransaction)

func (PendingTxInputList) IsPendingTxInput added in v1.9.0

func (p PendingTxInputList) IsPendingTxInput(txInput []byte, pendingTxWaitDuration time.Duration) bool

type RPCTransaction added in v1.9.0

type RPCTransaction struct {
	BlockHash        *common.Hash         `json:"blockHash"`
	BlockNumber      *hexutil.Big         `json:"blockNumber"`
	From             common.Address       `json:"from"`
	Gas              hexutil.Uint64       `json:"gas"`
	GasPrice         *hexutil.Big         `json:"gasPrice"`
	GasFeeCap        *hexutil.Big         `json:"maxFeePerGas,omitempty"`
	GasTipCap        *hexutil.Big         `json:"maxPriorityFeePerGas,omitempty"`
	Hash             common.Hash          `json:"hash"`
	Input            hexutil.Bytes        `json:"input"`
	Nonce            hexutil.Uint64       `json:"nonce"`
	To               *common.Address      `json:"to"`
	TransactionIndex *hexutil.Uint64      `json:"transactionIndex"`
	Value            *hexutil.Big         `json:"value"`
	Type             hexutil.Uint64       `json:"type"`
	Accesses         *ethTypes.AccessList `json:"accessList,omitempty"`
	ChainID          *hexutil.Big         `json:"chainId,omitempty"`
	V                *hexutil.Big         `json:"v"`
	R                *hexutil.Big         `json:"r"`
	S                *hexutil.Big         `json:"s"`
}

RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction

type ValsetArgs

type ValsetArgs struct {
	Validators   []common.Address `protobuf:"bytes,2,rep,name=validators,proto3" json:"validators,omitempty"`
	Powers       []*big.Int       `protobuf:"varint,1,opt,name=powers,proto3" json:"powers,omitempty"`
	ValsetNonce  *big.Int         `protobuf:"varint,3,opt,name=valsetNonce,proto3" json:"valsetNonce,omitempty"`
	RewardAmount *big.Int         `protobuf:"bytes,4,opt,name=rewardAmount,json=rewardAmount,proto3" json:"rewardAmount"`
	// the reward token in it's Ethereum hex address representation
	RewardToken common.Address `protobuf:"bytes,5,opt,name=rewardToken,json=rewardToken,proto3" json:"rewardToken,omitempty"`
}

Jump to

Keyboard shortcuts

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