Skip to content

Commit

Permalink
Merge branch 'master' into friend-tech
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhruv Chauhan authored and Dhruv Chauhan committed Sep 26, 2023
2 parents 4415297 + f961697 commit de2f390
Show file tree
Hide file tree
Showing 16 changed files with 2,692 additions and 1,794 deletions.
26 changes: 13 additions & 13 deletions deployment/deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -4289,9 +4289,9 @@
"deployments": {
"uniswap-v3-swap-base": {
"network": "base",
"status": "dev",
"status": "prod",
"versions": {
"schema": "4.0.1",
"schema": "4.0.0",
"subgraph": "1.0.0",
"methodology": "1.0.0"
},
Expand All @@ -4311,9 +4311,9 @@
},
"uniswap-v3-swap-optimism": {
"network": "optimism",
"status": "dev",
"status": "prod",
"versions": {
"schema": "4.0.1",
"schema": "4.0.0",
"subgraph": "1.0.0",
"methodology": "1.0.0"
},
Expand Down Expand Up @@ -4341,9 +4341,9 @@
"deployments": {
"pancakeswap-v3-swap-bsc": {
"network": "bsc",
"status": "dev",
"status": "prod",
"versions": {
"schema": "4.0.1",
"schema": "4.0.0",
"subgraph": "1.0.1",
"methodology": "1.0.0"
},
Expand All @@ -4363,7 +4363,7 @@
},
"pancakeswap-v3-swap-ethereum": {
"network": "ethereum",
"status": "dev",
"status": "prod",
"versions": {
"schema": "4.0.1",
"subgraph": "1.0.1",
Expand Down Expand Up @@ -4393,9 +4393,9 @@
"deployments": {
"sushiswap-v3-swap-base": {
"network": "base",
"status": "dev",
"status": "prod",
"versions": {
"schema": "4.0.1",
"schema": "4.0.0",
"subgraph": "1.0.0",
"methodology": "1.0.0"
},
Expand Down Expand Up @@ -4881,7 +4881,7 @@
"deployments": {
"quickswap-swap-polygon": {
"network": "polygon",
"status": "dev",
"status": "prod",
"versions": {
"schema": "1.3.2",
"subgraph": "1.0.1",
Expand Down Expand Up @@ -5459,7 +5459,7 @@
"deployments": {
"uniswap-v2-swap-ethereum": {
"network": "ethereum",
"status": "dev",
"status": "prod",
"versions": {
"schema": "1.3.2",
"subgraph": "1.0.2",
Expand Down Expand Up @@ -5523,7 +5523,7 @@
"deployments": {
"pancakeswap-v2-swap-bsc": {
"network": "bsc",
"status": "dev",
"status": "prod",
"versions": {
"schema": "1.3.2",
"subgraph": "1.0.1",
Expand Down Expand Up @@ -5553,7 +5553,7 @@
"deployments": {
"baseswap-swap-base": {
"network": "base",
"status": "dev",
"status": "prod",
"versions": {
"schema": "1.3.2",
"subgraph": "1.0.0",
Expand Down
14 changes: 7 additions & 7 deletions monitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ This script will function as a service continually querying deployed subgraphs a
### Check groups

- Indexing status
- Get list of valid current deployments
- Get list of valid pending deployments
- Combine two lists above into index failed depos and index success depos
- Use index success list for validating subgraph data
- send alerts for depos that have indexing errors
- Get list of valid current deployments
- Get list of valid pending deployments
- Combine two lists above into index failed depos and index success depos
- Use index success list for validating subgraph data
- send alerts for depos that have indexing errors
- protocol level data
- Separated into TS data validation and non TS data validation
- Separated into TS data validation and non TS data validation
- pool level data
- Separated into TS data validation and non TS data validation
- Separated into TS data validation and non TS data validation

### Discord Alerts

Expand Down
4 changes: 2 additions & 2 deletions monitor/clear.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { clearChannel, getAllThreadsToClear } from "./messageDiscord.js";
import 'dotenv/config'
import "dotenv/config";

getAllThreadsToClear(Date.now(), process.env.CHANNEL_ID);
clearChannel(process.env.PROD_CHANNEL)
clearChannel(process.env.PROD_CHANNEL);
203 changes: 126 additions & 77 deletions monitor/errorSchemas.js
Original file line number Diff line number Diff line change
@@ -1,89 +1,138 @@
import {
ONE_HUNDRED_THOUSAND,
FIVE_HUNDRED_THOUSAND,
ONE_HUNDRED_MILLION,
ONE_BILLION,
TEN_BILLION,
ONE_HUNDRED_BILLION,
} from "./util.js";

export const protocolErrorMessages = {
totalValueLockedUSD: "This field on 'Protocol' entity has a value below $0 or above $100,000,000,000.",
cumulativeRevenueFactors: "cumulativeSupplySideRevenueUSD/cumulativeProtocolSideRevenueUSD field on 'Protocol' entity has a value below $0 or above $100,000,000,000.",
cumulativeTotalRevenueUSD: "'Protocol' entity has a cumulativeTotalRevenueUSD that is not within $1000 of the value of cumulativeProtocolSideRevenueUSD + cumulativeSupplySideRevenueUSD",
cumulativeVolumeUSD: "This field on 'Protocol' entity has a negative value.",
cumulativeUniqueUsers: "This field on 'Protocol' entity has a value below 0 or greater than 100,000,000.",
totalPoolCount: "This field on 'Protocol' entity has less than 0 pools or more than 500,000 pools.",
cumulativeUniqueUserFactors: "'Protocol' entity has fewer cumulativeUniqueUsers than cumulativeUniqueDepositors/cumulativeUniqueBorrowers/cumulativeUniqueLiquidators/cumulativeUniqueLiquidatees.",
cumulativeUniqueBorrowers: "This field on 'Protocol' entity has a fewer cumulativeUniqueUsers than cumulativeUniqueBorrowers.",
cumulativeUniqueLiquidators: "This field on 'Protocol' entity has less cumulativeUniqueUsers than cumulativeUniqueLiquidators.",
cumulativeUniqueLiquidatees: "This field on 'Protocol' entity has less cumulativeUniqueUsers than cumulativeUniqueLiquidatees.",
openPositionCount: "This field on 'Protocol' entity has a value below 0 or greater than 1,000,000,000.",
cumulativePositionCount: "'Protocol' entity has a lower openPositionCount than cumulativePositionCount.",
totalDepositBalanceUSD: "This field on 'Protocol' entity has a value less than $0 or greater than $100,000,000,000.",
cumulativeDepositUSD: "'Protocol' entity has a lower cumulativeDepositUSD than totalDepositBalanceUSD.",
totalBorrowBalanceUSD: "'Protocol' entity has a lower totalDepositBalanceUSD than totalBorrowBalanceUSD.",
cumulativeLiquidateUSD: "'Protocol' entity has a lower cumulativeBorrowUSD than cumulativeLiquidateUSD.",
protocolEntity: "'Protocol' entity has zero instances.",
relatedField: "'Value' on 'Protocol' entity is null/[] but should be holding valid instances of another entity.",
queryError: "Querying the 'Protocol' entity returned error messages."
totalValueLockedUSD: `This field on 'Protocol' entity has a value below $0 or above $${ONE_HUNDRED_BILLION.toLocaleString(
"en-US"
)}.`,
cumulativeRevenueFactors: `cumulativeSupplySideRevenueUSD/cumulativeProtocolSideRevenueUSD field on 'Protocol' entity has a value below $0 or above $${ONE_HUNDRED_BILLION.toLocaleString(
"en-US"
)}.`,
cumulativeTotalRevenueUSD:
"'Protocol' entity has a cumulativeTotalRevenueUSD that is not within $1000 of the value of cumulativeProtocolSideRevenueUSD + cumulativeSupplySideRevenueUSD",
cumulativeVolumeUSD: "This field on 'Protocol' entity has a negative value.",
cumulativeUniqueUsers: `This field on 'Protocol' entity has a value below 0 or greater than ${ONE_HUNDRED_MILLION.toLocaleString(
"en-US"
)}.`,
totalPoolCount: `This field on 'Protocol' entity has less than 0 pools or more than ${FIVE_HUNDRED_THOUSAND.toLocaleString(
"en-US"
)} pools.`,
cumulativeUniqueUserFactors:
"'Protocol' entity has fewer cumulativeUniqueUsers than cumulativeUniqueDepositors/cumulativeUniqueBorrowers/cumulativeUniqueLiquidators/cumulativeUniqueLiquidatees.",
cumulativeUniqueBorrowers:
"This field on 'Protocol' entity has a fewer cumulativeUniqueUsers than cumulativeUniqueBorrowers.",
cumulativeUniqueLiquidators:
"This field on 'Protocol' entity has less cumulativeUniqueUsers than cumulativeUniqueLiquidators.",
cumulativeUniqueLiquidatees:
"This field on 'Protocol' entity has less cumulativeUniqueUsers than cumulativeUniqueLiquidatees.",
openPositionCount: `This field on 'Protocol' entity has a value below 0 or greater than ${ONE_BILLION.toLocaleString(
"en-US"
)}.`,
cumulativePositionCount:
"'Protocol' entity has a lower openPositionCount than cumulativePositionCount.",
totalDepositBalanceUSD: `This field on 'Protocol' entity has a value less than $0 or greater than ${ONE_HUNDRED_BILLION.toLocaleString(
"en-US"
)}.`,
cumulativeDepositUSD:
"'Protocol' entity has a lower cumulativeDepositUSD than totalDepositBalanceUSD.",
totalBorrowBalanceUSD:
"'Protocol' entity has a lower totalDepositBalanceUSD than totalBorrowBalanceUSD.",
cumulativeLiquidateUSD:
"'Protocol' entity has a lower cumulativeBorrowUSD than cumulativeLiquidateUSD.",
protocolEntity: "'Protocol' entity has zero instances.",
relatedField:
"'Value' on 'Protocol' entity is null/[] but should be holding valid instances of another entity.",
queryError: "Querying the 'Protocol' entity returned error messages.",
};

export const poolErrorMessages = {
totalValueLockedUSD: "The pools listed have a TVL below $0 or above $100,000,000,000.",
cumulativeSupplySideRevenueUSD: "The pools listed have a cumulativeSupplySideRevenueUSD below $0 or above $10,000,000,000.",
cumulativeProtocolSideRevenueUSD: "The pools listed have a cumulativeProtocolSideRevenueUSD below $0 or above $10,000,000,000.",
cumulativeTotalRevenueUSD: "The pools listed have a cumulativeTotalRevenueUSD value unequal to the sum of cumulativeSupplySideRevenueUSD and cumulativeProtocolSideRevenueUSD.",
cumulativeDepositUSD: "The pools listed have a cumulativeDepositUSD below $0.",
cumulativeBorrowUSD: "The pools listed have a cumulativeBorrowUSD value above the cumulativeDepositUSD value.",
cumulativeLiquidateUSD: "The pools listed have a cumulativeLiquidateUSD value above the cumulativeBorrowUSD value.",
totalDepositBalanceUSD: "The pools listed have a totalDepositBalanceUSD below $0 or above $100,000,000,000.",
totalBorrowBalanceUSD: "The pools listed have a totalBorrowBalanceUSD value above the totalDepositBalanceUSD value.",
outputTokenSupply: "The pools listed have an outputTokenSupply value of zero or less.",
outputTokenPriceUSD: "The pools listed have an outputTokenPriceUSD value below $0 or above $100,000",
cumulativeVolumeUSD: "The pools listed have a cumulativeVolumeUSD value below $0 or above $10,000,000,000."
totalValueLockedUSD: `The pools listed have a TVL below $0 or above $${ONE_HUNDRED_BILLION.toLocaleString(
"en-US"
)}.`,
cumulativeSupplySideRevenueUSD: `The pools listed have a cumulativeSupplySideRevenueUSD below $0 or above $${TEN_BILLION.toLocaleString(
"en-US"
)}.`,
cumulativeProtocolSideRevenueUSD: `The pools listed have a cumulativeProtocolSideRevenueUSD below $0 or above $${TEN_BILLION.toLocaleString(
"en-US"
)}.`,
cumulativeTotalRevenueUSD:
"The pools listed have a cumulativeTotalRevenueUSD value unequal to the sum of cumulativeSupplySideRevenueUSD and cumulativeProtocolSideRevenueUSD.",
cumulativeDepositUSD:
"The pools listed have a cumulativeDepositUSD below $0.",
cumulativeBorrowUSD:
"The pools listed have a cumulativeBorrowUSD value above the cumulativeDepositUSD value.",
cumulativeLiquidateUSD:
"The pools listed have a cumulativeLiquidateUSD value above the cumulativeBorrowUSD value.",
totalDepositBalanceUSD: `The pools listed have a totalDepositBalanceUSD below $0 or above $${ONE_HUNDRED_BILLION.toLocaleString(
"en-US"
)}.`,
totalBorrowBalanceUSD:
"The pools listed have a totalBorrowBalanceUSD value above the totalDepositBalanceUSD value.",
outputTokenSupply:
"The pools listed have an outputTokenSupply value of zero or less.",
outputTokenPriceUSD: `The pools listed have an outputTokenPriceUSD value below $0 or above $${ONE_HUNDRED_THOUSAND.toLocaleString(
"en-US"
)}`,
cumulativeVolumeUSD: `The pools listed have a cumulativeVolumeUSD value below $0 or above $${TEN_BILLION.toLocaleString(
"en-US"
)}.`,
};

export const protocolErrors = {
totalValueLockedUSD: [],
cumulativeRevenueFactors: [],
cumulativeTotalRevenueUSD: [],
cumulativeVolumeUSD: [],
cumulativeUniqueUsers: [],
totalPoolCount: [],
cumulativeUniqueUserFactors: [],
openPositionCount: [],
cumulativePositionCount: [],
totalDepositBalanceUSD: [],
cumulativeDepositUSD: [],
totalBorrowBalanceUSD: [],
cumulativeLiquidateUSD: [],
protocolEntity: [],
relatedField: [],
queryError: [],
};

export const errorsObj = {
lending: {
totalValueLockedUSD: [],
cumulativeRevenueFactors: [],
cumulativeSupplySideRevenueUSD: [],
cumulativeProtocolSideRevenueUSD: [],
cumulativeTotalRevenueUSD: [],
cumulativeVolumeUSD: [],
cumulativeUniqueUsers: [],
totalPoolCount: [],
cumulativeUniqueUserFactors: [],
openPositionCount: [],
cumulativePositionCount: [],
totalDepositBalanceUSD: [],
cumulativeDepositUSD: [],
totalBorrowBalanceUSD: [],
cumulativeBorrowUSD: [],
cumulativeLiquidateUSD: [],
protocolEntity: [],
relatedField: [],
queryError: []
};

export const errorsObj = {
lending: {
totalValueLockedUSD: [],
cumulativeSupplySideRevenueUSD: [],
cumulativeProtocolSideRevenueUSD: [],
cumulativeTotalRevenueUSD: [],
cumulativeDepositUSD: [],
cumulativeBorrowUSD: [],
cumulativeLiquidateUSD: [],
totalBorrowBalanceUSD: [],
totalDepositBalanceUSD: [],
outputTokenSupply: [],
outputTokenPriceUSD: [],
},
exchanges: {
totalValueLockedUSD: [],
cumulativeSupplySideRevenueUSD: [],
cumulativeProtocolSideRevenueUSD: [],
cumulativeTotalRevenueUSD: [],
cumulativeDepositUSD: [],
cumulativeVolumeUSD: [],
outputTokenSupply: [],
outputTokenPriceUSD: [],
},
vaults: {
totalValueLockedUSD: [],
cumulativeSupplySideRevenueUSD: [],
cumulativeProtocolSideRevenueUSD: [],
cumulativeTotalRevenueUSD: [],
outputTokenSupply: [],
outputTokenPriceUSD: [],
}
totalBorrowBalanceUSD: [],
totalDepositBalanceUSD: [],
outputTokenSupply: [],
outputTokenPriceUSD: [],
},
exchanges: {
totalValueLockedUSD: [],
cumulativeSupplySideRevenueUSD: [],
cumulativeProtocolSideRevenueUSD: [],
cumulativeTotalRevenueUSD: [],
cumulativeDepositUSD: [],
cumulativeVolumeUSD: [],
outputTokenSupply: [],
outputTokenPriceUSD: [],
},
vaults: {
totalValueLockedUSD: [],
cumulativeSupplySideRevenueUSD: [],
cumulativeProtocolSideRevenueUSD: [],
cumulativeTotalRevenueUSD: [],
outputTokenSupply: [],
outputTokenPriceUSD: [],
},
};
Loading

0 comments on commit de2f390

Please sign in to comment.