Documentation
¶
Index ¶
- Variables
- type AddressCodec
- type AllAccessors
- type BigInt
- type Bytes
- type Bytes32
- type ChainAccessor
- type ChainConfigSnapshot
- type ChainFeeComponents
- type ChainSelector
- type ChainSpecificAddressCodec
- type Codec
- type CommitPluginCodec
- type CommitPluginReport
- type CommitPluginReportWithMeta
- type CommitReportInfo
- type CommitReportsByConfidenceLevel
- type Config
- type ConfigInfo
- type ContractAddresses
- type CurseInfo
- type DataAvailabilityGasConfig
- type DestinationAccessor
- type EstimateProvider
- type ExecutePluginCodec
- type ExecutePluginReport
- type ExecutePluginReportSingleChain
- type ExecuteReportInfo
- type ExtraDataCodec
- type FeeQuoterConfig
- type FeeQuoterDestChainConfig
- type FeeQuoterStaticConfig
- type GasPriceChain
- type GetOnRampDynamicConfigResponse
- type MerkleRootChain
- type Message
- type MessageHasher
- type MessageTokenID
- type OCRConfig
- type OCRConfigResponse
- type OffRampDynamicChainConfig
- type OffRampStaticChainConfig
- type OfframpConfig
- type OnRampConfig
- type OnRampDestChainConfig
- type OnRampDynamicConfig
- type PriceReader
- type PriceUpdates
- type RMNCrypto
- type RMNCurseResponse
- type RMNDigestHeader
- type RMNECDSASignature
- type RMNLaneUpdate
- type RMNProxyConfig
- type RMNRemoteConfig
- type RMNReport
- type RampMessageHeader
- type RampTokenAmount
- type RemoteConfig
- type RemoteSignerInfo
- type RouterConfig
- type SeqNum
- type SeqNumRange
- func (s SeqNumRange) Contains(seq SeqNum) bool
- func (s SeqNumRange) End() SeqNum
- func (s SeqNumRange) FilterSlice(seqNums []SeqNum) []SeqNum
- func (s SeqNumRange) Length() int
- func (s *SeqNumRange) Limit(n uint64) SeqNumRange
- func (s SeqNumRange) Overlaps(other SeqNumRange) bool
- func (s *SeqNumRange) SetEnd(v SeqNum)
- func (s *SeqNumRange) SetStart(v SeqNum)
- func (s SeqNumRange) Start() SeqNum
- func (s SeqNumRange) String() string
- func (s SeqNumRange) ToSlice() []SeqNum
- type Signer
- type SourceAccessor
- type SourceChainConfig
- type SourceChainExtraDataCodec
- type TimestampedBig
- type TimestampedUnixBig
- type TokenDataEncoder
- type TokenInfo
- type TokenPrice
- type TokenPriceMap
- type USDCMessageReader
- type UnknownAddress
- type UnknownEncodedAddress
- type VersionedConfig
Constants ¶
This section is empty.
Variables ¶
var GlobalCurseSubject = [16]byte{0: 0x01, 15: 0x01}
GlobalCurseSubject Defined as a const in RMNRemote.sol Docs of RMNRemote: An active curse on this subject will cause isCursed() and isCursed(bytes16) to return true. Use this subject for issues affecting all of CCIP chains, or pertaining to the chain that this contract is deployed on, instead of using the local chain selector as a subject.
Functions ¶
This section is empty.
Types ¶
type AddressCodec ¶ added in v0.8.0
type AddressCodec interface {
AddressBytesToString(UnknownAddress, ChainSelector) (string, error)
AddressStringToBytes(string, ChainSelector) (UnknownAddress, error)
}
type AllAccessors ¶ added in v0.8.0
type AllAccessors interface {
// GetContractAddress returns the contract address that is registered for the provided contract name and chain.
// WARNING: This function will fail if the oracle does not support the requested chain.
//
// TODO(NONEVM-1865): do we want to mark this as deprecated in favor of Metadata()?
GetContractAddress(contractName string) ([]byte, error)
// GetAllConfigsLegacy returns a snapshot of all chain configurations for this chain using the legacy
// config structs.
//
// destChainSelector is used to determine whether or not destination chain specific configs should be fetched.
// sourceChainSelectors is used to determine which source chain configs should be fetched.
//
// This includes the following contracts:
// - Router
// - OffRamp
// - OnRamp
// - FeeQuoter
// - RMNProxy
// - RMNRemote
// - CurseInfo
//
// Access Type: Method(many, see code)
// Contract: Many
// Confidence: Unconfirmed
GetAllConfigsLegacy(
ctx context.Context,
destChainSelector ChainSelector,
sourceChainSelectors []ChainSelector,
) (ChainConfigSnapshot, map[ChainSelector]SourceChainConfig, error)
// GetChainFeeComponents Returns all fee components for given chains if corresponding
// chain writer is available.
//
// Access Type: ChainWriter
// Contract: N/A
// Confidence: N/A
GetChainFeeComponents(ctx context.Context) (ChainFeeComponents, error)
// Sync can be used to perform frequent syncing operations inside the reader implementation.
// Returns an error if the sync operation failed.
Sync(ctx context.Context, contractName string, contractAddress UnknownAddress) error
}
AllAccessors contains functionality that is available to all types of accessors.
type BigInt ¶
func NewBigIntFromInt64 ¶
func (BigInt) IsPositive ¶ added in v0.8.0
func (BigInt) MarshalJSON ¶
func (*BigInt) UnmarshalJSON ¶
type Bytes ¶
type Bytes []byte
func NewBytesFromString ¶
func (Bytes) MarshalJSON ¶
func (*Bytes) UnmarshalJSON ¶
type Bytes32 ¶
type Bytes32 [32]byte
func NewBytes32FromString ¶
func (Bytes32) MarshalJSON ¶
func (*Bytes32) UnmarshalJSON ¶
type ChainAccessor ¶ added in v0.8.0
type ChainAccessor interface {
AllAccessors
SourceAccessor
DestinationAccessor
USDCMessageReader
PriceReader
}
ChainAccessor for all direct chain access. The accessor is responsible for in addition to direct access to the chain, this interface also translates onchain representations of data to the plugin representation.
type ChainConfigSnapshot ¶ added in v0.8.0
type ChainConfigSnapshot struct {
Offramp OfframpConfig
RMNProxy RMNProxyConfig
RMNRemote RMNRemoteConfig
FeeQuoter FeeQuoterConfig
OnRamp OnRampConfig
Router RouterConfig
CurseInfo CurseInfo
}
ChainConfigSnapshot is a legacy type used in chain accessor's GetAllConfigsLegacy() function. This will eventually be replaced by a more explicit approach using an interface returned by a future GetAllConfig() function.
type ChainFeeComponents ¶ added in v0.8.0
type ChainFeeComponents struct {
// The cost of executing transaction in the chain's EVM (or the L2 environment).
ExecutionFee *big.Int
// The cost associated with an L2 posting a transaction's data to the L1.
DataAvailabilityFee *big.Int
}
ChainFeeComponents redeclares the ChainFeeComponents type from the chainlink-common/pkg/types to avoid a cyclic dependency caused by provider_ccip_ocr3.go importing this package.
type ChainSelector ¶
type ChainSelector uint64
func (ChainSelector) String ¶
func (c ChainSelector) String() string
type ChainSpecificAddressCodec ¶ added in v0.9.0
type ChainSpecificAddressCodec interface {
// AddressBytesToString converts an address from bytes to string
AddressBytesToString([]byte) (string, error)
// AddressStringToBytes converts an address from string to bytes
AddressStringToBytes(string) ([]byte, error)
// OracleIDAsAddressBytes returns a valid address for this chain family with the bytes set to the given oracle ID.
OracleIDAsAddressBytes(oracleID uint8) ([]byte, error)
// TransmitterBytesToString converts a transmitter account from bytes to string
TransmitterBytesToString([]byte) (string, error)
}
ChainSpecificAddressCodec is an interface that defines the methods for encoding and decoding addresses for a specific chain
type Codec ¶ added in v0.9.0
type Codec struct {
ChainSpecificAddressCodec
CommitPluginCodec
ExecutePluginCodec
TokenDataEncoder
SourceChainExtraDataCodec
}
Codec is an interface that defines the methods for chain family specific encoding and decoding various types of data used in CCIP OCR3
type CommitPluginCodec ¶
type CommitPluginCodec interface {
Encode(context.Context, CommitPluginReport) ([]byte, error)
Decode(context.Context, []byte) (CommitPluginReport, error)
}
type CommitPluginReport ¶
type CommitPluginReport struct {
PriceUpdates PriceUpdates `json:"priceUpdates"`
BlessedMerkleRoots []MerkleRootChain `json:"blessedMerkleRoots"`
UnblessedMerkleRoots []MerkleRootChain `json:"unblessedMerkleRoots"`
// RMNSignatures are the ECDSA signatures from the RMN signing nodes on the RMNReport structure.
// For more details see the contract here: https://github.com/smartcontractkit/chainlink/blob/7ba0f37134a618375542079ff1805fe2224d7916/contracts/src/v0.8/ccip/interfaces/IRMNV2.sol#L8-L12
//nolint:lll // it's a url
RMNSignatures []RMNECDSASignature `json:"rmnSignatures"`
}
CommitPluginReport contains the necessary information to commit CCIP messages from potentially many source chains, to a single destination chain.
It must consist of either:
- a non-empty MerkleRoots array, or
- a non-empty PriceUpdates array
If neither of the above is provided the report is considered empty and should not be transmitted on-chain.
In the event the MerkleRoots array is non-empty, it may also contain RMNSignatures, if RMN is configured for some lanes involved in the commitment. A report with RMN signatures but without merkle roots is invalid.
func (CommitPluginReport) HasNoRoots ¶ added in v0.8.0
func (r CommitPluginReport) HasNoRoots() bool
func (CommitPluginReport) IsEmpty ¶
func (r CommitPluginReport) IsEmpty() bool
IsEmpty returns true if the CommitPluginReport is empty. NOTE: A report is considered empty when core fields are missing (MerkleRoots, TokenPrices, GasPriceUpdates).
type CommitPluginReportWithMeta ¶ added in v0.8.0
type CommitPluginReportWithMeta struct {
Report CommitPluginReport `json:"report"`
Timestamp time.Time `json:"timestamp"`
BlockNum uint64 `json:"blockNum"`
}
type CommitReportInfo ¶ added in v0.8.0
type CommitReportInfo struct {
// RemoteF Max number of faulty RMN nodes; f+1 signers are required to verify a report.
RemoteF uint64 `json:"remoteF"`
MerkleRoots []MerkleRootChain `json:"merkleRoots"`
PriceUpdates
}
CommitReportInfo is the info data that will be sent with the along with the report It will be used to determine if the report should be accepted or not
func DecodeCommitReportInfo ¶ added in v0.8.0
func DecodeCommitReportInfo(data []byte) (CommitReportInfo, error)
DecodeCommitReportInfo is a version aware decode function for the commit report info bytes.
func (CommitReportInfo) Encode ¶ added in v0.8.0
func (cri CommitReportInfo) Encode() ([]byte, error)
type CommitReportsByConfidenceLevel ¶ added in v0.8.0
type CommitReportsByConfidenceLevel struct {
Finalized []CommitPluginReportWithMeta `json:"finalized"`
Unfinalized []CommitPluginReportWithMeta `json:"unfinalized"`
}
type Config ¶ added in v0.9.1
type Config struct {
RMNHomeContractConfigDigest Bytes32 `json:"rmnHomeContractConfigDigest"`
Signers []Signer `json:"signers"`
FSign uint64 `json:"fSign"` // previously: MinSigners
}
Config is used to parse the response from the RMNRemote contract's getVersionedConfig method. See: https://github.com/smartcontractkit/ccip/blob/ccip-develop/contracts/src/v0.8/ccip/rmn/RMNRemote.sol#L49-L53
type ConfigInfo ¶ added in v0.8.0
type ContractAddresses ¶ added in v0.8.0
type ContractAddresses map[string]map[ChainSelector]UnknownAddress
ContractAddresses is a map of contract names across all chain selectors and their address. Currently only one contract per chain per name is supported.
func (ContractAddresses) Append ¶ added in v0.9.1
func (ca ContractAddresses) Append(contract string, chain ChainSelector, address []byte) ContractAddresses
type CurseInfo ¶ added in v0.8.0
type CurseInfo struct {
// CursedSourceChains contains the cursed source chains.
CursedSourceChains map[ChainSelector]bool
// CursedDestination indicates that the destination chain is cursed.
CursedDestination bool
// GlobalCurse indicates that all chains are cursed.
GlobalCurse bool
}
CurseInfo contains cursing information that are fetched from the rmn remote contract.
func (CurseInfo) NonCursedSourceChains ¶ added in v0.8.0
func (ci CurseInfo) NonCursedSourceChains(inputChains []ChainSelector) []ChainSelector
type DataAvailabilityGasConfig ¶ added in v0.8.0
type DataAvailabilityGasConfig struct {
DestDataAvailabilityOverheadGas uint32 // Extra data availability gas charged, e.g., for OCR
DestGasPerDataAvailabilityByte uint16 // Gas charged per byte of message data needing availability
DestDataAvailabilityMultiplierBps uint16 // Multiplier for data availability gas in bps
}
type DestinationAccessor ¶ added in v0.8.0
type DestinationAccessor interface {
// CommitReportsGTETimestamp reads CommitReportAccepted events starting from a given timestamp.
// The number of results are limited according to limit.
//
// Access Type: Event(CommitReportAccepted)
// Contract: OffRamp
// Confidence: Unconfirmed, Finalized
CommitReportsGTETimestamp(
ctx context.Context,
ts time.Time,
confidence primitives.ConfidenceLevel,
limit int,
) ([]CommitPluginReportWithMeta, error)
// ExecutedMessages looks for ExecutionStateChanged events for each sequence
// in a given range. The presence of these events indicates that an attempt to
// execute the message has been made, which the system considers "executed".
// A slice of all executed sequence numbers is returned.
//
// Access Type: Event(ExecutionStateChanged)
// Contract: OffRamp
// Confidence: Unconfirmed, Finalized
ExecutedMessages(
ctx context.Context,
ranges map[ChainSelector][]SeqNumRange,
confidence primitives.ConfidenceLevel,
) (map[ChainSelector][]SeqNum, error)
// NextSeqNum reads the source chain config to get the next expected
// sequence number for the given source chains.
//
// Access Type: Method(NextSeqNum)
// Contract: OffRamp
// Confidence: Unconfirmed
NextSeqNum(ctx context.Context, sources []ChainSelector) (map[ChainSelector]SeqNum, error)
// Nonces for all provided selector/address pairs. Addresses must be encoded
// according to the source chain requirements by using the AddressCodec.
//
// Access Type: Method(GetInboundNonce)
// Contract: NonceManager
// Confidence: Unconfirmed
Nonces(ctx context.Context, addresses map[ChainSelector][]UnknownEncodedAddress) (map[ChainSelector]map[string]uint64, error)
// GetChainFeePriceUpdate Gets latest chain fee price update for the provided chains.
//
// Access Type: Method(GetChainFeePriceUpdate)
// Contract: FeeQuoter
// Confidence: Unconfirmed
GetChainFeePriceUpdate(ctx context.Context, selectors []ChainSelector) (map[ChainSelector]TimestampedUnixBig, error)
// GetLatestPriceSeqNr returns the latest price sequence number for the destination chain.
// Not to confuse with the sequence number of the messages. This is the OCR sequence number.
//
// Access Type: Method(GetLatestPriceSequenceNumber)
// Contract: OffRamp
// Confidence: Unconfirmed
GetLatestPriceSeqNr(ctx context.Context) (SeqNum, error)
}
DestinationAccessor contains all functions typically associated by the destination chain.
type EstimateProvider ¶ added in v0.8.0
type EstimateProvider interface {
CalculateMerkleTreeGas(numRequests int) uint64
CalculateMessageMaxGas(msg Message) uint64
}
EstimateProvider is used to estimate the gas cost of a message or a merkle tree.
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"`
}
func (ExecutePluginReportSingleChain) CopyNoMsgData ¶ added in v0.8.0
func (e ExecutePluginReportSingleChain) CopyNoMsgData() ExecutePluginReportSingleChain
type ExecuteReportInfo ¶ added in v0.8.0
type ExecuteReportInfo struct {
AbstractReports []ExecutePluginReportSingleChain
MerkleRoots []MerkleRootChain
}
ExecuteReportInfo contains metadata needed by transmitter and contract writer.
func DecodeExecuteReportInfo ¶ added in v0.8.0
func DecodeExecuteReportInfo(data []byte) (ExecuteReportInfo, error)
DecodeExecuteReportInfo is a version aware decode function for the execute report info bytes.
func (ExecuteReportInfo) Encode ¶ added in v0.8.0
func (eri ExecuteReportInfo) Encode() ([]byte, error)
Encode v1 execute report info. Very basic versioning in the first byte to allow for future encoding optimizations.
type ExtraDataCodec ¶ added in v0.9.0
type ExtraDataCodec map[string]SourceChainExtraDataCodec
ExtraDataCodec is a map of chain family to SourceChainExtraDataCodec
func (ExtraDataCodec) DecodeExtraArgs ¶ added in v0.9.0
func (c ExtraDataCodec) DecodeExtraArgs(extraArgs Bytes, sourceChainSelector ChainSelector) (map[string]any, error)
DecodeExtraArgs reformats bytes into a chain agnostic map[string]any representation for extra args
func (ExtraDataCodec) DecodeTokenAmountDestExecData ¶ added in v0.9.0
func (c ExtraDataCodec) DecodeTokenAmountDestExecData(destExecData Bytes, sourceChainSelector ChainSelector) (map[string]any, error)
DecodeTokenAmountDestExecData reformats bytes to chain-agnostic map[string]any for tokenAmount DestExecData field
type FeeQuoterConfig ¶ added in v0.8.0
type FeeQuoterConfig struct {
StaticConfig FeeQuoterStaticConfig
}
type FeeQuoterDestChainConfig ¶ added in v0.8.0
type FeeQuoterDestChainConfig struct {
IsEnabled bool // Whether this destination chain is enabled
MaxNumberOfTokensPerMsg uint16 // Maximum number of distinct ERC20 token transferred per message
MaxDataBytes uint32 // Maximum payload data size in bytes
MaxPerMsgGasLimit uint32 // Maximum gas limit for messages targeting EVMs
DestGasOverhead uint32 // Gas charged on top of the gasLimit to cover destination chain costs
DestGasPerPayloadByteBase uint32 // Destination gas charged per byte of payload to receiver by default
DestGasPerPayloadByteHigh uint32 // Destination gas charged per byte of payload over the threshold
DestGasPerPayloadByteThreshold uint32 // Threshold of payload byte size over which the high rate applies
DestDataAvailabilityOverheadGas uint32 // Extra data availability gas charged, e.g., for OCR
DestGasPerDataAvailabilityByte uint16 // Gas charged per byte of message data needing availability
DestDataAvailabilityMultiplierBps uint16 // Multiplier for data availability gas in bps
DefaultTokenFeeUSDCents uint16 // Default token fee charged per token transfer
DefaultTokenDestGasOverhead uint32 // Default gas charged to execute token transfer on destination
DefaultTxGasLimit uint32 // Default gas limit for a transaction
GasMultiplierWeiPerEth uint64 // Multiplier for gas costs, 1e18 based (11e17 = 10% extra cost)
NetworkFeeUSDCents uint32 // Flat network fee for messages, in multiples of 0.01 USD
GasPriceStalenessThreshold uint32 // Maximum time for gas price to be valid (0 means disabled)
EnforceOutOfOrder bool // Enforce the allowOutOfOrderExecution extraArg to be true
ChainFamilySelector [4]byte // Selector identifying the destination chain's family
}
FeeQuoterDestChainConfig represents the configuration of a destination chain in the FeeQuoter contract
func (FeeQuoterDestChainConfig) HasNonEmptyDAGasParams ¶ added in v0.8.0
func (c FeeQuoterDestChainConfig) HasNonEmptyDAGasParams() bool
HasNonEmptyDAGasParams returns true if the destination chain has non-empty data availability gas parameters
type FeeQuoterStaticConfig ¶ added in v0.9.1
type FeeQuoterStaticConfig struct {
MaxFeeJuelsPerMsg BigInt `json:"maxFeeJuelsPerMsg"`
LinkToken []byte `json:"linkToken"`
StalenessThreshold uint32 `json:"stalenessThreshold"`
}
FeeQuoterStaticConfig is used to parse the response from the feeQuoter contract's getStaticConfig method. See: https://github.com/smartcontractkit/ccip/blob/a3f61f7458e4499c2c62eb38581c60b4942b1160/contracts/src/v0.8/ccip/FeeQuoter.sol#L946
type GasPriceChain ¶
type GasPriceChain struct {
ChainSel ChainSelector `json:"chainSel"`
GasPrice BigInt `json:"gasPrice"`
}
func NewGasPriceChain ¶
func NewGasPriceChain(gasPrice *big.Int, chainSel ChainSelector) GasPriceChain
type GetOnRampDynamicConfigResponse ¶ added in v0.9.1
type GetOnRampDynamicConfigResponse struct {
DynamicConfig OnRampDynamicConfig `json:"dynamicConfig"`
}
GetOnRampDynamicConfigResponse wraps the OnRampDynamicConfig this way to map to on-chain return type which is a named struct https://github.com/smartcontractkit/chainlink/blob/12af1de88238e0e918177d6b5622070417f48adf/contracts/src/v0.8/ccip/onRamp/OnRamp.sol#L328
type MerkleRootChain ¶
type MerkleRootChain struct {
ChainSel ChainSelector `json:"chain"`
OnRampAddress UnknownAddress `json:"onRampAddress"`
SeqNumsRange SeqNumRange `json:"seqNumsRange"`
MerkleRoot Bytes32 `json:"merkleRoot"`
}
MerkleRootChain Mirroring https://github.com/smartcontractkit/chainlink/blob/cd5c78959575f593b27fd83d8766086d0c678487/contracts/src/v0.8/ccip/libraries/Internal.sol#L356-L362
func (MerkleRootChain) Equals ¶ added in v0.3.0
func (m MerkleRootChain) Equals(other MerkleRootChain) bool
func (MerkleRootChain) String ¶ added in v0.8.0
func (m MerkleRootChain) String() string
String returns a string representation of the 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 UnknownAddress `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 UnknownAddress `json:"receiver"`
// ExtraArgs is destination-chain specific extra args,
// such as the gasLimit for EVM chains.
// This field is encoded in the source chain encoding scheme.
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 UnknownAddress `json:"feeToken"`
// FeeTokenAmount is the amount of fee tokens paid.
FeeTokenAmount BigInt `json:"feeTokenAmount"`
// FeeValueJuels is the fee amount in Juels
FeeValueJuels BigInt `json:"feeValueJuels"`
// 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) CopyWithoutData ¶ added in v0.8.0
func (Message) IsPseudoDeleted ¶ added in v0.8.0
IsPseudoDeleted returns true when the message is stripped out of some fields that makes it usable. Message still contains some metaData like seqNumber and SourceChainSelector to be able to distinguish it from other messages while still in the pseudo deleted state.
type MessageHasher ¶
type MessageTokenID ¶ added in v0.9.5
MessageTokenID is a unique identifier for a message token data (per chain selector). It's a composite key of the message sequence number and the token index within the message. It's used to easier identify token data for messages without having to deal with nested maps.
func NewMessageTokenID ¶ added in v0.9.5
func NewMessageTokenID(seqNr SeqNum, index int) MessageTokenID
func (MessageTokenID) String ¶ added in v0.9.5
func (mti MessageTokenID) String() string
type OCRConfig ¶ added in v0.8.0
type OCRConfig struct {
ConfigInfo ConfigInfo
Signers [][]byte
Transmitters [][]byte
}
type OCRConfigResponse ¶ added in v0.8.0
type OCRConfigResponse struct {
OCRConfig OCRConfig
}
type OffRampDynamicChainConfig ¶ added in v0.9.1
type OffRampDynamicChainConfig struct {
FeeQuoter []byte `json:"feeQuoter"`
PermissionLessExecutionThresholdSeconds uint32 `json:"permissionLessExecutionThresholdSeconds"`
IsRMNVerificationDisabled bool `json:"isRMNVerificationDisabled"`
MessageInterceptor []byte `json:"messageInterceptor"`
}
OffRampDynamicChainConfig maps to DynamicConfig in OffRamp.sol
type OffRampStaticChainConfig ¶ added in v0.9.1
type OffRampStaticChainConfig struct {
ChainSelector ChainSelector `json:"chainSelector"`
GasForCallExactCheck uint16 `json:"gasForCallExactCheck"`
RmnRemote []byte `json:"rmnRemote"`
TokenAdminRegistry []byte `json:"tokenAdminRegistry"`
NonceManager []byte `json:"nonceManager"`
}
OffRampStaticChainConfig is used to parse the response from the offRamp contract's getStaticConfig method. See: <chainlink repo>/contracts/src/v0.8/ccip/offRamp/OffRamp.sol:StaticConfig
type OfframpConfig ¶ added in v0.8.0
type OfframpConfig struct {
CommitLatestOCRConfig OCRConfigResponse
ExecLatestOCRConfig OCRConfigResponse
StaticConfig OffRampStaticChainConfig
DynamicConfig OffRampDynamicChainConfig
}
type OnRampConfig ¶ added in v0.8.0
type OnRampConfig struct {
DynamicConfig GetOnRampDynamicConfigResponse
DestChainConfig OnRampDestChainConfig
}
type OnRampDestChainConfig ¶ added in v0.9.1
type OnRampDestChainConfig struct {
SequenceNumber uint64 `json:"sequenceNumber"`
AllowListEnabled bool `json:"allowListEnabled"`
Router []byte `json:"router"`
}
OnRampDestChainConfig - See DestChainConfig in OnRamp.sol
type OnRampDynamicConfig ¶ added in v0.9.1
type OnRampDynamicConfig struct {
FeeQuoter []byte `json:"feeQuoter"`
ReentrancyGuardEntered bool `json:"reentrancyGuardEntered"`
MessageInterceptor []byte `json:"messageInterceptor"`
FeeAggregator []byte `json:"feeAggregator"`
AllowListAdmin []byte `json:"allowListAdmin"`
}
OnRampDynamicConfig - See DynamicChainConfig in OnRamp.sol
type PriceReader ¶ added in v0.9.5
type PriceReader interface {
// GetFeedPricesUSD returns the prices of the provided tokens in USD normalized to e18.
// 1 USDC = 1.00 USD per full token, each full token is 1e6 units -> 1 * 1e18 * 1e18 / 1e6 = 1e30
// 1 ETH = 2,000 USD per full token, each full token is 1e18 units -> 2000 * 1e18 * 1e18 / 1e18 = 2_000e18
// 1 LINK = 5.00 USD per full token, each full token is 1e18 units -> 5 * 1e18 * 1e18 / 1e18 = 5e18
// The order of the returned prices corresponds to the order of the provided tokens.
GetFeedPricesUSD(
ctx context.Context,
tokens []UnknownEncodedAddress,
tokenInfo map[UnknownEncodedAddress]TokenInfo,
) (TokenPriceMap, error)
// GetFeeQuoterTokenUpdates returns the latest token prices from the FeeQuoter on the specified chain
GetFeeQuoterTokenUpdates(
ctx context.Context,
tokens []UnknownEncodedAddress,
chain ChainSelector,
) (map[UnknownEncodedAddress]TimestampedUnixBig, error)
}
type PriceUpdates ¶
type PriceUpdates struct {
TokenPriceUpdates []TokenPrice `json:"tokenPriceUpdates"`
GasPriceUpdates []GasPriceChain `json:"gasPriceUpdates"`
}
type RMNCrypto ¶ added in v0.2.2
type RMNCrypto interface {
// VerifyReportSignatures verifies each provided signature against the provided report and the signer addresses.
// If any signature is invalid (no matching signer address is found), an error is returned immediately.
VerifyReportSignatures(
ctx context.Context,
sigs []RMNECDSASignature,
report RMNReport,
signerAddresses []UnknownAddress,
) error
}
RMNCrypto provides a chain-agnostic interface for verifying RMN signatures. For example, on EVM, RMN reports are abi-encoded prior to being signed. On Solana, they would be borsh encoded instead, etc.
type RMNCurseResponse ¶ added in v0.8.0
type RMNCurseResponse struct {
CursedSubjects [][16]byte
}
type RMNDigestHeader ¶ added in v0.9.1
type RMNDigestHeader struct {
DigestHeader Bytes32
}
type RMNECDSASignature ¶ added in v0.2.2
RMNECDSASignature represents the signature provided by RMN on the RMNReport structure. The V value of the signature is included in the top-level commit report as part of a bitmap.
type RMNLaneUpdate ¶ added in v0.2.2
type RMNLaneUpdate struct {
SourceChainSelector ChainSelector
OnRampAddress UnknownAddress // (for EVM should be abi-encoded)
MinSeqNr SeqNum
MaxSeqNr SeqNum
MerkleRoot Bytes32
}
RMNLaneUpdate represents an interval that has been observed by an RMN node. It is part of the payload that is signed and transmitted onchain.
type RMNProxyConfig ¶ added in v0.8.0
type RMNProxyConfig struct {
RemoteAddress []byte
}
type RMNRemoteConfig ¶ added in v0.8.0
type RMNRemoteConfig struct {
DigestHeader RMNDigestHeader
VersionedConfig VersionedConfig
}
type RMNReport ¶ added in v0.2.2
type RMNReport struct {
ReportVersionDigest Bytes32 // e.g. keccak256("RMN_V1_6_ANY2EVM_REPORT")
DestChainID BigInt // If applies, a chain specific id, e.g. evm chain id otherwise empty.
DestChainSelector ChainSelector
RmnRemoteContractAddress UnknownAddress
OfframpAddress UnknownAddress
RmnHomeContractConfigDigest Bytes32
LaneUpdates []RMNLaneUpdate
}
RMNReport is the payload that is signed by the RMN nodes, transmitted and verified onchain.
func NewRMNReport ¶ added in v0.8.0
func NewRMNReport( reportVersionDigest Bytes32, destChainID BigInt, destChainSelector ChainSelector, rmnRemoteContractAddress UnknownAddress, offRampAddress UnknownAddress, rmnHomeContractConfigDigest Bytes32, laneUpdates []RMNLaneUpdate, ) RMNReport
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 UnknownAddress `json:"onRamp"`
// TxHash is the hash of the transaction that emitted this message.
TxHash string `json:"txHash"`
}
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 UnknownAddress `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 UnknownAddress `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"`
// DestExecData is destination chain specific execution data encoded in bytes.
// For an EVM destination, it consists of the amount of gas available for the releaseOrMint
// and transfer calls made by the offRamp.
// NOTE: this must be decoded before providing it as an execution input to the destination chain
// or hashing it. See Internal._hash(Any2EVMRampMessage) for more details as an example.
DestExecData Bytes `json:"destExecData"`
}
RampTokenAmount represents the family-agnostic token amounts used for both OnRamp & OffRamp messages.
type RemoteConfig ¶ added in v0.8.0
type RemoteConfig struct {
ContractAddress UnknownAddress `json:"contractAddress"`
ConfigDigest Bytes32 `json:"configDigest"`
Signers []RemoteSignerInfo `json:"signers"`
// F defines the max number of faulty RMN nodes; F+1 signers are required to verify a report.
FSign uint64 `json:"fSign"` // previously: MinSigners
ConfigVersion uint32 `json:"configVersion"`
RmnReportVersion Bytes32 `json:"rmnReportVersion"` // e.g., keccak256("RMN_V1_6_ANY2EVM_REPORT")
}
RemoteConfig contains the configuration fetched from the RMNRemote contract.
func (RemoteConfig) IsEmpty ¶ added in v0.8.0
func (r RemoteConfig) IsEmpty() bool
type RemoteSignerInfo ¶ added in v0.8.0
type RemoteSignerInfo struct {
// The signer's onchain address, used to verify report signature
OnchainPublicKey UnknownAddress `json:"onchainPublicKey"`
// The index of the node in the RMN config
NodeIndex uint64 `json:"nodeIndex"`
}
RemoteSignerInfo contains information about a signer from the RMNRemote contract.
type RouterConfig ¶ added in v0.8.0
type RouterConfig struct {
WrappedNativeAddress Bytes
}
type SeqNum ¶
type SeqNum uint64
func (SeqNum) IsWithinRanges ¶ added in v0.8.0
func (s SeqNum) IsWithinRanges(ranges []SeqNumRange) bool
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) FilterSlice ¶ added in v0.8.0
func (s SeqNumRange) FilterSlice(seqNums []SeqNum) []SeqNum
FilterSlice returns a slice of sequence numbers that are contained in the range.
func (SeqNumRange) Length ¶ added in v0.8.0
func (s SeqNumRange) Length() int
func (*SeqNumRange) Limit ¶ added in v0.3.0
func (s *SeqNumRange) Limit(n uint64) SeqNumRange
Limit returns a range limited up to n elements by truncating the end if necessary. Example: [1 -> 10].Limit(5) => [1 -> 5]
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
func (SeqNumRange) ToSlice ¶ added in v0.8.0
func (s SeqNumRange) ToSlice() []SeqNum
ToSlice returns a slice of sequence numbers in the range.
type Signer ¶ added in v0.9.1
type Signer struct {
OnchainPublicKey []byte `json:"onchainPublicKey"`
NodeIndex uint64 `json:"nodeIndex"`
}
Signer is used to parse the response from the RMNRemote contract's getVersionedConfig method. See: https://github.com/smartcontractkit/ccip/blob/ccip-develop/contracts/src/v0.8/ccip/rmn/RMNRemote.sol#L42-L45
type SourceAccessor ¶ added in v0.8.0
type SourceAccessor interface {
// MsgsBetweenSeqNums returns all messages being sent to the provided dest
// chain, between the provided sequence numbers. Messages are sorted ascending
// based on their timestamp.
//
// Access Type: Event(CCIPMessageSent)
// Contract: OnRamp
// Confidence: Finalized
MsgsBetweenSeqNums(ctx context.Context, dest ChainSelector, seqNumRange SeqNumRange) ([]Message, error)
// LatestMessageTo returns the sequence number associated with the most
// recent message being sent to a given destination.
//
// Access Type: Event(CCIPMessageSent)
// Contract: OnRamp
// Confidence: Finalized
LatestMessageTo(ctx context.Context, dest ChainSelector) (SeqNum, error)
// GetExpectedNextSequenceNumber returns the expected next sequence number
// messages being sent to the provided destination.
//
// Access Type: Method(GetExpectedNextSequenceNumber)
// Contract: OnRamp
// Confidence: Unconfirmed
GetExpectedNextSequenceNumber(ctx context.Context, dest ChainSelector) (SeqNum, error)
// GetTokenPriceUSD looks up a token price in USD. The address value should
// be retrieved from a configuration cache (i.e. ConfigPoller).
//
// Access Type: Method(GetTokenPrice)
// Contract: FeeQuoter
// Confidence: Unconfirmed
//
// Notes: This function is new and serves as a general price interface for
// both LinkPriceUSD and GetWrappedNativeTokenPriceUSD.
// See Design Doc (Combined Token Price Helper) for notes.
GetTokenPriceUSD(ctx context.Context, address UnknownAddress) (TimestampedUnixBig, error)
// GetFeeQuoterDestChainConfig returns the fee quoter destination chain config.
//
// Access Type: Method(GetDestChainConfig)
// Contract: FeeQuoter
// Confidence: Unconfirmed
//
// Notes: This is a new general purpose function needed to implement
// GetMedianDataAvailabilityGasConfig.
GetFeeQuoterDestChainConfig(ctx context.Context, dest ChainSelector) (FeeQuoterDestChainConfig, error)
}
type SourceChainConfig ¶ added in v0.8.0
type SourceChainConfig struct {
Router []byte // local router
IsEnabled bool
IsRMNVerificationDisabled bool
MinSeqNr uint64
OnRamp UnknownAddress
}
sourceChainConfig is used to parse the response from the offRamp contract's getSourceChainConfig method. See: https://github.com/smartcontractkit/ccip/blob/a3f61f7458e4499c2c62eb38581c60b4942b1160/contracts/src/v0.8/ccip/offRamp/OffRamp.sol#L94
type SourceChainExtraDataCodec ¶ added in v0.9.0
type SourceChainExtraDataCodec interface {
// DecodeExtraArgsToMap reformat bytes into a chain agnostic map[string]any representation for extra args
DecodeExtraArgsToMap(extraArgs Bytes) (map[string]any, error)
// DecodeDestExecDataToMap reformat bytes into a chain agnostic map[string]interface{} representation for dest exec data
DecodeDestExecDataToMap(destExecData Bytes) (map[string]any, error)
}
SourceChainExtraDataCodec is an interface for decoding source chain specific extra args and dest exec data into a map[string]any representation for a specific chain For chain A to chain B message, this interface will be the chain A specific codec
type TimestampedBig ¶ added in v0.8.0
func NewTimestampedBig ¶ added in v0.8.0
func NewTimestampedBig(value int64, timestamp time.Time) TimestampedBig
func TimeStampedBigFromUnix ¶ added in v0.8.0
func TimeStampedBigFromUnix(input TimestampedUnixBig) TimestampedBig
type TimestampedUnixBig ¶ added in v0.8.0
type TimestampedUnixBig struct {
// Value in uint224, can contain several packed fields
Value *big.Int `json:"value"`
// Timestamp in seconds since epoch of most recent update
Timestamp uint32 `json:"timestamp"`
}
TimestampedUnixBig Maps to on-chain struct https://github.com/smartcontractkit/chainlink/blob/37f3132362ec90b0b1c12fb1b69b9c16c46b399d/contracts/src/v0.8/ccip/libraries/Internal.sol#L43-L47
type TokenDataEncoder ¶ added in v0.3.0
type TokenDataEncoder interface {
EncodeUSDC(ctx context.Context, message Bytes, attestation Bytes) (Bytes, error)
}
TokenDataEncoder is a generic interface for encoding offchain token data for different chain families. Right now it supports only USDC/CCTP, but every new token that requires offchain data processsing should be added to that interface and implemented in the downstream repositories (e.g. chainlink-ccip, chainlink).
type TokenInfo ¶ added in v0.9.5
type TokenInfo struct {
// AggregatorAddress is the address of the price feed TOKEN/USD aggregator on the feed chain.
AggregatorAddress UnknownEncodedAddress `json:"aggregatorAddress"`
// DeviationPPB is the deviation in parts per billion that the price feed is allowed to deviate
// from the last written price on-chain before we write a new price.
DeviationPPB BigInt `json:"deviationPPB"`
// Decimals is the number of decimals for the token (NOT the feed).
Decimals uint8 `json:"decimals"`
}
type TokenPrice ¶
type TokenPrice struct {
TokenID UnknownEncodedAddress `json:"tokenID"`
Price BigInt `json:"price"`
}
func NewTokenPrice ¶
func NewTokenPrice(tokenID UnknownEncodedAddress, price *big.Int) TokenPrice
type TokenPriceMap ¶ added in v0.8.0
type TokenPriceMap map[UnknownEncodedAddress]BigInt
func (TokenPriceMap) ToSortedSlice ¶ added in v0.8.0
func (t TokenPriceMap) ToSortedSlice() []TokenPrice
type USDCMessageReader ¶ added in v0.9.5
type USDCMessageReader interface {
MessagesByTokenID(ctx context.Context,
source, dest ChainSelector,
tokens map[MessageTokenID]RampTokenAmount,
) (map[MessageTokenID]Bytes, error)
}
USDCMessageReader retrieves each of the CCTPv1 MessageSent event created when a ccipSend is made with USDC token transfer. The events are created when the USDC Token pool calls the 3rd party MessageTransmitter contract.
type UnknownAddress ¶ added in v0.8.0
type UnknownAddress []byte
UnknownAddress represents a raw address with an unknown encoding.
func NewUnknownAddressFromHex ¶ added in v0.8.0
func NewUnknownAddressFromHex(s string) (UnknownAddress, error)
NewUnknownAddressFromHex creates a new UnknownAddress from a hex string.
func (UnknownAddress) IsZeroOrEmpty ¶ added in v0.8.0
func (a UnknownAddress) IsZeroOrEmpty() bool
IsZeroOrEmpty returns true if the address contains 0 bytes or if all the bytes are 0.
func (UnknownAddress) MarshalJSON ¶ added in v0.8.0
func (a UnknownAddress) MarshalJSON() ([]byte, error)
func (UnknownAddress) String ¶ added in v0.8.0
func (a UnknownAddress) String() string
String returns the hex representation of the unknown address.
func (*UnknownAddress) UnmarshalJSON ¶ added in v0.8.0
func (a *UnknownAddress) UnmarshalJSON(data []byte) error
type UnknownEncodedAddress ¶ added in v0.8.0
UnknownEncodedAddress represents an encoded address with an unknown encoding.
type VersionedConfig ¶ added in v0.9.1
VersionedConfig is used to parse the response from the RMNRemote contract's getVersionedConfig method. See: https://github.com/smartcontractkit/ccip/blob/ccip-develop/contracts/src/v0.8/ccip/rmn/RMNRemote.sol#L167-L169