This project demonstrates how to fetch the latest ETH/USD price using Chainlink Price Feeds on the Arbitrum Sepolia network.
- Install dependencies:
npm install
- Compile the contract:
npx hardhat compile
- Run tests:
npx hardhat test
- Deploy to Arbitrum Sepolia:
npx hardhat run scripts/deploy.js --network arbitrum-sepolia
- Interact with the deployed contract using Hardhat console or scripts.
To fetch the latest price from the deployed contract, use the getLatestPrice
function:
const contract = await ethers.getContractAt(
"PricefeedConsumer",
"DEPLOYED_CONTRACT_ADDRESS"
);
console.log(await contract.getLatestPrice());