Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/YolaYing/Onchain-Price-Oracle
https://github.com/YolaYing/Onchain-Price-Oracle
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/YolaYing/Onchain-Price-Oracle
- Owner: YolaYing
- License: mit
- Created: 2024-01-19T15:53:23.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-01-19T15:55:40.000Z (12 months ago)
- Last Synced: 2024-08-02T13:29:37.183Z (5 months ago)
- Language: TypeScript
- Size: 95.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ora - Onchain Price Oracle
README
# Time-Weighted Average Price (TWAP) Oracle Based on Zkgraph
## Introduction to this project
This project implements a Time-Weighted Average Price (TWAP) Oracle using TypeScript and the @hyperoracle/zkgraph-lib library. The TWAP Oracle is designed to calculate the average price of a token over a specified time period based on events on-chain. The test case used in this implementation is for Test USDT on the Sepolia Testnet.
## Test Contract and Block id
when debugging execution and proof generation, you may use:
- block id: 5114301
- contract address: 0x7169D38820dfd117C3FA1f22a697dBA58d90BA06or you can just use 'script.sh' to test the whole workflow(remember to fill in the zkgraph.config.ts)
## Usage CLI
> Note: Only `full` image will be processed by zkOracle node. `local` (generated by commands ending with `--local` option) means the zkGraph is compiled locally and only contains partial computation (so that proving and executing will be faster).
The workflow of local zkGraph development must follow: `Develop` (code in /src) -> `Compile` (get compiled wasm image) -> `Execute` (get expected output) -> `Prove` (generate input and pre-test for actual proving in zkOracle) -> `Verify` (verify proof on-chain).
To upload and publish your zkGraph, you should `Upload` (upload code to IPFS), and then `Publish` (register zkGraph on onchain zkGraph Registry).
## Commonly used commands
- **compile**: `npx zkgraph compile`
- **exec**: `npx zkgraph exec `
- **prove**: ` npx zkgraph prove -i|-t|-p`
- ……Read more: https://github.com/hyperoracle/zkgraph-cli#cli