Skip to content

Commit

Permalink
gh: Project Structure refactor (#12)
Browse files Browse the repository at this point in the history
* move hh project to the repo root

* updated the readme

* update pr workflow

* update .gitignore
  • Loading branch information
pajicf authored Dec 10, 2023
1 parent 8b3ab2d commit 640d454
Show file tree
Hide file tree
Showing 50 changed files with 90 additions and 497 deletions.
File renamed without changes.
6 changes: 6 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DEPLOYER_PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1

ETHEREUM_GOERLI_RPC=API
ETHEREUM_SEPOLICA_RPC=API

ETHERSCAN_API_KEY=API
4 changes: 4 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,9 @@ jobs:
path: node_modules
key: node_modules-${{ hashFiles('**/yarn.lock') }}

- name: Create mock .env file
run: |
cp .env.test .env
- name: All Tests pass
run: yarn test
16 changes: 8 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
node_modules/

# Hardhat / Solidity
contracts/cache
contracts/artifacts
contracts/coverage
contracts/coverage.json
contracts/typechain
contracts/typechain-types
contracts/ignition/deployments/**/build-info
contracts/ignition/deployments/**/artifacts/*.dbg.json
/cache
/artifacts
/coverage
/coverage.json
/typechain
/typechain-types
/ignition/deployments/**/build-info
/ignition/deployments/**/artifacts/*.dbg.json
File renamed without changes.
File renamed without changes.
59 changes: 55 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,56 @@
# Token Price Oracle
A simple oracle for tracking token prices on-chain and accompanying API
for tracking & management of the data.
![Token Price Oracle - SC - banner](./assets/banner.jpeg)
# Token Price Oracle - Smart Contracts 📑
The core Solidity contracts for the Token Price Oracle

## Contributions
## Requirements ✅
To run the project, you'll need:
- [Node.js](https://nodejs.org/en/) (Version 16 works)
- [Yarn](https://yarnpkg.com/)

## Running the project 🚀
### Installation ⚙️
#### Git 🦑
1. Clone the repo: ```git clone https://github.com/pajicf/token-price-oracle.git```
2. Navigate to the folder: ```cd token-price-oracle```

#### Installing the dependencies 🧱
3. Run ```yarn``` to install the dependencies
4. Run ```cp .env.example .env``` and fill the values

#### Hardhat 👷‍♂️
- Compile: ```yarn compile```
- Tests: ```yarn test```

#### Contracts CLI 🧑‍💻
- Set a new price for a ticker: ```yarn contracts:set-ticker-price```
- Set a new feed for a ticker: ```yarn contracts:set-ticker-feed```

#### Miscellanious 🧹
- Project linting: ```yarn lint```
- Documentation generation: ```yarn docs:generate```

## Documentation 📚
All the Smart Contract documentation can be found inside the `/docs` folder:
- [`docs/api`](https://github.com/pajicf/token-price-oracle/tree/main/docs/api) - Contains the API of the Smart Contracts generated from the natspec
- [`docs/diagrams`](https://github.com/pajicf/token-price-oracle/tree/main/docs/diagrams) - Contains the Diagrams of common SC interactions

## Deployments 🌐
### How to Deploy on a new network? 📜
The Deployment is done decoratively using [Hardhat Ignition](https://hardhat.org/ignition/docs/getting-started#overview).
To deploy to the new network, you should:
1. Add the network to the [`hardhat.config.ts`](https://github.com/pajicf/token-price-oracle/blob/main/contracts/hardhat.config.ts) file
2. Run ```yarn hardhat ignition deploy /ignition/modules/TickerPriceStorage.ts --network yournewnetwok --verify```
> [!IMPORTANT]
> Ensure that the network you're deploying supports Etherscan for verification to be successfull
### Bytecode 💼
All the deployment and build artifacts are located inside [`ignition/deplotments`](https://github.com/pajicf/token-price-oracle/tree/main/ignition/deployments)

### Block Explorer Links 🔎
Ξ Ethereum Göerli:
`TickerUSDFeedRegistry`: [0xF3D020838782213d3da52daa079A9c07F0A8e67e](https://goerli.etherscan.io/address/0xF3D020838782213d3da52daa079A9c07F0A8e67e#code)
`TickerPriceStorage`: [0xa909e0bC9a35cC161dE9eA85cA76AB7A9b5b0121](https://goerli.etherscan.io/address/0xa909e0bC9a35cC161dE9eA85cA76AB7A9b5b0121#code)

Ξ Ethereum Sepolia:
`TickerUSDFeedRegistry`: [0xF3D020838782213d3da52daa079A9c07F0A8e67e](https://sepolia.etherscan.io/address/0xF3D020838782213d3da52daa079A9c07F0A8e67e#code)
`TickerPriceStorage`: [0xa909e0bC9a35cC161dE9eA85cA76AB7A9b5b0121](https://sepolia.etherscan.io/address/0xa909e0bC9a35cC161dE9eA85cA76AB7A9b5b0121#code)
File renamed without changes
56 changes: 0 additions & 56 deletions contracts/README.md

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 640d454

Please sign in to comment.