Skip to content

Commit

Permalink
chore(); uniswap-forks; add uniswap forks swap subgraphs on base (#2325)
Browse files Browse the repository at this point in the history
Co-authored-by: Dhruv Chauhan <dhruv@Dhruvs-MacBook-Pro.local>
Co-authored-by: Chris Steege <56660047+steegecs@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 17, 2023
1 parent f9e936b commit 7fd4e20
Show file tree
Hide file tree
Showing 26 changed files with 1,890 additions and 52 deletions.
194 changes: 142 additions & 52 deletions deployment/deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -3877,58 +3877,6 @@
}
}
},
"pancakeswap-v3-swap": {
"schema": "dex-amm",
"base": "uniswap-v3-forks-swap",
"protocol": "pancakeswap-v3-swap",
"project": "pancakeswap",
"deployments": {
"pancakeswap-v3-swap-bsc": {
"network": "bsc",
"status": "dev",
"versions": {
"schema": "4.0.1",
"subgraph": "1.0.0",
"methodology": "1.0.0"
},
"files": {
"template": "pancakeswap.v3.swap.template.yaml"
},
"options": {
"prepare:yaml": true,
"prepare:constants": true
},
"services": {
"hosted-service": {
"slug": "pancakeswap-v3-swap-bsc",
"query-id": "pancakeswap-v3-swap-bsc"
}
}
},
"pancakeswap-v3-swap-ethereum": {
"network": "ethereum",
"status": "dev",
"versions": {
"schema": "4.0.1",
"subgraph": "1.0.0",
"methodology": "1.0.0"
},
"files": {
"template": "pancakeswap.v3.swap.template.yaml"
},
"options": {
"prepare:yaml": true,
"prepare:constants": true
},
"services": {
"hosted-service": {
"slug": "pancakeswap-v3-swap-ethereum",
"query-id": "pancakeswap-v3-swap-ethereum"
}
}
}
}
},
"sushiswap-v3": {
"schema": "dex-amm",
"base": "uniswap-v3-forks",
Expand Down Expand Up @@ -4173,6 +4121,118 @@
}
}
},
"uniswap-v3-swap": {
"schema": "dex-amm",
"base": "uniswap-v3-forks-swap",
"protocol": "uniswap-v3-swap",
"project": "uniswap",
"deployments": {
"uniswap-v3-swap-base": {
"network": "base",
"status": "dev",
"versions": {
"schema": "4.0.1",
"subgraph": "1.0.0",
"methodology": "1.0.0"
},
"files": {
"template": "uniswap.v3.swap.template.yaml"
},
"options": {
"prepare:yaml": true,
"prepare:constants": true
},
"services": {
"hosted-service": {
"slug": "uniswap-v3-swap-base",
"query-id": "uniswap-v3-swap-base"
}
}
}
}
},
"pancakeswap-v3-swap": {
"schema": "dex-amm",
"base": "uniswap-v3-forks-swap",
"protocol": "pancakeswap-v3-swap",
"project": "pancakeswap",
"deployments": {
"pancakeswap-v3-swap-bsc": {
"network": "bsc",
"status": "dev",
"versions": {
"schema": "4.0.1",
"subgraph": "1.0.0",
"methodology": "1.0.0"
},
"files": {
"template": "pancakeswap.v3.swap.template.yaml"
},
"options": {
"prepare:yaml": true,
"prepare:constants": true
},
"services": {
"hosted-service": {
"slug": "pancakeswap-v3-swap-bsc",
"query-id": "pancakeswap-v3-swap-bsc"
}
}
},
"pancakeswap-v3-swap-ethereum": {
"network": "ethereum",
"status": "dev",
"versions": {
"schema": "4.0.1",
"subgraph": "1.0.0",
"methodology": "1.0.0"
},
"files": {
"template": "pancakeswap.v3.swap.template.yaml"
},
"options": {
"prepare:yaml": true,
"prepare:constants": true
},
"services": {
"hosted-service": {
"slug": "pancakeswap-v3-swap-ethereum",
"query-id": "pancakeswap-v3-swap-ethereum"
}
}
}
}
},
"sushiswap-v3-swap": {
"schema": "dex-amm",
"base": "uniswap-v3-forks-swap",
"protocol": "sushiswap-v3-swap",
"project": "sushiswap",
"deployments": {
"sushiswap-v3-swap-base": {
"network": "base",
"status": "dev",
"versions": {
"schema": "4.0.1",
"subgraph": "1.0.0",
"methodology": "1.0.0"
},
"files": {
"template": "sushiswap.v3.swap.template.yaml"
},
"options": {
"prepare:yaml": true,
"prepare:constants": true
},
"services": {
"hosted-service": {
"slug": "sushiswap-v3-swap-base",
"query-id": "sushiswap-v3-swap-base"
}
}
}
}
},
"osmosis-dex": {
"schema": "dex-amm",
"base": "osmosis-dex",
Expand Down Expand Up @@ -5211,6 +5271,36 @@
}
}
},
"baseswap-swap": {
"schema": "dex-amm",
"base": "uniswap-forks-swap",
"protocol": "baseswap-swap",
"project": "baseswap",
"deployments": {
"baseswap-swap-base": {
"network": "base",
"status": "dev",
"versions": {
"schema": "1.3.2",
"subgraph": "1.0.0",
"methodology": "1.0.0"
},
"files": {
"template": "baseswap.swap.template.yaml"
},
"options": {
"prepare:yaml": true,
"prepare:constants": true
},
"services": {
"hosted-service": {
"slug": "baseswap-swap-base",
"query-id": "baseswap-swap-base"
}
}
}
}
},
"vvs-finance": {
"schema": "dex-amm",
"base": "uniswap-forks",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Deploy } from "./deploy";
import { UniswapV2MainnetConfigurations } from "../../protocols/uniswap-v2-swap/config/deployments/uniswap-v2-swap-ethereum/configurations";
import { QuickswapMaticConfigurations } from "../../protocols/quickswap-swap/config/deployments/quickswap-swap-polygon/configurations";
import { PancakeswapV2BscConfigurations } from "../../protocols/pancakeswap-v2-swap/config/deployments/pancakeswap-v2-swap-bsc/configurations";
import { BaseswapBaseConfigurations } from "../../protocols/baseswap-swap/config/deployments/baseswap-swap-base/configurations";

