-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adaptation of Subgraph for Saucerswap v2 (#41)
Signed-off-by: Alfredo Gutierrez <[email protected]>
- Loading branch information
1 parent
a93fd92
commit 12545a8
Showing
23 changed files
with
6,970 additions
and
1,889 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Nodes Config | ||
HEDERA_THE_GRAPH_NODE=https://mainnet-thegraph.swirldslabs.com/manage | ||
IPFS_URL=https://api.thegraph.com/ipfs/ | ||
ACCESS_TOKEN=YOUR_ACCESS_TOKEN | ||
|
||
#SubGraph Config | ||
GRAPH_CONTRACT_ADDRESS=0x00000000000000000000000000000000003c3951 | ||
GRAPH_START_BLOCK=55651154 | ||
GRAPH_NETWORK=mainnet | ||
SUBGRAPH_NAME=saucerswap/saucerswapv2 | ||
|
||
# Specific to NFT Manager | ||
GRAPH_CONTRACT_NFT_MANAGER_ADDRESS=0x00000000000000000000000000000000003ddbb9 | ||
GRAPH_CONTRACT_NFT_MANAGER_START_BLOCK=56514876 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Nodes Config | ||
HEDERA_THE_GRAPH_NODE=https://testnet-thegraph.swirldslabs.com/manage | ||
IPFS_URL=https://api.thegraph.com/ipfs/ | ||
ACCESS_TOKEN=YOUR_ACCESS_TOKEN | ||
|
||
# SubGraph Config | ||
GRAPH_CONTRACT_ADDRESS=0x00000000000000000000000000000000001243ee | ||
GRAPH_START_BLOCK=11957 | ||
GRAPH_NETWORK=testnet | ||
SUBGRAPH_NAME=saucerswap/saucerswapv2 | ||
|
||
# Specific to NFT Manager | ||
GRAPH_CONTRACT_NFT_MANAGER_ADDRESS=0x000000000000000000000000000000000013f618 | ||
GRAPH_CONTRACT_NFT_MANAGER_START_BLOCK=12991 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["@typescript-eslint"], | ||
"extends": ["plugin:@typescript-eslint/recommended", "prettier", "prettier/@typescript-eslint"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
build/ | ||
node_modules/ | ||
src/types/ | ||
.DS_STORE | ||
yarn-error.log | ||
generated/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"semi": false, | ||
"singleQuote": true, | ||
"printWidth": 120 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,54 @@ | ||
# Uniswap V3 Subgraph | ||
# Saucerswap V2 Subgraph | ||
|
||
### Subgraph Endpoint | ||
|
||
Synced at: https://thegraph.com/hosted-service/subgraph/ianlapham/uniswap-v3-subgraph?selected=playground | ||
Synced at: https://mainnet-thegraph.swirldslabs.com/subgraphs/name/saucerswap-v2?selected=playground | ||
|
||
Pending Changes at same URL | ||
### Transitioning to Saucerswap V2: Key Adjustments | ||
|
||
The Saucerswap V2 subgraph is originally a fork of Uniswap v3 subgraph, but with some modifications to support Saucerswap V2. | ||
- All references to ETH and WETH have been replaced with HBAR and WHBAR respectively. | ||
- Token static definitions have been replaced with popular tokens on Hedera and Saucerswap. | ||
- Factory contract address has been updated to Saucerswap V2 factory contract address. | ||
- NFT Manager contract address has been updated to Saucerswap V2 NFT Manager contract address. | ||
- Abis have been updated to Saucerswap V2 abis, since the Saucerswap V2 contracts have different function signatures in some cases. Smart contracts to generate ABI files can be found in their respective repositories. | ||
- NFT Position Manager: https://github.com/saucerswaplabs/saucerswaplabs-v2-periphery | ||
- Factory and Pool: https://github.com/saucerswaplabs/saucerswaplabs-v2-core | ||
|
||
## Setup | ||
|
||
### Pre-requisites | ||
1. yarn | ||
2. thegraph cli | ||
3. nodejs | ||
4. HederaTheGraph Index Server | ||
|
||
### Getting Started | ||
|
||
The subgraph is able to run on 2 different networks: `mainnet` and `testnet`, for each network there is an example `.env` file, `.env.mainnet` and `.env.testnet` respectively. | ||
You will need to change the `ACCESS_TOKEN` for the correct one for the network you want to run the subgraph on, if you are planning to deploy on your own private node of `HederaTheGraph` instance you don't need to provide a valid one. | ||
|
||
1. Clone the project and install dependencies: | ||
```bash | ||
yarn install | ||
``` | ||
|
||
2. Create a `.env` file, you can use the example `.env.mainnet` or `.env.testnet` files as a template. | ||
```bash | ||
cp .env.mainnet .env | ||
``` | ||
|
||
3. Compile the subgraph | ||
```bash | ||
npm run compile | ||
``` | ||
|
||
4. Create the subgraph | ||
```bash | ||
npm run create | ||
``` | ||
|
||
5. Deploy the subgraph | ||
```bash | ||
npm run deploy | ||
``` |
Oops, something went wrong.