Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(); Uniswap V3 Base; Add Uniswap V3 Base #2318

Merged
merged 4 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 41 additions & 19 deletions deployment/deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -3657,7 +3657,7 @@
"network": "arbitrum",
"status": "prod",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.5.0",
"methodology": "1.0.0"
},
Expand All @@ -3679,11 +3679,33 @@
}
}
},
"uniswap-v3-base": {
"network": "base",
steegecs marked this conversation as resolved.
Show resolved Hide resolved
"status": "prod",
"versions": {
"schema": "4.0.1",
"subgraph": "1.0.0",
"methodology": "1.0.0"
},
"files": {
"template": "uniswapV3Template.yaml"
},
"options": {
"prepare:yaml": true,
"prepare:constants": true
},
"services": {
"hosted-service": {
"slug": "uniswap-v3-base",
"query-id": "uniswap-v3-base"
}
}
},
"uniswap-v3-bsc": {
"network": "bsc",
"status": "prod",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.5.0",
"methodology": "1.0.0"
},
Expand All @@ -3705,7 +3727,7 @@
"network": "celo",
"status": "prod",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.4.0",
"methodology": "1.0.0"
},
Expand Down Expand Up @@ -3757,7 +3779,7 @@
"network": "optimism",
"status": "prod",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.5.0",
"methodology": "1.0.0"
},
Expand All @@ -3779,7 +3801,7 @@
"network": "polygon",
"status": "prod",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.5.0",
"methodology": "1.0.0"
},
Expand Down Expand Up @@ -3809,7 +3831,7 @@
"network": "bsc",
"status": "prod",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.3.0",
"methodology": "1.0.0"
},
Expand All @@ -3831,7 +3853,7 @@
"network": "ethereum",
"status": "prod",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.3.0",
"methodology": "1.0.0"
},
Expand Down Expand Up @@ -3865,7 +3887,7 @@
"network": "bsc",
"status": "dev",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.0.0",
"methodology": "1.0.0"
},
Expand All @@ -3887,7 +3909,7 @@
"network": "ethereum",
"status": "dev",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.0.0",
"methodology": "1.0.0"
},
Expand Down Expand Up @@ -3917,7 +3939,7 @@
"network": "ethereum",
"status": "dev",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.2.0",
"methodology": "1.0.0"
},
Expand All @@ -3943,7 +3965,7 @@
"network": "arbitrum",
"status": "dev",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.2.0",
"methodology": "1.0.0"
},
Expand All @@ -3969,7 +3991,7 @@
"network": "avalanche",
"status": "dev",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.2.0",
"methodology": "1.0.0"
},
Expand All @@ -3995,7 +4017,7 @@
"network": "bsc",
"status": "dev",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.2.0",
"methodology": "1.0.0"
},
Expand All @@ -4017,7 +4039,7 @@
"network": "fantom",
"status": "dev",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.2.0",
"methodology": "1.0.0"
},
Expand All @@ -4039,7 +4061,7 @@
"network": "fuse",
"status": "dev",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.2.0",
"methodology": "1.0.0"
},
Expand All @@ -4061,7 +4083,7 @@
"network": "gnosis",
"status": "dev",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.2.0",
"methodology": "1.0.0"
},
Expand All @@ -4087,7 +4109,7 @@
"network": "moonriver",
"status": "dev",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.2.0",
"methodology": "1.0.0"
},
Expand All @@ -4109,7 +4131,7 @@
"network": "optimism",
"status": "dev",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.2.0",
"methodology": "1.0.0"
},
Expand All @@ -4131,7 +4153,7 @@
"network": "polygon",
"status": "dev",
"versions": {
"schema": "4.0.0",
"schema": "4.0.1",
"subgraph": "1.2.0",
"methodology": "1.0.0"
},
Expand Down
3 changes: 2 additions & 1 deletion schema-dex-amm-extended.graphql
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Subgraph Schema: DEX AMM (Extended)
# Version: 4.0.0
# Version: 4.0.1
# See https://github.com/messari/subgraphs/blob/master/docs/Schema.md for details

