Skip to content

Commit

Permalink
feat: subgraph migration (#2083)
Browse files Browse the repository at this point in the history
  • Loading branch information
grothem authored May 31, 2024
1 parent 92f91d4 commit e10a0ec
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 57 deletions.
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=
NEXT_PUBLIC_ENABLE_STAKING=true
NEXT_PUBLIC_ENABLE_GOVERNANCE=true
NEXT_PUBLIC_API_BASEURL=https://aave-api-v2.aave.com
NEXT_PUBLIC_SUBGRAPH_API_KEY=
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ NEXT_PUBLIC_FORK_URL_RPC=
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=
NEXT_PUBLIC_MIXPANEL=
NEXT_PUBLIC_FIAT_ON_RAMP=true
NEXT_PUBLIC_SUBGRAPH_API_KEY=
5 changes: 5 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ inputs:
description: wallet connect project id
required: false
default: ''
NEXT_PUBLIC_SUBGRAPH_API_KEY:
description: subgraph api key
required: false
default: ''

runs:
using: 'composite'
Expand Down Expand Up @@ -79,3 +83,4 @@ runs:
NEXT_PUBLIC_MIXPANEL: '${{ inputs.NEXT_PUBLIC_MIXPANEL }}'
NEXT_PUBLIC_FIAT_ON_RAMP: 'false'
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID: '${{ inputs.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID }}'
NEXT_PUBLIC_SUBGRAPH_API_KEY: '${{ inputs.NEXT_PUBLIC_SUBGRAPH_API_KEY }}'
1 change: 1 addition & 0 deletions .github/workflows/build-test-deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
NEXT_PUBLIC_MIXPANEL: ${{ secrets.NEXT_PUBLIC_MIXPANEL }}
NEXT_PUBLIC_FIAT_ON_RAMP: 'false'
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
NEXT_PUBLIC_SUBGRAPH_API_KEY: ${{ secrets.NEXT_PUBLIC_SUBGRAPH_API_KEY }}

- name: Upload artifacts
uses: ./.github/actions/upload-artifacts
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
NEXT_PUBLIC_MIXPANEL: ${{ secrets.NEXT_PUBLIC_MIXPANEL }}
NEXT_PUBLIC_FIAT_ON_RAMP: 'false'
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
NEXT_PUBLIC_SUBGRAPH_API_KEY: ${{ secrets.NEXT_PUBLIC_SUBGRAPH_API_KEY }}

- name: Upload artifacts
uses: ./.github/actions/upload-artifacts
Expand Down
1 change: 1 addition & 0 deletions custom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ namespace NodeJS {
NEXT_PUBLIC_FORK_URL_RPC?: string;
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID: string;
NEXT_PUBLIC_FIAT_ON_RAMP: string;
NEXT_PUBLIC_SUBGRAPH_API_KEY: string;
}
}
4 changes: 2 additions & 2 deletions src/modules/governance/proposal/VotersListModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const VotersListModal = ({
<VoteBar
yae
percent={proposal.forPercent}
votes={proposal.forPercent}
votes={proposal.forVotes}
sx={{
...borderBaseStyle,
px: 4,
Expand Down Expand Up @@ -79,7 +79,7 @@ export const VotersListModal = ({
<>
<VoteBar
percent={proposal.againstPercent}
votes={proposal.againstPercent}
votes={proposal.againstVotes}
sx={{
...borderBaseStyle,
px: 4,
Expand Down
20 changes: 8 additions & 12 deletions src/ui-config/governanceConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {

export const ipfsGateway = 'https://cloudflare-ipfs.com/ipfs';
export const fallbackIpfsGateway = 'https://ipfs.io/ipfs';
const subgraphApiKey = process.env.NEXT_PUBLIC_SUBGRAPH_API_KEY;

export interface VotingMachineConfig {
portalToMachineMap: { [votingPoralAddress: string]: string };
Expand Down Expand Up @@ -50,8 +51,7 @@ const sepoliaVotingMachineConfig: VotingMachineConfig = {
},
votingPortalDataHelperAddress: '0x133210F3fe2deEB34e65deB6861ee3dF87393977',
votingMachineAddress: '0xA1995F1d5A8A247c064a76F336E1C2ecD24Ef0D9',
subgraphUrl:
'https://api.goldsky.com/api/public/project_clk74pd7lueg738tw9sjh79d6/subgraphs/votingmachine-sepolia/v1/gn',
subgraphUrl: '',
};

const fujiVotingMachineConfig: VotingMachineConfig = {
Expand All @@ -60,8 +60,7 @@ const fujiVotingMachineConfig: VotingMachineConfig = {
},
votingPortalDataHelperAddress: '0x133210F3fe2deEB34e65deB6861ee3dF87393977',
votingMachineAddress: '0x767AA57554690D23D1E0594E8746271C97e1A1e4',
subgraphUrl:
'https://api.goldsky.com/api/public/project_clk74pd7lueg738tw9sjh79d6/subgraphs/votingmachine-sepolia-avalanche-testnet/v2/gn',
subgraphUrl: '',
};

type GovernanceChainConfig = {
Expand All @@ -72,7 +71,7 @@ export const governanceChainConfig: GovernanceChainConfig = {
[ChainId.sepolia]: {
coreChainId: ChainId.sepolia,
votingChainIds: [ChainId.sepolia, ChainId.fuji],
governanceCoreSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/grothem/gov-v3-sepolia',
governanceCoreSubgraphUrl: '',
votingChainConfig: {
[ChainId.sepolia]: sepoliaVotingMachineConfig,
[ChainId.fuji]: fujiVotingMachineConfig,
Expand All @@ -97,34 +96,31 @@ export const governanceChainConfig: GovernanceChainConfig = {
[ChainId.mainnet]: {
coreChainId: ChainId.mainnet,
votingChainIds: [ChainId.polygon, ChainId.avalanche],
governanceCoreSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/governance-v3',
governanceCoreSubgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${subgraphApiKey}/subgraphs/id/A7QMszgomC9cnnfpAcqZVLr2DffvkGNfimD8iUSMiurK`,
votingChainConfig: {
[ChainId.mainnet]: {
portalToMachineMap: {
[GovernanceV3Ethereum.VOTING_PORTAL_ETH_ETH]: GovernanceV3Ethereum.VOTING_MACHINE,
},
votingPortalDataHelperAddress: GovernanceV3Ethereum.VM_DATA_HELPER,
votingMachineAddress: GovernanceV3Ethereum.VOTING_MACHINE,
subgraphUrl:
'https://api.goldsky.com/api/public/project_clk74pd7lueg738tw9sjh79d6/subgraphs/gov-v3-voting-machine-mainnet/1/gn',
subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${subgraphApiKey}/subgraphs/id/2QPwuCfFtQ8WSCZoN3i9SmdoabMzbq2pmg4kRbrhymBV`,
},
[ChainId.polygon]: {
portalToMachineMap: {
[GovernanceV3Ethereum.VOTING_PORTAL_ETH_POL]: GovernanceV3Polygon.VOTING_MACHINE,
},
votingPortalDataHelperAddress: GovernanceV3Polygon.VM_DATA_HELPER,
votingMachineAddress: GovernanceV3Polygon.VOTING_MACHINE,
subgraphUrl:
'https://api.goldsky.com/api/public/project_clk74pd7lueg738tw9sjh79d6/subgraphs/gov-v3-voting-machine-matic/1/gn',
subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${subgraphApiKey}/subgraphs/id/32WLrLTQctAgfoshbkteHfxLu3DpAeZwh2vUPWXV6Qxu`,
},
[ChainId.avalanche]: {
portalToMachineMap: {
[GovernanceV3Ethereum.VOTING_PORTAL_ETH_AVAX]: GovernanceV3Avalanche.VOTING_MACHINE,
},
votingPortalDataHelperAddress: GovernanceV3Avalanche.VM_DATA_HELPER,
votingMachineAddress: GovernanceV3Avalanche.VOTING_MACHINE,
subgraphUrl:
'https://api.goldsky.com/api/public/project_clk74pd7lueg738tw9sjh79d6/subgraphs/gov-v3-voting-machine-avalanche/1/gn',
subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${subgraphApiKey}/subgraphs/id/FngMWWGJV45McvV7GUBkrta9eoEi3sHZoH7MYnFQfZkr`,
},
},
payloadsControllerDataHelpers: {
Expand Down
40 changes: 16 additions & 24 deletions src/ui-config/marketsConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ export enum CustomMarket {
// permissioned_market = 'permissioned_market',
}

const apiKey = process.env.NEXT_PUBLIC_SUBGRAPH_API_KEY;

export const marketsData: {
[key in keyof typeof CustomMarket]: MarketDataType;
} = {
Expand All @@ -122,7 +124,7 @@ export const marketsData: {
debtSwitch: true,
switch: true,
},
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v3',
subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${apiKey}/subgraphs/id/Cd2gEDVeqnjBn1hSeqFMitw8Q1iiyV9FYUZkLNRcL87g`,
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV3Ethereum.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV3Ethereum.POOL,
Expand Down Expand Up @@ -152,7 +154,7 @@ export const marketsData: {
debtSwitch: true,
switch: true,
},
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v2',
subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${apiKey}/subgraphs/id/8wR23o1zkS4gpLqLNU4kG3JHYVucqGyopL5utGxP2q1N`,
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV2Ethereum.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV2Ethereum.POOL,
Expand Down Expand Up @@ -193,7 +195,6 @@ export const marketsData: {
marketTitle: 'Ethereum AMM',
market: CustomMarket.amm_mainnet,
chainId: ChainId.mainnet,
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v2',
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV2EthereumAMM.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV2EthereumAMM.POOL,
Expand All @@ -215,7 +216,7 @@ export const marketsData: {
collateralRepay: true,
debtSwitch: true,
},
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/aave-v2-matic',
subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${apiKey}/subgraphs/id/H1Et77RZh3XEf27vkAmJyzgCME2RSFLtDS2f4PPW6CGp`,
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV2Polygon.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV2Polygon.POOL,
Expand All @@ -241,7 +242,7 @@ export const marketsData: {
debtSwitch: true,
switch: true,
},
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v2-avalanche',
subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${apiKey}/subgraphs/id/EZvK18pMhwiCjxwesRLTg81fP33WnR6BnZe5Cvma3H1C`,
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV2Avalanche.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV2Avalanche.POOL,
Expand Down Expand Up @@ -290,8 +291,7 @@ export const marketsData: {
debtSwitch: true,
switch: true,
},
// TODO: Need subgraph, currently not supported
// subgraphUrl: '',
subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${apiKey}/subgraphs/id/GQFbb95cE6d8mV989mL5figjaGaKCQB3xqYrr1bRyXqF`,
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV3Base.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV3Base.POOL,
Expand All @@ -314,7 +314,6 @@ export const marketsData: {
v3: true,
permitDisabled: true,
chainId: ChainId.arbitrum_sepolia,
//subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v3-arbitrum-goerli', needs re-deployment
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV3ArbitrumSepolia.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV3ArbitrumSepolia.POOL,
Expand All @@ -326,7 +325,6 @@ export const marketsData: {
L2_ENCODER: AaveV3ArbitrumSepolia.L2_ENCODER,
},
},

[CustomMarket.proto_arbitrum_v3]: {
marketTitle: 'Arbitrum',
market: CustomMarket.proto_arbitrum_v3,
Expand All @@ -340,7 +338,7 @@ export const marketsData: {
withdrawAndSwitch: true,
switch: true,
},
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v3-arbitrum',
subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${apiKey}/subgraphs/id/DLuE98kEb5pQNXAcKFQGQgfSQ57Xdou4jnVbAEqMfy3B`,
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV3Arbitrum.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV3Arbitrum.POOL,
Expand All @@ -362,7 +360,6 @@ export const marketsData: {
v3: true,
permitDisabled: true,
chainId: ChainId.base_sepolia,
//subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v3-arbitrum-goerli', needs re-deployment
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV3BaseSepolia.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV3BaseSepolia.POOL,
Expand All @@ -387,7 +384,7 @@ export const marketsData: {
withdrawAndSwitch: true,
switch: true,
},
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v3-avalanche',
subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${apiKey}/subgraphs/id/2h9woxy8RTjHu1HJsCEnmzpPHFArU33avmUh4f71JpVn`,
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV3Avalanche.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV3Avalanche.POOL,
Expand All @@ -411,7 +408,6 @@ export const marketsData: {
faucet: true,
incentives: true,
},
// subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v3-fuji', needs re-deployment
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV3Fuji.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV3Fuji.POOL,
Expand All @@ -428,7 +424,6 @@ export const marketsData: {
v3: true,
permitDisabled: true,
chainId: ChainId.optimism_sepolia,
// subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v3-optimism-goerli', needs re-deployment
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV3OptimismSepolia.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV3OptimismSepolia.POOL,
Expand Down Expand Up @@ -470,7 +465,7 @@ export const marketsData: {
collateralRepay: true,
liquiditySwap: true,
},
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v3-fantom',
subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${apiKey}/subgraphs/id/6L1vPqyE3xvkzkWjh6wUKc1ABWYYps5HJahoxhrv2PJn`,
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV3Fantom.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV3Fantom.POOL,
Expand All @@ -492,7 +487,6 @@ export const marketsData: {
faucet: true,
incentives: true,
},
// subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v3-fantom-testnet', needs re-deployment
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV3FantomTestnet.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV3FantomTestnet.POOL,
Expand All @@ -511,7 +505,7 @@ export const marketsData: {
enabledFeatures: {
incentives: false,
},
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v3-harmony',
subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${apiKey}/subgraphs/id/FifJapBdCqT9vgNqJ5axmr6eNyUpUSaRAbbZTfsViNsT`,
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV3Harmony.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV3Harmony.POOL,
Expand All @@ -535,7 +529,7 @@ export const marketsData: {
withdrawAndSwitch: true,
switch: true,
},
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v3-optimism',
subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${apiKey}/subgraphs/id/DSfLz8oQBUeU5atALgUFQKMTSYV9mZAVYp4noLSXAfvb`,
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV3Optimism.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV3Optimism.POOL,
Expand Down Expand Up @@ -564,7 +558,7 @@ export const marketsData: {
withdrawAndSwitch: true,
switch: true,
},
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v3-polygon',
subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${apiKey}/subgraphs/id/Co2URyXjnxaw8WqxKyVHdirq9Ahhm5vcTs4dMedAq211`,
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV3Polygon.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV3Polygon.POOL,
Expand All @@ -587,7 +581,6 @@ export const marketsData: {
faucet: true,
incentives: true,
},
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v2-fuji',
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV2Fuji.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV2Fuji.POOL,
Expand Down Expand Up @@ -622,7 +615,7 @@ export const marketsData: {
market: CustomMarket.proto_gnosis_v3,
chainId: ChainId.xdai,
v3: true,
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v3-gnosis',
subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${apiKey}/subgraphs/id/HtcDaL8L8iZ2KQNNS44EBVmLruzxuNAz1RkBYdui1QUT`,
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV3Gnosis.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV3Gnosis.POOL,
Expand All @@ -638,7 +631,7 @@ export const marketsData: {
market: CustomMarket.proto_bnb_v3,
chainId: ChainId.bnb,
v3: true,
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v3-bnb',
subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${apiKey}/subgraphs/id/7Jk85XgkV1MQ7u56hD8rr65rfASbayJXopugWkUoBMnZ`,
enabledFeatures: {
liquiditySwap: true,
collateralRepay: true,
Expand All @@ -665,8 +658,7 @@ export const marketsData: {
market: CustomMarket.proto_scroll_v3,
chainId: ChainId.scroll,
v3: true,
subgraphUrl:
'https://api.goldsky.com/api/public/project_clk74pd7lueg738tw9sjh79d6/subgraphs/aave-v3-scroll/1.0.0/gn',
subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${apiKey}/subgraphs/id/74JwenoHZb2aAYVGCCSdPWzi9mm745dyHyQQVoZ7Sbub`,
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV3Scroll.POOL_ADDRESSES_PROVIDER,
LENDING_POOL: AaveV3Scroll.POOL,
Expand Down
Loading

2 comments on commit e10a0ec

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

Please sign in to comment.