Using Band Oracle
The repo https://github.com/harmony-one/band_oracle contains examples on how to fetch price feeds using band oracle.
There are two scenarios:
  • Fetching price feed in your javascript application code
  • Fetching price feed in your smart contract

Requesting data using BandChain.js library

1
git clone https://github.com/harmony-one/band_oracle
2
cd band_oracle
3
4
yarn
5
node main.js
Copied!

Using BandChain data in EVM Smart Contract in Harmony

1
git clone https://github.com/harmony-one/band_oracle
2
cd band_oracle
3
4
yarn
5
export PRIVATE_KEY=place your private key here
6
yarn hardhat run ./scripts/deploy.js
Copied!
Contract's been deployed and you can call getPrice or getMultiPrices to get actual prices. More details with code snippets are in https://docs.harmony.one/home/developers/tools/oracle-band-protocol
Band’s StdReference contract for testnet 0xE740092E081CA7491A46C8Aa0175446e962e2A08
Mainnet contract is coming soon...