Chainlink Gas Oracle – How to Integrate Chainlink Fast Gas Oracle

chainlinkgasgas-priceoracles

I am trying to estimate the gas fee in USD for a function call. I came across the term "Chainlink Fast Gas oracle" but I couldn't find any documentation on how to use this in a smart contract? There is this website but nothing else: https://data.chain.link/ethereum/mainnet/gas/fast-gas-gwei

Best Answer

On your link you have the contract address, which is 0x169e633a2d1e6c10dd91238ba11c4a708dfef37c ContractAddress

And you have this specific function that you can call to get the current gwei:

function latestRoundData()
    public
    view
    virtual
    override
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

It will returns something like this:

Gwei

You can call this function from your smart contract if needed, if you want the USD price, you can do the same process by multiplying ETH/USD price by GWEI, ETH/USD

Related Topic