Skip to content

Commit

Permalink
upgrade @chainlink/contracts version
Browse files Browse the repository at this point in the history
  • Loading branch information
karen-stepanyan committed Apr 22, 2024
1 parent 744f1e5 commit da2d401
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/dull-baboons-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/ea-reference-data-reader': patch
---

Upgrade @chainlink/contracts dependency version
19 changes: 4 additions & 15 deletions packages/composites/rocket-pool/test/integration/adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,10 @@ jest.mock('ethers', () => ({
},
}))

jest.mock('@chainlink/contracts/ethers/v0.6/factories/AggregatorV2V3Interface__factory', () => ({
...jest.requireActual(
'@chainlink/contracts/ethers/v0.6/factories/AggregatorV2V3Interface__factory',
),
AggregatorV2V3Interface__factory: {
connect: function () {
return {
latestAnswer: async () => {
return jest.requireActual('ethers').BigNumber.from('129000000000')
},
decimals: () => {
return jest.requireActual('ethers').BigNumber.from(8)
},
}
},
jest.mock('@chainlink/ea-reference-data-reader', () => ({
...jest.requireActual('@chainlink/ea-reference-data-reader'),
getLatestAnswer: () => {
return 1290
},
}))

Expand Down
6 changes: 3 additions & 3 deletions packages/core/reference-data-reader/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ethers } from 'ethers'
import { util, Logger, AdapterConfigError, AdapterDataProviderError } from '@chainlink/ea-bootstrap'
import { AggregatorV2V3Interface__factory } from '@chainlink/contracts/ethers/v0.6/factories/AggregatorV2V3Interface__factory'
import abi from '@chainlink/contracts/abi/v0.8/AggregatorV2V3Interface.json'
import { BigNumber } from 'ethers/utils'

export interface RoundData {
Expand Down Expand Up @@ -49,7 +49,7 @@ export const getRpcLatestAnswer: ReferenceLatestAnswer = async (
try {
const rpcUrl = getRpcUrl(network)
const provider = new ethers.providers.JsonRpcProvider(rpcUrl)
const aggregator = AggregatorV2V3Interface__factory.connect(contractAddress, provider)
const aggregator = new ethers.Contract(contractAddress, abi, provider)
const decimals = computeDecimals ? await aggregator.decimals() : 0
return (await aggregator.latestAnswer())
.div(multiply)
Expand All @@ -70,7 +70,7 @@ export const getRpcLatestRound: ReferenceDataRound = async (
): Promise<RoundData> => {
const rpcUrl = getRpcUrl(network)
const provider = new ethers.providers.JsonRpcProvider(rpcUrl)
const aggregator = AggregatorV2V3Interface__factory.connect(contractAddress, provider)
const aggregator = new ethers.Contract(contractAddress, abi, provider)
return await aggregator.latestRoundData()
}

Expand Down

0 comments on commit da2d401

Please sign in to comment.