dapp/src/components/TestComponent.js
// the  X address then can call the API to updateData in the oracle contrac
the  X address then can call the API to updateData in the oracle contrac
the X address then can call the API to updateData in the oracle contrac
async function updateData () {
        const response = await CoinGeckoClient.coins.fetch('bitcoin', {});
        let currentPrice = parseFloat(response.data.market_data.current_price.usd);
        currentPrice = parseInt(currentPrice * 100);
        await oracleContractInstance.methods.updateData(
              web3.utils.soliditySha3('BTC/USD'), currentPrice).send({from: accounts[0]});
        console.log(`new price for BTC/USD ${currentPrice} updated on-chain`);
    }
async function updateData ( ) { const response = await CoinGeckoClient . coins . fetch ( 'bitcoin' , { } ) ; let currentPrice = parseFloat ( response . data . market_data . current_price . usd ) ; currentPrice = parseInt ( currentPrice * 100 ) ; await oracleContractInstance . methods . updateData ( web3 . utils . soliditySha3 ( 'BTC/USD' ) , currentPrice ) . send ( { from : accounts [ 0 ] } ) ; console . log ( ` ${ currentPrice } ` ) ; }
the  X address then can call the API to updateData in the oracle contrac
the X address then can call the API to updateData in the oracle contrac