Monday, November 6, 2023

177: Chainlink Oracle

 Chainlink interfaces allow real time data to be injected to a smart contract. A common use for this is to obtain the live trading price of a token. By using Chainlink's Aggregator V3 Interface we can extract the price out of a tuple to use in our code. However, as with many things in Solidity, we need to be careful abput the number of decimals in the returned value and be sure to convert it as necessary. The Goerli test net value returns with 8 decimals, so must be converted into wei or USD as appropriate. 

No comments:

Post a Comment

190: Sablier

 The CodeHawks platform has an upcoming audit on the Sablier protocol, so I decided to read through the docs and familiarize myself with the...