Skip to content

Commit

Permalink
Update of Subgraph saucerswap-v2 code for newer version (#89)
Browse files Browse the repository at this point in the history
Signed-off-by: Alfredo Gutierrez <[email protected]>
  • Loading branch information
AlfredoG87 authored Jun 13, 2024
1 parent ceb2fe8 commit 50f10ae
Show file tree
Hide file tree
Showing 43 changed files with 5,817 additions and 7,692 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/saucerswap-v2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: SaucerSwap V2 Subgraph

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-and-test:
name: build-and-test
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '18.x'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/subgraphs/saucerswap/v2/yarn.lock') }}
restore-keys: |
yarn-
- name: Install dependencies
working-directory: subgraphs/saucerswap/v2
run: yarn install

- name: Build project
working-directory: subgraphs/saucerswap/v2
run: yarn build

- name: Build Docker
working-directory: subgraphs/saucerswap/v2
run: yarn build:docker

- name: Test
working-directory: subgraphs/saucerswap/v2
run: yarn test:no-tty
4 changes: 0 additions & 4 deletions subgraphs/saucerswap/v2/.env.mainnet
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,3 @@ GRAPH_CONTRACT_ADDRESS=0x00000000000000000000000000000000003c3951
GRAPH_START_BLOCK=55651154
GRAPH_NETWORK=mainnet
SUBGRAPH_NAME=saucerswap/saucerswap-v2

# Specific to NFT Manager
GRAPH_CONTRACT_NFT_MANAGER_ADDRESS=0x00000000000000000000000000000000003ddbb9
GRAPH_CONTRACT_NFT_MANAGER_START_BLOCK=56514876
4 changes: 0 additions & 4 deletions subgraphs/saucerswap/v2/.env.testnet
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,3 @@ GRAPH_CONTRACT_ADDRESS=0x00000000000000000000000000000000001243ee
GRAPH_START_BLOCK=11957
GRAPH_NETWORK=testnet
SUBGRAPH_NAME=saucerswap/saucerswap-v2

# Specific to NFT Manager
GRAPH_CONTRACT_NFT_MANAGER_ADDRESS=0x000000000000000000000000000000000013f618
GRAPH_CONTRACT_NFT_MANAGER_START_BLOCK=12991
5 changes: 0 additions & 5 deletions subgraphs/saucerswap/v2/.eslintrc

This file was deleted.

47 changes: 47 additions & 0 deletions subgraphs/saucerswap/v2/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
require('@uniswap/eslint-config/load')

module.exports = {
extends: ['@uniswap/eslint-config/node'],
rules: {
'@typescript-eslint/no-inferrable-types': 'off',
'import/no-unused-modules': 'off',
'@typescript-eslint/no-restricted-imports': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
],
'@typescript-eslint/no-this-alias': [
'error',
{
allowDestructuring: true, // Allow `const { props, state } = this`; false by default
allowedNames: [
'self', // Allow `const self= this`; `[]` by default
],
},
],
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-types': [
'error',
{
types: {
// Allow BigInt (uppercase)
BigInt: false,
},
},
],
},
overrides: [
{
files: ['tests/**/*.ts'],
settings: {
jest: {
version: 26,
},
// jest is added as a plugin in our org's eslint config, but we use
// matchstick, and this would crash when linting matchstick files.
'disable/plugins': ['jest'],
},
},
],
}
4 changes: 3 additions & 1 deletion subgraphs/saucerswap/v2/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ node_modules/
src/types/
.DS_STORE
yarn-error.log
generated/
tests/.bin/
tests/.docker/
tests/.latest.json
7 changes: 4 additions & 3 deletions subgraphs/saucerswap/v2/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"semi": false,
"singleQuote": true,
"printWidth": 120
"semi": false,
"singleQuote": true,
"printWidth": 120,
"trailingComma": "all"
}
21 changes: 21 additions & 0 deletions subgraphs/saucerswap/v2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# copied from https://github.com/LimeChain/demo-subgraph/blob/main/Dockerfile

FROM --platform=linux/x86_64 ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive

ENV ARGS=""

RUN apt update \
&& apt install -y sudo curl postgresql postgresql-contrib

RUN curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - \
&& sudo apt-get install -y nodejs

RUN curl -OL https://github.com/LimeChain/matchstick/releases/download/0.6.0/binary-linux-22 \
&& chmod a+x binary-linux-22

RUN mkdir matchstick
WORKDIR /matchstick

CMD ../binary-linux-22 ${ARGS}
7 changes: 7 additions & 0 deletions subgraphs/saucerswap/v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,10 @@ You will need to change the `ACCESS_TOKEN` for the correct one for the network y
```bash
npm run deploy
```

### Running Unit Tests

1. Install [Docker](https://docs.docker.com/get-docker/) if you don't have it already
2. Install postgres: `brew install postgresql`
3. `yarn run build:docker`
4. `yarn run test`
2 changes: 1 addition & 1 deletion subgraphs/saucerswap/v2/abis/ERC20.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"outputs": [
{
"name": "",
"type": "uint8"
"type": "uint32"
}
],
"payable": false,
Expand Down
Loading

0 comments on commit 50f10ae

Please sign in to comment.