Arbitrum
Read and update manually
Update and read on-chain
To update the price:
import { ethers } from 'ethers';
// Set up your Ethereum provider
const provider = new ethers.providers.JsonRpcProvider("<YOUR_PROVIDER_URL>");
// Initialize wallet using private key and connect it to the provider
const wallet = new ethers.Wallet("<YOUR_PRIVATE_KEY>", provider);
// Smart contract address
const contractAddress = "0xff2743c44f820c64c94eccfc1b497a1019541097";
// ABI definition of the contract's refreshPriceFeeds method
const abi = [
"function refreshPriceFeeds() payable external"
];
// Create an instance of the contract
const contract = new ethers.Contract(contractAddress, abi, wallet);
async function refreshPriceFeeds() {
try {
// Define the amount of ETH to send (0.00000112 ETH)
const amountToSend = ethers.utils.parseEther("0.00000112");
// Call the refreshPriceFeeds function, sending 0.00000112 ETH
const tx = await contract.refreshPriceFeeds({
value: amountToSend // Send 0.00000112 ETH
});
// Wait for the transaction to be mined
console.log("Transaction sent. Waiting for confirmation...");
const receipt = await tx.wait();
console.log("Transaction confirmed, receipt:", receipt);
} catch (error) {
console.error("Error while calling refreshPriceFeeds:", error);
}
}
// Call the function
refreshPriceFeeds();Read the price on-chain:
Last updated
Was this helpful?

