Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CCIP-2958] Token price reader implementation #67

Merged
merged 22 commits into from
Aug 20, 2024
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7a78a26
WIP new token price reader
asoliman92 Aug 14, 2024
b324085
Bind first token aggregator to price reader
asoliman92 Aug 14, 2024
a64c23b
Moving price reader binding to chainlink inprocess.go and removing fr…
asoliman92 Aug 14, 2024
f942eea
Calculate USD price per 1e18 of smallest token denomination with 18 d…
asoliman92 Aug 15, 2024
6829d88
Fix call to GetLatestValue
asoliman92 Aug 15, 2024
2b55c95
Merge branch 'ccip-develop' into price-reader
asoliman92 Aug 15, 2024
9c4952d
Add decimals to offchain config
asoliman92 Aug 16, 2024
dc73503
Use TokenDecimals in on chain reader
asoliman92 Aug 19, 2024
19851b0
Normalize raw token prices
asoliman92 Aug 19, 2024
8bcd098
Validate all tokens has decimals in offchain config
asoliman92 Aug 19, 2024
691c7a6
Add comments
asoliman92 Aug 19, 2024
cf816e6
Merge branch 'ccip-develop' into price-reader
asoliman92 Aug 19, 2024
c31764c
Add new on chain prices reader to commitocb factory
asoliman92 Aug 19, 2024
2fe0c01
Validate ArbitrumPriceSource in the offchain config
asoliman92 Aug 19, 2024
2bc1395
Add comments
asoliman92 Aug 19, 2024
4e88e66
Merge branch 'ccip-develop' into price-reader
asoliman92 Aug 19, 2024
6ef8ee4
Fix tests - failing because of race condition
asoliman92 Aug 19, 2024
2b33e54
Make the test work with one token as expected
asoliman92 Aug 20, 2024
952025a
Update pluginconfig/commit.go
asoliman92 Aug 20, 2024
1661bba
Update pluginconfig/commit.go
asoliman92 Aug 20, 2024
fad8a3a
review comments
asoliman92 Aug 20, 2024
0f52997
Merge branch 'ccip-develop' into price-reader
asoliman92 Aug 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make the test work with one token as expected
Signed-off-by: asoliman <abdelrahman.soliman@smartcontract.com>
  • Loading branch information
asoliman92 committed Aug 20, 2024
commit 2b33e54f8afcea5df5bf2a3c89d725b3bf724f8e
14 changes: 7 additions & 7 deletions internal/reader/onchain_prices_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var (
)

func TestOnchainTokenPricesReader_GetTokenPricesUSD(t *testing.T) {
t.Skip("Skipping until we have a full price reader implementation")
//t.Skip("Skipping until we have a full price reader implementation")
testCases := []struct {
name string
inputTokens []ocr2types.Account
Expand All @@ -44,24 +44,24 @@ func TestOnchainTokenPricesReader_GetTokenPricesUSD(t *testing.T) {
wantErr bool
}{
{
name: "On-chain price",
name: "On-chain one price",
// No need to put sources as we're mocking the reader
priceSources: map[ocr2types.Account]pluginconfig.ArbitrumPriceSource{},
tokenDecimals: map[ocr2types.Account]uint8{
ArbAddr: Decimals18,
OpAddr: Decimals18,
EthAddr: Decimals18,
},
inputTokens: []ocr2types.Account{ArbAddr, OpAddr, EthAddr},
inputTokens: []ocr2types.Account{ArbAddr},
//TODO: change once we have control to return different prices in mock depending on the token
mockPrices: []*big.Int{ArbPrice, OpPrice, EthPrice},
want: []*big.Int{ArbPrice, OpPrice, EthPrice},
mockPrices: []*big.Int{ArbPrice},
want: []*big.Int{ArbPrice},
},
{
name: "Missing price should error",
priceSources: map[ocr2types.Account]pluginconfig.ArbitrumPriceSource{},
inputTokens: []ocr2types.Account{ArbAddr, OpAddr, EthAddr},
mockPrices: []*big.Int{ArbPrice, OpPrice},
inputTokens: []ocr2types.Account{ArbAddr},
mockPrices: []*big.Int{},
errorAccounts: []ocr2types.Account{EthAddr},
want: nil,
wantErr: true,
Expand Down
Loading