Skip to content

abhi3700/evm_contracts_defiavgprice

Repository files navigation

DeFi Utils - Token average price

Computationally efficient contract for calculating on-chain average token price for DeFi protocols

About

  • A keeper pushes a price of token(s).
  • Task: Find out the avg price of a token for a given time interval range, without iterating in loop (for, while).

Installation

$ npm install

Usage

Build

$ npx hardhat compile

Test

$ npx hardhat test

Deploying contracts to localhost Hardhat EVM

localhost-1

// on terminal-1
$ npx hardhat node

// on terminal-2
$ npx hardhat run deployment/hardhat/deploy_hardhat.ts --network localhost1

Deploying contracts to Testnet (Public)

ETH Testnet - Rinkeby

  • Environment variables
    • Create a .env file with its values:
INFURA_API_KEY=[YOUR_INFURA_API_KEY_HERE]
DEPLOYER_PRIVATE_KEY=[YOUR_DEPLOYER_PRIVATE_KEY_without_0x]
REPORT_GAS=<true_or_false>
  • Deploy the contracts
$ npx hardhat run deployment/testnet/Rinkeby/deploy_testnet_rinkeby.ts  --network rinkeby

Deploying contracts to Mainnet

ETH Mainnet

  • Environment variables
    • Create a .env file with its values:
INFURA_API_KEY=[YOUR_INFURA_API_KEY_HERE]
DEPLOYER_PRIVATE_KEY=[YOUR_DEPLOYER_PRIVATE_KEY_without_0x]
REPORT_GAS=<true_or_false>
  • Deploy the token on one-chain
$ npx hardhat run deployment/testnet/ETH/deploy_mainnet_eth.ts  --network mainnet

About

EVM smart contracts for on-chain token price.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published