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

[Staging to Main] ETH only indexing #1622

Merged
merged 44 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
38336c6
chore(deps): bump socket.io-parser from 3.3.2 to 3.3.3
dependabot[bot] Nov 12, 2022
2583f54
fix: governance listings offset
NamelsKing Dec 1, 2022
cfe9dec
Merge pull request #1595 from Badger-Finance/fix.governance.listing
okjintao Dec 1, 2022
34d19b1
chore: utilize gov types from sdk, add tx hash to proposals
NamelsKing Dec 6, 2022
b5e8be8
Merge pull request #1596 from Badger-Finance/chore.gov.types
NamelsKing Dec 6, 2022
bcf6bcb
chore(deps): bump decode-uri-component from 0.2.0 to 0.2.2
dependabot[bot] Dec 7, 2022
8100781
Merge branch 'staging' into dependabot/npm_and_yarn/decode-uri-compon…
okjintao Dec 8, 2022
bfabdff
Merge branch 'staging' into dependabot/npm_and_yarn/socket.io-parser-…
okjintao Dec 8, 2022
beead8d
Merge pull request #1597 from Badger-Finance/dependabot/npm_and_yarn/…
okjintao Dec 8, 2022
6dbbbe6
Merge pull request #1589 from Badger-Finance/dependabot/npm_and_yarn/…
okjintao Dec 8, 2022
5b674aa
feat: indexing tasks for call data decoding
NamelsKing Dec 12, 2022
7406bfe
Merge pull request #1598 from Badger-Finance/feat.decode.calldata
NamelsKing Dec 12, 2022
367f907
chore: use inmemory cache for contracts abi fetch from scans
NamelsKing Dec 13, 2022
5c49b4f
add ttl check
NamelsKing Dec 13, 2022
7b4d79d
rm entries on their ttl
NamelsKing Dec 13, 2022
ae3dd2a
Merge pull request #1599 from Badger-Finance/chore.useCache.abi
NamelsKing Dec 13, 2022
63143a4
feat: modify governance structs, tune indexing tasks
NamelsKing Dec 16, 2022
b923db7
fix: uniq index and decoded calldata in response
NamelsKing Dec 17, 2022
9357b9d
Merge pull request #1600 from Badger-Finance/feat.governance.structs
NamelsKing Dec 17, 2022
6394a7b
fix: governance ddb fields shift for sls in aws
NamelsKing Dec 18, 2022
63ccd35
Merge pull request #1601 from Badger-Finance/fix.gov.ddb.tbl
okjintao Dec 18, 2022
133c76e
fix: revert governance proposals table name
NamelsKing Dec 18, 2022
a3ae95f
Merge pull request #1602 from Badger-Finance/fix.revert.fov.tbl
okjintao Dec 18, 2022
ec915f9
feat: add indexing meta table, use it for event parsing chunks
NamelsKing Dec 20, 2022
35902cf
Merge pull request #1603 from Badger-Finance/feat.indexing.meta
NamelsKing Dec 21, 2022
9ca526d
feat: update node runtime for sls to 16.x
NamelsKing Dec 21, 2022
6a107f0
Merge pull request #1604 from Badger-Finance/feat.upd.node.v
okjintao Dec 21, 2022
59174bb
feat: update governance to relevant contract events
NamelsKing Dec 27, 2022
15ed6b3
fix: add description to proposal response
NamelsKing Dec 27, 2022
70cddfa
Merge pull request #1605 from Badger-Finance/feat.upgr.gov
NamelsKing Jan 5, 2023
300f3f3
chore: use contract addr in indexing metadata
NamelsKing Jan 10, 2023
9cf5691
Merge pull request #1608 from Badger-Finance/chore.metadata.map
NamelsKing Jan 10, 2023
1588294
feat: get time lock address from regisry
NamelsKing Feb 16, 2023
74b22b0
Merge pull request #1614 from Badger-Finance/feat.upd.gov.sdk
NamelsKing Feb 22, 2023
b4b4f57
fix: upgrade sdk, mock governance service for sdk test util
NamelsKing Feb 27, 2023
1d3d623
Merge pull request #1616 from Badger-Finance/fix.gov.tests
NamelsKing Mar 2, 2023
20cd994
feat: passing graphurl to badger sdk if available
mranilrai May 25, 2023
c610d8b
updated badger sdk
mranilrai Jun 6, 2023
7d6c3b8
Merge pull request #1619 from Badger-Finance/passing-graphurl-to-badg…
mrbasado Jun 6, 2023
bd355b3
fix: add graphurl to serverless env
mrbasado Jun 6, 2023
3c5d5ab
Merge pull request #1620 from Badger-Finance/add-graph-url-serverless
mrbasado Jun 6, 2023
bcdbe1b
Running indexs only for eth (#1621)
mranilrai Sep 6, 2023
c1f9873
refactor: removed code related to goverance.
mranilrai Sep 11, 2023
61f4f71
Merge pull request #1623 from Badger-Finance/removed-governance-code
mrbasado Sep 12, 2023
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
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ ETHERSCAN_API_KEY=
ARBISCAN_API_KEY=
BLOCKNATIVE_API_KEY=
DISCORD_WEBHOOK_URL=
GRAPH_URL=
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"dependencies": {
"@aws/dynamodb-data-mapper": "^0.7.3",
"@aws/dynamodb-data-mapper-annotations": "^0.7.3",
"@badger-dao/sdk": "^1.19.1",
"@badger-dao/sdk": "^1.23.0",
"@tsed/common": "6.95.9",
"@tsed/core": "6.95.9",
"@tsed/di": "6.95.9",
Expand All @@ -55,7 +55,7 @@
"tslib": "^2.2.0"
},
"devDependencies": {
"@badger-dao/sdk-mocks": "^1.18.13",
"@badger-dao/sdk-mocks": "^1.23.0",
"@graphql-codegen/cli": "^2.3.0",
"@graphql-codegen/typescript": "^2.7.3",
"@graphql-codegen/typescript-graphql-request": "^4.5.3",
Expand Down
41 changes: 8 additions & 33 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ custom:
CYCLE_ANALYTICS_DATA: rewards-${self:custom.stage}
PROTOCOL_DATA: protocol-data-${self:custom.stage}
CHART_DATA: chart-data-${self:custom.stage}
GOVERNANCE_PROPOSALS_DATA: governance-proposals-data-${self:custom.stage}
INDEXING_META_DATA: indexing-meta-data-${self:custom.stage}

merkleProofs:
staging: 'badger-staging-merkle-proofs-v2'
Expand All @@ -71,7 +71,7 @@ package:

provider:
name: aws
runtime: nodejs14.x
runtime: nodejs16.x
memorySize: 2048
stage: staging
region: us-west-1
Expand All @@ -93,6 +93,7 @@ provider:
MATIC_RPC: ${env:MATIC_RPC}
ARBITRUM_RPC: ${env:ARBITRUM_RPC}
# 3rd party API keys
GRAPH_URL: ${env:GRAPH_URL}
DISCORD_WEBHOOK_URL: ${env:DISCORD_WEBHOOK_URL}
UNISWAP: 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2'
SUSHISWAP: 'https://api.thegraph.com/subgraphs/name/sushiswap/exchange'
Expand Down Expand Up @@ -120,7 +121,7 @@ provider:
UNCLAIMED_SNAPSHOTS_DATA: ${self:custom.table.UNCLAIMED_SNAPSHOTS_DATA}
PROTOCOL_DATA: ${self:custom.table.PROTOCOL_DATA}
CHART_DATA: ${self:custom.table.CHART_DATA}
GOVERNANCE_PROPOSALS_DATA: ${self:custom.table.GOVERNANCE_PROPOSALS_DATA}
INDEXING_META_DATA: ${self:custom.table.INDEXING_META_DATA}
# General Defintions
REWARD_DATA: ${self:custom.merkleProofs.${self:custom.stage}}
STAGE: ${opt:stage, self:provider.stage}
Expand Down Expand Up @@ -443,34 +444,17 @@ resources:
- AttributeName: 'id'
AttributeType: 'S'

governanceProposalsData:
indexingMetaData:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.table.GOVERNANCE_PROPOSALS_DATA}
TableName: ${self:custom.table.INDEXING_META_DATA}
BillingMode: PAY_PER_REQUEST
KeySchema:
- AttributeName: 'idx'
- AttributeName: 'task'
KeyType: 'HASH'
- AttributeName: 'createdAt'
KeyType: 'RANGE'
AttributeDefinitions:
- AttributeName: 'idx'
- AttributeName: 'task'
AttributeType: 'S'
- AttributeName: 'createdAt'
AttributeType: 'N'
- AttributeName: 'network'
AttributeType: 'S'
- AttributeName: 'updateBlock'
AttributeType: 'N'
GlobalSecondaryIndexes:
- IndexName: IndexGovernanceProposalsUpdateBlock
KeySchema:
- AttributeName: 'network'
KeyType: 'HASH'
- AttributeName: 'updateBlock'
KeyType: 'RANGE'
Projection:
ProjectionType: ALL

yieldProjectionsTable:
Type: AWS::DynamoDB::Table
Expand Down Expand Up @@ -590,12 +574,3 @@ functions:
name: ${self:service}-${self:custom.stage}-index-protocol-metrics-snapshots
description: 'index protocol metrics'
rate: rate(1 day)

index-governance-proposals-events:
handler: src/indexers/governance-proposals-indexer.updateGovernanceProposals
timeout: 900
events:
- schedule:
name: ${self:service}-${self:custom.stage}-index-governance-proposals
description: 'index onchain governance proposals events'
rate: rate(20 minutes)
27 changes: 0 additions & 27 deletions src/aws/models/governance-proposals-child.interface.ts

This file was deleted.

24 changes: 0 additions & 24 deletions src/aws/models/governance-proposals-disputes.interface.ts

This file was deleted.

24 changes: 0 additions & 24 deletions src/aws/models/governance-proposals-statuses.interface.ts

This file was deleted.

71 changes: 0 additions & 71 deletions src/aws/models/governance-proposals.model.ts

This file was deleted.

12 changes: 12 additions & 0 deletions src/aws/models/indexing-metadata.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { attribute, hashKey, table } from '@aws/dynamodb-data-mapper-annotations';

import { INDEXING_META_DATA } from '../../config/constants';

@table(INDEXING_META_DATA)
export class IndexingMetadata<T> {
@hashKey()
task!: string;

@attribute({ memberType: { type: 'Any' } })
data!: T;
}
4 changes: 2 additions & 2 deletions src/chains/chains.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export const SUPPORTED_NETWORKS = [
Network.Optimism,
];

export function getSupportedChains(): Chain[] {
return SUPPORTED_NETWORKS.map((n) => getOrCreateChain(n));
export function getSupportedChains(supportedNetworks = SUPPORTED_NETWORKS): Chain[] {
return supportedNetworks.map((n) => getOrCreateChain(n));
}

export function getOrCreateChain(network?: Network): Chain {
Expand Down
3 changes: 2 additions & 1 deletion src/chains/config/chain.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import BadgerSDK, { GasPrices, getNetworkConfig, Network, SDKProvider } from '@b
import { BadRequest, NotFound } from '@tsed/exceptions';
import { ethers } from 'ethers';

import { GRAPH_URL } from '../../config/constants';
import { TOKENS } from '../../config/tokens.config';
import { TokenConfig } from '../../tokens/interfaces/token-config.interface';
import { ChainVaults } from '../vaults/chain.vaults';
Expand All @@ -22,7 +23,7 @@ export abstract class Chain {
const { chainId } = config;
this.chainId = chainId;
this.vaults = new ChainVaults(network);
this.sdk = new BadgerSDK({ network, provider });
this.sdk = new BadgerSDK({ network, provider, ...(GRAPH_URL ? { graphURL: GRAPH_URL } : {}) });
}

get provider(): providers.MulticallProvider {
Expand Down
3 changes: 2 additions & 1 deletion src/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const YIELD_ESTIMATES_DATA = getEnvVar('YIELD_ESTIMATES_DATA');
export const VAULT_YIELD_DATA = getEnvVar('VAULT_YIELD_DATA');
export const PROTOCOL_DATA = getEnvVar('PROTOCOL_DATA');
export const CHART_DATA = getEnvVar('CHART_DATA');
export const GOVERNANCE_PROPOSALS_DATA = getEnvVar('GOVERNANCE_PROPOSALS_DATA');
export const INDEXING_META_DATA = getEnvVar('INDEXING_META_DATA');
export const YIELD_PROJECTIONS_DATA = getEnvVar('YIELD_PROJECTIONS_DATA');

// thegraph constants
Expand All @@ -33,6 +33,7 @@ export const PANCAKESWAP_URL = getEnvVar('PANCAKESWAP');
export const QUICKSWAP_URL = getEnvVar('QUICKSWAP');
export const SWAPR_URL = getEnvVar('SWAPR');
export const BALANCER_URL = getEnvVar('BALANCER');
export const GRAPH_URL = getEnvVar('GRAPH_URL');

// general constants
export const STAGE = getEnvVar('STAGE');
Expand Down
2 changes: 0 additions & 2 deletions src/controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { AccountsV3Controller } from './accounts/accounts.v3.controller';
import { ChartsController } from './charts/charts.controller';
import { DevelopmentController } from './dev/dev.controller';
import { GasController } from './gas/gas.controller';
import { GovernanceController } from './governance/governance.controller';
import { LeaderBoardsController } from './leaderboards/leaderboards.controller';
import { MetricsController } from './metrics/metrics.controller';
import { PricesController } from './prices/prices.controller';
Expand Down Expand Up @@ -45,7 +44,6 @@ export const V3_CONTROLLERS = [
MetricsController,
PricesController,
TokensController,
GovernanceController,

DevelopmentController,

Expand Down
4 changes: 0 additions & 4 deletions src/governance/governance.constants.ts

This file was deleted.

Loading
Loading