From 079ef659d1414d7cef47d19a615004ce165c6e00 Mon Sep 17 00:00:00 2001 From: JimmyDummy <106658431+JimmyDummy@users.noreply.github.com> Date: Sun, 25 Jun 2023 15:04:51 +0400 Subject: [PATCH 01/18] feat: update pools.ts to include 80BIDS-20WETH --- src/lib/config/mainnet/pools.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/config/mainnet/pools.ts b/src/lib/config/mainnet/pools.ts index eb071c4f03..9ef9036516 100644 --- a/src/lib/config/mainnet/pools.ts +++ b/src/lib/config/mainnet/pools.ts @@ -137,6 +137,7 @@ const pools: Pools = { '0x26c2b83fc8535deead276f5cc3ad9c1a2192e02700020000000000000000056b', // OHM/bbaDAI '0x18fdf15ff782e44c1f9b6c5846ff6b0f0004f6a2000200000000000000000560', // OHM/LUSD '0x3b9fb87f7d081ceddb1289258fa5660d955317b6000200000000000000000544', // baoeth/bao + '0xd8721e92ba0f8235b375e9ec9a7b697ec4e2d6c6000200000000000000000575', // 80BIDS-20WETH ], }, Factories: { From e365750a4ffb63559066cdbaa616580662ac0ff7 Mon Sep 17 00:00:00 2001 From: Automated Version Bump Date: Mon, 26 Jun 2023 05:06:46 +0000 Subject: [PATCH 02/18] 1.108.9 --- 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 76b3d68afe..b6d1d839b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@balancer/frontend-v2", - "version": "1.108.8", + "version": "1.108.9", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@balancer/frontend-v2", - "version": "1.108.8", + "version": "1.108.9", "license": "MIT", "devDependencies": { "@aave/protocol-js": "^4.3.0", diff --git a/package.json b/package.json index f5623d86cf..adefb829c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@balancer/frontend-v2", - "version": "1.108.8", + "version": "1.108.9", "engines": { "node": "=16", "npm": ">=8" From 37da22afce82d9d63eb5e0f414655ccdbe923a13 Mon Sep 17 00:00:00 2001 From: pkattera Date: Mon, 19 Jun 2023 09:47:51 +0100 Subject: [PATCH 03/18] Updated risks page: Rate provider bridges (#3533) * Updated risks page: Rate provider bridges * chore: Refactor risks for risk keys * chore: Use RiskKey * chore: Fix risk tests * chore: Use risk keys as ids * chore: Add pool risk list component * chore: Cleanup risks section * chore: Fix tests * Fix Composable Stable risk link --------- Co-authored-by: Gareth Fuller Co-authored-by: Alberto Gualis --- .../pages/pool/risks/PoolRiskList.vue | 17 ++ .../contextual/pages/pool/risks/PoolRisks.vue | 39 ++-- .../usePoolRisks.spec.ts} | 44 +++-- .../usePoolRisks.ts} | 89 +++++---- src/lib/config/goerli/pools.ts | 7 +- src/lib/config/zkevm/pools.ts | 19 +- src/pages/risks.vue | 179 ++++++++++-------- src/types/pools.ts | 31 ++- 8 files changed, 274 insertions(+), 151 deletions(-) create mode 100644 src/components/contextual/pages/pool/risks/PoolRiskList.vue rename src/{components/contextual/pages/pool/risks/pool-risks.spec.ts => composables/usePoolRisks.spec.ts} (84%) rename src/{components/contextual/pages/pool/risks/pool-risks.ts => composables/usePoolRisks.ts} (52%) diff --git a/src/components/contextual/pages/pool/risks/PoolRiskList.vue b/src/components/contextual/pages/pool/risks/PoolRiskList.vue new file mode 100644 index 0000000000..c9f253e253 --- /dev/null +++ b/src/components/contextual/pages/pool/risks/PoolRiskList.vue @@ -0,0 +1,17 @@ + + + diff --git a/src/components/contextual/pages/pool/risks/PoolRisks.vue b/src/components/contextual/pages/pool/risks/PoolRisks.vue index 9c0e4c6e33..f43e6bbd3e 100644 --- a/src/components/contextual/pages/pool/risks/PoolRisks.vue +++ b/src/components/contextual/pages/pool/risks/PoolRisks.vue @@ -1,6 +1,11 @@ diff --git a/src/components/contextual/pages/pool/risks/pool-risks.spec.ts b/src/composables/usePoolRisks.spec.ts similarity index 84% rename from src/components/contextual/pages/pool/risks/pool-risks.spec.ts rename to src/composables/usePoolRisks.spec.ts index 6052286425..e489655249 100644 --- a/src/components/contextual/pages/pool/risks/pool-risks.spec.ts +++ b/src/composables/usePoolRisks.spec.ts @@ -3,7 +3,7 @@ import { generateThirdPartyComposabilityRisks, riskLinks, risksTitle, -} from './pool-risks'; +} from './usePoolRisks'; import { aWeightedPool } from '@/__mocks__/weighted-pool'; import { aPool } from '@tests/unit/builders/pool.builders'; import { PoolType } from '@balancer-labs/sdk'; @@ -46,6 +46,10 @@ describe('Generates links for', () => { "hash": "#composability-risk", "title": "Third party DeFi composability risks: Aave, Morpho", }, + { + "hash": "#general-risks", + "title": "General Balancer protocol risks", + }, ] `); }); @@ -67,6 +71,10 @@ describe('Generates links for', () => { "hash": "#mutable-attributes-risk", "title": "Mutable attributes risks", }, + { + "hash": "#general-risks", + "title": "General Balancer protocol risks", + }, ] `); }); @@ -84,6 +92,10 @@ describe('Generates links for', () => { "hash": "#polygon", "title": "Layer 2 network risks: Polygon", }, + { + "hash": "#general-risks", + "title": "General Balancer protocol risks", + }, ] `); }); @@ -92,17 +104,21 @@ describe('Generates links for', () => { withGnosis(); expect(riskLinks(aPool({ poolType: PoolType.ComposableStable }))) .toMatchInlineSnapshot(` - [ - { - "hash": "#composable-pools", - "title": "Composable stable pool risks", - }, - { - "hash": "#gnosis", - "title": "Layer 2 network risks: Gnosis", - }, - ] - `); + [ + { + "hash": "#composable-pools", + "title": "Composable Stable pool risks", + }, + { + "hash": "#gnosis", + "title": "Layer 2 network risks: Gnosis", + }, + { + "hash": "#general-risks", + "title": "General Balancer protocol risks", + }, + ] + `); }); test('a composable stable pool with Delegate Owner', () => { @@ -114,6 +130,10 @@ describe('Generates links for', () => { "hash": "#composable-pools", "title": "MetaStable pool risks", }, + { + "hash": "#general-risks", + "title": "General Balancer protocol risks", + }, ] `); }); diff --git a/src/components/contextual/pages/pool/risks/pool-risks.ts b/src/composables/usePoolRisks.ts similarity index 52% rename from src/components/contextual/pages/pool/risks/pool-risks.ts rename to src/composables/usePoolRisks.ts index e32dfe6062..f173041eb6 100644 --- a/src/components/contextual/pages/pool/risks/pool-risks.ts +++ b/src/composables/usePoolRisks.ts @@ -15,43 +15,56 @@ import { } from '@/composables/usePoolHelpers'; import { POOLS } from '@/constants/pools'; import { Pool } from '@/services/pool/types'; +import { RiskKey } from '@/types/pools'; import { capitalize } from 'lodash'; -interface Risk { +export const riskTitles = { + [RiskKey.General]: 'General Balancer protocol risks', + [RiskKey.Weighted]: 'Weighted pool risks', + [RiskKey.Stable]: 'Stable pool risks', + [RiskKey.ComposableStable]: 'Composable stable pool risks', + [RiskKey.MetaStable]: 'MetaStable pool risks', + [RiskKey.Boosted]: 'Boosted pool risks', + [RiskKey.Arbitrum]: 'Layer 2 network risks: Arbitrum', + [RiskKey.Polygon]: 'Layer 2 network risks: Polygon', + [RiskKey.Optimism]: 'Layer 2 network risks: Optimism', + [RiskKey.Gnosis]: 'Layer 2 network risks: Gnosis', + [RiskKey.Mutable]: 'Mutable attributes risks', + [RiskKey.Composability]: 'Composability risks', + [RiskKey.RateProvider]: 'Rate provider risks', + [RiskKey.RateProviderBridge]: + 'Rate provider cross-chain bridge risks: Layer Zero', +}; + +export interface Risk { title: string; hash: string; } -function aLink(title: string, hash: string) { +function aLink(key: RiskKey, title?: string) { return { - title, - hash, + title: title || riskTitles[key], + hash: `#${key}`, }; } // Pool type risks -const weightedRisks = aLink('Weighted pool risks', '#weighted-pools'); -const stableRisks = aLink('Stable pool risks', '#stable-pools'); +const weightedRisks = aLink(RiskKey.Weighted); +const stableRisks = aLink(RiskKey.Stable); const composableRisks = aLink( - 'Composable stable pool risks', - '#composable-pools' + RiskKey.ComposableStable, + // Explicit title because RiskKey.ComposableStable and RiskKey.MetaStable share the same key (hash) + 'Composable Stable pool risks' ); -const metaStableRisks = aLink('MetaStable pool risks', '#composable-pools'); -const boostedRisks = aLink('Boosted pool risks', '#boosted-pools'); - -// L2 risks -const arbitrumRisks = aLink('Layer 2 network risks: Arbitrum', '#arbitrum'); -const polygonRisks = aLink('Layer 2 network risks: Polygon', '#polygon'); -const optimismRisks = aLink('Layer 2 network risks: Optimism', '#optimism'); -const gnosisRisks = aLink('Layer 2 network risks: Gnosis', '#gnosis'); - -// Mutable risks -const mutableRisks = aLink( - 'Mutable attributes risks', - '#mutable-attributes-risk' -); - -export function riskLinks(pool: Pool) { +const metaStableRisks = aLink(RiskKey.MetaStable); +const boostedRisks = aLink(RiskKey.Boosted); +const arbitrumRisks = aLink(RiskKey.Arbitrum); +const polygonRisks = aLink(RiskKey.Polygon); +const optimismRisks = aLink(RiskKey.Optimism); +const gnosisRisks = aLink(RiskKey.Gnosis); +const mutableRisks = aLink(RiskKey.Mutable); + +export function riskLinks(pool: Pool): Risk[] { const result: Risk[] = []; if (isWeighted(pool.poolType)) result.push(weightedRisks); @@ -72,6 +85,8 @@ export function riskLinks(pool: Pool) { if (hasOwner(pool)) result.push(mutableRisks); + result.push(aLink(RiskKey.General)); + return result; } @@ -83,8 +98,8 @@ export function generateThirdPartyComposabilityRisks(pool): Risk | undefined { protocols?.includes(BoostedProtocol.Idle) ) return aLink( - 'Third party DeFi composability risks: May use multiple yield protocols', - '#composability-risk' + RiskKey.Composability, + 'Third party DeFi composability risks: May use multiple yield protocols' ); if (protocols?.includes(BoostedProtocol.Reaper)) @@ -92,10 +107,10 @@ export function generateThirdPartyComposabilityRisks(pool): Risk | undefined { if (protocols) { return aLink( + RiskKey.Composability, `Third party DeFi composability risks: ${protocols .map(protocol => capitalize(protocol)) - .join(', ')}`, - '#composability-risk' + .join(', ')}` ); } } @@ -111,16 +126,16 @@ export function risksTitle(pool: Pool) { } function alsoWhenSpecificRisks(pool: Pool) { - if (poolSpecificRisks(pool)) return ' also'; + if (poolSpecificRisks(pool).length > 0) return ' also'; return ''; } -export function poolSpecificRisks(pool: Pool) { - // GOERLI ID for testing - if ( - pool.id === - '0x5aee1e99fe86960377de9f88689616916d5dcabe000000000000000000000467' - ) - return 'This pool has testing specific risks.'; - return ''; +export function poolSpecificRisks(pool: Pool): Risk[] { + const risks = POOLS?.Risks?.[pool.id.toLowerCase()]; + + if (risks) { + return risks.map(risk => aLink(risk)); + } + + return []; } diff --git a/src/lib/config/goerli/pools.ts b/src/lib/config/goerli/pools.ts index c24f470c17..92a5631996 100644 --- a/src/lib/config/goerli/pools.ts +++ b/src/lib/config/goerli/pools.ts @@ -1,5 +1,5 @@ import { BoostedProtocol } from '@/composables/useBoostedPool'; -import { Pools } from '@/types/pools'; +import { Pools, RiskKey } from '@/types/pools'; export const poolIdThatRequiresInternalBalanceExit = '0xd4e7c1f3da1144c9e2cfd1b015eda7652b4a439900000000000000000000046a'; @@ -148,6 +148,11 @@ const pools: Pools = { deprecatedid: {}, //Used for unit testing }, ExitViaInternalBalance: [poolIdThatRequiresInternalBalanceExit], + Risks: { + '0x5aee1e99fe86960377de9f88689616916d5dcabe000000000000000000000467': [ + RiskKey.RateProviderBridge, + ], + }, }; export default pools; diff --git a/src/lib/config/zkevm/pools.ts b/src/lib/config/zkevm/pools.ts index 6764b2bd3a..c97e52b450 100644 --- a/src/lib/config/zkevm/pools.ts +++ b/src/lib/config/zkevm/pools.ts @@ -1,4 +1,4 @@ -import { Pools } from '@/types/pools'; +import { Pools, RiskKey } from '@/types/pools'; const pools: Pools = { IdsMap: {}, @@ -105,6 +105,23 @@ const pools: Pools = { GaugeMigration: {}, BoostedApr: [], DisabledJoins: [], + Risks: { + '0x1d0a8a31cdb04efac3153237526fb15cc65a252000000000000000000000000f': [ + RiskKey.RateProviderBridge, + ], + '0xe1f2c039a68a216de6dd427be6c60decf405762a00000000000000000000000e': [ + RiskKey.RateProviderBridge, + ], + '0xdf725fde6e89981fb30d9bf999841ac2c160b512000000000000000000000010': [ + RiskKey.RateProviderBridge, + ], + '0x6f34a44fce1506352a171232163e7716dd073ade000200000000000000000015': [ + RiskKey.RateProviderBridge, + ], + '0x68a69c596b3839023c0e08d09682314f582314e5000200000000000000000011': [ + RiskKey.RateProviderBridge, + ], + }, }; export default pools; diff --git a/src/pages/risks.vue b/src/pages/risks.vue index e812baf97e..702493c1d3 100644 --- a/src/pages/risks.vue +++ b/src/pages/risks.vue @@ -1,3 +1,7 @@ + +