From 8ba3af65b53d8ca15f27bc6f79b00caeac193164 Mon Sep 17 00:00:00 2001 From: ilija Date: Wed, 6 Nov 2024 17:05:08 +0100 Subject: [PATCH] Remove temporary ccipMessage struct used for CR QueryKey --- pkg/reader/ccip.go | 54 ++-------------------------------------------- 1 file changed, 2 insertions(+), 52 deletions(-) diff --git a/pkg/reader/ccip.go b/pkg/reader/ccip.go index d38380c58..fc5b6fef6 100644 --- a/pkg/reader/ccip.go +++ b/pkg/reader/ccip.go @@ -276,56 +276,6 @@ func (r *ccipChainReader) ExecutedMessageRanges( return executed, nil } -// Temporary struct to properly deserialize cciptypes.Message before we have support for cciptypes.BigInt -type ccipMessageTokenAmount struct { - SourcePoolAddress cciptypes.UnknownAddress - DestTokenAddress cciptypes.UnknownAddress - ExtraData cciptypes.Bytes - Amount *big.Int - DestExecData cciptypes.Bytes -} - -func (t *ccipMessageTokenAmount) ToOnRampToken() cciptypes.RampTokenAmount { - return cciptypes.RampTokenAmount{ - SourcePoolAddress: t.SourcePoolAddress, - DestTokenAddress: t.DestTokenAddress, - ExtraData: t.ExtraData, - Amount: cciptypes.NewBigInt(t.Amount), - DestExecData: t.DestExecData, - } -} - -type ccipMessage struct { - Header cciptypes.RampMessageHeader - Sender cciptypes.UnknownAddress - Data cciptypes.Bytes - Receiver cciptypes.UnknownAddress - ExtraArgs cciptypes.Bytes - FeeToken cciptypes.UnknownAddress - FeeTokenAmount *big.Int - FeeValueJuels *big.Int - TokenAmounts []ccipMessageTokenAmount -} - -func (m *ccipMessage) ToMessage() cciptypes.Message { - tk := make([]cciptypes.RampTokenAmount, len(m.TokenAmounts)) - for i := range m.TokenAmounts { - tk[i] = m.TokenAmounts[i].ToOnRampToken() - } - - return cciptypes.Message{ - Header: m.Header, - Sender: m.Sender, - Data: m.Data, - Receiver: m.Receiver, - ExtraArgs: m.ExtraArgs, - FeeToken: m.FeeToken, - FeeTokenAmount: cciptypes.NewBigInt(m.FeeTokenAmount), - FeeValueJuels: cciptypes.NewBigInt(m.FeeValueJuels), - TokenAmounts: tk, - } -} - func (r *ccipChainReader) MsgsBetweenSeqNums( ctx context.Context, sourceChainSelector cciptypes.ChainSelector, seqNumRange cciptypes.SeqNumRange, ) ([]cciptypes.Message, error) { @@ -340,7 +290,7 @@ func (r *ccipChainReader) MsgsBetweenSeqNums( type SendRequestedEvent struct { DestChainSelector cciptypes.ChainSelector - Message ccipMessage + Message cciptypes.Message } seq, err := r.contractReaders[sourceChainSelector].ExtendedQueryKey( @@ -392,7 +342,7 @@ func (r *ccipChainReader) MsgsBetweenSeqNums( } msg.Message.Header.OnRamp = onRampAddress - msgs = append(msgs, msg.Message.ToMessage()) + msgs = append(msgs, msg.Message) } r.lggr.Infow("decoded messages between sequence numbers", "msgs", msgs,