@@ -200,10 +161,7 @@ export function VaultsListRow({currentVault}: {currentVault: TYDaemonVault}): Re
-
+
-
-
+
+
diff --git a/apps/vaults/contexts/useActionFlow.tsx b/apps/vaults/contexts/useActionFlow.tsx
index a8a6c0f07..f13c9d87f 100644
--- a/apps/vaults/contexts/useActionFlow.tsx
+++ b/apps/vaults/contexts/useActionFlow.tsx
@@ -96,22 +96,14 @@ function useContextualIs({selectedTo, currentVault}: TUseContextualIs): [boolean
const router = useRouter();
const isDepositing = useMemo(
- (): boolean =>
- (!router.query.action || router.query.action === 'deposit') &&
- (!selectedTo?.value || toAddress(selectedTo?.value) === toAddress(currentVault.address)),
+ (): boolean => (!router.query.action || router.query.action === 'deposit') && (!selectedTo?.value || toAddress(selectedTo?.value) === toAddress(currentVault.address)),
[selectedTo?.value, currentVault.address, router.query.action]
);
- const isPartnerAddressValid = useMemo(
- (): boolean => !isZeroAddress(getNetwork(safeChainID)?.contracts?.partnerContract?.address),
- [safeChainID]
- );
+ const isPartnerAddressValid = useMemo((): boolean => !isZeroAddress(getNetwork(safeChainID)?.contracts?.partnerContract?.address), [safeChainID]);
const isUsingPartnerContract = useMemo(
- (): boolean =>
- (process?.env?.SHOULD_USE_PARTNER_CONTRACT === undefined
- ? true
- : Boolean(process?.env?.SHOULD_USE_PARTNER_CONTRACT)) && isPartnerAddressValid,
+ (): boolean => (process?.env?.SHOULD_USE_PARTNER_CONTRACT === undefined ? true : Boolean(process?.env?.SHOULD_USE_PARTNER_CONTRACT)) && isPartnerAddressValid,
[isPartnerAddressValid]
);
@@ -141,13 +133,7 @@ function getMaxDepositPossible(props: TGetMaxDepositPossible): TNormalizedBN {
}
const ActionFlowContext = createContext
(DefaultActionFlowContext);
-export function ActionFlowContextApp({
- children,
- currentVault
-}: {
- children: ReactNode;
- currentVault: TYDaemonVault;
-}): React.ReactElement {
+export function ActionFlowContextApp({children, currentVault}: {children: ReactNode; currentVault: TYDaemonVault}): React.ReactElement {
const {balances, balancesNonce} = useWallet();
const {chainID, safeChainID} = useChainID();
const {balances: zapBalances, tokensList} = useWalletForZap();
@@ -225,18 +211,10 @@ export function ActionFlowContextApp({
isDepositing,
depositLimit: depositLimit || 0n
});
- }, [
- actionParams?.selectedOptionFrom?.decimals,
- actionParams?.selectedOptionFrom?.value,
- balances,
- currentVault,
- depositLimit,
- isDepositing
- ]);
+ }, [actionParams?.selectedOptionFrom?.decimals, actionParams?.selectedOptionFrom?.value, balances, currentVault, depositLimit, isDepositing]);
const currentSolver = useMemo((): TSolver => {
- const isUnderlyingToken =
- toAddress(actionParams?.selectedOptionFrom?.value) === toAddress(currentVault.token.address);
+ const isUnderlyingToken = toAddress(actionParams?.selectedOptionFrom?.value) === toAddress(currentVault.token.address);
// Only use OptimismBooster if the user chose to stake automatically
if (hasStakingRewards && isStakingOpBoostedVaults && isDepositing && isUnderlyingToken) {
@@ -253,10 +231,7 @@ export function ActionFlowContextApp({
if (isVaultTokenWrappedCoin && (isInputTokenEth || isOutputTokenEth)) {
return Solver.enum.ChainCoin;
}
- if (
- currentVault?.migration?.available &&
- toAddress(actionParams?.selectedOptionTo?.value) === toAddress(currentVault?.migration?.address)
- ) {
+ if (currentVault?.migration?.available && toAddress(actionParams?.selectedOptionTo?.value) === toAddress(currentVault?.migration?.address)) {
return Solver.enum.InternalMigration;
}
if (isDepositing && (actionParams?.selectedOptionFrom?.solveVia?.length || 0) > 0) {
@@ -301,9 +276,7 @@ export function ActionFlowContextApp({
if (isDepositing && (actionParams?.selectedOptionFrom?.solveVia || []).length > 0) {
// We don't want to be able to withdraw to exotic tokens. If the current from is one of them, take another one.
_selectedOptionFrom = possibleOptionsFrom.find(
- (option: TDropdownOption): boolean =>
- option.value !== actionParams?.selectedOptionFrom?.value &&
- isZero((option.solveVia || []).length)
+ (option: TDropdownOption): boolean => option.value !== actionParams?.selectedOptionFrom?.value && isZero((option.solveVia || []).length)
);
}
actionParamsDispatcher({
@@ -358,10 +331,7 @@ export function ActionFlowContextApp({
});
} else if (nextFlow === Flow.Migrate) {
const userBalance = toBigInt(balances?.[toAddress(currentVault?.address)]?.raw);
- const _amount = toNormalizedBN(
- userBalance,
- currentVault?.decimals || currentVault?.token?.decimals || 18
- );
+ const _amount = toNormalizedBN(userBalance, currentVault?.decimals || currentVault?.token?.decimals || 18);
const selectedOptionTo = {
name: currentVault?.name,
symbol: currentVault?.symbol,
@@ -433,13 +403,7 @@ export function ActionFlowContextApp({
}
});
},
- [
- balances,
- currentVault.details.depositLimit,
- currentVault.token?.address,
- currentVault.token.decimals,
- isDepositing
- ]
+ [balances, currentVault.details.depositLimit, currentVault.token?.address, currentVault.token.decimals, isDepositing]
);
/* 🔵 - Yearn Finance **************************************************************************
@@ -478,11 +442,7 @@ export function ActionFlowContextApp({
})
]
);
- } else if (
- safeChainID === 250 &&
- currentVault &&
- toAddress(currentVault.token.address) === WFTM_TOKEN_ADDRESS
- ) {
+ } else if (safeChainID === 250 && currentVault && toAddress(currentVault.token.address) === WFTM_TOKEN_ADDRESS) {
payloadFrom.push(
...[
setZapOption({
@@ -501,11 +461,7 @@ export function ActionFlowContextApp({
})
]
);
- } else if (
- safeChainID === 10 &&
- currentVault &&
- toAddress(currentVault.token.address) === OPT_WETH_TOKEN_ADDRESS
- ) {
+ } else if (safeChainID === 10 && currentVault && toAddress(currentVault.token.address) === OPT_WETH_TOKEN_ADDRESS) {
payloadFrom.push(
...[
setZapOption({
@@ -604,12 +560,9 @@ export function ActionFlowContextApp({
**********************************************************************************************/
useUpdateEffect((): void => {
const _possibleZapOptionsFrom: TDropdownOption[] = [];
- const isWithWETH =
- safeChainID === 1 && currentVault && toAddress(currentVault.token.address) === WETH_TOKEN_ADDRESS;
- const isWithWOPT =
- safeChainID === 10 && currentVault && toAddress(currentVault.token.address) === OPT_WETH_TOKEN_ADDRESS;
- const isWithWFTM =
- safeChainID === 250 && currentVault && toAddress(currentVault.token.address) === WFTM_TOKEN_ADDRESS;
+ const isWithWETH = safeChainID === 1 && currentVault && toAddress(currentVault.token.address) === WETH_TOKEN_ADDRESS;
+ const isWithWOPT = safeChainID === 10 && currentVault && toAddress(currentVault.token.address) === OPT_WETH_TOKEN_ADDRESS;
+ const isWithWFTM = safeChainID === 250 && currentVault && toAddress(currentVault.token.address) === WFTM_TOKEN_ADDRESS;
Object.entries(zapBalances || {})
.filter((): boolean => safeChainID === currentVault?.chainID) // Disable if we are on the wrong chain
@@ -701,17 +654,7 @@ export function ActionFlowContextApp({
maxDepositPossible,
currentSolver
}),
- [
- currentVault,
- possibleZapOptionsFrom,
- possibleZapOptionsTo,
- actionParams,
- onSwitchSelectedOptions,
- isDepositing,
- maxDepositPossible,
- currentSolver,
- updateParams
- ]
+ [currentVault, possibleZapOptionsFrom, possibleZapOptionsTo, actionParams, onSwitchSelectedOptions, isDepositing, maxDepositPossible, currentSolver, updateParams]
);
return {children};
diff --git a/apps/vaults/contexts/useAppSettings.tsx b/apps/vaults/contexts/useAppSettings.tsx
index a2d48ed26..991f658ce 100755
--- a/apps/vaults/contexts/useAppSettings.tsx
+++ b/apps/vaults/contexts/useAppSettings.tsx
@@ -30,11 +30,7 @@ const defaultProps: TAppSettingsContext = {
};
const AppSettingsContext = createContext(defaultProps);
-export const AppSettingsContextApp = memo(function AppSettingsContextApp({
- children
-}: {
- children: ReactElement;
-}): ReactElement {
+export const AppSettingsContextApp = memo(function AppSettingsContextApp({children}: {children: ReactElement}): ReactElement {
const [category, set_category] = useSessionStorage('yearn.fi/vaults-category', 'All Vaults');
const [searchValue, set_searchValue] = useSessionStorage('yearn.fi/vaults-search', '');
const [selectedChains, set_selectedChains] = useSessionStorage('yearn.fi/selected-chains', '[1]');
@@ -57,16 +53,7 @@ export const AppSettingsContextApp = memo(function AppSettingsContextApp({
set_searchValue,
set_selectedChains
}),
- [
- shouldHideDust,
- shouldHideLowTVLVaults,
- category,
- searchValue,
- set_category,
- set_searchValue,
- set_shouldHideDust,
- set_shouldHideLowTVLVaults
- ]
+ [shouldHideDust, shouldHideLowTVLVaults, category, searchValue, set_category, set_searchValue, set_shouldHideDust, set_shouldHideLowTVLVaults]
);
return {children};
diff --git a/apps/vaults/contexts/useSolver.tsx b/apps/vaults/contexts/useSolver.tsx
index 0ac704734..76ea09291 100644
--- a/apps/vaults/contexts/useSolver.tsx
+++ b/apps/vaults/contexts/useSolver.tsx
@@ -97,11 +97,7 @@ export function WithSolverContextApp({children}: {children: React.ReactElement})
**********************************************************************************************/
const onUpdateSolver = useCallback(
async (currentNonce: number): Promise => {
- if (
- !actionParams?.selectedOptionFrom ||
- !actionParams?.selectedOptionTo ||
- actionParams?.amount.raw === undefined
- ) {
+ if (!actionParams?.selectedOptionFrom || !actionParams?.selectedOptionTo || actionParams?.amount.raw === undefined) {
return;
}
set_isLoading(true);
@@ -114,18 +110,8 @@ export function WithSolverContextApp({children}: {children: React.ReactElement})
isDepositing: isDepositing
};
- const isValidSolver = ({
- quote,
- solver
- }: {
- quote: PromiseSettledResult;
- solver: TSolver;
- }): boolean => {
- return (
- quote.status === 'fulfilled' &&
- quote?.value.raw > 0n &&
- !isSolverDisabled(currentVault.chainID)[solver]
- );
+ const isValidSolver = ({quote, solver}: {quote: PromiseSettledResult; solver: TSolver}): boolean => {
+ return quote.status === 'fulfilled' && quote?.value.raw > 0n && !isSolverDisabled(currentVault.chainID)[solver];
};
switch (currentSolver) {
@@ -168,17 +154,9 @@ export function WithSolverContextApp({children}: {children: React.ReactElement})
ctx: vanilla
};
- const solverPriority = [
- Solver.enum.Wido,
- Solver.enum.Cowswap,
- Solver.enum.Portals,
- Solver.enum.None
- ];
+ const solverPriority = [Solver.enum.Wido, Solver.enum.Cowswap, Solver.enum.Portals, Solver.enum.None];
- const newSolverPriority = [
- currentSolver,
- ...solverPriority.filter((solver): boolean => solver !== currentSolver)
- ];
+ const newSolverPriority = [currentSolver, ...solverPriority.filter((solver): boolean => solver !== currentSolver)];
for (const solver of newSolverPriority) {
if (!solvers[solver]) {
diff --git a/apps/vaults/contexts/useStakingRewards.tsx b/apps/vaults/contexts/useStakingRewards.tsx
index eca5167d9..6d11a9888 100644
--- a/apps/vaults/contexts/useStakingRewards.tsx
+++ b/apps/vaults/contexts/useStakingRewards.tsx
@@ -42,11 +42,7 @@ const defaultProps: TStakingRewardsContext = {
};
const StakingRewardsContext = createContext(defaultProps);
-export const StakingRewardsContextApp = memo(function StakingRewardsContextApp({
- children
-}: {
- children: ReactElement;
-}): ReactElement {
+export const StakingRewardsContextApp = memo(function StakingRewardsContextApp({children}: {children: ReactElement}): ReactElement {
const {provider, address: userAddress, isActive} = useWeb3();
const {chainID: appChainID} = useChainID();
const router = useRouter();
diff --git a/apps/vaults/hooks/useFilteredVaults.ts b/apps/vaults/hooks/useFilteredVaults.ts
index d07feb6b2..214dbd423 100644
--- a/apps/vaults/hooks/useFilteredVaults.ts
+++ b/apps/vaults/hooks/useFilteredVaults.ts
@@ -3,12 +3,6 @@ import {useMemo} from 'react';
import type {TDict} from '@yearn-finance/web-lib/types';
import type {TYDaemonVault} from '@common/schemas/yDaemonVaultsSchemas';
-export function useFilteredVaults(
- vaultMap: TDict,
- condition: (v: TYDaemonVault) => boolean
-): TYDaemonVault[] {
- return useMemo(
- (): TYDaemonVault[] => Object.values(vaultMap).filter((vault): boolean => condition(vault)),
- [vaultMap, condition]
- );
+export function useFilteredVaults(vaultMap: TDict, condition: (v: TYDaemonVault) => boolean): TYDaemonVault[] {
+ return useMemo((): TYDaemonVault[] => Object.values(vaultMap).filter((vault): boolean => condition(vault)), [vaultMap, condition]);
}
diff --git a/apps/vaults/hooks/useFindVault.ts b/apps/vaults/hooks/useFindVault.ts
index c9d499703..030e76a1e 100644
--- a/apps/vaults/hooks/useFindVault.ts
+++ b/apps/vaults/hooks/useFindVault.ts
@@ -3,10 +3,7 @@ import {useMemo} from 'react';
import type {TDict} from '@yearn-finance/web-lib/types';
import type {TYDaemonVault} from '@common/schemas/yDaemonVaultsSchemas';
-export function useFindVault(
- vaultMap: TDict,
- condition: (v: TYDaemonVault) => boolean
-): TYDaemonVault | null {
+export function useFindVault(vaultMap: TDict, condition: (v: TYDaemonVault) => boolean): TYDaemonVault | null {
const foundVault = useMemo((): TYDaemonVault | undefined => {
return Object.values(vaultMap).find((vault): boolean => condition(vault));
}, [vaultMap, condition]);
diff --git a/apps/vaults/hooks/useSolverChainCoin.ts b/apps/vaults/hooks/useSolverChainCoin.ts
index ec90e7529..0c4318914 100644
--- a/apps/vaults/hooks/useSolverChainCoin.ts
+++ b/apps/vaults/hooks/useSolverChainCoin.ts
@@ -58,12 +58,7 @@ export function useSolverChainCoin(): TSolverContext {
return toNormalizedBN(0);
}
- const key = allowanceKey(
- safeChainID,
- toAddress(request.current.inputToken.value),
- toAddress(request.current.outputToken.value),
- toAddress(request.current.from)
- );
+ const key = allowanceKey(safeChainID, toAddress(request.current.inputToken.value), toAddress(request.current.outputToken.value), toAddress(request.current.from));
if (existingAllowances.current[key] && !shouldForceRefetch) {
return existingAllowances.current[key];
}
@@ -85,11 +80,7 @@ export function useSolverChainCoin(): TSolverContext {
** need to approve the yvWrappedCoin to be used by the zap contract.
**************************************************************************/
const onApprove = useCallback(
- async (
- amount = MAX_UINT_256,
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (amount = MAX_UINT_256, txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
assert(request?.current?.inputToken, 'Input token is not set');
const result = await approveERC20({
@@ -112,10 +103,7 @@ export function useSolverChainCoin(): TSolverContext {
** aka the vault underlying token, and then deposit it to the vault.
**************************************************************************/
const onExecuteDeposit = useCallback(
- async (
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
assert(request.current, 'Request is not set');
assert(request.current.inputAmount, 'Input amount is not set');
@@ -138,10 +126,7 @@ export function useSolverChainCoin(): TSolverContext {
** yvETH to wETH, unwrap the wETH and send them to the user.
**************************************************************************/
const onExecuteWithdraw = useCallback(
- async (
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
assert(request.current, 'Request is not set');
assert(request.current.inputAmount, 'Input amount is not set');
diff --git a/apps/vaults/hooks/useSolverCowswap.ts b/apps/vaults/hooks/useSolverCowswap.ts
index ba223e86b..6e5973928 100644
--- a/apps/vaults/hooks/useSolverCowswap.ts
+++ b/apps/vaults/hooks/useSolverCowswap.ts
@@ -21,21 +21,12 @@ import {assert} from '@common/utils/assert';
import type {TDict} from '@yearn-finance/web-lib/types';
import type {TTxResponse, TTxStatus} from '@yearn-finance/web-lib/utils/web3/transaction';
import type {TNormalizedBN} from '@common/types/types';
-import type {
- Order,
- OrderCreation,
- OrderQuoteResponse,
- SigningResult,
- SigningScheme,
- UnsignedOrder
-} from '@cowprotocol/cow-sdk';
+import type {Order, OrderCreation, OrderQuoteResponse, SigningResult, SigningScheme, UnsignedOrder} from '@cowprotocol/cow-sdk';
import type {TInitSolverArgs, TSolverContext} from '@vaults/types/solvers';
const orderBookApi = new OrderBookApi({chainId: 1});
-async function getQuote(
- request: TInitSolverArgs
-): Promise<{data: OrderQuoteResponse | undefined; error: Error | undefined}> {
+async function getQuote(request: TInitSolverArgs): Promise<{data: OrderQuoteResponse | undefined; error: Error | undefined}> {
const YEARN_APP_DATA = '0x5d22bf49b708de1d2d9547a6cca9faccbdc2b162012e8573811c07103b163d4b';
const quoteRequest = {
from: request.from, // receiver
@@ -94,10 +85,7 @@ export function useSolverCowswap(): TSolverContext {
}
const {quote} = currentQuote;
const buyAmount = Number(ethers.utils.formatUnits(quote.buyAmount, decimals));
- const withSlippage = ethers.utils.parseUnits(
- (buyAmount * (1 - Number(zapSlippage / 100))).toFixed(decimals),
- decimals
- );
+ const withSlippage = ethers.utils.parseUnits((buyAmount * (1 - Number(zapSlippage / 100))).toFixed(decimals), decimals);
return withSlippage.toString();
},
[zapSlippage]
@@ -205,10 +193,7 @@ export function useSolverCowswap(): TSolverContext {
** boolean value indicating whether the order was successful or not.
** It will timeout once the order is no longer valid or after 50 minutes (max should be 30mn)
**********************************************************************************************/
- async function checkOrderStatus(
- orderUID: string,
- validTo: number
- ): Promise<{isSuccessful: boolean; error?: Error}> {
+ async function checkOrderStatus(orderUID: string, validTo: number): Promise<{isSuccessful: boolean; error?: Error}> {
for (let i = 0; i < maxIterations; i++) {
const {data: order} = await axios.get(`https://api.cow.fi/mainnet/api/v1/orders/${orderUID}`);
if (order?.status === 'fulfilled') {
@@ -249,10 +234,7 @@ export function useSolverCowswap(): TSolverContext {
assert(request?.current, 'No request available');
const {quote, from, id} = latestQuote.current;
- const buyAmountWithSlippage = getBuyAmountWithSlippage(
- latestQuote.current,
- request.current.outputToken.decimals
- );
+ const buyAmountWithSlippage = getBuyAmountWithSlippage(latestQuote.current, request.current.outputToken.decimals);
quote.buyAmount = buyAmountWithSlippage;
const {signature, signingScheme} = await signCowswapOrder(quote as Order);
const orderCreation: OrderCreation = {
@@ -288,10 +270,7 @@ export function useSolverCowswap(): TSolverContext {
if (!latestQuote?.current?.quote?.buyAmount || isDisabled) {
return toNormalizedBN(0);
}
- return toNormalizedBN(
- toBigInt(latestQuote?.current?.quote?.buyAmount),
- request?.current?.outputToken?.decimals || 18
- );
+ return toNormalizedBN(toBigInt(latestQuote?.current?.quote?.buyAmount), request?.current?.outputToken?.decimals || 18);
}, [latestQuote, isDisabled]);
/* 🔵 - Yearn Finance ******************************************************
@@ -304,17 +283,9 @@ export function useSolverCowswap(): TSolverContext {
return toNormalizedBN(0);
}
assert(request.current, 'Request is not defined');
- assert(
- request?.current?.inputToken?.solveVia?.includes(Solver.enum.Cowswap),
- 'Input token is not supported by Cowswap'
- );
+ assert(request?.current?.inputToken?.solveVia?.includes(Solver.enum.Cowswap), 'Input token is not supported by Cowswap');
- const key = allowanceKey(
- safeChainID,
- request.current.inputToken.value,
- request.current.outputToken.value,
- request.current.from
- );
+ const key = allowanceKey(safeChainID, request.current.inputToken.value, request.current.outputToken.value, request.current.from);
if (existingAllowances.current[key] && !shouldForceRefetch) {
return existingAllowances.current[key];
}
@@ -335,19 +306,12 @@ export function useSolverCowswap(): TSolverContext {
** of the token by the Cowswap solver.
**************************************************************************/
const onApprove = useCallback(
- async (
- amount = MAX_UINT_256,
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (amount = MAX_UINT_256, txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
if (isDisabled) {
return;
}
assert(request.current, 'Request is not defined');
- assert(
- request?.current?.inputToken?.solveVia?.includes(Solver.enum.Cowswap),
- 'Input token is not supported by Cowswap'
- );
+ assert(request?.current?.inputToken?.solveVia?.includes(Solver.enum.Cowswap), 'Input token is not supported by Cowswap');
const isApproved = await isApprovedERC20(
provider,
@@ -378,10 +342,7 @@ export function useSolverCowswap(): TSolverContext {
** simply swapping the input token for the output token.
**************************************************************************/
const onExecute = useCallback(
- async (
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
assert(provider, 'Provider is not defined');
txStatusSetter({...defaultTxStatus, pending: true});
diff --git a/apps/vaults/hooks/useSolverInternalMigration.ts b/apps/vaults/hooks/useSolverInternalMigration.ts
index a2a82755b..7d98c9f31 100644
--- a/apps/vaults/hooks/useSolverInternalMigration.ts
+++ b/apps/vaults/hooks/useSolverInternalMigration.ts
@@ -37,11 +37,7 @@ export function useSolverInternalMigration(): TSolverContext {
address: ZAP_YEARN_VE_CRV_ADDRESS,
abi: ZAP_CRV_ABI,
functionName: 'calc_expected_out',
- args: [
- request.current.inputToken.value,
- request.current.outputToken.value,
- request.current.inputAmount
- ]
+ args: [request.current.inputToken.value, request.current.outputToken.value, request.current.inputAmount]
});
const minAmountWithSlippage = estimateOut - (estimateOut * 6n) / 10_000n;
latestQuote.current = toNormalizedBN(minAmountWithSlippage);
@@ -72,12 +68,7 @@ export function useSolverInternalMigration(): TSolverContext {
return toNormalizedBN(0);
}
- const key = allowanceKey(
- safeChainID,
- toAddress(request.current.inputToken.value),
- toAddress(request.current.outputToken.value),
- toAddress(request.current.from)
- );
+ const key = allowanceKey(safeChainID, toAddress(request.current.inputToken.value), toAddress(request.current.outputToken.value), toAddress(request.current.from));
if (existingAllowances.current[key] && !shouldForceRefetch) {
return existingAllowances.current[key];
}
@@ -100,11 +91,7 @@ export function useSolverInternalMigration(): TSolverContext {
** (not connected) or if the tx is still pending.
**************************************************************************/
const onApprove = useCallback(
- async (
- amount = MAX_UINT_256,
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (amount = MAX_UINT_256, txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
assert(request.current, 'Request is not set');
assert(request.current.inputToken, 'Input token is not defined');
assert(request.current.migrator, 'Input token is not defined');
@@ -128,10 +115,7 @@ export function useSolverInternalMigration(): TSolverContext {
** the selected vault.
**************************************************************************/
const onExecuteMigration = useCallback(
- async (
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
assert(request.current, 'Request is not set');
if (request.current.migrator === ZAP_YEARN_VE_CRV_ADDRESS) {
@@ -139,11 +123,7 @@ export function useSolverInternalMigration(): TSolverContext {
address: ZAP_YEARN_VE_CRV_ADDRESS,
abi: ZAP_CRV_ABI,
functionName: 'calc_expected_out',
- args: [
- request.current.inputToken.value,
- request.current.outputToken.value,
- request.current.inputAmount
- ]
+ args: [request.current.inputToken.value, request.current.outputToken.value, request.current.inputAmount]
});
const result = await zapCRV({
connector: provider,
diff --git a/apps/vaults/hooks/useSolverOptimismBooster.ts b/apps/vaults/hooks/useSolverOptimismBooster.ts
index 3b534f814..cb25cbb4d 100644
--- a/apps/vaults/hooks/useSolverOptimismBooster.ts
+++ b/apps/vaults/hooks/useSolverOptimismBooster.ts
@@ -55,12 +55,7 @@ export function useSolverOptimismBooster(): TSolverContext {
return toNormalizedBN(0);
}
- const key = allowanceKey(
- safeChainID,
- toAddress(request.current.inputToken.value),
- toAddress(request.current.outputToken.value),
- toAddress(request.current.from)
- );
+ const key = allowanceKey(safeChainID, toAddress(request.current.inputToken.value), toAddress(request.current.outputToken.value), toAddress(request.current.from));
if (existingAllowances.current[key] && !shouldForceRefetch) {
return existingAllowances.current[key];
}
@@ -82,11 +77,7 @@ export function useSolverOptimismBooster(): TSolverContext {
** (not connected) or if the tx is still pending.
**************************************************************************/
const onApprove = useCallback(
- async (
- amount = MAX_UINT_256,
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (amount = MAX_UINT_256, txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
assert(request.current, 'Request is not set');
assert(request.current.inputToken, 'Input token is not set');
@@ -109,10 +100,7 @@ export function useSolverOptimismBooster(): TSolverContext {
** tokens via the Staking Rewards Zap Contract, to the selected vault.
**************************************************************************/
const onExecuteDeposit = useCallback(
- async (
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
assert(request.current, 'Request is not set');
assert(request.current.inputAmount, 'Input amount is not set');
diff --git a/apps/vaults/hooks/useSolverPartnerContract.ts b/apps/vaults/hooks/useSolverPartnerContract.ts
index 2946f64a3..14856dc19 100644
--- a/apps/vaults/hooks/useSolverPartnerContract.ts
+++ b/apps/vaults/hooks/useSolverPartnerContract.ts
@@ -57,12 +57,7 @@ export function useSolverPartnerContract(): TSolverContext {
return toNormalizedBN(0);
}
- const key = allowanceKey(
- safeChainID,
- toAddress(request.current.inputToken.value),
- toAddress(request.current.outputToken.value),
- toAddress(request.current.from)
- );
+ const key = allowanceKey(safeChainID, toAddress(request.current.inputToken.value), toAddress(request.current.outputToken.value), toAddress(request.current.from));
if (existingAllowances.current[key] && !shouldForceRefetch) {
return existingAllowances.current[key];
}
@@ -86,11 +81,7 @@ export function useSolverPartnerContract(): TSolverContext {
** (not connected) or if the tx is still pending.
**************************************************************************/
const onApprove = useCallback(
- async (
- amount = MAX_UINT_256,
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (amount = MAX_UINT_256, txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
const partnerContract = getNetwork(safeChainID)?.contracts?.partnerContract?.address;
assert(request.current, 'Request is not set');
@@ -116,10 +107,7 @@ export function useSolverPartnerContract(): TSolverContext {
** via the Partner Contract, to the selected vault.
**************************************************************************/
const onExecuteDeposit = useCallback(
- async (
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
const partnerContract = getNetwork(safeChainID)?.contracts?.partnerContract?.address;
assert(request.current, 'Request is not set');
@@ -145,10 +133,7 @@ export function useSolverPartnerContract(): TSolverContext {
** some underlying token from this specific vault.
**************************************************************************/
const onExecuteWithdraw = useCallback(
- async (
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
assert(request.current, 'Request is not set');
assert(request.current.inputToken, 'Input token is not set');
assert(request.current.inputAmount, 'Input amount is not set');
diff --git a/apps/vaults/hooks/useSolverPortals.ts b/apps/vaults/hooks/useSolverPortals.ts
index 8eee85b0e..0354c5479 100644
--- a/apps/vaults/hooks/useSolverPortals.ts
+++ b/apps/vaults/hooks/useSolverPortals.ts
@@ -34,11 +34,7 @@ export type TPortalsQuoteResult = {
error?: Error;
};
-async function getQuote(
- request: TInitSolverArgs,
- safeChainID: number,
- zapSlippage: number
-): Promise<{data: TPortalsEstimate | null; error?: Error}> {
+async function getQuote(request: TInitSolverArgs, safeChainID: number, zapSlippage: number): Promise<{data: TPortalsEstimate | null; error?: Error}> {
const params = {
sellToken: toAddress(request.inputToken.value),
sellAmount: toBigInt(request.inputAmount).toString(),
@@ -249,12 +245,7 @@ export function useSolverPortals(): TSolverContext {
return toNormalizedBN(0);
}
- const key = allowanceKey(
- safeChainID,
- toAddress(request.current.inputToken.value),
- toAddress(request.current.outputToken.value),
- toAddress(request.current.from)
- );
+ const key = allowanceKey(safeChainID, toAddress(request.current.inputToken.value), toAddress(request.current.outputToken.value), toAddress(request.current.from));
if (existingAllowances.current[key] && !shouldForceRefetch) {
return existingAllowances.current[key];
}
@@ -274,10 +265,7 @@ export function useSolverPortals(): TSolverContext {
throw new Error('Portals approval not found');
}
- existingAllowances.current[key] = toNormalizedBN(
- approval.context.allowance,
- request.current.inputToken.decimals
- );
+ existingAllowances.current[key] = toNormalizedBN(approval.context.allowance, request.current.inputToken.decimals);
return existingAllowances.current[key];
} catch (error) {
console.error(error);
@@ -293,11 +281,7 @@ export function useSolverPortals(): TSolverContext {
** of the token by the Portals solver.
**************************************************************************/
const onApprove = useCallback(
- async (
- amount = MAX_UINT_256,
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (amount = MAX_UINT_256, txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
if (isSolverDisabled(safeChainID)[Solver.enum.Portals]) {
return;
}
@@ -355,10 +339,7 @@ export function useSolverPortals(): TSolverContext {
** simply swapping the input token for the output token.
**************************************************************************/
const onExecute = useCallback(
- async (
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
assert(provider, 'Provider is not set');
txStatusSetter({...defaultTxStatus, pending: true});
diff --git a/apps/vaults/hooks/useSolverVanilla.ts b/apps/vaults/hooks/useSolverVanilla.ts
index 553615bef..d9d13dedf 100644
--- a/apps/vaults/hooks/useSolverVanilla.ts
+++ b/apps/vaults/hooks/useSolverVanilla.ts
@@ -54,12 +54,7 @@ export function useSolverVanilla(): TSolverContext {
return toNormalizedBN(0);
}
- const key = allowanceKey(
- safeChainID,
- toAddress(request.current.inputToken.value),
- toAddress(request.current.outputToken.value),
- toAddress(request.current.from)
- );
+ const key = allowanceKey(safeChainID, toAddress(request.current.inputToken.value), toAddress(request.current.outputToken.value), toAddress(request.current.from));
if (existingAllowances.current[key] && !shouldForceRefetch) {
return existingAllowances.current[key];
}
@@ -82,11 +77,7 @@ export function useSolverVanilla(): TSolverContext {
** (not connected) or if the tx is still pending.
**************************************************************************/
const onApprove = useCallback(
- async (
- amount = MAX_UINT_256,
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (amount = MAX_UINT_256, txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
assert(request.current, 'Request is not set');
assert(request.current.inputToken, 'Input token is not set');
assert(request.current.outputToken, 'Output token is not set');
@@ -110,10 +101,7 @@ export function useSolverVanilla(): TSolverContext {
** the selected vault.
**************************************************************************/
const onExecuteDeposit = useCallback(
- async (
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
assert(request.current, 'Request is not set');
assert(request.current.outputToken, 'Output token is not set');
assert(request.current.inputAmount, 'Input amount is not set');
@@ -136,10 +124,7 @@ export function useSolverVanilla(): TSolverContext {
** some underlying token from this specific vault.
**************************************************************************/
const onExecuteWithdraw = useCallback(
- async (
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
assert(request.current, 'Request is not set');
assert(request.current.inputToken, 'Output token is not set');
assert(request.current.inputAmount, 'Input amount is not set');
diff --git a/apps/vaults/hooks/useSolverWido.ts b/apps/vaults/hooks/useSolverWido.ts
index 596f5a489..b298fe5bf 100644
--- a/apps/vaults/hooks/useSolverWido.ts
+++ b/apps/vaults/hooks/useSolverWido.ts
@@ -197,12 +197,7 @@ export function useSolverWido(): TSolverContext {
return toNormalizedBN(MAX_UINT_256);
}
- const key = allowanceKey(
- safeChainID,
- toAddress(request.current.inputToken.value),
- toAddress(request.current.outputToken.value),
- toAddress(request.current.from)
- );
+ const key = allowanceKey(safeChainID, toAddress(request.current.inputToken.value), toAddress(request.current.outputToken.value), toAddress(request.current.from));
if (existingAllowances.current[key] && !shouldForceRefetch) {
return existingAllowances.current[key];
@@ -241,11 +236,7 @@ export function useSolverWido(): TSolverContext {
** of the token by the Wido solver.
**************************************************************************/
const onApprove = useCallback(
- async (
- amount = MAX_UINT_256,
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (amount = MAX_UINT_256, txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
if (isSolverDisabled(safeChainID)[Solver.enum.Wido]) {
return;
}
@@ -292,10 +283,7 @@ export function useSolverWido(): TSolverContext {
** simply swapping the input token for the output token.
**************************************************************************/
const onExecute = useCallback(
- async (
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ): Promise => {
+ async (txStatusSetter: React.Dispatch>, onSuccess: () => Promise): Promise => {
assert(provider, 'Provider is not set');
txStatusSetter({...defaultTxStatus, pending: true});
diff --git a/apps/vaults/hooks/useSortVaults.ts b/apps/vaults/hooks/useSortVaults.ts
index 9c3cdf75a..f6d4812b6 100644
--- a/apps/vaults/hooks/useSortVaults.ts
+++ b/apps/vaults/hooks/useSortVaults.ts
@@ -13,11 +13,7 @@ import type {TSortDirection} from '@common/types/types';
export type TPossibleSortBy = 'apy' | 'tvl' | 'name' | 'deposited' | 'available';
-export function useSortVaults(
- vaultList: TYDaemonVaults,
- sortBy: TPossibleSortBy,
- sortDirection: TSortDirection
-): TYDaemonVaults {
+export function useSortVaults(vaultList: TYDaemonVaults, sortBy: TPossibleSortBy, sortDirection: TSortDirection): TYDaemonVaults {
const {balances, balancesNonce} = useWallet();
const {stakingRewardsByVault, positionsMap} = useStakingRewards();
@@ -45,24 +41,15 @@ export function useSortVaults(
[sortDirection, vaultList]
);
- const sortedByTVL = useCallback(
- (): TYDaemonVaults => vaultList.sort((a, b): number => numberSort({a: a.tvl.tvl, b: b.tvl.tvl, sortDirection})),
- [sortDirection, vaultList]
- );
+ const sortedByTVL = useCallback((): TYDaemonVaults => vaultList.sort((a, b): number => numberSort({a: a.tvl.tvl, b: b.tvl.tvl, sortDirection})), [sortDirection, vaultList]);
const sortedByDeposited = useCallback((): TYDaemonVaults => {
balancesNonce; // remove warning, force deep refresh
return vaultList.sort((a, b): number => {
const aDepositedBalance = balances[toAddress(a.address)]?.normalized || 0;
const bDepositedBalance = balances[toAddress(b.address)]?.normalized || 0;
- const aStakedBalance = toNormalizedValue(
- toBigInt(positionsMap[toAddress(stakingRewardsByVault[a.address])]?.stake),
- a.decimals
- );
- const bStakedBalance = toNormalizedValue(
- toBigInt(positionsMap[toAddress(stakingRewardsByVault[b.address])]?.stake),
- b.decimals
- );
+ const aStakedBalance = toNormalizedValue(toBigInt(positionsMap[toAddress(stakingRewardsByVault[a.address])]?.stake), a.decimals);
+ const bStakedBalance = toNormalizedValue(toBigInt(positionsMap[toAddress(stakingRewardsByVault[b.address])]?.stake), b.decimals);
if (sortDirection === 'asc') {
return aDepositedBalance + aStakedBalance - (bDepositedBalance + bStakedBalance);
}
@@ -112,16 +99,7 @@ export function useSortVaults(
}
return sortResult;
- }, [
- sortBy,
- sortDirection,
- sortedByAPY,
- sortedByAvailable,
- sortedByDeposited,
- sortedByName,
- sortedByTVL,
- stringifiedVaultList
- ]);
+ }, [sortBy, sortDirection, sortedByAPY, sortedByAvailable, sortedByDeposited, sortedByName, sortedByTVL, stringifiedVaultList]);
return sortedVaults;
}
diff --git a/apps/vaults/types/solvers.ts b/apps/vaults/types/solvers.ts
index 2038b6469..cc76c052e 100644
--- a/apps/vaults/types/solvers.ts
+++ b/apps/vaults/types/solvers.ts
@@ -14,19 +14,9 @@ export type TWithSolver = {
hash?: string;
isLoadingExpectedOut: boolean;
onRetrieveAllowance: (shouldForceRefetch?: boolean) => Promise;
- onApprove: (
- amount: bigint,
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ) => Promise;
- onExecuteDeposit: (
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ) => Promise;
- onExecuteWithdraw: (
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ) => Promise;
+ onApprove: (amount: bigint, txStatusSetter: React.Dispatch>, onSuccess: () => Promise) => Promise;
+ onExecuteDeposit: (txStatusSetter: React.Dispatch>, onSuccess: () => Promise) => Promise;
+ onExecuteWithdraw: (txStatusSetter: React.Dispatch>, onSuccess: () => Promise) => Promise;
};
export type TInitSolverArgs = {
@@ -43,19 +33,9 @@ export type TSolverContext = {
quote: TNormalizedBN;
init: (args: TInitSolverArgs, shouldLogError?: boolean) => Promise;
onRetrieveAllowance: (shouldForceRefetch?: boolean) => Promise;
- onApprove: (
- amount: bigint,
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ) => Promise;
- onExecuteDeposit: (
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ) => Promise;
- onExecuteWithdraw: (
- txStatusSetter: React.Dispatch>,
- onSuccess: () => Promise
- ) => Promise;
+ onApprove: (amount: bigint, txStatusSetter: React.Dispatch>, onSuccess: () => Promise) => Promise;
+ onExecuteDeposit: (txStatusSetter: React.Dispatch>, onSuccess: () => Promise) => Promise;
+ onExecuteWithdraw: (txStatusSetter: React.Dispatch>, onSuccess: () => Promise) => Promise;
};
/* 🔵 - Yearn Finance ******************************************************
diff --git a/apps/vaults/utils/zapOptions.tsx b/apps/vaults/utils/zapOptions.tsx
index c5c3f87a0..dbb03ae8a 100644
--- a/apps/vaults/utils/zapOptions.tsx
+++ b/apps/vaults/utils/zapOptions.tsx
@@ -12,27 +12,13 @@ type TSetZapOptionProps = {
decimals: number;
solveVia?: TSolver[];
};
-export function setZapOption({
- name,
- symbol,
- address,
- chainID,
- decimals,
- solveVia
-}: TSetZapOptionProps): TDropdownOption {
+export function setZapOption({name, symbol, address, chainID, decimals, solveVia}: TSetZapOptionProps): TDropdownOption {
return {
label: name,
symbol,
value: address,
decimals,
solveVia,
- icon: (
-
- )
+ icon:
};
}
diff --git a/apps/veyfi/Wrapper.tsx b/apps/veyfi/Wrapper.tsx
index fef2f6464..41224a63f 100644
--- a/apps/veyfi/Wrapper.tsx
+++ b/apps/veyfi/Wrapper.tsx
@@ -20,13 +20,7 @@ export function Wrapper({children, router}: {children: ReactElement; router: Nex
-
+
{children}
diff --git a/apps/veyfi/components/ClaimTab.tsx b/apps/veyfi/components/ClaimTab.tsx
index d789b3bb8..89cd36eaf 100644
--- a/apps/veyfi/components/ClaimTab.tsx
+++ b/apps/veyfi/components/ClaimTab.tsx
@@ -62,14 +62,7 @@ export function ClaimTab(): ReactElement {
className={'w-full md:mt-7'}
onClick={onWithdrawUnlocked}
isBusy={withdrawUnlockedStatus.pending}
- isDisabled={
- !isActive ||
- !isValidNetwork ||
- !isClaimable ||
- withdrawUnlockedStatus.pending ||
- !votingEscrow ||
- !address
- }>
+ isDisabled={!isActive || !isValidNetwork || !isClaimable || withdrawUnlockedStatus.pending || !votingEscrow || !address}>
{'Claim'}
diff --git a/apps/veyfi/components/GaugesTab.tsx b/apps/veyfi/components/GaugesTab.tsx
index 018518daa..5dba6c50d 100644
--- a/apps/veyfi/components/GaugesTab.tsx
+++ b/apps/veyfi/components/GaugesTab.tsx
@@ -37,14 +37,7 @@ export function GaugesTab(): ReactElement {
const [selectedGauge, set_selectedGauge] = useState('');
const [selectedAction, set_selectedAction] = useState<'stake' | 'unstake' | undefined>();
const {provider, address, isActive, chainID} = useWeb3();
- const {
- gaugeAddresses,
- gaugesMap,
- positionsMap,
- allowancesMap,
- refresh: refreshGauges,
- isLoading: isLoadingGauges
- } = useGauge();
+ const {gaugeAddresses, gaugesMap, positionsMap, allowancesMap, refresh: refreshGauges, isLoading: isLoadingGauges} = useGauge();
const {vaults} = useYearn();
const {balances, refresh: refreshBalances} = useWallet();
const refreshData = (): unknown => Promise.all([refreshGauges(), refreshBalances()]);
@@ -70,9 +63,7 @@ export function GaugesTab(): ReactElement {
gaugeApy: 0, // TODO: gauge apy calcs
gaugeBoost: positionsMap[address]?.boost ?? 1,
gaugeStaked: toBigInt(formatBigNumberAsAmount(positionsMap[address]?.deposit.balance)),
- allowance: toBigInt(
- formatBigNumberAsAmount(allowancesMap[allowanceKey(1, vaultAddress, address, userAddress)])
- ),
+ allowance: toBigInt(formatBigNumberAsAmount(allowancesMap[allowanceKey(1, vaultAddress, address, userAddress)])),
isApproved:
toBigInt(formatBigNumberAsAmount(allowancesMap[allowanceKey(1, vaultAddress, address, userAddress)])) >=
toBigInt(formatBigNumberAsAmount(balances[vaultAddress]?.raw)),
@@ -156,18 +147,8 @@ export function GaugesTab(): ReactElement {
className: 'my-4 md:my-0',
transform: ({vaultIcon, vaultName}): ReactElement => (
-
@@ -183,8 +164,7 @@ export function GaugesTab(): ReactElement {
key: 'vaultDeposited',
label: 'Deposited in Vault',
sortable: true,
- format: ({vaultDeposited, decimals}): string =>
- formatAmount(toNormalizedValue(vaultDeposited, decimals))
+ format: ({vaultDeposited, decimals}): string => formatAmount(toNormalizedValue(vaultDeposited, decimals))
},
{
key: 'gaugeApy',
@@ -201,8 +181,7 @@ export function GaugesTab(): ReactElement {
key: 'gaugeStaked',
label: 'Staked in Gauge',
sortable: true,
- format: ({gaugeStaked, decimals}): string =>
- formatAmount(toNormalizedValue(gaugeStaked, decimals))
+ format: ({gaugeStaked, decimals}): string => formatAmount(toNormalizedValue(gaugeStaked, decimals))
},
{
key: 'actions',
@@ -210,37 +189,22 @@ export function GaugesTab(): ReactElement {
columnSpan: 2,
fullWidth: true,
className: 'my-4 md:my-0',
- transform: ({
- isApproved,
- vaultAddress,
- gaugeAddress,
- vaultDeposited,
- gaugeStaked
- }): ReactElement => (
+ transform: ({isApproved, vaultAddress, gaugeAddress, vaultDeposited, gaugeStaked}): ReactElement => (
{!isApproved && (
@@ -250,12 +214,7 @@ export function GaugesTab(): ReactElement {
className={'w-full md:w-24'}
onClick={async (): Promise
=> onStake(gaugeAddress, vaultDeposited)}
isDisabled={!isActive || !isValidNetwork || isZero(vaultDeposited)}
- isBusy={
- (isLoadingGauges && vaultDeposited > 0n) ||
- (gaugeAddress === selectedGauge &&
- selectedAction === 'stake' &&
- stakeStatus.none)
- }>
+ isBusy={(isLoadingGauges && vaultDeposited > 0n) || (gaugeAddress === selectedGauge && selectedAction === 'stake' && stakeStatus.none)}>
{'Stake'}
)}
diff --git a/apps/veyfi/components/LockTab.tsx b/apps/veyfi/components/LockTab.tsx
index 540e1ff5d..0865e1476 100644
--- a/apps/veyfi/components/LockTab.tsx
+++ b/apps/veyfi/components/LockTab.tsx
@@ -29,13 +29,7 @@ export function LockTab(): ReactElement {
const {provider, address, isActive} = useWeb3();
const {safeChainID} = useChainID();
const {refresh: refreshBalances} = useWallet();
- const {
- votingEscrow,
- positions,
- allowances,
- isLoading: isLoadingVotingEscrow,
- refresh: refreshVotingEscrow
- } = useVotingEscrow();
+ const {votingEscrow, positions, allowances, isLoading: isLoadingVotingEscrow, refresh: refreshVotingEscrow} = useVotingEscrow();
const tokenBalance = useBalance(toAddress(votingEscrow?.token));
const hasLockedAmount = toBigInt(positions?.deposit?.underlyingBalance) > 0n;
const [approveLockStatus, set_approveLockStatus] = useState(defaultTxStatus);
@@ -129,17 +123,8 @@ export function LockTab(): ReactElement {
walletNetwork: safeChainID
});
- const isApproveDisabled =
- !isActive || !isValidNetwork || isApproved || isLoadingVotingEscrow || !votingEscrow || !address;
- const isLockDisabled =
- !isActive ||
- !isValidNetwork ||
- !isApproved ||
- !isValidLockAmount ||
- !isValidLockTime ||
- isLoadingVotingEscrow ||
- !votingEscrow ||
- !address;
+ const isApproveDisabled = !isActive || !isValidNetwork || isApproved || isLoadingVotingEscrow || !votingEscrow || !address;
+ const isLockDisabled = !isActive || !isValidNetwork || !isApproved || !isValidLockAmount || !isValidLockTime || isLoadingVotingEscrow || !votingEscrow || !address;
const txAction = !isApproved
? {
label: 'Approve',
@@ -168,11 +153,7 @@ export function LockTab(): ReactElement {
{'Lock your YFI for veYFI to take part in Yearn governance.'}
-
- {
- 'Please note, governance is currently the only use for veYFI until the full platform launches ‘soon’. Stay tuned anon.'
- }
-
+
{'Please note, governance is currently the only use for veYFI until the full platform launches ‘soon’. Stay tuned anon.'}
@@ -201,11 +182,7 @@ export function LockTab(): ReactElement {
diff --git a/apps/veyfi/components/ManageLockTab.tsx b/apps/veyfi/components/ManageLockTab.tsx
index 424329a52..f08a398a6 100644
--- a/apps/veyfi/components/ManageLockTab.tsx
+++ b/apps/veyfi/components/ManageLockTab.tsx
@@ -62,9 +62,7 @@ export function ManageLockTab(): ReactElement {
if (!positions?.deposit || !newUnlockTime) {
return 0n;
}
- return willExtendLock
- ? getVotingPower(positions?.deposit?.underlyingBalance, newUnlockTime)
- : toBigInt(positions?.deposit?.balance);
+ return willExtendLock ? getVotingPower(positions?.deposit?.underlyingBalance, newUnlockTime) : toBigInt(positions?.deposit?.balance);
}, [positions?.deposit, newUnlockTime, willExtendLock]);
const {isValid: isValidLockTime, error: lockTimeError} = validateAmount({
@@ -93,13 +91,7 @@ export function ManageLockTab(): ReactElement {
amount={lockTime}
onAmountChange={(amount): void => set_lockTime(Math.floor(toTime(amount)).toString())}
maxAmount={MAX_LOCK_TIME - weeksToUnlock > 0 ? MAX_LOCK_TIME - weeksToUnlock : 0}
- onMaxClick={(): void =>
- set_lockTime(
- Math.floor(
- toTime(MAX_LOCK_TIME - weeksToUnlock > 0 ? MAX_LOCK_TIME - weeksToUnlock : 0)
- ).toString()
- )
- }
+ onMaxClick={(): void => set_lockTime(Math.floor(toTime(MAX_LOCK_TIME - weeksToUnlock > 0 ? MAX_LOCK_TIME - weeksToUnlock : 0)).toString())}
disabled={!hasLockedAmount}
error={lockTimeError}
legend={'Minimum: 1 week'}
@@ -111,14 +103,7 @@ export function ManageLockTab(): ReactElement {
className={'w-full md:mt-7'}
onClick={onExtendLockTime}
isBusy={extendLockTimeStatus.pending}
- isDisabled={
- !isActive ||
- !isValidNetwork ||
- !isValidLockTime ||
- extendLockTimeStatus.pending ||
- !votingEscrow ||
- !address
- }>
+ isDisabled={!isActive || !isValidNetwork || !isValidLockTime || extendLockTimeStatus.pending || !votingEscrow || !address}>
{'Extend'}