@mimic-fi/v1-chainlink-price-oracle

0.0.4 • Public • Published

Chainlink Price Oracle

CI npm version

This repository contains an implementation of the Vault's PriceOracle. The PriceOracle is part of the core architecture and is in charge of providing an interface to rate a token based on another token to the Vault. This can be achieved using any type of on-chain oracle, then this repo provides a simple implementation using Chainlink V3.

Deployment

In order to deploy this smart contract locally you can simply do:

import { deploy } from '@mimic-fi/v1-helpers'

const tokens = [...]
const priceFeeds = [...]
const oracle = await deploy('@mimic-fi/v1-chainlink-price-oracle/artifacts/contracts/ChainlinkPriceOracle.sol/ChainlinkPriceOracle', [tokens, priceFeeds])

Development

In order to use a PriceOracle you can simply do:

import "@mimic-fi/v1-vault/contracts/interfaces/IPriceOracle.sol";

contract MyContract {
  IPriceOracle connector;

  function getTokenPrice(address token, address base)
    external
    returns (uint256)
  {
    return oracle.getTokenPrice(token, base);
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @mimic-fi/v1-chainlink-price-oracle

Weekly Downloads

0

Version

0.0.4

License

GPL-3.0

Unpacked Size

30.5 kB

Total Files

5

Last publish

Collaborators

  • facuspagnuolo
  • lkndjrt2