diff --git a/subgraphs/uniswap-forks/README.md b/subgraphs/uniswap-forks/README.md index e72c891509..75434d03e2 100644 --- a/subgraphs/uniswap-forks/README.md +++ b/subgraphs/uniswap-forks/README.md @@ -13,6 +13,7 @@ - VVS (Cronos) - Honeyswap (Gnosis, Polygon) - Pangolin (Avalanche) +- VaporDEX (Avalanche) ## Calculation Methodology v1.0.0 diff --git a/subgraphs/uniswap-forks/abis/vapordex/ERC20.json b/subgraphs/uniswap-forks/abis/vapordex/ERC20.json new file mode 100644 index 0000000000..405d6b3648 --- /dev/null +++ b/subgraphs/uniswap-forks/abis/vapordex/ERC20.json @@ -0,0 +1,222 @@ +[ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "from", + "type": "address" + }, + { + "indexed": true, + "name": "to", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + } +] diff --git a/subgraphs/uniswap-forks/abis/vapordex/Pair.json b/subgraphs/uniswap-forks/abis/vapordex/Pair.json new file mode 100644 index 0000000000..53582c1ed6 --- /dev/null +++ b/subgraphs/uniswap-forks/abis/vapordex/Pair.json @@ -0,0 +1,713 @@ +[ + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "Burn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0In", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1In", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0Out", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1Out", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "Swap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint112", + "name": "reserve0", + "type": "uint112" + }, + { + "indexed": false, + "internalType": "uint112", + "name": "reserve1", + "type": "uint112" + } + ], + "name": "Sync", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "MINIMUM_LIQUIDITY", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "PERMIT_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "burn", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "factory", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getReserves", + "outputs": [ + { + "internalType": "uint112", + "name": "_reserve0", + "type": "uint112" + }, + { + "internalType": "uint112", + "name": "_reserve1", + "type": "uint112" + }, + { + "internalType": "uint32", + "name": "_blockTimestampLast", + "type": "uint32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_token0", + "type": "address" + }, + { + "internalType": "address", + "name": "_token1", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "kLast", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "price0CumulativeLast", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "price1CumulativeLast", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "skim", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "amount0Out", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Out", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "swap", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "sync", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "token0", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "token1", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/subgraphs/uniswap-forks/configurations/configurations/configurations.ts b/subgraphs/uniswap-forks/configurations/configurations/configurations.ts index 80788577c3..e7b13cb53f 100644 --- a/subgraphs/uniswap-forks/configurations/configurations/configurations.ts +++ b/subgraphs/uniswap-forks/configurations/configurations/configurations.ts @@ -27,6 +27,7 @@ import { HoneyswapGnosisConfigurations } from "../../protocols/honeyswap/config/ import { HoneyswapMaticConfigurations } from "../../protocols/honeyswap/config/deployments/honeyswap-polygon/configurations"; import { PangolinAvalancheConfigurations } from "../../protocols/pangolin/config/deployments/pangolin-avalanche/configurations"; import { BiswapBscConfigurations } from "../../protocols/biswap/config/deployments/biswap-bsc/configurations"; +import { VaporDEXAvalancheConfigurations } from "../../protocols/vapordex/config/deployments/vapordex-avalanche/configurations"; import { Configurations } from "./interface"; import { Deploy } from "./deploy"; @@ -124,6 +125,9 @@ export function getNetworkConfigurations(deploy: i32): Configurations { case Deploy.BISWAP_BSC: { return new BiswapBscConfigurations(); } + case Deploy.VAPORDEX_AVALANCHE: { + return new VaporDEXAvalancheConfigurations(); + } default: { log.critical( "No configurations found for deployment protocol/network", diff --git a/subgraphs/uniswap-forks/configurations/configurations/deploy.ts b/subgraphs/uniswap-forks/configurations/configurations/deploy.ts index 570fd8165e..dc32e255d5 100644 --- a/subgraphs/uniswap-forks/configurations/configurations/deploy.ts +++ b/subgraphs/uniswap-forks/configurations/configurations/deploy.ts @@ -31,4 +31,5 @@ export namespace Deploy { export const MM_FINANCE_POLYGON = 26; export const PANGOLIN_AVALANCHE = 27; export const BISWAP_BSC = 28; + export const VAPORDEX_AVALANCHE = 29; } diff --git a/subgraphs/uniswap-forks/configurations/configure.ts b/subgraphs/uniswap-forks/configurations/configure.ts index 3ca115adf1..52b50354c1 100644 --- a/subgraphs/uniswap-forks/configurations/configure.ts +++ b/subgraphs/uniswap-forks/configurations/configure.ts @@ -3,7 +3,7 @@ import { getNetworkConfigurations } from "./configurations/configurations"; import { Deploy } from "./configurations/deploy"; // Select the deployment protocol and network -const deployment = Deploy.PANGOLIN_AVALANCHE; +let deployment = Deploy.VAPORDEX_AVALANCHE; // export const NetworkConfigs = configurationsMap.get(deployment)! export const NetworkConfigs = getNetworkConfigurations(deployment); diff --git a/subgraphs/uniswap-forks/package-lock.json b/subgraphs/uniswap-forks/package-lock.json index 5905333c59..2d95de7389 100644 --- a/subgraphs/uniswap-forks/package-lock.json +++ b/subgraphs/uniswap-forks/package-lock.json @@ -11,7 +11,6 @@ "npx": "^10.2.2" }, "devDependencies": { - "mustache": "^3.1.0", "prettier": "^2.6.0" } }, @@ -3773,18 +3772,6 @@ "node": ">=8.0.0" } }, - "node_modules/mustache": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/mustache/-/mustache-3.2.1.tgz", - "integrity": "sha512-RERvMFdLpaFfSRIEe632yDm5nsd0SDKn8hGmcUwswnyiE5mtdZLDybtHAz6hjJhawokF0hXvGLtx9mrQfm6FkA==", - "dev": true, - "bin": { - "mustache": "bin/mustache" - }, - "engines": { - "npm": ">=1.4.0" - } - }, "node_modules/mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", @@ -12627,12 +12614,6 @@ "resolved": "https://registry.npmjs.org/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.0.tgz", "integrity": "sha512-/sF3ee6zvScXMb1XFJ8gDsSnY+X8PbOyjIuBhtgis10W2Jx4ZjIhikUCIF9c4gpJxVnQIsPAFrSwTCuAjicP6g==" }, - "mustache": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/mustache/-/mustache-3.2.1.tgz", - "integrity": "sha512-RERvMFdLpaFfSRIEe632yDm5nsd0SDKn8hGmcUwswnyiE5mtdZLDybtHAz6hjJhawokF0hXvGLtx9mrQfm6FkA==", - "dev": true - }, "mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", diff --git a/subgraphs/uniswap-forks/protocols/pangolin/config/deployments/pangolin-avalanche/deploymentJsonContext.json b/subgraphs/uniswap-forks/protocols/pangolin/config/deployments/pangolin-avalanche/deploymentJsonContext.json index fb5d018c9b..bc65047a00 100644 --- a/subgraphs/uniswap-forks/protocols/pangolin/config/deployments/pangolin-avalanche/deploymentJsonContext.json +++ b/subgraphs/uniswap-forks/protocols/pangolin/config/deployments/pangolin-avalanche/deploymentJsonContext.json @@ -6,6 +6,12 @@ "subgraph": "1.0.0", "methodology": "1.0.0" }, + "services": { + "hosted-service": { + "slug": "pangolin-avalanche", + "query-id": "pangolin-avalanche" + } + }, "files": { "template": "pangolin.template.yaml" }, @@ -13,12 +19,6 @@ "prepare:yaml": true, "prepare:constants": true }, - "services": { - "hosted-service": { - "slug": "pangolin-avalanche", - "query-id": "pangolin-avalanche" - } - }, "protocol": "pangolin", "base": "uniswap-forks", "schema": "dex-amm", diff --git a/subgraphs/uniswap-forks/protocols/vapordex/README.md b/subgraphs/uniswap-forks/protocols/vapordex/README.md new file mode 100644 index 0000000000..d7d9306fdf --- /dev/null +++ b/subgraphs/uniswap-forks/protocols/vapordex/README.md @@ -0,0 +1,72 @@ +# VaporDEX Subgraph + +- The code that faciliates the basic operations of this exchange are forked from Uniswap V2. The two main contracts that are forked and used to index data from swaps, deposits, withdraws, and more are the `UniswapV2Factory` and `Pair` contracts. + +## Networks + +- Avalanche + +## Calculation Methodology v1.0.0 + +- Sum accross all liquidity pools for protocol metric. + +### Total Value Locked (TVL) USD + +- The value of all tokens provided in the liquidity pools. + +### Volume + +- The total value or amount from swaps in liquidity pools. The value of a swap in USD is single-sided, and is only used to update protocol and financial metrics if at least one token is a part of our token whitelist. + +### Total Revenue USD + +- `Pool Swap Trading Volume * Total Swap Fee Percentage` + +- Total Swap Fee: %0.29. + +- Protocol Side Fee: `off`. + +More info on swaps found here: +https://docs.vapordex.io/ + +### Protocol-Side Revenue USD + +- `Pool Swap Trading Volume * Protocol Side Fee Percentage` + +- `Protocol Side Fee Percentage = Total Swap Fee Percentage - Supply Side Fee Percentage` + +- Protocol Side Fee (On): %0.05. + +- Protocol Side Fee (Off): %0.00. + +### Supply-Side Revenue USD + +- `Pool Swap Trading Volume * Supply Side Fee Percentage` + +- `Supply Side Fee Percentage = Total Swap Fee Percentage - Protocol Side Fee Percentage` + +- Supply Side Fee (On): %0.24. + +- Supply Side Fee (Off): %0.29. + +### Total Unique Users + +**Count of Unique Addresses which have interacted with the protocol via any transaction:** + +- Swaps + +- Deposits + +- Withdraws + +### Reward Token Emissions Amount + +- Not Applicable for this subgraph. + +### Protocol Controlled Value + +- Not Applicable for this subgraph. + +## References and Useful Links + +Documentation: https://docs.vapordex.io/ diff --git a/subgraphs/uniswap-forks/protocols/vapordex/config/deployments/vapordex-avalanche/configurations.json b/subgraphs/uniswap-forks/protocols/vapordex/config/deployments/vapordex-avalanche/configurations.json new file mode 100644 index 0000000000..b274438e39 --- /dev/null +++ b/subgraphs/uniswap-forks/protocols/vapordex/config/deployments/vapordex-avalanche/configurations.json @@ -0,0 +1,11 @@ +{ + "deployment": "VAPORDEX_AVALANCHE", + "network": "avalanche", + "factory": { + "address": "0xC009a670E2B02e21E7e75AE98e254F467f7ae257", + "startBlock": 19911183 + }, + "graftEnabled": false, + "subgraphId": "", + "graftStartBlock": 0 +} diff --git a/subgraphs/uniswap-forks/protocols/vapordex/config/deployments/vapordex-avalanche/configurations.ts b/subgraphs/uniswap-forks/protocols/vapordex/config/deployments/vapordex-avalanche/configurations.ts new file mode 100644 index 0000000000..d295bf82d0 --- /dev/null +++ b/subgraphs/uniswap-forks/protocols/vapordex/config/deployments/vapordex-avalanche/configurations.ts @@ -0,0 +1,127 @@ +import { Address, BigDecimal, BigInt } from "@graphprotocol/graph-ts"; +import { Factory } from "../../../../../generated/Factory/Factory"; +import { + BIGINT_ZERO, + FeeSwitch, + MINIMUM_LIQUIDITY_FIVE_THOUSAND, + MINIMUM_LIQUIDITY_TEN_THOUSAND, + Network, + PROTOCOL_SCHEMA_VERSION, + RewardIntervalType, +} 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"; +import { + toLowerCase, + toLowerCaseList, +} from "../../../../../src/common/utils/utils"; + +export class VaporDEXAvalancheConfigurations implements Configurations { + getNetwork(): string { + return Network.AVALANCHE; + } + 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 toLowerCase("0xC009a670E2B02e21E7e75AE98e254F467f7ae257"); + } + getFactoryContract(): Factory { + return Factory.bind( + Address.fromString( + toLowerCase("0xC009a670E2B02e21E7e75AE98e254F467f7ae257") + ) + ); + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + getTradeFee(blockNumber: BigInt): BigDecimal { + return BigDecimal.fromString("0.29"); + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + getProtocolFeeToOn(blockNumber: BigInt): BigDecimal { + return BigDecimal.fromString("0.05"); + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + getLPFeeToOn(blockNumber: BigInt): BigDecimal { + return BigDecimal.fromString("0.24"); + } + getProtocolFeeToOff(): BigDecimal { + return BigDecimal.fromString("0"); + } + getLPFeeToOff(): BigDecimal { + return BigDecimal.fromString("0.29"); + } + getFeeOnOff(): string { + return FeeSwitch.OFF; + } + getRewardIntervalType(): string { + return RewardIntervalType.NONE; + } + getRewardTokenRate(): BigInt { + return BIGINT_ZERO; + } + getReferenceToken(): string { + return toLowerCase("0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7"); // wAVAX + } + getRewardToken(): string { + return toLowerCase(""); + } + getWhitelistTokens(): string[] { + return toLowerCaseList([ + "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", // wAVAX + "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e", // USDC + "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7", // USDT + "0xc7198437980c041c805a1edcba50c1ce5db95118", // USDT.e + "0x83a283641C6B4DF383BCDDf807193284C84c5342", // VPND + "0x7bddaF6DbAB30224AA2116c4291521C7a60D5f55", // VAPE + ]); + } + getStableCoins(): string[] { + return toLowerCaseList([ + "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e", // USDC + "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664", // USDC.e + "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7", // USDT + "0xc7198437980c041c805a1edcba50c1ce5db95118", // USDT.e + ]); + } + getStableOraclePools(): string[] { + return toLowerCaseList([ + "0x6cd2c4c74125a6ee1999a061b1cea9892e331339", // USDC/wAVAX + "0x6b4bb60cfd7e9e4fc9a6f3bc7a5a52715443c37d", // USDC.e/wAVAX + "0x437dcce15eb801093e6427147df9b08f67cb69d5", // USDT/wAVAX + "0xc0ab231e82894a1b05f7369f617474138d378495", // USDT.e/wAVAX + ]); + } + getUntrackedPairs(): string[] { + return toLowerCaseList([]); + } + getUntrackedTokens(): string[] { + return []; + } + getBrokenERC20Tokens(): string[] { + return []; + } + getMinimumLiquidityThresholdTrackVolume(): BigDecimal { + return MINIMUM_LIQUIDITY_TEN_THOUSAND; + } + getMinimumLiquidityThresholdTrackPrice(): BigDecimal { + return MINIMUM_LIQUIDITY_FIVE_THOUSAND; + } +} diff --git a/subgraphs/uniswap-forks/protocols/vapordex/config/templates/vapordex.template.yaml b/subgraphs/uniswap-forks/protocols/vapordex/config/templates/vapordex.template.yaml new file mode 100644 index 0000000000..5308bd9072 --- /dev/null +++ b/subgraphs/uniswap-forks/protocols/vapordex/config/templates/vapordex.template.yaml @@ -0,0 +1,62 @@ +specVersion: 0.0.2 +schema: + file: ./schema.graphql +{{#graftEnabled}} +description: ... +graft: + base: {{subgraphId}} # Subgraph ID of base subgraph + block: {{graftStartBlock}} # Block number +{{/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 + entities: [] + abis: + - name: Factory + file: ./abis/vapordex/Factory.json + - name: TokenABI + file: ./abis/vapordex/ERC20.json + eventHandlers: + - event: PairCreated(indexed address,indexed address,address,uint256) + handler: handlePairCreated + file: ./src/mappings/factory.ts +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: [] + abis: + - name: Pair + file: ./abis/vapordex/Pair.json + - name: Factory + file: ./abis/vapordex/Factory.json + - name: TokenABI + file: ./abis/vapordex/ERC20.json + eventHandlers: + - event: Mint(indexed address,uint256,uint256) + handler: handleMint + - event: Burn(indexed address,uint256,uint256,indexed address) + handler: handleBurn + - event: Swap(indexed address,uint256,uint256,uint256,uint256,indexed address) + handler: handleSwap + - event: Transfer(indexed address,indexed address,uint256) + handler: handleTransfer + - event: Sync(uint112,uint112) + handler: handleSync + \ No newline at end of file diff --git a/subgraphs/uniswap-forks/protocols/vapordex/src/common/constants.ts b/subgraphs/uniswap-forks/protocols/vapordex/src/common/constants.ts new file mode 100644 index 0000000000..6173548a64 --- /dev/null +++ b/subgraphs/uniswap-forks/protocols/vapordex/src/common/constants.ts @@ -0,0 +1,8 @@ +//////////////////// +//////Versions////// +//////////////////// + +export const PROTOCOL_SUBGRAPH_VERSION = "1.0.0"; +export const PROTOCOL_METHODOLOGY_VERSION = "1.0.0"; +export const PROTOCOL_NAME = "VaporDEX"; +export const PROTOCOL_SLUG = "vapordex";