ccipocr3

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BigInt

type BigInt struct {
	*big.Int
}

func NewBigInt

func NewBigInt(i *big.Int) BigInt

func NewBigIntFromInt64

func NewBigIntFromInt64(i int64) BigInt

func (BigInt) IsEmpty

func (b BigInt) IsEmpty() bool

func (BigInt) MarshalJSON

func (b BigInt) MarshalJSON() ([]byte, error)

func (*BigInt) UnmarshalJSON

func (b *BigInt) UnmarshalJSON(p []byte) error

type Bytes

type Bytes []byte

func NewBytesFromString

func NewBytesFromString(s string) (Bytes, error)

func (Bytes) MarshalJSON

func (b Bytes) MarshalJSON() ([]byte, error)

func (Bytes) String

func (b Bytes) String() string

func (*Bytes) UnmarshalJSON

func (b *Bytes) UnmarshalJSON(data []byte) error

type Bytes32

type Bytes32 [32]byte

func NewBytes32FromString

func NewBytes32FromString(s string) (Bytes32, error)

func (Bytes32) IsEmpty

func (b Bytes32) IsEmpty() bool

func (Bytes32) MarshalJSON

func (b Bytes32) MarshalJSON() ([]byte, error)

func (Bytes32) String

func (b Bytes32) String() string

func (*Bytes32) UnmarshalJSON

func (b *Bytes32) UnmarshalJSON(data []byte) error

type ChainSelector

type ChainSelector uint64

func (ChainSelector) String

func (c ChainSelector) String() string

type CommitPluginCodec

type CommitPluginCodec interface {
	Encode(context.Context, CommitPluginReport) ([]byte, error)
	Decode(context.Context, []byte) (CommitPluginReport, error)
}

type CommitPluginReport

type CommitPluginReport struct {
	MerkleRoots  []MerkleRootChain `json:"merkleRoots"`
	PriceUpdates PriceUpdates      `json:"priceUpdates"`
}

func NewCommitPluginReport

func NewCommitPluginReport(merkleRoots []MerkleRootChain, tokenPriceUpdates []TokenPrice, gasPriceUpdate []GasPriceChain) CommitPluginReport

func (CommitPluginReport) IsEmpty

func (r CommitPluginReport) IsEmpty() bool

IsEmpty returns true if the CommitPluginReport is empty

type ExecutePluginCodec

type ExecutePluginCodec interface {
	Encode(context.Context, ExecutePluginReport) ([]byte, error)
	Decode(context.Context, []byte) (ExecutePluginReport, error)
}

type ExecutePluginReport

type ExecutePluginReport struct {
	ChainReports []ExecutePluginReportSingleChain `json:"chainReports"`
}

type ExecutePluginReportSingleChain

type ExecutePluginReportSingleChain struct {
	SourceChainSelector ChainSelector `json:"sourceChainSelector"`
	Messages            []Message     `json:"messages"`
	OffchainTokenData   [][][]byte    `json:"offchainTokenData"`
	Proofs              []Bytes32     `json:"proofs"`
	ProofFlagBits       BigInt        `json:"proofFlagBits"`
}

type GasPriceChain

type GasPriceChain struct {
	GasPrice BigInt        `json:"gasPrice"`
	ChainSel ChainSelector `json:"chainSel"`
}

func NewGasPriceChain

func NewGasPriceChain(gasPrice *big.Int, chainSel ChainSelector) GasPriceChain

type MerkleRootChain

type MerkleRootChain struct {
	ChainSel     ChainSelector `json:"chain"`
	SeqNumsRange SeqNumRange   `json:"seqNumsRange"`
	MerkleRoot   Bytes32       `json:"merkleRoot"`
}

func NewMerkleRootChain

func NewMerkleRootChain(
	chainSel ChainSelector,
	seqNumsRange SeqNumRange,
	merkleRoot Bytes32,
) MerkleRootChain

type Message

type Message struct {
	// Header is the family-agnostic header for OnRamp and OffRamp messages.
	// This is always set on all CCIP messages.
	Header RampMessageHeader `json:"header"`
	// Sender address on the source chain.
	// i.e if the source chain is EVM, this is an abi-encoded EVM address.
	Sender Bytes `json:"sender"`
	// Data is the arbitrary data payload supplied by the message sender.
	Data Bytes `json:"data"`
	// Receiver is the receiver address on the destination chain.
	// This is encoded in the destination chain family specific encoding.
	// i.e if the destination is EVM, this is abi.encode(receiver).
	Receiver Bytes `json:"receiver"`
	// ExtraArgs is destination-chain specific extra args, such as the gasLimit for EVM chains.
	ExtraArgs Bytes `json:"extraArgs"`
	// FeeToken is the fee token address.
	// i.e if the source chain is EVM, len(FeeToken) == 20 (i.e, is not abi-encoded).
	FeeToken Bytes `json:"feeToken"`
	// FeeTokenAmount is the amount of fee tokens paid.
	FeeTokenAmount BigInt `json:"feeTokenAmount"`
	// TokenAmounts is the array of tokens and amounts to transfer.
	TokenAmounts []RampTokenAmount `json:"tokenAmounts"`
}

