From 272decfbb9984aff9867c60278529655dbeedf26 Mon Sep 17 00:00:00 2001 From: bearpong <178402093+bearpong@users.noreply.github.com> Date: Wed, 8 Jan 2025 10:21:58 -0500 Subject: [PATCH 01/14] chore(graphql): removes unused files --- .../graphql/src/modules/berachef/index.ts | 1 - .../graphql/src/modules/berachef/types.ts | 34 ------------------- packages/graphql/src/modules/index.ts | 3 -- 3 files changed, 38 deletions(-) delete mode 100755 packages/graphql/src/modules/berachef/index.ts delete mode 100755 packages/graphql/src/modules/berachef/types.ts diff --git a/packages/graphql/src/modules/berachef/index.ts b/packages/graphql/src/modules/berachef/index.ts deleted file mode 100755 index eea524d65..000000000 --- a/packages/graphql/src/modules/berachef/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./types"; diff --git a/packages/graphql/src/modules/berachef/types.ts b/packages/graphql/src/modules/berachef/types.ts deleted file mode 100755 index 162d88a9b..000000000 --- a/packages/graphql/src/modules/berachef/types.ts +++ /dev/null @@ -1,34 +0,0 @@ -export interface InflationRate { - id: string; - currentBlockSupply: number; - lastBlockSupply: number; - lastBlock: number; - currentBlock: number; - difference: number; - inflationRate: number; - bgtPerYear: number; -} - -export interface CuttingBoard { - startEpoch: number; - valConsAddr: string; - id: string; - epoch: number; - weights: Weight[]; -} - -export interface Weight { - id: string; - receiver: string; - weight: number; - amount: number; - epoch: number; -} - -export interface GlobalCuttingBoardData { - startEpoch: number; - valConsAddr: string; - id: string; - epoch: number; - weights: Weight[]; -} diff --git a/packages/graphql/src/modules/index.ts b/packages/graphql/src/modules/index.ts index 759335b8a..13997fa81 100755 --- a/packages/graphql/src/modules/index.ts +++ b/packages/graphql/src/modules/index.ts @@ -3,7 +3,4 @@ export * from "./types"; export * from "./chain/chain.codegen"; export * from "./honey"; export * from "./lend"; -// export * from "./governance"; -export * from "./berachef"; export * from "./clients"; -// export * from "./pol"; From 3e493dee2c47d5c7fb5ebbda1fb45be90eff754b Mon Sep 17 00:00:00 2001 From: bearpong <178402093+bearpong@users.noreply.github.com> Date: Wed, 8 Jan 2025 14:30:37 -0500 Subject: [PATCH 02/14] chore(pol): updates vault UI --- .../components/VaultDetails.tsx | 5 +- .../{withdraw-lp.tsx => WithdrawLP.tsx} | 68 +++++++++---------- .../[gaugeAddress]/components/deposit-lp.tsx | 59 ++++++++-------- .../components/gauge-lp-change.tsx | 33 --------- .../vaults/[gaugeAddress]/components/info.tsx | 22 ------ .../components/my-gauge-details.tsx | 65 ++++++++++++++---- .../src/app/vaults/[gaugeAddress]/loading.tsx | 9 ++- .../src/components/gauge-header-widget.tsx | 14 ++-- packages/graphql/src/modules/pol/api.graphql | 1 + secrets | 2 +- 10 files changed, 135 insertions(+), 143 deletions(-) rename apps/hub/src/app/vaults/[gaugeAddress]/components/{withdraw-lp.tsx => WithdrawLP.tsx} (72%) delete mode 100755 apps/hub/src/app/vaults/[gaugeAddress]/components/gauge-lp-change.tsx delete mode 100755 apps/hub/src/app/vaults/[gaugeAddress]/components/info.tsx diff --git a/apps/hub/src/app/vaults/[gaugeAddress]/components/VaultDetails.tsx b/apps/hub/src/app/vaults/[gaugeAddress]/components/VaultDetails.tsx index 7c95df384..37a254121 100755 --- a/apps/hub/src/app/vaults/[gaugeAddress]/components/VaultDetails.tsx +++ b/apps/hub/src/app/vaults/[gaugeAddress]/components/VaultDetails.tsx @@ -83,7 +83,7 @@ const _GaugeDetails = ({ address }: { address: Address }) => { return ( <> {rewardVault ? ( -
+
{ externalLink: `${blockExplorerUrl}/address/${rewardVault?.stakingToken.address}`, }, ]} - className="border-b border-border pb-8" + className="border-b-[0.5px] border-border pb-6" /> {activeIncentives @@ -185,6 +185,7 @@ const _GaugeDetails = ({ address }: { address: Address }) => { loading={isValidatorsLoading} validating={isValidatorsValidating} data={validators} + pageSize={10} className="min-w-[800px] shadow" onRowClick={(row) => router.push(getHubValidatorPath(row.original.pubkey)) diff --git a/apps/hub/src/app/vaults/[gaugeAddress]/components/withdraw-lp.tsx b/apps/hub/src/app/vaults/[gaugeAddress]/components/WithdrawLP.tsx similarity index 72% rename from apps/hub/src/app/vaults/[gaugeAddress]/components/withdraw-lp.tsx rename to apps/hub/src/app/vaults/[gaugeAddress]/components/WithdrawLP.tsx index 5adb82fcc..19149d945 100755 --- a/apps/hub/src/app/vaults/[gaugeAddress]/components/withdraw-lp.tsx +++ b/apps/hub/src/app/vaults/[gaugeAddress]/components/WithdrawLP.tsx @@ -4,7 +4,7 @@ import { Token, TransactionActionType, usePollVaultsInfo, - usePollWalletBalances, + useTokenInformation, } from "@bera/berajs"; import { ActionButton, @@ -19,12 +19,14 @@ import { Address, parseUnits } from "viem"; import { ApiVaultFragment } from "@bera/graphql/pol/api"; export const WithdrawLP = ({ - lpToken, rewardVault, }: { - lpToken: Token; rewardVault: ApiVaultFragment; }) => { + const { data: lpToken } = useTokenInformation({ + address: rewardVault.stakingToken.address, + }); + const [withdrawAmount, setWithdrawAmount] = useState<`${number}`>("0"); const [withdrawPercent, setWithdrawPercent] = useState(0); @@ -44,7 +46,7 @@ export const WithdrawLP = ({ try { track("unstake", { quantity: withdrawAmount, - token: lpToken.symbol, + token: lpToken!.symbol, vault: rewardVault.vaultAddress, }); } catch (e) { @@ -60,35 +62,32 @@ export const WithdrawLP = ({ }); return ( -
-
-
- Unstake Receipt Tokens -
-
- Unstaking your receipt tokens will also claim your outstanding BGT - rewards -
-
- { - setWithdrawAmount(amount as `${number}`); - if (!data?.balance || BigNumber(data?.balance ?? "0").eq(0)) - return; - setWithdrawPercent( - BigNumber(amount).div(data?.balance).times(100).toNumber(), - ); - }} - /> -
+
+
+ { + setWithdrawAmount(amount as `${number}`); + if (!data?.balance || BigNumber(data?.balance ?? "0").eq(0)) return; + + if (!amount) { + setWithdrawPercent(0); + return; + } + + setWithdrawPercent( + BigNumber(amount).div(data?.balance).times(100).toNumber(), + ); + }} + />
-
+

{withdrawPercent.toFixed(2)}% @@ -138,14 +137,13 @@ export const WithdrawLP = ({ + + + + Unstake Receipt Tokens + + +

{rewardVault?.metadata?.name}
@@ -52,11 +88,9 @@ export const MyGaugeDetails = ({
-
-
- Unclaimed Rewards -
-
+
+
Rewards
+
BGT @@ -70,6 +104,8 @@ export const MyGaugeDetails = ({ value={BigNumber(data?.rewards ?? "0").times(price ?? 0)} symbol="USD" showIsSmallerThanMin + prefixText="(" + suffixText=")" className="text-sm text-muted-foreground" />
@@ -77,8 +113,9 @@ export const MyGaugeDetails = ({
) : ( -
+
)}
); diff --git a/apps/hub/src/app/vaults/[gaugeAddress]/loading.tsx b/apps/hub/src/app/vaults/[gaugeAddress]/loading.tsx index a73c8f2f7..39c82cf1d 100755 --- a/apps/hub/src/app/vaults/[gaugeAddress]/loading.tsx +++ b/apps/hub/src/app/vaults/[gaugeAddress]/loading.tsx @@ -2,10 +2,10 @@ import { Skeleton } from "@bera/ui/skeleton"; export default function Loading() { return ( -
+

-
+
@@ -26,8 +26,7 @@ export const HeaderLoading = () => ( ); export const ActionLoading = () => ( -
- +
@@ -38,7 +37,7 @@ export const ActionLoading = () => ( ); export const UserLoading = () => ( -
+
diff --git a/apps/hub/src/components/gauge-header-widget.tsx b/apps/hub/src/components/gauge-header-widget.tsx index 017d97059..85128a6aa 100755 --- a/apps/hub/src/components/gauge-header-widget.tsx +++ b/apps/hub/src/components/gauge-header-widget.tsx @@ -1,8 +1,13 @@ import { truncateHash, useRewardVaults, useTokens } from "@bera/berajs"; import { ApiVaultFragment } from "@bera/graphql/pol/api"; -import { GaugeIcon, MarketIcon, TokenIconList } from "@bera/shared-ui"; +import { + GaugeIcon, + MarketIcon, + TokenIconList, + getRewardsVaultUrl, +} from "@bera/shared-ui"; import { cn } from "@bera/ui"; -import { isAddressEqual } from "viem"; +import Link from "next/link"; import { Address } from "viem"; export const GaugeHeaderWidget = ({ @@ -37,8 +42,9 @@ export const GaugeHeaderWidget = ({ address={gauge.vaultAddress as Address} src={gauge.metadata?.logoURI} /> - {gauge.metadata?.name ?? - truncateHash(gauge.id ?? gauge.vaultAddress)} + + {gauge.metadata?.name ?? truncateHash(gauge.id ?? gauge.address)} +
Date: Wed, 8 Jan 2025 14:31:25 -0500 Subject: [PATCH 03/14] fix: tos typo --- packages/shared-ui/src/terms-of-use.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shared-ui/src/terms-of-use.tsx b/packages/shared-ui/src/terms-of-use.tsx index 0b0fac4a6..e6b30ffc3 100755 --- a/packages/shared-ui/src/terms-of-use.tsx +++ b/packages/shared-ui/src/terms-of-use.tsx @@ -184,7 +184,7 @@ export const TermOfUseModal = () => { {" "} You Must Agree - to User Our Services + to Use Our Services Looks like you selected “I Disagree”, unfortunately you From 2763f18b86140b65f159b801468729246bc5c044 Mon Sep 17 00:00:00 2001 From: bearpong <178402093+bearpong@users.noreply.github.com> Date: Wed, 8 Jan 2025 14:57:59 -0500 Subject: [PATCH 04/14] fix(pol): removed deduped hooks and refresh rv after it's created --- .../app/vaults/components/gauge-creation.tsx | 2 +- .../create/components/create-gauge-card.tsx | 43 ++++++++----------- .../src/actions/pol/get-reward-vault.ts | 37 ---------------- packages/berajs/src/actions/pol/index.ts | 1 - .../modules/pol/hooks/poll-reward-vault.ts | 30 ------------- .../useRewardVaultBalanceFromStakingToken.ts | 6 +-- .../pol/hooks/useRewardVaultFromToken.ts | 10 +++-- .../berajs/src/hooks/modules/pol/index.ts | 1 - 8 files changed, 27 insertions(+), 103 deletions(-) delete mode 100644 packages/berajs/src/actions/pol/get-reward-vault.ts delete mode 100644 packages/berajs/src/hooks/modules/pol/hooks/poll-reward-vault.ts diff --git a/apps/hub/src/app/vaults/components/gauge-creation.tsx b/apps/hub/src/app/vaults/components/gauge-creation.tsx index e9932c830..586484eef 100644 --- a/apps/hub/src/app/vaults/components/gauge-creation.tsx +++ b/apps/hub/src/app/vaults/components/gauge-creation.tsx @@ -5,7 +5,7 @@ import { Icons } from "@bera/ui/icons"; export const GaugeCreation = () => { return ( -
+
Add your protocol's Reward Vault
diff --git a/apps/hub/src/app/vaults/create/components/create-gauge-card.tsx b/apps/hub/src/app/vaults/create/components/create-gauge-card.tsx index 5de906ef1..b461b2bc4 100644 --- a/apps/hub/src/app/vaults/create/components/create-gauge-card.tsx +++ b/apps/hub/src/app/vaults/create/components/create-gauge-card.tsx @@ -3,45 +3,42 @@ import React, { useMemo, useState } from "react"; import { useRouter } from "next/navigation"; import { - usePollRewardVault, + ADDRESS_ZERO, + useRewardVaultFromToken, useStakingTokenInformation, - useTokenInformation, } from "@bera/berajs"; import { FormattedNumber, Spinner, Tooltip } from "@bera/shared-ui"; import { Button } from "@bera/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@bera/ui/card"; import { Icons } from "@bera/ui/icons"; -import { Input, InputWithLabel } from "@bera/ui/input"; +import { InputWithLabel } from "@bera/ui/input"; import { Address, isAddress } from "viem"; import { useCreateRewardVault } from "./useCreateRewardVault"; export const CreateGaugeCard: React.FC = () => { const [targetAddress, setTargetAddress] = useState(""); - const { createRewardVault, ModalPortal } = useCreateRewardVault({ + + const { + data: rewardVault, + isLoading: isLoadingRewardVault, + mutate, + } = useRewardVaultFromToken({ tokenAddress: targetAddress as Address, }); - const { data: rewardVaultData, isLoading: isLoadingRewardVault } = - usePollRewardVault( - isAddress(targetAddress) ? (targetAddress as `0x${string}`) : undefined, - ); + const { createRewardVault, ModalPortal } = useCreateRewardVault({ + tokenAddress: targetAddress as Address, + onSuccess: () => mutate(), + }); const { data: tokenInformation, error } = useStakingTokenInformation({ address: targetAddress, }); - const rewardVault = useMemo( - () => - rewardVaultData?.vaults.length === 0 - ? undefined - : rewardVaultData?.vaults?.[0], - [rewardVaultData], - ); - - console.log({ tokenInformation, error }); - const router = useRouter(); + const doesExist = !!rewardVault && rewardVault !== ADDRESS_ZERO; + return (
- - - ))} - - {address.toLowerCase() !== lendRewardsAddress.toLowerCase() ? ( - - ) : ( - - )} - - -
- - - Incentives - - - Validators - - -
- - - - - - - router.push(getHubValidatorPath(row.original.pubkey)) - } - /> - -
-
+ {activeIncentives + ?.filter((inc) => account && inc.manager === account) + .map((inc, idx) => ( + + +
+
+ Add {inc.token.name ? `${inc.token.name} ` : ""}incentives to + this rewards vault +
+
+ You are currently logged in with a token manager wallet + enabling you to add incentives. +
+
+ +
+
+ ))} + + {address.toLowerCase() !== lendRewardsAddress.toLowerCase() ? ( + ) : ( - + )} - + + +
+ + + Incentives + + + Validators + + +
+ + + + + + + router.push(getHubValidatorPath(row.original.pubkey)) + } + /> + +
+
); }; diff --git a/apps/hub/src/app/vaults/[gaugeAddress]/page.tsx b/apps/hub/src/app/vaults/[gaugeAddress]/page.tsx index acc3a02ab..940a141c8 100755 --- a/apps/hub/src/app/vaults/[gaugeAddress]/page.tsx +++ b/apps/hub/src/app/vaults/[gaugeAddress]/page.tsx @@ -2,10 +2,21 @@ import React from "react"; import { type Metadata } from "next"; import { notFound } from "next/navigation"; import { isIPFS } from "@bera/config"; -import { Address, createPublicClient, http, isAddress } from "viem"; +import { + Address, + PublicClient, + createPublicClient, + http, + isAddress, +} from "viem"; import { VaultDetails } from "./components/VaultDetails"; import { defaultBeraNetworkConfig } from "@bera/wagmi/config"; -import { BERA_VAULT_REWARDS_ABI } from "@bera/berajs/abi"; + +import { + getRewardVault, + getRewardVaultStakingToken, +} from "@bera/berajs/actions"; +import { ApiVaultFragment } from "@bera/graphql/pol/api"; export function generateMetadata(): Metadata { return { @@ -13,7 +24,9 @@ export function generateMetadata(): Metadata { }; } -export const revalidate = 10; +export const dynamicParams = true; + +export const revalidate = 30; export default async function PoolPage({ params, @@ -35,21 +48,33 @@ export default async function PoolPage({ transport: http(), }); - const stakeToken = await publicClient.readContract({ - address: params.gaugeAddress, - abi: BERA_VAULT_REWARDS_ABI, - functionName: "stakeToken", - }); + const vaultPromise = getRewardVault(params.gaugeAddress); - if (!stakeToken) { - console.error( - "Stake token address not found, so vault is invalid", - stakeToken, + try { + await getRewardVaultStakingToken({ + address: params.gaugeAddress, + // @ts-ignore viem types + publicClient: publicClient as PublicClient, + }); + } catch (error) { + console.error("Stake token address not found, so vault is invalid", error); + return notFound(); + } + + let rewardVault: ApiVaultFragment | undefined; + + try { + rewardVault = await vaultPromise; + } catch (error) { + console.warn( + "Vault not found during SSR, but staking token was found", + params.gaugeAddress, ); - notFound(); } - return ; + return ( + + ); } export function generateStaticParams() { diff --git a/turbo.json b/turbo.json index 65bd81f89..e1a070107 100755 --- a/turbo.json +++ b/turbo.json @@ -28,9 +28,7 @@ "env": [".env.bartio"] }, "check-types": { - "dependsOn": ["^build"], - "cache": false, - "outputs": ["storybook-static/**"] + "dependsOn": ["^build"] } }, "globalEnv": ["CI", "NODE_ENV", "SKIP_ENV_VALIDATION", "VERCEL", "VERCEL_ENV"] From 7fbaa3b50d5e40ccf694777dada7e16c91d515ee Mon Sep 17 00:00:00 2001 From: bearpong <178402093+bearpong@users.noreply.github.com> Date: Wed, 8 Jan 2025 17:50:03 -0500 Subject: [PATCH 07/14] refactor(pol): renames reward vault ABI --- .../governance/[genre]/proposal/[proposalId]/Actions.tsx | 4 ++-- apps/hub/src/app/incentivize/incentivize.tsx | 4 ++-- .../src/app/vaults/[gaugeAddress]/components/WithdrawLP.tsx | 4 ++-- .../src/app/vaults/[gaugeAddress]/components/deposit-lp.tsx | 4 ++-- apps/hub/src/app/vaults/components/claim-modal.tsx | 4 ++-- apps/hub/src/hooks/useClaimAllBgtCalldata.ts | 4 ++-- packages/berajs/src/abi/pol/reward-vault.ts | 2 +- packages/berajs/src/actions/bgt/getRewardVaultIncentives.ts | 6 +++--- packages/berajs/src/actions/bgt/getUserVaultsBalance.ts | 4 ++-- packages/berajs/src/actions/bgt/getUserVaultsReward.ts | 4 ++-- packages/berajs/src/actions/bgt/getVaultsSupply.ts | 4 ++-- .../berajs/src/actions/pol/getRewardVaultStakingToken.ts | 4 ++-- packages/berajs/src/hooks/modules/bgt/useUserVaults.ts | 6 +++--- .../berajs/src/hooks/modules/lend/usePollUserBGTRewards.ts | 4 ++-- .../pol/hooks/useRewardVaultBalanceFromStakingToken.ts | 4 ++-- 15 files changed, 31 insertions(+), 31 deletions(-) diff --git a/apps/hub/src/app/governance/[genre]/proposal/[proposalId]/Actions.tsx b/apps/hub/src/app/governance/[genre]/proposal/[proposalId]/Actions.tsx index e7d8b4f7d..c16e22d5d 100644 --- a/apps/hub/src/app/governance/[genre]/proposal/[proposalId]/Actions.tsx +++ b/apps/hub/src/app/governance/[genre]/proposal/[proposalId]/Actions.tsx @@ -1,4 +1,4 @@ -import { BERA_CHEF_ABI, BERA_VAULT_REWARDS_ABI } from "@bera/berajs"; +import { BERA_CHEF_ABI, rewardVaultAbi } from "@bera/berajs"; import { Card } from "@bera/ui/card"; import { serialize } from "wagmi"; import { useGetVerifiedAbi } from "@bera/berajs"; @@ -99,7 +99,7 @@ export const Actions = ({ const abi: Abi = [ ...BERA_CHEF_ABI, - ...BERA_VAULT_REWARDS_ABI, + ...rewardVaultAbi, ...erc20Abi, ...(data && !error && !isLoading ? JSON.parse(data) : []), ]; diff --git a/apps/hub/src/app/incentivize/incentivize.tsx b/apps/hub/src/app/incentivize/incentivize.tsx index 7a437ae6b..4bcd3ee34 100755 --- a/apps/hub/src/app/incentivize/incentivize.tsx +++ b/apps/hub/src/app/incentivize/incentivize.tsx @@ -3,7 +3,7 @@ import { useMemo, useState } from "react"; import { notFound, useSearchParams } from "next/navigation"; import { - BERA_VAULT_REWARDS_ABI, + rewardVaultAbi, TransactionActionType, truncateHash, usePollAllowance, @@ -292,7 +292,7 @@ export const Incentivize = () => { onClick={() => write({ address: gaugeInfo?.vaultAddress as Address, - abi: BERA_VAULT_REWARDS_ABI, + abi: rewardVaultAbi, functionName: "addIncentive", params: [ // We should make sure token is not undefined diff --git a/apps/hub/src/app/vaults/[gaugeAddress]/components/WithdrawLP.tsx b/apps/hub/src/app/vaults/[gaugeAddress]/components/WithdrawLP.tsx index 19149d945..0024c6335 100755 --- a/apps/hub/src/app/vaults/[gaugeAddress]/components/WithdrawLP.tsx +++ b/apps/hub/src/app/vaults/[gaugeAddress]/components/WithdrawLP.tsx @@ -1,6 +1,6 @@ import { useState } from "react"; import { - BERA_VAULT_REWARDS_ABI, + rewardVaultAbi, Token, TransactionActionType, usePollVaultsInfo, @@ -141,7 +141,7 @@ export const WithdrawLP = ({ onClick={() => write({ address: rewardVault.vaultAddress as Address, - abi: BERA_VAULT_REWARDS_ABI, + abi: rewardVaultAbi, functionName: "withdraw", params: [parseUnits(withdrawAmount, lpToken!.decimals)], }) diff --git a/apps/hub/src/app/vaults/[gaugeAddress]/components/deposit-lp.tsx b/apps/hub/src/app/vaults/[gaugeAddress]/components/deposit-lp.tsx index f659e923d..9772e85e9 100755 --- a/apps/hub/src/app/vaults/[gaugeAddress]/components/deposit-lp.tsx +++ b/apps/hub/src/app/vaults/[gaugeAddress]/components/deposit-lp.tsx @@ -1,6 +1,6 @@ import { useState } from "react"; import { - BERA_VAULT_REWARDS_ABI, + rewardVaultAbi, TransactionActionType, usePollAllowance, usePollVaultsInfo, @@ -120,7 +120,7 @@ export const DepositLP = ({ onClick={() => write({ address: rewardVault.vaultAddress as Address, - abi: BERA_VAULT_REWARDS_ABI, + abi: rewardVaultAbi, functionName: "stake", params: [parseUnits(depositAmount, lpToken!.decimals)], }) diff --git a/apps/hub/src/app/vaults/components/claim-modal.tsx b/apps/hub/src/app/vaults/components/claim-modal.tsx index b844218be..ccd9ad6d3 100755 --- a/apps/hub/src/app/vaults/components/claim-modal.tsx +++ b/apps/hub/src/app/vaults/components/claim-modal.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from "react"; import { - BERA_VAULT_REWARDS_ABI, + rewardVaultAbi, TransactionActionType, truncateHash, useBeraJs, @@ -166,7 +166,7 @@ export const ClaimBGTModal = ({ checkAddress(recipient) && write({ address: rewardVault, - abi: BERA_VAULT_REWARDS_ABI, + abi: rewardVaultAbi, functionName: "getReward", params: [account!, recipient], // TODO: A second param is needed here for recipient. Added current account twice for now }) diff --git a/apps/hub/src/hooks/useClaimAllBgtCalldata.ts b/apps/hub/src/hooks/useClaimAllBgtCalldata.ts index 25df2451b..abdc1c469 100755 --- a/apps/hub/src/hooks/useClaimAllBgtCalldata.ts +++ b/apps/hub/src/hooks/useClaimAllBgtCalldata.ts @@ -1,5 +1,5 @@ import React from "react"; -import { BERA_VAULT_REWARDS_ABI, useBeraJs } from "@bera/berajs"; +import { rewardVaultAbi, useBeraJs } from "@bera/berajs"; import { Address, encodeFunctionData } from "viem"; export const useClaimAllBgtCalldata = (vaultAddresses: Address[]) => { @@ -7,7 +7,7 @@ export const useClaimAllBgtCalldata = (vaultAddresses: Address[]) => { return React.useMemo(() => { const calls: any[] = vaultAddresses.map((vaultAddress) => { const data = encodeFunctionData({ - abi: BERA_VAULT_REWARDS_ABI, + abi: rewardVaultAbi, functionName: "getReward", args: [account!, account!], // TODO: A second param is needed here for recipient. Added current account twice for now }); diff --git a/packages/berajs/src/abi/pol/reward-vault.ts b/packages/berajs/src/abi/pol/reward-vault.ts index 60dcd488d..bfef4254a 100755 --- a/packages/berajs/src/abi/pol/reward-vault.ts +++ b/packages/berajs/src/abi/pol/reward-vault.ts @@ -1,4 +1,4 @@ -export const BERA_VAULT_REWARDS_ABI = [ +export const rewardVaultAbi = [ { type: "constructor", inputs: [], stateMutability: "nonpayable" }, { type: "function", diff --git a/packages/berajs/src/actions/bgt/getRewardVaultIncentives.ts b/packages/berajs/src/actions/bgt/getRewardVaultIncentives.ts index 64b80bdfc..9a8360515 100644 --- a/packages/berajs/src/actions/bgt/getRewardVaultIncentives.ts +++ b/packages/berajs/src/actions/bgt/getRewardVaultIncentives.ts @@ -6,7 +6,7 @@ import { formatUnits, } from "viem"; -import { BERA_VAULT_REWARDS_ABI } from "~/abi"; +import { rewardVaultAbi } from "~/abi"; export interface RewardVaultIncentive { token: Address; @@ -22,7 +22,7 @@ export const getRewardVaultIncentives = async ( ) => { const whitelistedTokens = await publicClient.readContract({ address: gaugeAddress, - abi: BERA_VAULT_REWARDS_ABI, + abi: rewardVaultAbi, functionName: "getWhitelistedTokens", }); @@ -30,7 +30,7 @@ export const getRewardVaultIncentives = async ( whitelistedTokens.map((incentive) => publicClient.readContract({ address: gaugeAddress, - abi: BERA_VAULT_REWARDS_ABI, + abi: rewardVaultAbi, functionName: "incentives", args: [incentive], }), diff --git a/packages/berajs/src/actions/bgt/getUserVaultsBalance.ts b/packages/berajs/src/actions/bgt/getUserVaultsBalance.ts index 78e9d483e..895c8712f 100755 --- a/packages/berajs/src/actions/bgt/getUserVaultsBalance.ts +++ b/packages/berajs/src/actions/bgt/getUserVaultsBalance.ts @@ -1,5 +1,5 @@ import { Address, PublicClient } from "viem"; -import { BERA_VAULT_REWARDS_ABI } from "~/abi"; +import { rewardVaultAbi } from "~/abi"; export interface GetUserVaultsInfo { account: string | undefined; @@ -19,7 +19,7 @@ export const getUserVaultsBalance = async ({ try { const result = await publicClient.readContract({ address: vaultAddress, - abi: BERA_VAULT_REWARDS_ABI, + abi: rewardVaultAbi, functionName: "balanceOf", args: [account as `0x${string}`], }); diff --git a/packages/berajs/src/actions/bgt/getUserVaultsReward.ts b/packages/berajs/src/actions/bgt/getUserVaultsReward.ts index 329ae6942..c266b50ae 100755 --- a/packages/berajs/src/actions/bgt/getUserVaultsReward.ts +++ b/packages/berajs/src/actions/bgt/getUserVaultsReward.ts @@ -1,6 +1,6 @@ import { Address, PublicClient } from "viem"; -import { BERA_VAULT_REWARDS_ABI } from "~/abi"; +import { rewardVaultAbi } from "~/abi"; export interface GetUserVaultsInfo { account: string | undefined; @@ -19,7 +19,7 @@ export const getUserVaultsReward = async ({ return await publicClient.readContract({ address: vaultAddress, - abi: BERA_VAULT_REWARDS_ABI, + abi: rewardVaultAbi, functionName: "earned", args: [account as `0x${string}`], }); diff --git a/packages/berajs/src/actions/bgt/getVaultsSupply.ts b/packages/berajs/src/actions/bgt/getVaultsSupply.ts index ec5564b9e..a9c5329e3 100755 --- a/packages/berajs/src/actions/bgt/getVaultsSupply.ts +++ b/packages/berajs/src/actions/bgt/getVaultsSupply.ts @@ -1,6 +1,6 @@ import { Address, PublicClient } from "viem"; -import { BERA_VAULT_REWARDS_ABI } from "~/abi"; +import { rewardVaultAbi } from "~/abi"; export interface GetVaultsSupply { vaultAddress: Address; @@ -16,7 +16,7 @@ export const getVaultsSupply = async ({ try { const result = await publicClient.readContract({ address: vaultAddress, - abi: BERA_VAULT_REWARDS_ABI, + abi: rewardVaultAbi, functionName: "totalSupply", args: [], }); diff --git a/packages/berajs/src/actions/pol/getRewardVaultStakingToken.ts b/packages/berajs/src/actions/pol/getRewardVaultStakingToken.ts index ed75d4e39..d2e17dd6b 100644 --- a/packages/berajs/src/actions/pol/getRewardVaultStakingToken.ts +++ b/packages/berajs/src/actions/pol/getRewardVaultStakingToken.ts @@ -2,7 +2,7 @@ import { rewardVaultFactoryAddress } from "@bera/config"; import { Address, PublicClient, createPublicClient } from "viem"; import { UsePublicClientReturnType } from "wagmi"; -import { BERA_VAULT_REWARDS_ABI } from "~/abi"; +import { rewardVaultAbi } from "~/abi"; export const getRewardVaultStakingToken = async ({ address, @@ -13,7 +13,7 @@ export const getRewardVaultStakingToken = async ({ }) => { const vaultAddress = await publicClient.readContract({ address: address, - abi: BERA_VAULT_REWARDS_ABI, + abi: rewardVaultAbi, functionName: "stakeToken", }); diff --git a/packages/berajs/src/hooks/modules/bgt/useUserVaults.ts b/packages/berajs/src/hooks/modules/bgt/useUserVaults.ts index 2ccac72d9..95f6df6a7 100755 --- a/packages/berajs/src/hooks/modules/bgt/useUserVaults.ts +++ b/packages/berajs/src/hooks/modules/bgt/useUserVaults.ts @@ -12,7 +12,7 @@ import useSWR from "swr"; import { Address, formatUnits } from "viem"; import { usePublicClient } from "wagmi"; -import { BERA_VAULT_REWARDS_ABI } from "~/abi"; +import { rewardVaultAbi } from "~/abi"; import { useBeraJs } from "~/contexts"; import POLLING from "~/enum/polling"; import { DefaultHookOptions, DefaultHookReturnType } from "~/types/global"; @@ -73,14 +73,14 @@ export const useUserVaults = ( const calls: Call[] = deposits.map((deposit) => ({ address: deposit.vaultAddress as Address, - abi: BERA_VAULT_REWARDS_ABI, + abi: rewardVaultAbi, functionName: "earned", args: [account], })); const balanceCalls: Call[] = deposits.map((deposit) => ({ address: deposit.vaultAddress as Address, - abi: BERA_VAULT_REWARDS_ABI, + abi: rewardVaultAbi, functionName: "balanceOf", args: [account], })); diff --git a/packages/berajs/src/hooks/modules/lend/usePollUserBGTRewards.ts b/packages/berajs/src/hooks/modules/lend/usePollUserBGTRewards.ts index db7fbe6b6..6431aa752 100755 --- a/packages/berajs/src/hooks/modules/lend/usePollUserBGTRewards.ts +++ b/packages/berajs/src/hooks/modules/lend/usePollUserBGTRewards.ts @@ -2,7 +2,7 @@ import { lendRewardsAddress, peripheryDebtToken } from "@bera/config"; import useSWR from "swr"; import { usePublicClient } from "wagmi"; -import { BERA_VAULT_REWARDS_ABI, lendRewardHelperAbi } from "~/abi"; +import { rewardVaultAbi, lendRewardHelperAbi } from "~/abi"; import { useBeraJs } from "~/contexts"; import POLLING from "~/enum/polling"; import { DefaultHookOptions } from "~/types"; @@ -22,7 +22,7 @@ export const usePollLendUserBGTRewards = (options?: DefaultHookOptions) => { try { const { result } = await publicClient.simulateContract({ address: lendRewardsAddress, - abi: BERA_VAULT_REWARDS_ABI, + abi: rewardVaultAbi, functionName: "getReward", account: account, args: [account, account], // TODO: A second param is needed here for recipient. Added current account twice for now diff --git a/packages/berajs/src/hooks/modules/pol/hooks/useRewardVaultBalanceFromStakingToken.ts b/packages/berajs/src/hooks/modules/pol/hooks/useRewardVaultBalanceFromStakingToken.ts index af307a750..769b10668 100644 --- a/packages/berajs/src/hooks/modules/pol/hooks/useRewardVaultBalanceFromStakingToken.ts +++ b/packages/berajs/src/hooks/modules/pol/hooks/useRewardVaultBalanceFromStakingToken.ts @@ -3,7 +3,7 @@ import useSWR from "swr"; import { Address } from "viem"; import { usePublicClient } from "wagmi"; -import { BERA_CHEF_ABI, BERA_VAULT_REWARDS_ABI } from "~/abi"; +import { BERA_CHEF_ABI, rewardVaultAbi } from "~/abi"; import { ADDRESS_ZERO } from "~/config"; import { useBeraJs } from "~/contexts"; import { useIsWhitelistedVault } from "~/hooks/useIsWhitelistedVault"; @@ -61,7 +61,7 @@ export const useRewardVaultBalanceFromStakingToken = ({ const balance = account ? await client?.readContract({ address: rewardVaultAddress!, - abi: BERA_VAULT_REWARDS_ABI, + abi: rewardVaultAbi, functionName: "balanceOf", args: [account], }) From 716cb44a2c90990c5824abb8f9aa22970269e215 Mon Sep 17 00:00:00 2001 From: bearpong <178402093+bearpong@users.noreply.github.com> Date: Wed, 8 Jan 2025 17:53:30 -0500 Subject: [PATCH 08/14] refactor(pol): renames vault route param --- .../components/VaultDetails.tsx | 0 .../components/WithdrawLP.tsx | 0 .../components/banner.tsx | 0 .../components/deposit-lp.tsx | 0 .../components/my-gauge-details.tsx | 0 .../{[gaugeAddress] => [address]}/loading.tsx | 0 .../{[gaugeAddress] => [address]}/page.tsx | 18 ++++++++---------- apps/hub/src/app/vaults/vault/page.tsx | 10 +++++----- .../actions/bgt/getRewardVaultIncentives.ts | 6 +++--- 9 files changed, 16 insertions(+), 18 deletions(-) rename apps/hub/src/app/vaults/{[gaugeAddress] => [address]}/components/VaultDetails.tsx (100%) rename apps/hub/src/app/vaults/{[gaugeAddress] => [address]}/components/WithdrawLP.tsx (100%) rename apps/hub/src/app/vaults/{[gaugeAddress] => [address]}/components/banner.tsx (100%) rename apps/hub/src/app/vaults/{[gaugeAddress] => [address]}/components/deposit-lp.tsx (100%) rename apps/hub/src/app/vaults/{[gaugeAddress] => [address]}/components/my-gauge-details.tsx (100%) rename apps/hub/src/app/vaults/{[gaugeAddress] => [address]}/loading.tsx (100%) rename apps/hub/src/app/vaults/{[gaugeAddress] => [address]}/page.tsx (79%) diff --git a/apps/hub/src/app/vaults/[gaugeAddress]/components/VaultDetails.tsx b/apps/hub/src/app/vaults/[address]/components/VaultDetails.tsx similarity index 100% rename from apps/hub/src/app/vaults/[gaugeAddress]/components/VaultDetails.tsx rename to apps/hub/src/app/vaults/[address]/components/VaultDetails.tsx diff --git a/apps/hub/src/app/vaults/[gaugeAddress]/components/WithdrawLP.tsx b/apps/hub/src/app/vaults/[address]/components/WithdrawLP.tsx similarity index 100% rename from apps/hub/src/app/vaults/[gaugeAddress]/components/WithdrawLP.tsx rename to apps/hub/src/app/vaults/[address]/components/WithdrawLP.tsx diff --git a/apps/hub/src/app/vaults/[gaugeAddress]/components/banner.tsx b/apps/hub/src/app/vaults/[address]/components/banner.tsx similarity index 100% rename from apps/hub/src/app/vaults/[gaugeAddress]/components/banner.tsx rename to apps/hub/src/app/vaults/[address]/components/banner.tsx diff --git a/apps/hub/src/app/vaults/[gaugeAddress]/components/deposit-lp.tsx b/apps/hub/src/app/vaults/[address]/components/deposit-lp.tsx similarity index 100% rename from apps/hub/src/app/vaults/[gaugeAddress]/components/deposit-lp.tsx rename to apps/hub/src/app/vaults/[address]/components/deposit-lp.tsx diff --git a/apps/hub/src/app/vaults/[gaugeAddress]/components/my-gauge-details.tsx b/apps/hub/src/app/vaults/[address]/components/my-gauge-details.tsx similarity index 100% rename from apps/hub/src/app/vaults/[gaugeAddress]/components/my-gauge-details.tsx rename to apps/hub/src/app/vaults/[address]/components/my-gauge-details.tsx diff --git a/apps/hub/src/app/vaults/[gaugeAddress]/loading.tsx b/apps/hub/src/app/vaults/[address]/loading.tsx similarity index 100% rename from apps/hub/src/app/vaults/[gaugeAddress]/loading.tsx rename to apps/hub/src/app/vaults/[address]/loading.tsx diff --git a/apps/hub/src/app/vaults/[gaugeAddress]/page.tsx b/apps/hub/src/app/vaults/[address]/page.tsx similarity index 79% rename from apps/hub/src/app/vaults/[gaugeAddress]/page.tsx rename to apps/hub/src/app/vaults/[address]/page.tsx index 940a141c8..c8ddc568c 100755 --- a/apps/hub/src/app/vaults/[gaugeAddress]/page.tsx +++ b/apps/hub/src/app/vaults/[address]/page.tsx @@ -31,14 +31,14 @@ export const revalidate = 30; export default async function PoolPage({ params, }: { - params: { gaugeAddress: Address }; + params: { address: Address }; }) { if (isIPFS) { return null; } - if (!isAddress(params.gaugeAddress)) { - console.error("Invalid gauge address", params.gaugeAddress); + if (!isAddress(params.address)) { + console.error("Invalid gauge address", params.address); notFound(); } @@ -48,11 +48,11 @@ export default async function PoolPage({ transport: http(), }); - const vaultPromise = getRewardVault(params.gaugeAddress); + const vaultPromise = getRewardVault(params.address); try { await getRewardVaultStakingToken({ - address: params.gaugeAddress, + address: params.address, // @ts-ignore viem types publicClient: publicClient as PublicClient, }); @@ -68,19 +68,17 @@ export default async function PoolPage({ } catch (error) { console.warn( "Vault not found during SSR, but staking token was found", - params.gaugeAddress, + params.address, ); } - return ( - - ); + return ; } export function generateStaticParams() { return [ { - gaugeAddress: "0x", + address: "0x", }, ]; } diff --git a/apps/hub/src/app/vaults/vault/page.tsx b/apps/hub/src/app/vaults/vault/page.tsx index 91b1fe883..dac66145a 100644 --- a/apps/hub/src/app/vaults/vault/page.tsx +++ b/apps/hub/src/app/vaults/vault/page.tsx @@ -4,17 +4,17 @@ import { FC, Suspense } from "react"; import { notFound, useSearchParams } from "next/navigation"; import { isAddress } from "viem"; -import { VaultDetails } from "../[gaugeAddress]/components/VaultDetails"; -import Loading from "../[gaugeAddress]/loading"; +import { VaultDetails } from "../[address]/components/VaultDetails"; +import Loading from "../[address]/loading"; const Gauge: FC = () => { const searchParams = useSearchParams(); - const gaugeAddress = searchParams.get("address"); + const address = searchParams.get("address"); - if (!gaugeAddress || !isAddress(gaugeAddress)) { + if (!address || !isAddress(address)) { return notFound(); } - return ; + return ; }; export default function GaugeStaticPage() { diff --git a/packages/berajs/src/actions/bgt/getRewardVaultIncentives.ts b/packages/berajs/src/actions/bgt/getRewardVaultIncentives.ts index 9a8360515..af77fed86 100644 --- a/packages/berajs/src/actions/bgt/getRewardVaultIncentives.ts +++ b/packages/berajs/src/actions/bgt/getRewardVaultIncentives.ts @@ -17,11 +17,11 @@ export interface RewardVaultIncentive { } export const getRewardVaultIncentives = async ( - gaugeAddress: Address, + address: Address, publicClient: PublicClient, ) => { const whitelistedTokens = await publicClient.readContract({ - address: gaugeAddress, + address: address, abi: rewardVaultAbi, functionName: "getWhitelistedTokens", }); @@ -29,7 +29,7 @@ export const getRewardVaultIncentives = async ( const incentivesInfoPromise = Promise.all( whitelistedTokens.map((incentive) => publicClient.readContract({ - address: gaugeAddress, + address: address, abi: rewardVaultAbi, functionName: "incentives", args: [incentive], From 1b8422de7113bcbcf368c6e1e89c07f54d84c2c5 Mon Sep 17 00:00:00 2001 From: bearpong <178402093+bearpong@users.noreply.github.com> Date: Wed, 8 Jan 2025 17:55:45 -0500 Subject: [PATCH 09/14] fix(pol): BGT inflation --- apps/hub/src/app/vaults/components/gauge-info-card.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/hub/src/app/vaults/components/gauge-info-card.tsx b/apps/hub/src/app/vaults/components/gauge-info-card.tsx index ddec25cb0..90427468e 100755 --- a/apps/hub/src/app/vaults/components/gauge-info-card.tsx +++ b/apps/hub/src/app/vaults/components/gauge-info-card.tsx @@ -84,7 +84,7 @@ export default function GaugeInfoCard() { /> From e93312a6bcf9b32972742473f49fd2f2cc90418b Mon Sep 17 00:00:00 2001 From: brown Date: Wed, 8 Jan 2025 18:10:09 -0500 Subject: [PATCH 10/14] fix(honey): remove deprecated honey api call Refs BFE-452 --- apps/honey/src/app/api/useHoneyEvents.ts | 118 ----------------------- apps/honey/src/utils/vercel-utils.ts | 19 ---- 2 files changed, 137 deletions(-) delete mode 100755 apps/honey/src/app/api/useHoneyEvents.ts delete mode 100755 apps/honey/src/utils/vercel-utils.ts diff --git a/apps/honey/src/app/api/useHoneyEvents.ts b/apps/honey/src/app/api/useHoneyEvents.ts deleted file mode 100755 index 22fd4763f..000000000 --- a/apps/honey/src/app/api/useHoneyEvents.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { POLLING } from "@bera/shared-ui"; -import useSWRInfinite from "swr/infinite"; - -import { getAbsoluteUrl } from "~/utils/vercel-utils"; - -const DEFAULT_SIZE = 10; - -const fetchData = async (url: string) => { - try { - const res = await fetch(url, { - method: "GET", - headers: { - "x-vercel-protection-bypass": "4fphLjUJKQcW0kAbaFBGUNcAHb2WwnTX", - }, - }); - const jsonRes = await res.json(); - return jsonRes; - } catch (e) { - console.error(e); - return null; - } -}; - -export const useHoneyEvents = () => { - const { - data: allData, - size: allDataSize, - setSize: setAllDataSize, - isLoading: isAllDataLoading, - } = useSWRInfinite( - (index) => ["allHoneyData", index], - (key) => - fetchData( - `${getAbsoluteUrl()}/api?page=${ - (key[1] ?? 0) + 1 - }&perPage=${DEFAULT_SIZE}`, - ), - { refreshInterval: POLLING.SLOW }, - ); - - const { - data: mintData, - size: mintDataSize, - setSize: setMintDataSize, - isLoading: isMintDataLoading, - } = useSWRInfinite( - (index) => ["mintData", index], - (key) => - fetchData( - `${getAbsoluteUrl()}/api?page=${ - (key[1] ?? 0) + 1 - }&perPage=${DEFAULT_SIZE}&mint`, - ), - ); - - const { - data: burnData, - size: burnDataSize, - setSize: setBurnDataSize, - isLoading: isBurnDataLoading, - } = useSWRInfinite( - (index) => ["burnData", index], - (key) => - fetchData( - `${getAbsoluteUrl()}/api?page=${ - (key[1] ?? 0) + 1 - }&perPage=${DEFAULT_SIZE}&burn`, - ), - ); - - const isAllDataLoadingMore = - isAllDataLoading || - (allDataSize > 0 && - allData && - typeof allData[allDataSize - 1] === "undefined"); - const isMintDataLoadingMore = - isMintDataLoading || - (mintDataSize > 0 && - mintData && - typeof mintData[mintDataSize - 1] === "undefined"); - const isBurnDataLoadingMore = - isBurnDataLoading || - (burnDataSize > 0 && - burnData && - typeof burnData[burnDataSize - 1] === "undefined"); - - const isAllDataEmpty = allData?.[0]?.length === 0; - const isSwapDataEmpty = mintData?.[0]?.length === 0; - const isBurnDataEmpty = burnData?.[0]?.length === 0; - - const isAllDataReachingEnd = - isAllDataEmpty || - (allData && allData[allData.length - 1]?.length < DEFAULT_SIZE); - const isMintDataReachingEnd = - isSwapDataEmpty || - (mintData && mintData[mintData.length - 1]?.length < DEFAULT_SIZE); - const isBurnDataReachingEnd = - isBurnDataEmpty || - (burnData && burnData[burnData.length - 1]?.length < DEFAULT_SIZE); - - return { - allData: allData ? [].concat(...allData) : [], - allDataSize, - setAllDataSize, - isAllDataLoadingMore, - isAllDataReachingEnd, - mintData: mintData ? [].concat(...mintData) : [], - mintDataSize, - setMintDataSize, - isMintDataLoadingMore, - isMintDataReachingEnd, - burnData: burnData ? [].concat(...burnData) : [], - burnDataSize, - setBurnDataSize, - isBurnDataLoadingMore, - isBurnDataReachingEnd, - }; -}; diff --git a/apps/honey/src/utils/vercel-utils.ts b/apps/honey/src/utils/vercel-utils.ts deleted file mode 100755 index 7396b8c35..000000000 --- a/apps/honey/src/utils/vercel-utils.ts +++ /dev/null @@ -1,19 +0,0 @@ -// utils/vercel-utils.tsx -export const IS_SERVER = typeof window === "undefined"; -export function getProtocol() { - const isProd = process.env.VERCEL_ENV === "production"; - if (isProd) return "https://"; - return "http://"; -} -export function getAbsoluteUrl() { - //get absolute url in client/browser - if (!IS_SERVER) { - return location.origin; - } - //get absolute url in server. - const protocol = getProtocol(); - if (process.env.VERCEL_URL) { - return `${protocol}${process.env.VERCEL_URL}`; - } - return "http://localhost:3000"; -} From eb9409c4fcbfa1deeab08e0eb60e9606c1c44029 Mon Sep 17 00:00:00 2001 From: bearpong <178402093+bearpong@users.noreply.github.com> Date: Wed, 8 Jan 2025 18:10:26 -0500 Subject: [PATCH 11/14] chore: fetches vault description and renders markdown --- apps/hub/src/app/incentivize/incentivize.tsx | 4 +-- .../[address]/components/VaultDetails.tsx | 4 +-- .../[address]/components/my-gauge-details.tsx | 29 +++++++++++++++++-- apps/hub/src/components/chart-tooltip.tsx | 4 +-- .../src/components/gauge-header-widget.tsx | 4 +-- .../components/user-gauge-weight-table.tsx | 2 +- packages/graphql/src/modules/pol/api.graphql | 5 ++-- secrets | 2 +- 8 files changed, 38 insertions(+), 16 deletions(-) diff --git a/apps/hub/src/app/incentivize/incentivize.tsx b/apps/hub/src/app/incentivize/incentivize.tsx index 4bcd3ee34..7763d8294 100755 --- a/apps/hub/src/app/incentivize/incentivize.tsx +++ b/apps/hub/src/app/incentivize/incentivize.tsx @@ -130,10 +130,10 @@ export const Incentivize = () => { <> {" "} - {gaugeInfo?.metadata?.productName ?? "OTHER"} + {gaugeInfo?.metadata?.protocolName ?? "OTHER"} ), externalLink: gaugeInfo?.metadata?.url ?? "", diff --git a/apps/hub/src/app/vaults/[address]/components/VaultDetails.tsx b/apps/hub/src/app/vaults/[address]/components/VaultDetails.tsx index 628875a68..7f3060b16 100755 --- a/apps/hub/src/app/vaults/[address]/components/VaultDetails.tsx +++ b/apps/hub/src/app/vaults/[address]/components/VaultDetails.tsx @@ -113,10 +113,10 @@ const _VaultDetails = ({ address }: { address: Address }) => { content: ( <> - {rewardVault?.metadata?.productName ?? "OTHER"} + {rewardVault?.metadata?.protocolName ?? "OTHER"} ), externalLink: rewardVault?.metadata?.url ?? "", diff --git a/apps/hub/src/app/vaults/[address]/components/my-gauge-details.tsx b/apps/hub/src/app/vaults/[address]/components/my-gauge-details.tsx index 2b864f61c..c4a868993 100755 --- a/apps/hub/src/app/vaults/[address]/components/my-gauge-details.tsx +++ b/apps/hub/src/app/vaults/[address]/components/my-gauge-details.tsx @@ -17,6 +17,7 @@ import { DialogTrigger, } from "@bera/ui/dialog"; import { WithdrawLP } from "./WithdrawLP"; +import Markdown from "react-markdown"; export const MyGaugeDetails = ({ rewardVault, @@ -44,9 +45,31 @@ export const MyGaugeDetails = ({
-

How do I get Receipt Tokens?

-

- {rewardVault?.metadata?.description} +

+ How do I get Receipt Tokens? +

+

+ ( + + {children} + + ), + i: ({ children }) => {children}, + b: ({ children }) => ( + {children} + ), + }} + allowedElements={["a", "i", "b", "p"]} + > + {rewardVault?.metadata?.description} +

diff --git a/apps/hub/src/components/chart-tooltip.tsx b/apps/hub/src/components/chart-tooltip.tsx index d107e7c25..86c272b4f 100755 --- a/apps/hub/src/components/chart-tooltip.tsx +++ b/apps/hub/src/components/chart-tooltip.tsx @@ -41,10 +41,10 @@ export function ChartTooltip({
{" "} - {gauge.receivingVault?.metadata?.productName ?? "OTHER"} + {gauge.receivingVault?.metadata?.protocolName ?? "OTHER"}
diff --git a/apps/hub/src/components/gauge-header-widget.tsx b/apps/hub/src/components/gauge-header-widget.tsx index 85128a6aa..61bd5d8bf 100755 --- a/apps/hub/src/components/gauge-header-widget.tsx +++ b/apps/hub/src/components/gauge-header-widget.tsx @@ -48,10 +48,10 @@ export const GaugeHeaderWidget = ({
- {gauge.metadata?.productName ?? "OTHER"} + {gauge.metadata?.protocolName ?? "OTHER"}
)} diff --git a/apps/hub/src/components/user-gauge-weight-table.tsx b/apps/hub/src/components/user-gauge-weight-table.tsx index d5a46c370..d780bcd3e 100755 --- a/apps/hub/src/components/user-gauge-weight-table.tsx +++ b/apps/hub/src/components/user-gauge-weight-table.tsx @@ -42,7 +42,7 @@ export default function UserGaugeWeightTable({ .filter((vaultInfo: UserVault) => { if (keywords === "") return true; if (vaultInfo.vault.metadata?.name?.includes(keywords)) return true; - if (vaultInfo.vault.metadata?.productName?.includes(keywords)) + if (vaultInfo.vault.metadata?.protocolName?.includes(keywords)) return true; if (vaultInfo.vault.vaultAddress.includes(keywords)) return true; return false; diff --git a/packages/graphql/src/modules/pol/api.graphql b/packages/graphql/src/modules/pol/api.graphql index df07439bc..0ec13115e 100644 --- a/packages/graphql/src/modules/pol/api.graphql +++ b/packages/graphql/src/modules/pol/api.graphql @@ -32,12 +32,11 @@ fragment ApiVault on GqlRewardVault { } metadata { - name name logoURI url - productName - description: name + protocolName + description } activeIncentives { diff --git a/secrets b/secrets index 65952c75e..00dbef920 160000 --- a/secrets +++ b/secrets @@ -1 +1 @@ -Subproject commit 65952c75ec929af891255e62e0282939f5a6473b +Subproject commit 00dbef920070fcd1bc61084e81597940506e5319 From 9686ca92fd2d7fb4f46ffe0951e2cea6bf5397d6 Mon Sep 17 00:00:00 2001 From: bearpong <178402093+bearpong@users.noreply.github.com> Date: Wed, 8 Jan 2025 18:23:27 -0500 Subject: [PATCH 12/14] fix: hydration error --- .../src/app/vaults/[address]/components/my-gauge-details.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/hub/src/app/vaults/[address]/components/my-gauge-details.tsx b/apps/hub/src/app/vaults/[address]/components/my-gauge-details.tsx index c4a868993..8e4fe7452 100755 --- a/apps/hub/src/app/vaults/[address]/components/my-gauge-details.tsx +++ b/apps/hub/src/app/vaults/[address]/components/my-gauge-details.tsx @@ -48,7 +48,7 @@ export const MyGaugeDetails = ({

How do I get Receipt Tokens?

-

+

( @@ -70,7 +70,7 @@ export const MyGaugeDetails = ({ > {rewardVault?.metadata?.description} -

+
)} From c7096ffad7c05d4c3a84e47af71ba5c4c1091a22 Mon Sep 17 00:00:00 2001 From: bearpong <178402093+bearpong@users.noreply.github.com> Date: Wed, 8 Jan 2025 19:34:56 -0500 Subject: [PATCH 13/14] chore(pol): removes loading from vaults homepage --- apps/hub/src/app/vaults/[address]/page.tsx | 17 ++---- .../app/vaults/components/RewardVaults.tsx | 52 +++++++++++++++++++ .../app/vaults/components/gauge-info-card.tsx | 17 +++--- apps/hub/src/app/vaults/components/gauge.tsx | 27 ---------- apps/hub/src/app/vaults/page.tsx | 28 ++++++++-- .../src/components/getRewardVaultsFilter.ts | 32 ++++++++++++ .../components/global-gauge-weight-chart.tsx | 4 +- .../components/global-gauge-weight-table.tsx | 38 +++++--------- apps/hub/src/utils/serverSidePublicClient.ts | 11 ++++ .../src/actions/bgt/getBGTGlobalInfo.ts | 4 +- .../berajs/src/actions/bgt/getGlobalData.ts | 36 +++++++++++++ packages/berajs/src/actions/bgt/index.ts | 2 + .../berajs/src/hooks/modules/bgt/index.ts | 2 +- .../hooks/modules/bgt/usePollGlobalData.ts | 44 +++------------- 14 files changed, 193 insertions(+), 121 deletions(-) create mode 100755 apps/hub/src/app/vaults/components/RewardVaults.tsx delete mode 100755 apps/hub/src/app/vaults/components/gauge.tsx create mode 100644 apps/hub/src/components/getRewardVaultsFilter.ts create mode 100644 apps/hub/src/utils/serverSidePublicClient.ts create mode 100644 packages/berajs/src/actions/bgt/getGlobalData.ts diff --git a/apps/hub/src/app/vaults/[address]/page.tsx b/apps/hub/src/app/vaults/[address]/page.tsx index c8ddc568c..af6b9a758 100755 --- a/apps/hub/src/app/vaults/[address]/page.tsx +++ b/apps/hub/src/app/vaults/[address]/page.tsx @@ -2,21 +2,15 @@ import React from "react"; import { type Metadata } from "next"; import { notFound } from "next/navigation"; import { isIPFS } from "@bera/config"; -import { - Address, - PublicClient, - createPublicClient, - http, - isAddress, -} from "viem"; +import { Address, PublicClient, isAddress } from "viem"; import { VaultDetails } from "./components/VaultDetails"; -import { defaultBeraNetworkConfig } from "@bera/wagmi/config"; import { getRewardVault, getRewardVaultStakingToken, } from "@bera/berajs/actions"; import { ApiVaultFragment } from "@bera/graphql/pol/api"; +import { getServerSidePublicClient } from "~/utils/serverSidePublicClient"; export function generateMetadata(): Metadata { return { @@ -42,12 +36,7 @@ export default async function PoolPage({ notFound(); } - const publicClient = createPublicClient({ - // @ts-ignore viem types - chain: defaultBeraNetworkConfig.chain, - transport: http(), - }); - + const publicClient = await getServerSidePublicClient(); const vaultPromise = getRewardVault(params.address); try { diff --git a/apps/hub/src/app/vaults/components/RewardVaults.tsx b/apps/hub/src/app/vaults/components/RewardVaults.tsx new file mode 100755 index 000000000..e6e7b3044 --- /dev/null +++ b/apps/hub/src/app/vaults/components/RewardVaults.tsx @@ -0,0 +1,52 @@ +"use client"; + +import React from "react"; +import { usePollGlobalData, usePollGlobalDataQueryKey } from "@bera/berajs"; + +import GlobalGaugeWeightChart from "~/components/global-gauge-weight-chart"; +import GaugeTables from "./gauge-tables"; +import GaugeInfoCard from "./gauge-info-card"; +import { GaugeCreation } from "./gauge-creation"; +import { SWRFallback } from "@bera/berajs"; +import { unstable_serialize } from "swr"; +import { useRewardVaultsQueryKey } from "@bera/berajs"; +import { getRewardVaultsFilter } from "~/components/getRewardVaultsFilter"; +import { GetGaugeData, GlobalData } from "@bera/berajs/actions"; + +export default function RewardVaults({ + vaults, + globalInfo, +}: { + vaults: GetGaugeData | undefined; + globalInfo: GlobalData | undefined; +}) { + return ( + + + + ); +} + +export function Gauge() { + const { data, isLoading: isGlobalDataLoading } = usePollGlobalData(); + return ( +
+
+ + +
+ + +
+ ); +} diff --git a/apps/hub/src/app/vaults/components/gauge-info-card.tsx b/apps/hub/src/app/vaults/components/gauge-info-card.tsx index 90427468e..1f87d0d35 100755 --- a/apps/hub/src/app/vaults/components/gauge-info-card.tsx +++ b/apps/hub/src/app/vaults/components/gauge-info-card.tsx @@ -18,8 +18,7 @@ import { Badge } from "@bera/ui/badge"; export default function GaugeInfoCard() { const { data: globalData, isLoading } = usePollGlobalData(); - const { data: bgtInflation, isLoading: isBgtInflationLoading } = - useBgtInflation(); + const { data: bgtInflation } = useBgtInflation(); const blockTime = useBlockTime(); @@ -30,7 +29,7 @@ export default function GaugeInfoCard() {
Active Reward Vaults
- {!isLoading ? ( + {globalData ? ( {globalData?.activeRewardVaultCount} @@ -42,7 +41,7 @@ export default function GaugeInfoCard() {
Active Incentives
- {!isLoading && globalData ? ( + {globalData ? ( Total Circulating BGT
- {isLoading ? ( + {!globalData ? ( ) : (
@@ -72,7 +71,7 @@ export default function GaugeInfoCard() {
BGT Distribution (Yearly)
- {isBgtInflationLoading ? ( + {!bgtInflation ? ( ) : (
@@ -84,7 +83,7 @@ export default function GaugeInfoCard() { /> @@ -98,7 +97,7 @@ export default function GaugeInfoCard() {
# Of Active Validators
- {isLoading || !globalData ? ( + {!globalData ? ( ) : (
@@ -111,7 +110,7 @@ export default function GaugeInfoCard() {
Top 3 Validators
- {!isLoading && globalData ? ( + {globalData ? ( globalData.top3EmittingValidators?.map((validator, index) => { const estimatedBgtPerYear = getValidatorEstimatedBgtPerYear( validator, diff --git a/apps/hub/src/app/vaults/components/gauge.tsx b/apps/hub/src/app/vaults/components/gauge.tsx deleted file mode 100755 index 50e4ff870..000000000 --- a/apps/hub/src/app/vaults/components/gauge.tsx +++ /dev/null @@ -1,27 +0,0 @@ -"use client"; - -import React from "react"; -import { usePollGlobalData } from "@bera/berajs"; - -import GlobalGaugeWeightChart from "~/components/global-gauge-weight-chart"; -import GaugeTables from "./gauge-tables"; -import GaugeInfoCard from "./gauge-info-card"; -import { GaugeCreation } from "./gauge-creation"; - -export default function Gauge() { - const { data, isLoading: isGlobalDataLoading } = usePollGlobalData(); - return ( -
-
- - -
- - -
- ); -} diff --git a/apps/hub/src/app/vaults/page.tsx b/apps/hub/src/app/vaults/page.tsx index 6ac86b2eb..610ccaa1e 100755 --- a/apps/hub/src/app/vaults/page.tsx +++ b/apps/hub/src/app/vaults/page.tsx @@ -1,7 +1,29 @@ import React from "react"; -import Gauge from "./components/gauge"; +import RewardVaultsPage from "./components/RewardVaults"; +import { getGlobalData, getRewardVaults } from "@bera/berajs/actions"; +import { getRewardVaultsFilter } from "~/components/getRewardVaultsFilter"; +import { getServerSidePublicClient } from "~/utils/serverSidePublicClient"; +import { defaultBeraConfig } from "@bera/berajs/config"; -export default function Page() { - return ; +export default async function Page() { + const publicClient = await getServerSidePublicClient(); + + const [vaults, globalData] = await Promise.allSettled([ + getRewardVaults({ filter: getRewardVaultsFilter() }), + getGlobalData( + // @ts-ignore viem types + publicClient, + defaultBeraConfig, + ), + ]); + + return ( + + ); } diff --git a/apps/hub/src/components/getRewardVaultsFilter.ts b/apps/hub/src/components/getRewardVaultsFilter.ts new file mode 100644 index 000000000..8706df322 --- /dev/null +++ b/apps/hub/src/components/getRewardVaultsFilter.ts @@ -0,0 +1,32 @@ +import { + GqlRewardVaultOrderBy, + GqlRewardVaultOrderDirection, +} from "@bera/graphql/dex/api"; +import type { SortingState } from "@tanstack/react-table"; + +const map: Record = { + allTimeReceivedBGTAmount: GqlRewardVaultOrderBy.AllTimeBgtReceived, + dynamicData_bgtCapturePercentage: GqlRewardVaultOrderBy.BgtCapturePercentage, +}; +export const REWARD_VAULTS_PAGE_SIZE = 10; + +export const getRewardVaultsFilter = ( + sorting: SortingState = [], + page = 0, + pageSize = REWARD_VAULTS_PAGE_SIZE, + keywords = "", +) => { + return { + orderBy: map[sorting[0]?.id], + orderDirection: + sorting[0] !== undefined + ? sorting[0]?.desc + ? GqlRewardVaultOrderDirection.Desc + : GqlRewardVaultOrderDirection.Asc + : undefined, + skip: pageSize * page, + // filterByProduct: markets, + pageSize: pageSize, + search: keywords === "" || !keywords ? undefined : keywords, + }; +}; diff --git a/apps/hub/src/components/global-gauge-weight-chart.tsx b/apps/hub/src/components/global-gauge-weight-chart.tsx index f3f882cb8..cb04e20d5 100755 --- a/apps/hub/src/components/global-gauge-weight-chart.tsx +++ b/apps/hub/src/components/global-gauge-weight-chart.tsx @@ -139,9 +139,9 @@ export default function GlobalGaugeWeightChart({
{isLoading ? ( - + ) : ( -
+
= { - allTimeReceivedBGTAmount: GqlRewardVaultOrderBy.AllTimeBgtReceived, - dynamicData_bgtCapturePercentage: GqlRewardVaultOrderBy.BgtCapturePercentage, -}; export default function GlobalGaugeWeightTable({ myGauge = false, keywords = "", @@ -48,19 +43,12 @@ export default function GlobalGaugeWeightTable({ }, [markets]); const { data, isLoading, isValidating } = useRewardVaults( - { - orderBy: map[sorting[0]?.id], - orderDirection: - sorting[0] !== undefined - ? sorting[0]?.desc - ? GqlRewardVaultOrderDirection.Desc - : GqlRewardVaultOrderDirection.Asc - : undefined, - skip: GAUGE_PAGE_SIZE * page, - // filterByProduct: markets, - pageSize: GAUGE_PAGE_SIZE, - search: isTyping ? "" : keywords, - }, + getRewardVaultsFilter( + sorting, + page, + REWARD_VAULTS_PAGE_SIZE, + isTyping ? "" : keywords, + ), { opts: { keepPreviousData: true } }, ); @@ -97,7 +85,7 @@ export default function GlobalGaugeWeightTable({ typeof updater === "function" ? updater({ pageIndex: prev ?? 0, - pageSize: GAUGE_PAGE_SIZE, + pageSize: REWARD_VAULTS_PAGE_SIZE, }) : updater; return newPaginationState.pageIndex ?? 0; @@ -120,14 +108,14 @@ export default function GlobalGaugeWeightTable({ state: { pagination: { pageIndex: page, - pageSize: GAUGE_PAGE_SIZE, + pageSize: REWARD_VAULTS_PAGE_SIZE, }, sorting, }, manualSorting: true, manualPagination: true, autoResetPageIndex: false, - pageCount: Math.ceil(gaugeCounts / GAUGE_PAGE_SIZE), + pageCount: Math.ceil(gaugeCounts / REWARD_VAULTS_PAGE_SIZE), onPaginationChange: handlePaginationChange, onSortingChange: handleSortingChange, }, diff --git a/apps/hub/src/utils/serverSidePublicClient.ts b/apps/hub/src/utils/serverSidePublicClient.ts new file mode 100644 index 000000000..e8cb365af --- /dev/null +++ b/apps/hub/src/utils/serverSidePublicClient.ts @@ -0,0 +1,11 @@ +import { defaultBeraNetworkConfig } from "@bera/wagmi/config"; +import "server-only"; +import { createPublicClient, http } from "viem"; + +export const getServerSidePublicClient = async () => { + return createPublicClient({ + // @ts-ignore viem types + chain: defaultBeraNetworkConfig.chain, + transport: http(), + }); +}; diff --git a/packages/berajs/src/actions/bgt/getBGTGlobalInfo.ts b/packages/berajs/src/actions/bgt/getBGTGlobalInfo.ts index 453a83ca8..7d400833c 100755 --- a/packages/berajs/src/actions/bgt/getBGTGlobalInfo.ts +++ b/packages/berajs/src/actions/bgt/getBGTGlobalInfo.ts @@ -20,9 +20,7 @@ export interface GlobalInfo { annualizedBGTInflation: string; } -export const getBGTGlobalInfo = async ( - config: BeraConfig, -): Promise => { +export const getBGTGlobalInfo = async (): Promise => { const apiRes = await bexApiGraphqlClient.query< GlobalDataQuery, GlobalDataQueryVariables diff --git a/packages/berajs/src/actions/bgt/getGlobalData.ts b/packages/berajs/src/actions/bgt/getGlobalData.ts new file mode 100644 index 000000000..bce483003 --- /dev/null +++ b/packages/berajs/src/actions/bgt/getGlobalData.ts @@ -0,0 +1,36 @@ +import { PublicClient } from "viem"; +import { BeraConfig } from "~/types"; +import { getBGTGlobalInfo, GlobalInfo } from "./getBGTGlobalInfo"; +import { getGlobalCuttingBoard } from "./getGlobalCuttingBoard"; +import { getBgtTokenTotalSupply } from "./getBgtTokenTotalSupply"; +import { getBgtTokenTotalBoosts } from "./getBgtTokenTotalBoosts"; +import { ApiRewardAllocationWeightFragment } from "@bera/graphql/pol/api"; + +export interface GlobalData extends GlobalInfo { + globalCuttingBoard: ApiRewardAllocationWeightFragment[]; + bgtTotalSupply: string | undefined; + bgtTotalBoosts: string | undefined; +} +export const getGlobalData = async ( + publicClient: PublicClient, + config: BeraConfig, +): Promise => { + const [globalData, globalCuttingBoard, bgtTotalSupply, bgtTotalBoosts] = + await Promise.all([ + getBGTGlobalInfo(), + getGlobalCuttingBoard(300, config), + getBgtTokenTotalSupply({ + publicClient, + }), + getBgtTokenTotalBoosts({ + publicClient, + }), + ]); + + return { + bgtTotalSupply, + globalCuttingBoard, + bgtTotalBoosts, + ...globalData, + } satisfies GlobalData; +}; diff --git a/packages/berajs/src/actions/bgt/index.ts b/packages/berajs/src/actions/bgt/index.ts index 339b59593..9d684d847 100755 --- a/packages/berajs/src/actions/bgt/index.ts +++ b/packages/berajs/src/actions/bgt/index.ts @@ -1,3 +1,5 @@ export * from "./getUserVaultsReward"; export * from "./getRewardVault"; export * from "./getRewardVaultIncentives"; +export * from "./getRewardVaults"; +export * from "./getGlobalData"; diff --git a/packages/berajs/src/hooks/modules/bgt/index.ts b/packages/berajs/src/hooks/modules/bgt/index.ts index 6e75b7248..fee305ec7 100755 --- a/packages/berajs/src/hooks/modules/bgt/index.ts +++ b/packages/berajs/src/hooks/modules/bgt/index.ts @@ -3,7 +3,7 @@ export { useRewardVaults } from "./useRewardVaults"; export { useBgtApy } from "./useBgtApy"; export { usePollUserQueuedBoost } from "./usePollUserQueuedBoost"; export { usePollVaultsInfo } from "./usePollVaultsInfo"; -export { usePollGlobalData } from "./usePollGlobalData"; +export * from "./usePollGlobalData"; export { useBgtUnstakedBalance } from "./useBgtUnstakedBalance"; export { useUserVaults, type UserVault } from "./useUserVaults"; export { useSelectedValidator } from "./useSelectedValidator"; diff --git a/packages/berajs/src/hooks/modules/bgt/usePollGlobalData.ts b/packages/berajs/src/hooks/modules/bgt/usePollGlobalData.ts index 4d0a2fb3a..580e29d63 100755 --- a/packages/berajs/src/hooks/modules/bgt/usePollGlobalData.ts +++ b/packages/berajs/src/hooks/modules/bgt/usePollGlobalData.ts @@ -1,50 +1,20 @@ import useSWR from "swr"; import { usePublicClient } from "wagmi"; - -import { GlobalInfo, getBGTGlobalInfo } from "~/actions/bgt/getBGTGlobalInfo"; -import { getBgtTokenTotalSupply } from "~/actions/bgt/getBgtTokenTotalSupply"; -import { getGlobalCuttingBoard } from "~/actions/bgt/getGlobalCuttingBoard"; import { DefaultHookOptions, DefaultHookReturnType, useBeraJs } from "../../.."; -import { ApiRewardAllocationWeightFragment } from "@bera/graphql/pol/api"; -import { getBgtTokenTotalBoosts } from "~/actions/bgt/getBgtTokenTotalBoosts"; - -interface GlobalData extends GlobalInfo { - globalCuttingBoard: ApiRewardAllocationWeightFragment[]; - bgtTotalSupply: string | undefined; - bgtTotalBoosts: string | undefined; -} -export interface IUsePollGlobalDataResponse - extends DefaultHookReturnType {} +import { GlobalData, getGlobalData } from "~/actions/bgt/getGlobalData"; +export const usePollGlobalDataQueryKey = () => "usePollGlobalData"; export const usePollGlobalData = ( options?: DefaultHookOptions, -): IUsePollGlobalDataResponse => { +): DefaultHookReturnType => { const publicClient = usePublicClient(); const { config: beraConfig } = useBeraJs(); + const config = options?.beraConfigOverride ?? beraConfig; - const QUERY_KEY = "usePollGlobalData"; - const swrResponse = useSWR( - QUERY_KEY, - async () => { - const [globalData, globalCuttingBoard, bgtTotalSupply, bgtTotalBoosts] = - await Promise.all([ - getBGTGlobalInfo(config), - getGlobalCuttingBoard(300, config), - getBgtTokenTotalSupply({ - publicClient, - }), - getBgtTokenTotalBoosts({ - publicClient, - }), - ]); - return { - bgtTotalSupply, - globalCuttingBoard, - bgtTotalBoosts, - ...globalData, - } as any; - }, + const swrResponse = useSWR( + publicClient ? usePollGlobalDataQueryKey() : null, + async () => getGlobalData(publicClient!, config), { revalidateOnFocus: false, ...options?.opts, From e930f825041e83087c7a1d4b061fc51331790052 Mon Sep 17 00:00:00 2001 From: bearpong <178402093+bearpong@users.noreply.github.com> Date: Wed, 8 Jan 2025 21:25:21 -0500 Subject: [PATCH 14/14] fix(pol): mobile withdraw overflow --- apps/hub/src/app/vaults/[address]/components/WithdrawLP.tsx | 4 ++-- .../app/vaults/[address]/components/my-gauge-details.tsx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/hub/src/app/vaults/[address]/components/WithdrawLP.tsx b/apps/hub/src/app/vaults/[address]/components/WithdrawLP.tsx index 0024c6335..023c0d569 100755 --- a/apps/hub/src/app/vaults/[address]/components/WithdrawLP.tsx +++ b/apps/hub/src/app/vaults/[address]/components/WithdrawLP.tsx @@ -99,7 +99,7 @@ export const WithdrawLP = ({ key={percent.toString()} variant={"secondary"} size={"sm"} - className="w-full text-foreground" + className="w-full text-foreground max-md:odd:hidden" onClick={() => { setWithdrawPercent(percent); setWithdrawAmount( @@ -134,7 +134,7 @@ export const WithdrawLP = ({ />
{/* */} - +