Skip to content

fluxprotocol/fpo-evm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

2b7c713 · Sep 7, 2022
Mar 7, 2022
Nov 17, 2021
Aug 26, 2022
Nov 17, 2021
Aug 29, 2022
Sep 7, 2022
Feb 14, 2022
Aug 29, 2022
Aug 29, 2022
Mar 16, 2022
Nov 17, 2021
Nov 17, 2021
Nov 17, 2021
Mar 16, 2022
Nov 17, 2021
Nov 17, 2021
Nov 18, 2021
Nov 17, 2021
Nov 17, 2021
Nov 17, 2021
Nov 17, 2021
Nov 17, 2021
Nov 17, 2021
Nov 17, 2021
Sep 7, 2022
Aug 29, 2022
Mar 10, 2022
Nov 17, 2021
Mar 10, 2022

Repository files navigation

Flux - First-Party Price Feeds for EVM

This repository contains contracts for first-party price feeds for EVM chains, using OpenZeppelin for access control. Those with a validator role can post numeric data to deployed contracts at any interval. FluxPriceFeed contracts are compatible with Chainlink's V2 and V3 aggregator interface, and the FluxPriceFeedFactory contract is EIP-2362 compatible.

If you are a smart contract developer looking to utilize Flux price feeds, check out the live pairs on the documentation and copy the interface file contracts/interface/CLV2V3Interface.sol to use within your contracts. The contracts ExamplePriceFeedConsumer and RelayerOracleConsumer demonstrate how to use a price feed within a smart contract.

If you are interested in becoming a first-party data provider, deploy a price feed factory or individual price feed using the instructions in this repository and post data to it using the fpo-node.

See the docs/ directory for more information on using the contracts.

Usage

Pre-Requisites

Before running any command, you need to create a .env file and set a BIP-39 compatible mnemonic as an environment variable. Follow the example in .env.example. If you don't already have a mnemonic, use this website to generate one.

Then, proceed with installing dependencies:

yarn install

Next, compile the smart contracts with Hardhat:

$ yarn compile

TypeChain

Compile the smart contracts and generate TypeChain artifacts:

$ yarn typechain

Lint Solidity

Lint the Solidity code:

$ yarn lint:sol

Lint TypeScript

Lint the TypeScript code:

$ yarn lint:ts

Test

Run the Mocha tests:

$ yarn test

Coverage

Generate the code coverage report:

$ yarn coverage

Report Gas

See the gas usage per unit test and average gas per method call:

$ REPORT_GAS=true yarn test

Clean

Delete the smart contract artifacts, the coverage reports and the Hardhat cache:

$ yarn clean

Syntax Highlighting

If you use VSCode, you can enjoy syntax highlighting for your Solidity code via the vscode-solidity extension. The recommended approach to set the compiler version is to add the following fields to your VSCode user settings:

{
  "solidity.compileUsingRemoteVersion": "v0.8.4+commit.c7e474f2",
  "solidity.defaultCompiler": "remote"
}

Where of course v0.8.4+commit.c7e474f2 can be replaced with any other version.