Skip to content

Latest commit

 

History

History
99 lines (63 loc) · 2.73 KB

README.md

File metadata and controls

99 lines (63 loc) · 2.73 KB

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.