From 5fece57de0766a6545792cbc53981b2a6ba38dc1 Mon Sep 17 00:00:00 2001 From: Gareth Fuller Date: Tue, 13 Feb 2024 11:06:47 +0000 Subject: [PATCH 1/4] feat: Add LRT pool filter (dm) (#5257) * feat: init * chore: delete generated file * chore: Update gitignore * chore: Remove log * fix: module import * chore: Keep required folder * chore: Update schema --- .gitignore | 1 + package.json | 5 +++-- src/assets/data/pools/.gitkeep | 0 src/components/inputs/PoolFeatureSelect.vue | 1 + src/composables/usePoolGroups.ts | 23 +++++++++++++++++++ src/lib/scripts/metadata.generator.ts | 25 +++++++++++++++++++++ src/pages/index.vue | 6 +++++ src/types/pools.ts | 1 + 8 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 src/assets/data/pools/.gitkeep create mode 100644 src/composables/usePoolGroups.ts create mode 100644 src/lib/scripts/metadata.generator.ts diff --git a/.gitignore b/.gitignore index 7994124d26..4242966f71 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ pnpm-debug.log* # tokenlists /src/assets/data/tokenlists.json /src/assets/data/tokenlists/*.json +/src/assets/data/pools/**/*.json #test coverage /coverage diff --git a/package.json b/package.json index 07ccc34291..b2accce474 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,9 @@ }, "scripts": { "vite": "vite", - "dev": "npm run generate:tokenlists && vite", + "dev": "npm run generate:tokenlists && npm run generate:metadata && vite", "serve": "npm run dev", - "build": "npm run generate:tokenlists && vite build", + "build": "npm run generate:tokenlists && npm run generate:metadata && vite build", "build:witChunkSizeCheck": "node ./scripts/buildWithChunkSizeCheck.mjs", "build:analyze": "BUILD_ANALIZE=true npm run build", "build:docker": "export NODE_OPTIONS=--max-old-space-size=8192 && npm run build", @@ -35,6 +35,7 @@ "tailwind:view": "tailwind-config-viewer -o", "generate:contract-addresses": "NODE_ENV=development npx vite-node ./src/lib/scripts/contract-addresses.generator.ts", "generate:tokenlists": "NODE_ENV=development npx vite-node --options.deps.inline=@ethersproject/basex --options.deps.inline=@ethersproject/signing-key --options.deps.inline=@balancer-labs/sdk ./src/lib/scripts/tokenlists.generator.ts", + "generate:metadata": "NODE_ENV=development npx vite-node ./src/lib/scripts/metadata.generator.ts", "generate:api": "graphql-codegen --config codegen.yml -r dotenv/config", "typecheck": "vue-tsc --noEmit" }, diff --git a/src/assets/data/pools/.gitkeep b/src/assets/data/pools/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/components/inputs/PoolFeatureSelect.vue b/src/components/inputs/PoolFeatureSelect.vue index 4791735d21..203fe870e4 100644 --- a/src/components/inputs/PoolFeatureSelect.vue +++ b/src/components/inputs/PoolFeatureSelect.vue @@ -19,6 +19,7 @@ const options = [ PoolTypeFilter.Stable, PoolTypeFilter.CLP, PoolTypeFilter.LBP, + PoolTypeFilter.LRT, ]; const attributeOptions = [PoolAttributeFilter.New]; diff --git a/src/composables/usePoolGroups.ts b/src/composables/usePoolGroups.ts new file mode 100644 index 0000000000..6086c51716 --- /dev/null +++ b/src/composables/usePoolGroups.ts @@ -0,0 +1,23 @@ +import { ref, onBeforeMount } from 'vue'; + +const lrtPools = ref([]); + +const chainIdToNetworkFileMap = { + 1: 'mainnet', + 1101: 'zkevm', +}; + +export function usePoolGroups(chainId: string | number) { + const fileName = chainIdToNetworkFileMap[chainId] || 'mainnet'; + + onBeforeMount(async () => { + const module = await import(`@/assets/data/pools/${fileName}.json`); + const pools = module.default; + + lrtPools.value = pools + .filter(pool => pool.categories.includes('lrt')) + .map(pool => pool.id); + }); + + return { lrtPools }; +} diff --git a/src/lib/scripts/metadata.generator.ts b/src/lib/scripts/metadata.generator.ts new file mode 100644 index 0000000000..93255e3fd7 --- /dev/null +++ b/src/lib/scripts/metadata.generator.ts @@ -0,0 +1,25 @@ +import axios from 'axios'; + +const fs = require('fs'); + +const baseUrl = 'https://raw.githubusercontent.com/balancer/metadata/main'; +const filesToFetch = ['/pools/mainnet.json', '/pools/zkevm.json']; + +async function generate() { + filesToFetch.forEach(async file => { + console.log(`Generating metadata for file ${file}...`); + const { data } = await axios(baseUrl + file); + fs.writeFileSync(`./src/assets/data${file}`, JSON.stringify(data, null, 2)); + }); +} + +(async () => { + try { + console.log('⏳ Generating metadata...'); + await generate(); + console.log('✅ Generated metadata at /src/assets/data/*'); + } catch (error) { + console.error('Failed to generate metadata:', error); + process.exit(1); + } +})(); diff --git a/src/pages/index.vue b/src/pages/index.vue index e3aef44c36..2919837b5e 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -17,6 +17,7 @@ import PoolFeatureSelect from '@/components/inputs/PoolFeatureSelect.vue'; import { useTokens } from '@/providers/tokens.provider'; import { PoolAttributeFilter, PoolTypeFilter } from '@/types/pools'; import UserInvestedInAffectedPoolAlert from '@/pages/recovery-exit/UserInvestedInAffectedPoolAlert.vue'; +import { usePoolGroups } from '@/composables/usePoolGroups'; const featuredProtocolsSentinel = ref(null); const isFeaturedProtocolsVisible = ref(false); @@ -59,6 +60,7 @@ const { pools, isLoading, isFetchingNextPage, loadMorePools } = usePools({ const { upToSmallBreakpoint } = useBreakpoints(); const { networkSlug, networkConfig } = useNetwork(); +const { lrtPools } = usePoolGroups(networkConfig.chainId); const isPaginated = computed(() => pools.value.length >= 10); @@ -97,6 +99,10 @@ function updatePoolFilters(feature: PoolTypeFilter | undefined) { filterPoolIds.value = []; filterPoolTypes.value = [PoolType.LiquidityBootstrapping]; break; + case PoolTypeFilter.LRT: + filterPoolIds.value = lrtPools.value; + filterPoolTypes.value = []; + break; default: filterPoolIds.value = []; filterPoolTypes.value = []; diff --git a/src/types/pools.ts b/src/types/pools.ts index ca6908c0ec..5901121ad9 100644 --- a/src/types/pools.ts +++ b/src/types/pools.ts @@ -6,6 +6,7 @@ export enum PoolTypeFilter { Stable = 'Stable', CLP = 'CLP', LBP = 'LBP', + LRT = 'LRT', } export enum PoolAttributeFilter { From a18d1c7687ebdd626f164cd817f6e55891812c0c Mon Sep 17 00:00:00 2001 From: Gareth Fuller Date: Tue, 13 Feb 2024 11:08:42 +0000 Subject: [PATCH 2/4] hotfix: add veBal gauge address (#5258) Co-authored-by: alter-eggo --- .../contextual/pages/pool/PoolContractDetails.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/contextual/pages/pool/PoolContractDetails.vue b/src/components/contextual/pages/pool/PoolContractDetails.vue index c05c8ff0cb..b54a34554a 100644 --- a/src/components/contextual/pages/pool/PoolContractDetails.vue +++ b/src/components/contextual/pages/pool/PoolContractDetails.vue @@ -3,6 +3,7 @@ import useNumbers from '@/composables/useNumbers'; import { POOLS } from '@/constants/pools'; import { poolMetadata } from '@/lib/config/metadata'; import { shortenLabel } from '@/lib/utils'; +import { usePoolStaking } from '@/providers/local/pool-staking.provider'; import { Pool, PoolType } from '@/services/pool/types'; import useWeb3 from '@/services/web3/useWeb3'; import { format } from 'date-fns'; @@ -38,6 +39,8 @@ function formSwapFeesHint(owner: string): string { return t('poolAttrs.feesEditableOwner'); } +const { preferentialGaugeAddress } = usePoolStaking(); + /** * COMPUTED */ @@ -121,6 +124,13 @@ const data = computed(() => { value: shortenLabel(address), link: explorer.addressLink(address || ''), }, + preferentialGaugeAddress.value + ? { + title: 'veBAL gauge', + value: shortenLabel(preferentialGaugeAddress.value), + link: explorer.addressLink(preferentialGaugeAddress.value), + } + : null, { title: t('createDate'), value: format((createTime || 0) * 1000, 'dd MMMM yyyy'), From 14e7598a69bfbf7297d3e8c4b1b397ff9234e600 Mon Sep 17 00:00:00 2001 From: Alberto Gualis Date: Fri, 16 Feb 2024 09:32:12 +0100 Subject: [PATCH 3/4] Fix uniswap tokenlist (#5272) * fix: use https instead of ipns for tokens.uniswap.org to avoid SSL certificate issues --- package-lock.json | 4 ++-- package.json | 2 +- src/lib/config/arbitrum/pools.ts | 1 + src/lib/config/base/pools.ts | 1 + src/lib/config/gnosis-chain/pools.ts | 1 + src/lib/config/mainnet/tokenlists.ts | 2 +- src/lib/config/polygon/pools.ts | 10 ++++++++++ 7 files changed, 17 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 055599267d..fe4ec2563e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@balancer/frontend-v2", - "version": "1.141.0", + "version": "1.141.15", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@balancer/frontend-v2", - "version": "1.141.0", + "version": "1.141.15", "license": "MIT", "devDependencies": { "@aave/protocol-js": "^4.3.0", diff --git a/package.json b/package.json index b2accce474..d2f318a5a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@balancer/frontend-v2", - "version": "1.141.0", + "version": "1.141.15", "engines": { "node": "=16", "npm": ">=8" diff --git a/src/lib/config/arbitrum/pools.ts b/src/lib/config/arbitrum/pools.ts index 695a708d40..09ebf95d93 100644 --- a/src/lib/config/arbitrum/pools.ts +++ b/src/lib/config/arbitrum/pools.ts @@ -176,6 +176,7 @@ const pools: Pools = { '0xf8201d478418d6a67507e10880eafaaacd3230da000200000000000000000504', // ECLP-sFRAX-FRAX '0xd558d4ed9fb22d4a76210a62afc6af86e5736dcf000200000000000000000505', // 50USX-50ARB '0x5d5822a2648333fbee05f8d539ef9e5107b81d9b000200000000000000000506', // 50GMX-50USDT + '0xebd7cbf210b21469227a828129c2816c9917f3e9000200000000000000000507', // 99DEFI5-1USDC.e ], }, Factories: { diff --git a/src/lib/config/base/pools.ts b/src/lib/config/base/pools.ts index 0e442cd706..b76042cab5 100644 --- a/src/lib/config/base/pools.ts +++ b/src/lib/config/base/pools.ts @@ -173,6 +173,7 @@ const pools: Pools = { '0x79776bc02521019e91302d683c3227c21a406c4c0002000000000000000000f2', // 50USDbC-50axlUSDC '0x7564adbf90fd823a74e5b4821729b679cecae23d0002000000000000000000f4', // 50BALD-50DAI '0x074eb0780b768e0084cd6e0d5d8934c2365a59e10002000000000000000000f6', // 50USDbC-50axlUSDC + '0xa943b51909943569ff85ccbbc25a4c9fb2d247aa0002000000000000000000f9', // 50LINU-50USDbC ], }, Factories: { diff --git a/src/lib/config/gnosis-chain/pools.ts b/src/lib/config/gnosis-chain/pools.ts index fb04639caf..898637ec07 100644 --- a/src/lib/config/gnosis-chain/pools.ts +++ b/src/lib/config/gnosis-chain/pools.ts @@ -78,6 +78,7 @@ const pools: Pools = { '0xc5df11757f4a8dfaccc731d13b9577f67055c6c6000200000000000000000077', // B-50EURe-50GBPe '0xea54604e7e1ddec8320cf838cfe857fbf44aad9f000200000000000000000078', // B-50GBPe-50WXDAI '0xf94e8be09a276d2ca75aeb02113893dc5034bb66000200000000000000000079', // 50USDT-50WXDAI + '0x72f9a28b95d50a66ac0f3cb008d1e932e142cb7200010000000000000000007a', // 50CRV-25crvUSD-25USDC ], }, Factories: { diff --git a/src/lib/config/mainnet/tokenlists.ts b/src/lib/config/mainnet/tokenlists.ts index bb64a669e8..37da9d93a7 100644 --- a/src/lib/config/mainnet/tokenlists.ts +++ b/src/lib/config/mainnet/tokenlists.ts @@ -6,7 +6,7 @@ const tokenlists: TokenListURLMap = { 'https://raw.githubusercontent.com/balancer/tokenlists/main/generated/balancer.tokenlist.json', }, External: [ - 'ipns://tokens.uniswap.org', + 'https://tokens.uniswap.org/', 'https://www.gemini.com/uniswap/manifest.json', ], }; diff --git a/src/lib/config/polygon/pools.ts b/src/lib/config/polygon/pools.ts index c17bea802f..9886a77057 100644 --- a/src/lib/config/polygon/pools.ts +++ b/src/lib/config/polygon/pools.ts @@ -516,6 +516,16 @@ const pools: Pools = { '0xdd35f8d90ca82a44eedcd2ef4fd06aaaccd94eed000200000000000000000ddc', // 34SP-66SSC/V-VR3/StarSeeds_Protocol '0xaa68bb84ee4ebddac7c966aaa298d0428bd18047000100000000000000000ddb', // 10WMATIC-10MATIC-S-30SP-40SSC-10STARV3/V-EV4.1/StarSeeds_Protocol '0xea62af18e468eafb9b8d1b479eeec22f1e867347000100000000000000000dda', // 20WMATIC-20DAO-20SP-20STARV3-20STARV3-M/StarSeeds_Protocol + '0x37860d295058cc54ebd97f3f0cd7ee4a593bfc2e000100000000000000000de9', // 20WBTC-20MATIC-S-60STARV3/V-GR17/StarSeeds_Protocol + '0x12e0ad411080bf860aea108dd78ba3288fed2ddb000100000000000000000de8', // 20MATIC-S-20WETH-60STARV3/V-GR17/StarSeeds_Protocol + '0x48f4ab52367badf2d36ddb6c05f6d148ce3a4c61000100000000000000000de7', // 15WBTC-25MATIC-S-60SSC/V-GR16/StarSeeds_Protocol + '0xae8a4f72eb54c80dc484178bcae5bbcb7a3b44e1000200000000000000000de6', // 66SSC-34STARV3-M/V-GR/StarSeeds_Protocol + '0x9ba442091c6bdb491643dded1108223b54c5edde000100000000000000000de5', // 25MATIC-S-15WETH-60SSC/V-GR16/StarSeeds_Protocol + '0x70e5b0c93dec8cf47e6b22ab8a65417ec538813a000200000000000000000de4', // 40MATIC-S-60SSC/V-VR/StarSeeds_Protocol + '0xa01ca371a70d8d89c017c85ce855f36e59b30810000200000000000000000de3', // 60SSC-40STARV3/V-VR/StarSeeds_Protocol + '0x2b9b87240a36197c6b119581e81db21adcea026d000100000000000000000de2', // 20MATIC-S-20WETH-40SSC-20STARV3/V-GR15/StarSeeds_Protocol + '0xea645e6ce8dbdebb78f512cb932bac9a9d89ef82000100000000000000000de1', // 8WMATIC-8WBTC-8USDC-8MATIC-S-8SP-8WETH-40SSC-12STARV3/V-GR14/StarSeeds_Protocol + '0xc191cf918143bc615a58238e8c57a86a51284c8d000200000000000000000de0', // 50wstETH-50WMATIC ], }, Factories: { From 49b36e1511bf8f0eba82467664e540a2b10a2ad8 Mon Sep 17 00:00:00 2001 From: Alberto Gualis Date: Fri, 16 Feb 2024 10:01:22 +0100 Subject: [PATCH 4/4] 1.142.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index fe4ec2563e..e4d2801ee0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@balancer/frontend-v2", - "version": "1.141.15", + "version": "1.142.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@balancer/frontend-v2", - "version": "1.141.15", + "version": "1.142.0", "license": "MIT", "devDependencies": { "@aave/protocol-js": "^4.3.0", diff --git a/package.json b/package.json index d2f318a5a4..32cc0e9737 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@balancer/frontend-v2", - "version": "1.141.15", + "version": "1.142.0", "engines": { "node": "=16", "npm": ">=8"