Message is the generic Any2Any message type for CCIP messages. It represents, in particular, a message emitted by a CCIP onramp. The message is expected to be consumed by a CCIP offramp after translating it into the appropriate format for the destination chain.

func (Message) String

func (c Message) String() string

type MessageHasher

type MessageHasher interface {
	Hash(context.Context, Message) (Bytes32, error)
}

type PriceUpdates

type PriceUpdates struct {
	TokenPriceUpdates []TokenPrice    `json:"tokenPriceUpdates"`
	GasPriceUpdates   []GasPriceChain `json:"gasPriceUpdates"`
}

type RampMessageHeader

type RampMessageHeader struct {
	// MessageID is a unique identifier for the message, it should be unique across all chains.
	// It is generated on the chain that the CCIP send is requested (i.e. the source chain of a message).
	MessageID Bytes32 `json:"messageId"`
	// SourceChainSelector is the chain selector of the chain that the message originated from.
	SourceChainSelector ChainSelector `json:"sourceChainSelector,string"`
	// DestChainSelector is the chain selector of the chain that the message is destined for.
	DestChainSelector ChainSelector `json:"destChainSelector,string"`
	// SequenceNumber is an auto-incrementing sequence number for the message.
	// Not unique across lanes.
	SequenceNumber SeqNum `json:"seqNum,string"`
	// Nonce is the nonce for this lane for this sender, not unique across senders/lanes
	Nonce uint64 `json:"nonce"`

	// MsgHash is the hash of all the message fields.
	// NOTE: The field is expected to be empty, and will be populated by the plugin using the MsgHasher interface.
	MsgHash Bytes32 `json:"msgHash"` // populated

	// OnRamp is the address of the onramp that sent the message.
	// NOTE: This is populated by the ccip reader. Not emitted explicitly onchain.
	OnRamp Bytes `json:"onRamp"`
}

RampMessageHeader is the family-agnostic header for OnRamp and OffRamp messages. The MessageID is not expected to match MsgHash, since it may originate from a different ramp family.

type RampTokenAmount

type RampTokenAmount struct {
	// SourcePoolAddress is the source pool address, encoded according to source family native encoding scheme.
	// This value is trusted as it was obtained through the onRamp. It can be relied upon by the destination
	// pool to validate the source pool.
	SourcePoolAddress Bytes `json:"sourcePoolAddress"`
	// DestTokenAddress is the address of the destination token, abi encoded in the case of EVM chains.
	// This value is UNTRUSTED as any pool owner can return whatever value they want.
	DestTokenAddress Bytes `json:"destTokenAddress"`
	// ExtraData is optional pool data to be transferred to the destination chain. Be default this is capped at
	// CCIP_LOCK_OR_BURN_V1_RET_BYTES bytes. If more data is required, the TokenTransferFeeConfig.destBytesOverhead
	// has to be set for the specific token.
	ExtraData Bytes `json:"extraData"`
	// Amount is the amount of tokens to be transferred.
	Amount BigInt `json:"amount"`
}

RampTokenAmount represents the family-agnostic token amounts used for both OnRamp & OffRamp messages.

type SeqNum

type SeqNum uint64

func (SeqNum) String

func (s SeqNum) String() string

type SeqNumRange

type SeqNumRange [2]SeqNum

SeqNumRange defines an inclusive range of sequence numbers.

func NewSeqNumRange

func NewSeqNumRange(start, end SeqNum) SeqNumRange

func (SeqNumRange) Contains

func (s SeqNumRange) Contains(seq SeqNum) bool

Contains returns true if the range contains the given sequence number.

func (SeqNumRange) End

func (s SeqNumRange) End() SeqNum

func (SeqNumRange) Overlaps

func (s SeqNumRange) Overlaps(other SeqNumRange) bool

Overlaps returns true if the two ranges overlap.

func (*SeqNumRange) SetEnd

func (s *SeqNumRange) SetEnd(v SeqNum)

func (*SeqNumRange) SetStart

func (s *SeqNumRange) SetStart(v SeqNum)

func (SeqNumRange) Start

func (s SeqNumRange) Start() SeqNum

func (SeqNumRange) String

func (s SeqNumRange) String() string

type TokenPrice

type TokenPrice struct {
	TokenID types.Account `json:"tokenID"`
	Price   BigInt        `json:"price"`
}

func NewTokenPrice

func NewTokenPrice(tokenID types.Account, price *big.Int) TokenPrice

Jump to

Keyboard shortcuts

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