// This function is called to load in the proper configurations for a protocol/network deployment.
// To add a new deployment, add a value to the `Deploy` namespace and add a new configuration class to the network specific typescript file in the `protocols` folder.
Expand All @@ -21,6 +22,9 @@ export function getNetworkConfigurations(deploy: i32): Configurations {
case Deploy.PANCAKESWAP_V2_BSC: {
return new PancakeswapV2BscConfigurations();
}
case Deploy.BASESWAP_BASE: {
return new BaseswapBaseConfigurations();
}
default: {
log.critical(
"No configurations found for deployment protocol/network",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export namespace Deploy {
export const UNISWAP_V2_ETHEREUM = 0;
export const QUICKSWAP_POLYGON = 1;
export const PANCAKESWAP_V2_BSC = 2;
export const BASESWAP_BASE = 3;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Baseswap - Swap Subgraph

> Note: This subgraph only tracks the `Swap` events.<br/>
> All the other events have been ignored. If you wish to see other entities and metrics for uniswap-forks, you may check the [uniswap-forks subgraphs here](https://github.com/messari/subgraphs/tree/master/subgraphs/uniswap-forks).
## Networks

- Base
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"deployment": "BASESWAP_BASE",
"network": "base",
"factory": {
"address": "0xFDa619b6d20975be80A10332cD39b9a4b0FAa8BB",
"startBlock": 2059124
},
"graftEnabled": false,
"subgraphId": "",
"graftStartBlock": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {
Network,
PROTOCOL_SCHEMA_VERSION,
} from "../../../../../src/common/constants";
import { Configurations } from "../../../../../configurations/configurations/interface";
import {
PROTOCOL_SUBGRAPH_VERSION,
PROTOCOL_METHODOLOGY_VERSION,
PROTOCOL_NAME,
PROTOCOL_SLUG,
} from "../../../src/common/constants";

export class BaseswapBaseConfigurations implements Configurations {
getNetwork(): string {
return Network.BASE;
}
getSchemaVersion(): string {
return PROTOCOL_SCHEMA_VERSION;
}
getSubgraphVersion(): string {
return PROTOCOL_SUBGRAPH_VERSION;
}
getMethodologyVersion(): string {
return PROTOCOL_METHODOLOGY_VERSION;
}
getProtocolName(): string {
return PROTOCOL_NAME;
}
getProtocolSlug(): string {
return PROTOCOL_SLUG;
}
getFactoryAddress(): string {
return "0xfda619b6d20975be80a10332cd39b9a4b0faa8bb";
}
getBrokenERC20Tokens(): string[] {
return [];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
specVersion: 0.0.2
repository: https://github.com/messari/subgraphs
schema:
file: ./schema.graphql
{{#graftEnabled}}
description: ...
graft:
base: {{subgraphId}} # Subgraph ID of base subgraph
block: {{graftStartBlock}} # Block number
features:
- grafting
{{/graftEnabled}}
dataSources:
- kind: ethereum/contract
name: Factory
network: {{network}}
source:
address: "{{factory.address}}"
abi: Factory
startBlock: {{factory.startBlock}}
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/mappings/factory.ts
entities:
- Token
- DexAmmProtocol
- LiquidityPool
- LiquidityPoolFee
- Protocol
abis:
- name: Factory
file: ./abis/uniswap-v2/Factory.json
- name: TokenABI
file: ./abis/uniswap-v2/ERC20.json
eventHandlers:
- event: PairCreated(indexed address,indexed address,address,uint256)
handler: handlePairCreated
templates:
- kind: ethereum/contract
name: Pair
network: {{network}}
source:
abi: Pair
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/mappings/pool.ts
entities:
- LiqudityPool
- Token
- Deposit
- Withdraw
- Swap
- LiquidityPool
- LiquidityPoolFee
- DexAmmProtocol
- Token
- _Transaction
- _Mint
- _Burn
- _PricesUSD
- UsageMetricsDailySnapshot
- FinancialsDailySnapshot
- _Account
- _DailyActiveAccount
- PoolDailySnapshot
- _TokenTracker
abis:
- name: Pair
file: ./abis/uniswap-v2/Pair.json
- name: Factory
file: ./abis/uniswap-v2/Factory.json
- name: TokenABI
file: ./abis/uniswap-v2/ERC20.json
eventHandlers:
- event: Swap(indexed address,uint256,uint256,uint256,uint256,indexed address)
handler: handleSwap

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
////////////////////
//////Versions/////
////////////////////
import { Versions } from "../../../../src/versions";

export const PROTOCOL_SUBGRAPH_VERSION = Versions.getSubgraphVersion();
export const PROTOCOL_METHODOLOGY_VERSION = Versions.getMethodologyVersion();
export const PROTOCOL_NAME = "Baseswap - Swap";
export const PROTOCOL_SLUG = "baseswap-swap";
1 change: 1 addition & 0 deletions subgraphs/uniswap-forks-swap/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ enum Network {
ARWEAVE_MAINNET
AURORA
AVALANCHE
BASE
BOBA
BSC # aka BNB Chain
CELO
Expand Down
Loading

0 comments on commit 7fd4e20

Please sign in to comment.