Skip to content

Commit cb4c31b

Browse files
authored
CCIP - add price reader interfaces to ChainAccessor and move some generic types, clean others up (#1487)
* CCIP - add price reader interfaces to ChainAccessor and move some generic types * update a few more functions * use TimestampedUnixBig instead of TimestampedBig * preserve zeros when converting between PB types * move TokenInfo to cl-common and add to GetFeedPricesUSD args * resync accessor sync calls on relayer restart * nits * change persisted sync storage to a map[] instead of SyncRequest * use maps.Clone * move persisted syncs conversion to ccipprovider
1 parent 21a3c87 commit cb4c31b

17 files changed

Lines changed: 2578 additions & 364 deletions

pkg/loop/internal/pb/ccipocr3/chainaccessor.pb.go

Lines changed: 571 additions & 88 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/loop/internal/pb/ccipocr3/chainaccessor.proto

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ service ChainAccessor {
3030
rpc GetExpectedNextSequenceNumber(GetExpectedNextSequenceNumberRequest) returns (GetExpectedNextSequenceNumberResponse);
3131
rpc GetTokenPriceUSD(GetTokenPriceUSDRequest) returns (GetTokenPriceUSDResponse);
3232
rpc GetFeeQuoterDestChainConfig(GetFeeQuoterDestChainConfigRequest) returns (GetFeeQuoterDestChainConfigResponse);
33+
34+
// USDCMessageReader methods
35+
rpc MessagesByTokenID(MessagesByTokenIDRequest) returns (MessagesByTokenIDResponse);
36+
37+
// PriceReader methods
38+
rpc GetFeedPricesUSD(GetFeedPricesUSDRequest) returns (GetFeedPricesUSDResponse);
39+
rpc GetFeeQuoterTokenUpdates(GetFeeQuoterTokenUpdatesRequest) returns (GetFeeQuoterTokenUpdatesResponse);
3340
}
3441

3542
// AllAccessors request/response messages
@@ -101,7 +108,7 @@ message GetChainFeePriceUpdateRequest {
101108
}
102109

103110
message GetChainFeePriceUpdateResponse {
104-
map<uint64, TimestampedBig> fee_price_updates = 1; // key is chain selector
111+
map<uint64, TimestampedUnixBig> fee_price_updates = 1; // key is chain selector
105112
}
106113

107114
message GetLatestPriceSeqNrResponse {
@@ -337,4 +344,46 @@ message FeeQuoterDestChainConfig {
337344
uint32 gas_price_staleness_threshold = 19;
338345
bool enforce_out_of_order = 15;
339346
bytes chain_family_selector = 16; // [4]byte in Go
347+
}
348+
349+
// USDCMessageReader request/response messages
350+
message MessagesByTokenIDRequest {
351+
uint64 source_chain_selector = 1;
352+
uint64 dest_chain_selector = 2;
353+
map<string, RampTokenAmount> tokens = 3; // key is MessageTokenID string representation
354+
}
355+
356+
message MessagesByTokenIDResponse {
357+
map<string, bytes> messages = 1; // key is MessageTokenID string representation, value is message bytes
358+
}
359+
360+
// PriceReader request/response messages
361+
message GetFeedPricesUSDRequest {
362+
repeated string tokens = 1; // UnknownEncodedAddress
363+
map<string, TokenInfo> token_info = 2; // key is UnknownEncodedAddress
364+
}
365+
366+
message GetFeedPricesUSDResponse {
367+
map<string, BigInt> prices = 1; // key is UnknownEncodedAddress, value is price
368+
}
369+
370+
message GetFeeQuoterTokenUpdatesRequest {
371+
repeated string tokens = 1; // UnknownEncodedAddress
372+
uint64 chain_selector = 2;
373+
}
374+
375+
message GetFeeQuoterTokenUpdatesResponse {
376+
map<string, TimestampedUnixBig> token_updates = 1; // key is UnknownEncodedAddress
377+
}
378+
379+
// Helper message types
380+
message MessageTokenID {
381+
uint64 seq_nr = 1;
382+
int32 index = 2;
383+
}
384+
385+
message TokenInfo {
386+
string aggregator_address = 1; // UnknownEncodedAddress
387+
BigInt deviation_ppb = 2;
388+
uint32 decimals = 3;
340389
}

pkg/loop/internal/pb/ccipocr3/chainaccessor_grpc.pb.go

Lines changed: 118 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)