Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Feat/plume #166

Draft
wants to merge 9 commits into
base: next
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ VITE_SNAPSHOT_URL="https://hub.snapshot.org/graphql"
VITE_ALCHEMY_RPC="https://eth-mainnet.g.alchemy.com/v2/"
VITE_ALCHEMY_ARBITRUM_RPC="https://arb-mainnet.g.alchemy.com/v2/"
VITE_ALCHEMY_BASE_RPC="https://base-mainnet.g.alchemy.com/v2/"
VITE_ALCHEMY_PLUME_RPC=
VITE_ALCHEMY_OP_MAINNET_RPC="https://opt-mainnet.g.alchemy.com/v2/"
VITE_ALCHEMY_SONIC_MAINNET_RPC="https://sonic-mainnet.g.alchemy.com/v2/"


# Nx 18 enables using plugins to infer targets by default
# This is disabled for existing workspaces to maintain compatibility
# For more info, see: https://nx.dev/concepts/inferred-tasks
Expand Down
40 changes: 36 additions & 4 deletions apps/analytics/src/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import {
OETH,
OS,
OUSD,
superOETH,
superOETHb,
superOETHp,
} from '@origin/shared/icons';
import { defineMessage } from 'react-intl';

Expand All @@ -42,9 +43,9 @@ export const routes: RouteObject[] = [
index: false,
path: 'super',
handle: {
title: defineMessage({ defaultMessage: 'Super OETH' }),
icon: superOETH,
breadcrumb: defineMessage({ defaultMessage: 'Super OETH' }),
title: defineMessage({ defaultMessage: 'Super OETHb' }),
icon: superOETHb,
breadcrumb: defineMessage({ defaultMessage: 'Super OETHb' }),
},
children: [
{
Expand Down Expand Up @@ -78,6 +79,37 @@ export const routes: RouteObject[] = [
},
],
},
{
index: false,
path: 'superp',
handle: {
title: defineMessage({ defaultMessage: 'Super OETHp' }),
icon: superOETHp,
breadcrumb: defineMessage({ defaultMessage: 'Super OETHp' }),
},
children: [
{
index: true,
element: <OverviewView token={tokens.plume.superOETHp} />,
handle: {
title: defineMessage({ defaultMessage: 'Overview' }),
icon: FaEyeRegular,
breadcrumb: defineMessage({ defaultMessage: 'Overview' }),
},
},
{
path: 'poy',
handle: {
title: defineMessage({ defaultMessage: 'Proof of Yield' }),
icon: FaClockRegular,
breadcrumb: defineMessage({
defaultMessage: 'Proof of Yield',
}),
},
element: <PoYView token={tokens.plume.superOETHp} />,
},
],
},
{
index: false,
path: 'oeth',
Expand Down
1 change: 1 addition & 0 deletions apps/defi/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ VITE_CUSTOM_RPC=
VITE_CUSTOM_ARBITRUM_RPC=
VITE_CUSTOM_BASE_RPC=
VITE_CUSTOM_OP_MAINNET_RPC=
VITE_CUSTOM_PLUME_RPC=
VITE_CUSTOM_SONIC_RPC=

# Wallet Connect v2 project id
Expand Down
4 changes: 3 additions & 1 deletion apps/defi/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { Stack } from '@mui/material';
import { Topnav, trackEvent, trackSentryError } from '@origin/defi/shared';
import { ErrorBoundary, ErrorPage } from '@origin/shared/components';
import { TrackingProvider } from '@origin/shared/providers';
import { TrackingProvider, useChainIdListener } from '@origin/shared/providers';
import { Outlet } from 'react-router';

import { routes } from './routes';

export const App = () => {
useChainIdListener();

return (
<ErrorBoundary
ErrorComponent={<ErrorPage height={1} width={1} />}
Expand Down
2 changes: 2 additions & 0 deletions apps/defi/src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ interface ImportMetaEnv {
readonly VITE_ALCHEMY_BASE_RPC?: string;
readonly VITE_ALCHEMY_OP_MAINNET_RPC?: string;
readonly VITE_ALCHEMY_SONIC_MAINNET_RPC?: string;
readonly VITE_ALCHEMY_PLUME_RPC?: string;
readonly VITE_CUSTOM_RPC?: string;
readonly VITE_CUSTOM_ARBITRUM_RPC?: string;
readonly VITE_CUSTOM_BASE_RPC?: string;
readonly VITE_CUSTOM_OP_MAINNET_RPC?: string;
readonly VITE_CUSTOM_SONIC_RPC?: string;
readonly VITE_CUSTOM_PLUME_RPC?: string;
readonly VITE_GTM_CONTAINER_ID?: string;
readonly VITE_SENTRY_DSN?: string;
readonly VITE_STRAPI_URL: string;
Expand Down
6 changes: 6 additions & 0 deletions libs/analytics/shared/src/components/Layout/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const useDappHref = () => {
const isOeth = useMatch('oeth/*');
const isOusd = useMatch('ousd/*');
const isSuper = useMatch('super/*');
const isSuperP = useMatch('superp/*');

if (isOeth) {
return oTokenConfig[tokens.mainnet.OETH.id]?.dappHref ?? ORIGIN_DAPP_URL;
Expand All @@ -74,6 +75,11 @@ export const useDappHref = () => {
if (isSuper) {
return oTokenConfig[tokens.base.superOETHb.id]?.dappHref ?? ORIGIN_DAPP_URL;
}
if (isSuperP) {
return (
oTokenConfig[tokens.plume.superOETHp.id]?.dappHref ?? ORIGIN_DAPP_URL
);
}

return ORIGIN_DAPP_URL;
};
2 changes: 1 addition & 1 deletion libs/analytics/shared/src/components/ProofOfYield/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const { Provider: PoYProvider, useTracked: usePoYState } =
if (data) {
draft.data = data;
if (!draft.selectedId) {
draft.selectedId = data[1].id;
draft.selectedId = data[1]?.id;
}
}
}),
Expand Down
16 changes: 15 additions & 1 deletion libs/analytics/shared/src/constants/oTokenConfig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ORIGIN_DAPP_URL } from '@origin/shared/constants';
import { tokens } from '@origin/shared/contracts';
import { arbitrum, base, mainnet, sonic } from 'viem/chains';
import { arbitrum, base, mainnet, plumeMainnet, sonic } from 'viem/chains';

import type { Currency } from '@origin/shared/components';
import type { Token } from '@origin/shared/contracts';
Expand Down Expand Up @@ -79,6 +79,20 @@ export const oTokenConfig: Record<string, OTokenConfig> = {
currencyOptions: ['ETH', 'USD'],
currencyDigits: 4,
},
[tokens.plume.superOETHp.id]: {
from: '2024-08-28T00:00:00.000000Z',
availableNetworks: [plumeMainnet],
pageHref: 'superp',
dappHref: `${ORIGIN_DAPP_URL}/#/super?chainId=${plumeMainnet.id}`,
dripperToken: tokens.plume.WETH,
showCirculatingSplit: true,
protocolRevenueCardDefaultLimit: 30,
defaultApyTrailing: 'apy7',
lineChartColor: '#7A26F3',
currency: 'PLUME',
currencyOptions: ['PLUME', 'USD'],
currencyDigits: 4,
},
[tokens.mainnet['ARM-WETH-stETH'].id]: {
from: '2024-08-28T00:00:00.000000Z',
availableNetworks: [mainnet],
Expand Down
17 changes: 17 additions & 0 deletions libs/defi/home/src/views/HomeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Container, Stack, Typography } from '@mui/material';
import { Page, SonicBanner } from '@origin/defi/shared';
import { tokens } from '@origin/shared/contracts';
import { useIntl } from 'react-intl';
import { useSwitchChain } from 'wagmi';
import { base, plumeMainnet } from 'wagmi/chains';

import { ARMRow } from '../components/ARMRow';
import { GovernanceRow } from '../components/GovernanceRow';
Expand All @@ -10,6 +12,7 @@ import { TokenRow } from '../components/TokenRow';

export const HomeView = () => {
const intl = useIntl();
const { switchChain } = useSwitchChain();

return (
<Page showFooterMargin>
Expand Down Expand Up @@ -65,6 +68,20 @@ export const HomeView = () => {
defaultMessage: 'Supercharged LST',
})}
href="super"
onClick={() => {
switchChain({ chainId: base.id });
}}
/>
<TokenRow
token={tokens.plume.superOETHp}
currency="ETH"
productDescription={intl.formatMessage({
defaultMessage: 'Supercharged LST',
})}
href="super"
onClick={() => {
switchChain({ chainId: plumeMainnet.id });
}}
/>
<TokenRow
token={tokens.mainnet.OETH}
Expand Down
10 changes: 1 addition & 9 deletions libs/defi/oeth/src/swap/components/PageTitleSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ import { InfoTooltip, LoadingLabel } from '@origin/shared/components';
import { tokens } from '@origin/shared/contracts';
import { useIntl } from 'react-intl';
import { arbitrum, mainnet } from 'viem/chains';
import { useSwitchChain } from 'wagmi';

import type { StackProps } from '@mui/material';

export const PageTitleSection = (props: StackProps) => {
const intl = useIntl();
const { switchChain } = useSwitchChain();
const { data: apies, isLoading: isApiesLoading } = useOTokenStatsQuery(
{
token: tokens.mainnet.OETH.address.toLowerCase(),
Expand Down Expand Up @@ -75,13 +73,7 @@ export const PageTitleSection = (props: StackProps) => {
iconColor="primary.main"
/>
</ColorChip>
<ChainsChip
chainIds={[mainnet.id, arbitrum.id]}
minHeight={40}
onChainClick={(chainId) => {
switchChain({ chainId });
}}
/>
<ChainsChip chainIds={[mainnet.id, arbitrum.id]} minHeight={40} />
</Stack>
);
};
100 changes: 74 additions & 26 deletions libs/defi/shared/src/clients/wagmi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ import {
trustWallet,
walletConnectWallet,
} from '@rainbow-me/rainbowkit/wallets';
import { arbitrum, base, mainnet, optimism, sonic } from 'viem/chains';
import {
arbitrum,
base,
mainnet,
optimism,
plumeMainnet,
sonic,
} from 'viem/chains';
import { createConfig, fallback, http } from 'wagmi';

const connectors = connectorsForWallets(
Expand Down Expand Up @@ -44,58 +51,99 @@ export const wagmiConfig = createConfig({
mainnet,
arbitrum,
base,
plumeMainnet,
sonic,
...(import.meta.env.DEV ? [optimism] : []),
],
connectors,
transports: {
[mainnet.id]: isNilOrEmpty(import.meta.env?.VITE_CUSTOM_RPC)
? fallback([
http(
`${import.meta.env.VITE_ALCHEMY_RPC}${
import.meta.env.VITE_ALCHEMY_ID
}`,
),
...(!!import.meta.env.VITE_ALCHEMY_RPC &&
!!import.meta.env.VITE_ALCHEMY_ID
? [
http(
`${import.meta.env.VITE_ALCHEMY_RPC}${
import.meta.env.VITE_ALCHEMY_ID
}`,
),
]
: []),
http(),
])
: http(import.meta.env.VITE_CUSTOM_RPC),
[arbitrum.id]: isNilOrEmpty(import.meta.env?.VITE_CUSTOM_ARBITRUM_RPC)
? fallback([
http(
`${import.meta.env.VITE_ALCHEMY_ARBITRUM_RPC}${
import.meta.env.VITE_ALCHEMY_ID
}`,
),
...(!!import.meta.env.VITE_ALCHEMY_ARBITRUM_RPC &&
!!import.meta.env.VITE_ALCHEMY_ID
? [
http(
`${import.meta.env.VITE_ALCHEMY_ARBITRUM_RPC}${
import.meta.env.VITE_ALCHEMY_ID
}`,
),
]
: []),
http(),
])
: http(import.meta.env.VITE_CUSTOM_ARBITRUM_RPC),
[base.id]: isNilOrEmpty(import.meta.env?.VITE_CUSTOM_BASE_RPC)
? fallback([
http(
`${import.meta.env.VITE_ALCHEMY_BASE_RPC}${
import.meta.env.VITE_ALCHEMY_ID
}`,
),
...(!!import.meta.env.VITE_ALCHEMY_BASE_RPC &&
!!import.meta.env.VITE_ALCHEMY_ID
? [
http(
`${import.meta.env.VITE_ALCHEMY_BASE_RPC}${
import.meta.env.VITE_ALCHEMY_ID
}`,
),
]
: []),
http(),
])
: http(import.meta.env.VITE_CUSTOM_BASE_RPC),
[plumeMainnet.id]: isNilOrEmpty(import.meta.env?.VITE_CUSTOM_PLUME_RPC)
? fallback([
...(!!import.meta.env.VITE_ALCHEMY_PLUME_RPC &&
!!import.meta.env.VITE_ALCHEMY_ID
? [
http(
`${import.meta.env.VITE_ALCHEMY_PLUME_RPC}${
import.meta.env.VITE_ALCHEMY_ID
}`,
),
]
: []),
http(),
])
: http(import.meta.env.VITE_CUSTOM_PLUME_RPC),
[sonic.id]: isNilOrEmpty(import.meta.env?.VITE_CUSTOM_SONIC_RPC)
? fallback([
http(
`${import.meta.env.VITE_ALCHEMY_SONIC_MAINNET_RPC}${
import.meta.env.VITE_ALCHEMY_ID
}`,
),
...(!!import.meta.env.VITE_ALCHEMY_SONIC_MAINNET_RPC &&
!!import.meta.env.VITE_ALCHEMY_ID
? [
http(
`${import.meta.env.VITE_ALCHEMY_SONIC_MAINNET_RPC}${
import.meta.env.VITE_ALCHEMY_ID
}`,
),
]
: []),
http(),
])
: http(import.meta.env.VITE_CUSTOM_SONIC_RPC),
[optimism.id]: isNilOrEmpty(import.meta.env?.VITE_CUSTOM_OP_MAINNET_RPC)
? fallback([
http(
`${import.meta.env.VITE_ALCHEMY_OP_MAINNET_RPC}${
import.meta.env.VITE_ALCHEMY_ID
}`,
),
...(!!import.meta.env.VITE_ALCHEMY_OP_MAINNET_RPC &&
!!import.meta.env.VITE_ALCHEMY_ID
? [
http(
`${import.meta.env.VITE_ALCHEMY_OP_MAINNET_RPC}${
import.meta.env.VITE_ALCHEMY_ID
}`,
),
]
: []),
http(),
])
: http(import.meta.env.VITE_CUSTOM_OP_MAINNET_RPC),
Expand Down
Loading