enum Network {
ARBITRUM_ONE
ARWEAVE_MAINNET
AURORA
AVALANCHE
BASE
BOBA
BSC # aka BNB Chain
CELO
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { UniswapV3ArbitrumConfigurations } from "../../protocols/uniswap-v3/config/deployments/uniswap-v3-arbitrum/configurations";
import { UniswapV3BaseConfigurations } from "../../protocols/uniswap-v3/config/deployments/uniswap-v3-base/configurations";
import { UniswapV3MainnetConfigurations } from "../../protocols/uniswap-v3/config/deployments/uniswap-v3-ethereum/configurations";
import { UniswapV3MaticConfigurations } from "../../protocols/uniswap-v3/config/deployments/uniswap-v3-polygon/configurations";
import { UniswapV3OptimismConfigurations } from "../../protocols/uniswap-v3/config/deployments/uniswap-v3-optimism/configurations";
Expand Down Expand Up @@ -40,6 +41,9 @@ export function getNetworkConfigurations(deploy: i32): Configurations {
case Deploy.UNISWAP_V3_BSC: {
return new UniswapV3BSCConfigurations();
}
case Deploy.UNISWAP_V3_BASE: {
return new UniswapV3BaseConfigurations();
}
case Deploy.PANCAKE_V3_BSC: {
return new PancakeV3BSCConfigurations();
}
Expand Down
35 changes: 18 additions & 17 deletions subgraphs/uniswap-v3-forks/configurations/configurations/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
export namespace Deploy {
export const UNISWAP_V3_ARBITRUM = 0;
export const UNISWAP_V3_ETHEREUM = 1;
export const UNISWAP_V3_POLYGON = 2;
export const UNISWAP_V3_OPTIMISM = 3;
export const UNISWAP_V3_CELO = 4;
export const UNISWAP_V3_BSC = 5;
export const PANCAKE_V3_BSC = 6;
export const PANCAKE_V3_ETHEREUM = 7;
export const SUSHISWAP_V3_ETHEREUM = 8;
export const SUSHISWAP_V3_ARBITRUM = 9;
export const SUSHISWAP_V3_AVALANCHE = 10;
export const SUSHISWAP_V3_BSC = 11;
export const SUSHISWAP_V3_FANTOM = 12;
export const SUSHISWAP_V3_FUSE = 13;
export const SUSHISWAP_V3_GNOSIS = 14;
export const SUSHISWAP_V3_MOONRIVER = 15;
export const SUSHISWAP_V3_OPTIMISM = 16;
export const SUSHISWAP_V3_POLYGON = 17;
export const UNISWAP_V3_BASE = 1;
export const UNISWAP_V3_BSC = 2;
export const UNISWAP_V3_CELO = 3;
export const UNISWAP_V3_ETHEREUM = 4;
export const UNISWAP_V3_OPTIMISM = 5;
export const UNISWAP_V3_POLYGON = 6;
export const PANCAKE_V3_BSC = 7;
export const PANCAKE_V3_ETHEREUM = 8;
export const SUSHISWAP_V3_ETHEREUM = 9;
export const SUSHISWAP_V3_ARBITRUM = 10;
export const SUSHISWAP_V3_AVALANCHE = 11;
export const SUSHISWAP_V3_BSC = 12;
export const SUSHISWAP_V3_FANTOM = 13;
export const SUSHISWAP_V3_FUSE = 14;
export const SUSHISWAP_V3_GNOSIS = 15;
export const SUSHISWAP_V3_MOONRIVER = 16;
export const SUSHISWAP_V3_OPTIMISM = 17;
export const SUSHISWAP_V3_POLYGON = 18;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"network": "base",
"factoryAddress": "0x33128a8fc17869897dce68ed026d694621f6fdfd",
"factoryAddressStartBlock": 1371670,
"nonFungiblePositionManagerAddress": "0x03a520b32c04bf3beef7beb72e919cf822ed34f1",
"nonFungiblePositionManagerAddressStartBlock": 1371704,
"deployment": "UNISWAP_V3_BASE",
"graftEnabled": false,
"subgraphId": "",
"graftStartBlock": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import {
Address,
BigInt,
BigDecimal,
Bytes,
log,
} from "@graphprotocol/graph-ts";
import { Factory } from "../../../../../generated/Factory/Factory";
import {
BIGDECIMAL_ONE,
BIGDECIMAL_ZERO,
FeeSwitch,
Network,
RewardIntervalType,
} from "../../../../../src/common/constants";
import { Configurations } from "../../../../../configurations/configurations/interface";
import { PROTOCOL_NAME, PROTOCOL_SLUG } from "../../../src/common/constants";
import { stringToBytesList } from "../../../../../src/common/utils/utils";

export class UniswapV3BaseConfigurations implements Configurations {
getNetwork(): string {
return Network.BASE;
}
getProtocolName(): string {
return PROTOCOL_NAME;
}
getProtocolSlug(): string {
return PROTOCOL_SLUG;
}
getFactoryAddress(): Bytes {
return Bytes.fromHexString("0x33128a8fc17869897dce68ed026d694621f6fdfd");
}
getFactoryContract(): Factory {
return Factory.bind(
Address.fromString("0x33128a8fc17869897dce68ed026d694621f6fdfd")
);
}
getProtocolFeeOnOff(): string {
return FeeSwitch.OFF;
}
getInitialProtocolFeeProportion(fee: i64): BigDecimal {
log.warning("getProtocolFeeRatio is not implemented: {}", [fee.toString()]);
return BIGDECIMAL_ZERO;
}
getProtocolFeeProportion(protocolFee: BigInt): BigDecimal {
return BIGDECIMAL_ONE.div(protocolFee.toBigDecimal());
}
getRewardIntervalType(): string {
return RewardIntervalType.NONE;
}
getReferenceToken(): Bytes {
return Bytes.fromHexString("0x4200000000000000000000000000000000000006");
}
getRewardToken(): Bytes {
return Bytes.fromHexString("");
}
getWhitelistTokens(): Bytes[] {
return stringToBytesList([
"0x4200000000000000000000000000000000000006", // weth
"0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22", // coinbase wsETH
"0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca", // usdc
]);
}
getStableCoins(): Bytes[] {
return stringToBytesList([
"0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca", // usdc
]);
}
getStableOraclePools(): Bytes[] {
return stringToBytesList([
"0x4c36388be6f416a29c8d8eee81c771ce6be14b18", // usdc-weth 0.05%
"0x3ddf264ac95d19e81f8c25f4c300c4e59e424d43", // usdc-weth 0.3%
"0xe584fe0c7505025c3819c82c99944b79a7cc009d", // usdc-weth 1%
]);
}
getUntrackedPairs(): Bytes[] {
return stringToBytesList([]);
}
getUntrackedTokens(): Bytes[] {
return stringToBytesList([]);
}
getMinimumLiquidityThreshold(): BigDecimal {
return BigDecimal.fromString("10000");
}
}
3 changes: 2 additions & 1 deletion subgraphs/uniswap-v3-forks/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Subgraph Schema: DEX AMM (Extended)
# Version: 4.0.0
# Version: 4.0.1
# See https://github.com/messari/subgraphs/blob/master/docs/Schema.md for details

enum Network {
ARBITRUM_ONE
ARWEAVE_MAINNET
AURORA
AVALANCHE
BASE
BOBA
BSC # aka BNB Chain
CELO
Expand Down
1 change: 1 addition & 0 deletions subgraphs/uniswap-v3-forks/src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export namespace Network {
export const AVALANCHE = "AVALANCHE";
export const AURORA = "AURORA";
export const BSC = "BSC"; // aka BNB Chain
export const BASE = "BASE";
export const CELO = "CELO";
export const MAINNET = "MAINNET"; // Ethereum mainnet
export const FANTOM = "FANTOM";
Expand Down
Loading