Cross Prices
Last updated
Last updated
This guide walks you through consuming Cross Prices on Arbitrum using our on-chain delivery. Several asset pairs are publicly available, meaning you can access free hourly updates or update on-demand by covering the gas fee. We've developed this solution to demonstrate how you could consume our data on-chain. If you're interested in consuming any other Kaiko data on-chain please get in touch.
Visit onchain.kaiko.com. Here, you can see the latest Kaiko price updates for all pairs.
To update the price:
Click "connect wallet"
Once you've connected your wallet, click "Update"
Authorize the gas payment of 0.00000112 ETH
Wait a few seconds for the prices to be updated
To read and update on-chain, you'll need to set up an off-chain listening event using a node provider of your choice to connect to the blockchain.
This example script uses Typescript, but you can produce similar results using other coding languages. Running the script requests a price update and listens until it's been updated on-chain. When the update is detected, it alerts your on-chain smart contract.
Install ethers npm install ethers
Send a gas fee with a value of 0.00000112 ETH to the refreshPriceFeeds
contract address 0xff2743c44f820c64c94eccfc1b497a1019541097
Wait for at least one block for the price update to be reflected on-chain
This Solidity contract example is triggered by the refreshPriceFeeds
function in the Typescript example above. When triggered, it ingests the updated prices on-chain.
Although one price update refreshes all prices on-chain, you must read each price feed individually. See the price feeds and their corresponding addresses at onchain.kaiko.com.