Skip to content

Commit

Permalink
Merge branch 'master' into release/1.145.0
Browse files Browse the repository at this point in the history
  • Loading branch information
garethfuller committed Jul 23, 2024
2 parents 046798e + 9dbbd2b commit 40127a2
Show file tree
Hide file tree
Showing 27 changed files with 2,089 additions and 555 deletions.
39 changes: 9 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Balancer Frontend App (v2)
# ⛔️ This app is now deprecated

Official frontend app for the Balancer protocol (v2)
We have launched a new UI for the Balancer protocol, which is available at
[https://balancer.fi](https://balancer.fi). The source code for the new UI is
available at
[https://github.com/balancer/frontend-v3](https://github.com/balancer/frontend-v3).

_Note, there is an exception where by the veBAL page is still available at
[https://app.balancer.fi/vebal](https://app.balancer.fi/vebal). We will continue to maintain the veBAL page of this
UI until we migrate that functionality to the new UI._

## Development

Expand Down Expand Up @@ -99,34 +106,6 @@ export DOCKER_DEFAULT_PLATFORM=linux/amd64

source: https://stackoverflow.com/questions/65612411/forcing-docker-to-use-linux-amd64-platform-by-default-on-macos

## Self-Hosting

As we believe in decentralization at all layers, we've made it easy to host your own Balancer Frontend.

### Docker Production Image

We've created a production ready [docker image](./Dockerfile) runs
a pre-built version of Balancer Frontend-v2 using nginx. You'll need your own
[Infura](https://infura.io), [Alchemy](https://www.alchemy.com/), and
[Blocknative](https://blocknative.com) API keys in order to fetch data and
execute transactions.

Here's an example of how to run the container. This can also be found in [scripts/run-docker.sh](./scripts/run-docker.sh).

```bash
docker run \
-e INFURA_PROJECT_ID= \ # Required
-e ALCHEMY_KEY= \ # Required
-e BLOCKNATIVE_DAPP_ID= \ # Required
balancerfi/frontend-v2
```

### Custom RPC urls

To override RPC network config set in `src/lib/config`, you can use the following environment variables:

`VITE_RPC_URL_<networkId>=XXX`

### One Click Deploys

The frontend can easily be deployed to any static host. Use the buttons below to spin up an instance. You will be prompted to provide your Infura Project ID, Alchemy Key, and Blocknative Dapp ID as these are required for the frontend to work correctly.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@balancer/frontend-v2",
"version": "1.144.110",
"version": "1.144.130",
"engines": {
"node": "=16",
"npm": ">=8"
Expand Down
17 changes: 6 additions & 11 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import useAlerts, {
AlertPriority,
AlertType,
} from './composables/useAlerts';
import { useI18n } from 'vue-i18n';
import useNetwork from './composables/useNetwork';
// Dynamic import of layout components:
// it prevents the initial bundle from including all the layouts (and their unique dependencies)
Expand Down Expand Up @@ -77,23 +75,20 @@ const { sidebarOpen } = useSidebar();
const { addAlert } = useAlerts();
const { handleThirdPartyModalToggle, isThirdPartyServicesModalVisible } =
useThirdPartyServices();
const { t } = useI18n();
const router = useRouter();
const { networkSlug } = useNetwork();
// OPTIONAL FEATURE ALERTS are enabled by featureAlertEnabled toggle
const featureAlert: Alert = {
id: 'csp-alert',
id: 'new-ui-alert',
priority: AlertPriority.HIGH,
label: t('poolWarnings.cspPoolVulnWarning.generalTitle'), // Add the new feature alert text here and set featureAlertEnabled to true to activate it
type: AlertType.ERROR,
label: 'Balancer has a new UI: Chain agnostic, speedy, and ready for v3', // Add the new feature alert text here and set featureAlertEnabled to true to activate it
type: AlertType.FEATURE,
rememberClose: false,
actionLabel: 'Recovery exit',
actionLabel: 'Try zen',
action: () => {
router.push({ name: 'recovery-exit', params: { networkSlug } });
window.location.href = 'https://balancer.fi';
},
};
const featureAlertEnabled = false;
const featureAlertEnabled = true;
if (featureAlertEnabled) addAlert(featureAlert);
/**
Expand Down
Binary file added src/assets/images/icons/protocols/mellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/images/icons/protocols/superfest.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/assets/images/icons/protocols/symbiotic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 21 additions & 11 deletions src/components/banners/PointsBanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,52 @@ const { hasPoints, poolPoints } = usePoints(props.pool);
function getIconSrc(protocol: Protocol) {
return protocolIconPaths[protocol];
}
const isPointsPool = computed(
() => hasPoints && poolPoints.value.some(p => p.multiple)
);
</script>

<template>
<div v-if="hasPoints" class="points-banner">
<span class="pb-3 sm:pb-0 leading-5"
>Liquidity providers in this pool also earn partner points</span
>
<span class="pb-3 sm:pb-0 leading-5">{{
isPointsPool
? 'Liquidity providers in this pool also earn partner points'
: 'Liquidity providers in this pool earn partner rewards'
}}</span>
<div class="flex">
<div
v-for="{ protocol, multiple, description } in poolPoints"
v-for="{ protocol, multiple, description, url } in poolPoints"
:key="protocol"
>
<BalTooltip placement="bottom" width="64">
<BalTooltip placement="bottom" width="64" :disabled="!description">
<template #activator>
<div
<component
:is="url ? 'a' : 'div'"
class="flex justify-center items-center py-2 px-3 ml-2 text-white rounded-full border border-gray-700 backdrop-blur-sm bg-black/20"
:href="url"
target="_blank"
rel="noopener noreferrer"
>
<BalAsset
:iconURI="getIconSrc(protocol)"
:alt="protocol"
class="mr-2"
:class="{ 'mr-2': multiple }"
/>
{{ multiple }}x
</div>
{{ multiple && `${multiple}x` }}
</component>
</template>
<div>
<div class="mb-2 font-bold">
<span class="capitalize">{{ protocol }}</span
>: {{ multiple }}x points multiplier
>{{ multiple && `: ${multiple}x points multiplier` }}
</div>
<div
v-if="description"
class="mb-2 list-disc"
v-html="description"
/>
<span>
<span v-if="multiple">
This UI does not provide real-time updates on partner point
multipliers. These points may change or expire and might not
reflect the most current info, please refer to the partner
Expand Down
1 change: 0 additions & 1 deletion src/composables/queries/mappers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ test('Maps API pool types', async () => {
expect(mapApiPoolType(GqlPoolType.Gyro3)).toBe(PoolType.Gyro3);
expect(mapApiPoolType(GqlPoolType.Gyroe)).toBe(PoolType.GyroE);
expect(mapApiPoolType(GqlPoolType.Investment)).toBe(PoolType.Investment);
expect(mapApiPoolType(GqlPoolType.Linear)).toBe(PoolType.Linear);
expect(mapApiPoolType(GqlPoolType.LiquidityBootstrapping)).toBe(
PoolType.LiquidityBootstrapping
);
Expand Down
9 changes: 7 additions & 2 deletions src/composables/queries/useLockRankQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import QUERY_KEYS from '@/constants/queryKeys';
import useGraphQuery from './useGraphQuery';
import useNetwork from '../useNetwork';
import { FETCH_ONCE_OPTIONS } from '@/constants/vue-query';
import { GqlChain } from '@/services/api/graphql/generated/api-types';
import { EnumType } from 'json-to-graphql-query';

const attrs = {
balance: true,
Expand All @@ -25,14 +27,17 @@ export function useLockRankQuery(account: ComputedRef<string>) {
queryKey,
() => ({
veBalGetUser: {
__args: {
chain: new EnumType(GqlChain.Mainnet),
address: account.value?.toLowerCase(),
},
...attrs,
},
}),
reactive({
enabled: computed(() => !!account.value),
...FETCH_ONCE_OPTIONS,
}),
false,
{ accountAddress: account.value }
false
);
}
15 changes: 15 additions & 0 deletions src/composables/useProtocols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export enum Protocol {
Swell = 'swell',
EtherFi = 'etherfi',
Kelp = 'kelp',
Mellow = 'mellow',
Symbiotic = 'symbiotic',
Superfest = 'superfest',
}

export const protocolIconPaths: Record<Protocol, string> = {
Expand Down Expand Up @@ -102,4 +105,16 @@ export const protocolIconPaths: Record<Protocol, string> = {
'@/assets/images/icons/protocols/gyro.png',
import.meta.url
).href,
[Protocol.Mellow]: new URL(
'@/assets/images/icons/protocols/mellow.png',
import.meta.url
).href,
[Protocol.Symbiotic]: new URL(
'@/assets/images/icons/protocols/symbiotic.svg',
import.meta.url
).href,
[Protocol.Superfest]: new URL(
'@/assets/images/icons/protocols/superfest.svg',
import.meta.url
).href,
};
11 changes: 11 additions & 0 deletions src/lib/config/arbitrum/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,16 @@ const pools: Pools = {
'0xcdcef9765d369954a4a936064535710f7235110a000200000000000000000558',
'0xd2b6e489ce64691cb46967df6963a49f92764ba9000200000000000000000545',
'0xfed111077e0905ef2b2fbf3060cfa9a34bab4383000200000000000000000544',
'0x2b783cd37774bb77d387d35683e8388937712f0a00020000000000000000056b',
'0x46472cba35e6800012aa9fcc7939ff07478c473e00020000000000000000056c',
'0xbc88fa2aeb274326ae3f2c66139d5eb33d1f5c2e00020000000000000000056d',
'0xf890360473c12d8015da8dbf7af11da87337a065000000000000000000000570',
'0xe8a6026365254f779b6927f00f8724ea1b8ae5e0000000000000000000000580',
'0xb8cb384e65096386c1edaaf784e842c957fa3645000000000000000000000571',
'0x5b89dc91e5a4dc6d4ab0d970af6a7f981971a443000000000000000000000572',
'0x7967fa58b9501600d96bd843173b9334983ee6e600020000000000000000056e',
'0x7272163a931dac5bbe1cb5fefaf959bb65f7346f000200000000000000000549',
'0x6e822c64c00393b2078f2a5bb75c575ab505b55c000200000000000000000548',
],
AllowList: [
'0x88e2c969e2a1c69c16d1dcd9f8acde4c6ab3838a0002000000000000000004c1',
Expand All @@ -334,6 +344,7 @@ const pools: Pools = {
'0x920ce9ec4c52e740ab4c3d36fb5454c274907ae500020000000000000000051b',
'0x49a16fa51bbcdd3cfeda623e83e50b2f75fbcb4f000200000000000000000566',
'0x42f7cfc38dd1583ffda2e4f047f4f6fa06cefc7c000000000000000000000553', // osETH/wETH ECLP
'0x46472cba35e6800012aa9fcc7939ff07478c473e00020000000000000000056c', // gho gyro
],
},
Metadata: {
Expand Down
27 changes: 26 additions & 1 deletion src/lib/config/fraxtal/pools.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CSP_ISSUE_POOL_IDS } from '@/constants/pool-lists/csp-issue';
import { PoolWarning, Pools } from '@/types/pools';
import { Network } from '../types';
import { Protocol } from '@/composables/useProtocols';

const pools: Pools = {
IdsMap: {},
Expand Down Expand Up @@ -42,12 +43,36 @@ const pools: Pools = {
'0xa0af0b88796c1aa67e93db89fead2ab7aa3d6747000000000000000000000007',
'0x33251abecb0364df98a27a8d5d7b5ccddc774c42000000000000000000000008',
'0x1570315476480fa80cec1fff07a20c1df1adfd53000200000000000000000009',
'0x760b30eb4be3ccd840e91183e33e2953c6a31253000000000000000000000005',
],
AllowList: [],
},
Deep: [],
BoostedApr: [],
Metadata: {},
Metadata: {
'0x33251abecb0364df98a27a8d5d7b5ccddc774c42000000000000000000000008': {
points: [
{
protocol: Protocol.Superfest,
multiple: '',
url: 'https://jumper.exchange/superfest',
description:
'To find out more about Superfest, visit <a href="https://jumper.exchange/superfest" target="_blank" rel="noopener noreferrer">jumper.exchange/superfest</a>',
},
],
},
'0x1570315476480fa80cec1fff07a20c1df1adfd53000200000000000000000009': {
points: [
{
protocol: Protocol.Superfest,
multiple: '',
url: 'https://jumper.exchange/superfest',
description:
'To find out more about Superfest, visit <a href="https://jumper.exchange/superfest" target="_blank" rel="noopener noreferrer">jumper.exchange/superfest</a>',
},
],
},
},
DisabledJoins: [],
BrandedRedirect: {
Gyro2: 'gyro',
Expand Down
6 changes: 6 additions & 0 deletions src/lib/config/fraxtal/rateProviders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ const rateProviders: RateProviders = {
'*': {
'0x0000000000000000000000000000000000000000': true,
},
'0xFC00000000000000000000000000000000000005': {
'0x761efEF0347E23e2e75907A6e2df0Bbc6d3A3F38': true,
},
'0xfc00000000000000000000000000000000000008': {
'0x3893E8e1584fF73188034D37Fc6B7d41A255E570': true,
},
};

export default convertKeysToLowerCase(rateProviders);
2 changes: 1 addition & 1 deletion src/lib/config/gnosis-chain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const config: Config = {
unknown: false,
visibleInUI: true,
testNetwork: false,
rpc: 'https://rpc.gnosischain.com',
rpc: 'https://gnosis-rpc.publicnode.com',
ws: '',
publicRpc: 'https://rpc.gnosis.gateway.fm',
explorer: 'https://gnosisscan.io',
Expand Down
1 change: 1 addition & 0 deletions src/lib/config/gnosis-chain/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ const pools: Pools = {
'0x045200c6077f105023000d803f3f95b16b187d70000200000000000000000091',
'0x8dd4df4ce580b9644437f3375e54f1ab0980822800020000000000000000009c',
'0x71e1179c5e197fa551beec85ca2ef8693c61b85b0002000000000000000000a0',
'0xfc095c811fe836ed12f247bcf042504342b73fb700000000000000000000009f',
],
AllowList: [],
},
Expand Down
3 changes: 3 additions & 0 deletions src/lib/config/gnosis-chain/rateProviders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const rateProviders: RateProviders = {
'0xaf204776c7245bF4147c2612BF6e5972Ee483701': {
'0x89C80A4540A00b5270347E02e2E144c71da2EceD': true,
},
'0xc791240D1F2dEf5938E2031364Ff4ed887133C3d': {
'0xdc90e2680094314CEaB45CE15100F6e02cEB7ceD': true,
},
};

export default convertKeysToLowerCase(rateProviders);
Loading

0 comments on commit 40127a2

Please sign in to comment.