From b3b569b1415eb26e21e084f651f206cc158a5558 Mon Sep 17 00:00:00 2001 From: Majorfi Date: Fri, 12 Jan 2024 14:41:06 +0100 Subject: [PATCH 1/2] chore: export ybal --- apps/common/components/AppHeader.tsx | 2 - apps/common/components/Apps.tsx | 23 +- apps/common/hooks/useCurrentApp.tsx | 5 - apps/ybal/Wrapper.tsx | 31 - .../ybal/components/CardTransactorWrapper.tsx | 289 ------ apps/ybal/components/CardZap.tsx | 275 ------ apps/ybal/components/Harvests.tsx | 77 -- apps/ybal/components/HarvestsListHead.tsx | 49 - apps/ybal/components/HarvestsListRow.tsx | 91 -- apps/ybal/components/header/YBalHeader.tsx | 21 - apps/ybal/constants/index.tsx | 1 - apps/ybal/constants/menu.ts | 4 - apps/ybal/constants/tokens.tsx | 122 --- apps/ybal/contexts/useAllowanceHook.tsx | 96 -- apps/ybal/contexts/useHoldingsHook.tsx | 123 --- apps/ybal/contexts/useYBal.tsx | 79 -- apps/ybal/utils/abi/styBal.abi.ts | 882 ------------------ apps/ybal/utils/abi/veBAL.abi.ts | 310 ------ apps/ybal/utils/abi/veBalPegHelper.abi.ts | 201 ---- apps/ybal/utils/abi/yBalBalancerPool.abi.ts | 839 ----------------- apps/ybal/utils/actions.test.ts | 40 - apps/ybal/utils/actions.ts | 151 --- next.config.js | 3 +- pages/ybal/about.tsx | 229 ----- pages/ybal/index.tsx | 217 ----- public/apps/ybal-manifest.json | 35 - tsconfig.json | 3 +- vitest.config.ts | 1 - 28 files changed, 4 insertions(+), 4195 deletions(-) delete mode 100755 apps/ybal/Wrapper.tsx delete mode 100755 apps/ybal/components/CardTransactorWrapper.tsx delete mode 100755 apps/ybal/components/CardZap.tsx delete mode 100644 apps/ybal/components/Harvests.tsx delete mode 100644 apps/ybal/components/HarvestsListHead.tsx delete mode 100755 apps/ybal/components/HarvestsListRow.tsx delete mode 100644 apps/ybal/components/header/YBalHeader.tsx delete mode 100644 apps/ybal/constants/index.tsx delete mode 100644 apps/ybal/constants/menu.ts delete mode 100755 apps/ybal/constants/tokens.tsx delete mode 100644 apps/ybal/contexts/useAllowanceHook.tsx delete mode 100644 apps/ybal/contexts/useHoldingsHook.tsx delete mode 100755 apps/ybal/contexts/useYBal.tsx delete mode 100644 apps/ybal/utils/abi/styBal.abi.ts delete mode 100644 apps/ybal/utils/abi/veBAL.abi.ts delete mode 100644 apps/ybal/utils/abi/veBalPegHelper.abi.ts delete mode 100644 apps/ybal/utils/abi/yBalBalancerPool.abi.ts delete mode 100644 apps/ybal/utils/actions.test.ts delete mode 100644 apps/ybal/utils/actions.ts delete mode 100755 pages/ybal/about.tsx delete mode 100755 pages/ybal/index.tsx delete mode 100755 public/apps/ybal-manifest.json diff --git a/apps/common/components/AppHeader.tsx b/apps/common/components/AppHeader.tsx index 3c30d9aa6..565fbec40 100644 --- a/apps/common/components/AppHeader.tsx +++ b/apps/common/components/AppHeader.tsx @@ -12,7 +12,6 @@ import {cl} from '@yearn-finance/web-lib/utils/cl'; import {useMenu} from '@common/contexts/useMenu'; import {useCurrentApp} from '@common/hooks/useCurrentApp'; import {LogoYearn} from '@common/icons/LogoYearn'; -import {YBalHeader} from '@yBal/components/header/YBalHeader'; import {YBribeHeader} from '@yBribe/components/header/YBribeHeader'; import {YCrvHeader} from '@yCRV/components/header/YCrvHeader'; @@ -28,7 +27,6 @@ function Logo(): ReactElement { return ( <> - diff --git a/apps/common/components/Apps.tsx b/apps/common/components/Apps.tsx index 84f1930c6..97b0b95fa 100644 --- a/apps/common/components/Apps.tsx +++ b/apps/common/components/Apps.tsx @@ -1,15 +1,13 @@ import vaultsManifest from 'public/apps/vaults-manifest.json'; import veyfiManifest from 'public/apps/veyfi-manifest.json'; -import yBalManifest from 'public/apps/ybal-manifest.json'; import ybribeManifest from 'public/apps/ybribe-manifest.json'; import ycrvManifest from 'public/apps/ycrv-manifest.json'; import {VAULTS_MENU} from '@vaults/constants/menu'; import {VAULTS_V3_MENU} from '@vaults-v3/constants/menu'; import {VEYFI_MENU} from '@veYFI/constants/menu'; -import {YBAL_TOKEN_ADDRESS, YCRV_TOKEN_ADDRESS} from '@yearn-finance/web-lib/utils/constants'; +import {YCRV_TOKEN_ADDRESS} from '@yearn-finance/web-lib/utils/constants'; import {ImageWithFallback} from '@common/components/ImageWithFallback'; import {LogoYearn} from '@common/icons/LogoYearn'; -import {YBAL_MENU} from '@yBal/constants/menu'; import {YBRIBE_MENU} from '@yBribe/constants/menu'; import {YCRV_MENU} from '@yCRV/constants/menu'; @@ -21,7 +19,6 @@ export enum AppName { VAULTSV3 = 'V3', VAULTS = 'Vaults', YCRV = 'yCRV', - YBAL = 'yBal', VEYFI = 'veYFI', YBRIBE = 'yBribe', YETH = 'yETH', @@ -95,24 +92,6 @@ export const APPS: {[key in AppName]: TApp} = { /> ) }, - yBal: { - name: AppName.YBAL, - href: '/ybal', - menu: YBAL_MENU, - manifest: yBalManifest, - isDisabled: true, - icon: ( - - ) - }, yETH: { name: AppName.YETH, href: 'https://yeth.yearn.fi', diff --git a/apps/common/hooks/useCurrentApp.tsx b/apps/common/hooks/useCurrentApp.tsx index f5d2ecf39..038c30f6c 100644 --- a/apps/common/hooks/useCurrentApp.tsx +++ b/apps/common/hooks/useCurrentApp.tsx @@ -3,7 +3,6 @@ import {VeYfiHeader} from 'apps/veyfi/components/header/VeYfiHeader'; import homeManifest from 'public/manifest.json'; import {VaultsHeader} from '@vaults/components/header/VaultsHeader'; import {AppName, APPS} from '@common/components/Apps'; -import {YBalHeader} from '@yBal/components/header/YBalHeader'; import {YBribeHeader} from '@yBribe/components/header/YBribeHeader'; import {YCrvHeader} from '@yCRV/components/header/YCrvHeader'; @@ -39,10 +38,6 @@ export function useCurrentApp({pathname}: NextRouter): TCurrentApp { ...APPS[AppName.YCRV], header: }, - '/ybal': { - ...APPS[AppName.YBAL], - header: - }, '/veyfi': { ...APPS[AppName.VEYFI], header: diff --git a/apps/ybal/Wrapper.tsx b/apps/ybal/Wrapper.tsx deleted file mode 100755 index 9cae8dd72..000000000 --- a/apps/ybal/Wrapper.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import {AnimatePresence, motion} from 'framer-motion'; -import Meta from '@common/components/Meta'; -import {useCurrentApp} from '@common/hooks/useCurrentApp'; -import {variants} from '@common/utils/animations'; -import {YBalContextApp} from '@yBal/contexts/useYBal'; - -import type {NextRouter} from 'next/router'; -import type {ReactElement} from 'react'; - -export function Wrapper({children, router}: {children: ReactElement; router: NextRouter}): ReactElement { - const {manifest} = useCurrentApp(router); - - return ( -
- - - - - {children} - - - -
- ); -} diff --git a/apps/ybal/components/CardTransactorWrapper.tsx b/apps/ybal/components/CardTransactorWrapper.tsx deleted file mode 100755 index 67d798fee..000000000 --- a/apps/ybal/components/CardTransactorWrapper.tsx +++ /dev/null @@ -1,289 +0,0 @@ -import {createContext, useCallback, useContext, useEffect, useMemo, useState} from 'react'; -import {useAsync, useUpdateEffect} from '@react-hookz/web'; -import {yToast} from '@yearn-finance/web-lib/components/yToast'; -import {useWeb3} from '@yearn-finance/web-lib/contexts/useWeb3'; -import {useAddToken} from '@yearn-finance/web-lib/hooks/useAddToken'; -import {useDismissToasts} from '@yearn-finance/web-lib/hooks/useDismissToasts'; -import {allowanceKey, toAddress} from '@yearn-finance/web-lib/utils/address'; -import { - LPYBAL_TOKEN_ADDRESS, - MAX_UINT_256, - STYBAL_TOKEN_ADDRESS, - ZAP_YEARN_YBAL_ADDRESS -} from '@yearn-finance/web-lib/utils/constants'; -import {formatToNormalizedValue, toBigInt, toNormalizedBN} from '@yearn-finance/web-lib/utils/format.bigNumber'; -import {formatPercent} from '@yearn-finance/web-lib/utils/format.number'; -import {isZero} from '@yearn-finance/web-lib/utils/isZero'; -import {defaultTxStatus} from '@yearn-finance/web-lib/utils/web3/transaction'; -import {useWallet} from '@common/contexts/useWallet'; -import {useYearn} from '@common/contexts/useYearn'; -import {getVaultAPR} from '@common/utils'; -import {approveERC20, deposit} from '@common/utils/actions'; -import {YBAL_SUPPORTED_NETWORK} from '@yBal/constants/index'; -import {ZAP_OPTIONS_FROM, ZAP_OPTIONS_TO} from '@yBal/constants/tokens'; -import {useYBal} from '@yBal/contexts/useYBal'; -import {simulateZapForMinOut, zapBal} from '@yBal/utils/actions'; - -import type {ReactElement} from 'react'; -import type {Connector} from 'wagmi'; -import type {TAddress, VoidPromiseFunction} from '@yearn-finance/web-lib/types'; -import type {TDropdownOption, TNormalizedBN} from '@common/types/types'; - -type TCardTransactor = { - selectedOptionFrom: TDropdownOption; - selectedOptionTo: TDropdownOption; - amount: TNormalizedBN; - txStatusApprove: typeof defaultTxStatus; - txStatusZap: typeof defaultTxStatus; - allowanceFrom: bigint; - fromVaultAPY: string; - toVaultAPY: string; - expectedOutWithSlippage: number; - set_selectedOptionFrom: (option: TDropdownOption) => void; - set_selectedOptionTo: (option: TDropdownOption) => void; - set_amount: (amount: TNormalizedBN) => void; - set_hasTypedSomething: (hasTypedSomething: boolean) => void; - onApproveFrom: VoidPromiseFunction; - onZap: VoidPromiseFunction; -}; - -const CardTransactorContext = createContext({ - selectedOptionFrom: ZAP_OPTIONS_FROM[0], - selectedOptionTo: ZAP_OPTIONS_TO[0], - amount: toNormalizedBN(0), - txStatusApprove: defaultTxStatus, - txStatusZap: defaultTxStatus, - allowanceFrom: 0n, - fromVaultAPY: '', - toVaultAPY: '', - expectedOutWithSlippage: 0, - set_selectedOptionFrom: (): void => undefined, - set_selectedOptionTo: (): void => undefined, - set_amount: (): void => undefined, - set_hasTypedSomething: (): void => undefined, - onApproveFrom: async (): Promise => undefined, - onZap: async (): Promise => undefined -}); - -export function CardTransactorContextApp({ - defaultOptionFrom = ZAP_OPTIONS_FROM[0], - defaultOptionTo = ZAP_OPTIONS_TO[0], - children =
-}): ReactElement { - const {provider, isActive, address} = useWeb3(); - const {styBalAPY, allowances, refetchAllowances, slippage} = useYBal(); - const {getBalance, refresh} = useWallet(); - const {vaults} = useYearn(); - const [txStatusApprove, set_txStatusApprove] = useState(defaultTxStatus); - const [txStatusZap, set_txStatusZap] = useState(defaultTxStatus); - const [selectedOptionFrom, set_selectedOptionFrom] = useState(defaultOptionFrom); - const [selectedOptionTo, set_selectedOptionTo] = useState(defaultOptionTo); - const [amount, set_amount] = useState(toNormalizedBN(0)); - const [hasTypedSomething, set_hasTypedSomething] = useState(false); - const addToken = useAddToken(); - const {dismissAllToasts} = useDismissToasts(); - const {toast} = yToast(); - - /* 🔵 - Yearn Finance ****************************************************** - ** useEffect to set the amount to the max amount of the selected token once - ** the wallet is connected, or to 0 if the wallet is disconnected. - **************************************************************************/ - useEffect((): void => { - set_amount((prevAmount): TNormalizedBN => { - if (isActive && isZero(prevAmount.raw) && !hasTypedSomething) { - return toNormalizedBN( - getBalance({address: selectedOptionFrom.value, chainID: selectedOptionFrom.chainID}).raw - ); - } - if (!isActive && prevAmount.raw > 0n) { - return toNormalizedBN(0); - } - return prevAmount; - }); - }, [isActive, selectedOptionFrom.value, getBalance, hasTypedSomething, selectedOptionFrom.chainID]); - - useUpdateEffect((): void => { - if (!isActive) { - set_hasTypedSomething(false); - } - }, [isActive]); - - /* 🔵 - Yearn Finance ****************************************************** - ** Perform a smartContract call to the ZAP contract to get the expected - ** out for a given in/out pair with a specific amount. This callback is - ** called every 10s or when amount/in or out changes. - **************************************************************************/ - const [{result: expectedOut}, actions] = useAsync( - async ( - _provider: Connector | undefined, - _inputToken: TAddress, - _outputToken: TAddress, - _amountIn: bigint - ): Promise<{shouldMint: boolean; minOut: bigint}> => { - return await simulateZapForMinOut({ - connector: provider, - chainID: YBAL_SUPPORTED_NETWORK, - contractAddress: ZAP_YEARN_YBAL_ADDRESS, - inputToken: _inputToken, - outputToken: _outputToken, - amountIn: _amountIn - }); - }, - {shouldMint: false, minOut: 0n} - ); - - useUpdateEffect((): void => { - actions.execute(provider, selectedOptionFrom.value, selectedOptionTo.value, amount.raw); - }, [actions, provider, amount, selectedOptionFrom.value, selectedOptionTo.value]); - - /* 🔵 - Yearn Finance ****************************************************** - ** Approve the spending of token A by the corresponding ZAP contract to - ** perform the swap. - **************************************************************************/ - const onApprove = useCallback(async (): Promise => { - const result = await approveERC20({ - connector: provider, - chainID: selectedOptionFrom.chainID, - contractAddress: selectedOptionFrom.value, - spenderAddress: selectedOptionFrom.zapVia, - amount: MAX_UINT_256, - statusHandler: set_txStatusApprove - }); - if (result.isSuccessful) { - await Promise.all([refetchAllowances(), refresh()]); - } - }, [provider, refresh, selectedOptionFrom.value, selectedOptionFrom.zapVia]); - - /* 🔵 - Yearn Finance ****************************************************** - ** Execute a zap using the ZAP contract to migrate from a token A to a - ** supported token B. - **************************************************************************/ - const onZap = useCallback(async (): Promise => { - dismissAllToasts(); - const addToMetamaskToast = { - type: 'info' as const, - content: `Add ${selectedOptionTo.symbol} to Metamask?`, - duration: Infinity, - cta: { - label: 'Add +', - onClick: (): void => - addToken({ - address: selectedOptionTo.value, - symbol: selectedOptionTo.symbol, - decimals: selectedOptionTo.decimals, - image: selectedOptionTo.icon?.props.src - }) - } - }; - - if (selectedOptionFrom.zapVia === LPYBAL_TOKEN_ADDRESS) { - // Direct deposit to vault from Bal/yBal balancer LP Token to lp-yBal Vault - const result = await deposit({ - connector: provider, - chainID: selectedOptionFrom.chainID, - contractAddress: selectedOptionTo.value, - amount: amount.raw, //amount_in - statusHandler: set_txStatusZap - }); - if (result.isSuccessful) { - set_amount(toNormalizedBN(0)); - await refresh(); - toast(addToMetamaskToast); - } - } else { - // Zap in - const result = await zapBal({ - connector: provider, - chainID: selectedOptionFrom.chainID, - contractAddress: ZAP_YEARN_YBAL_ADDRESS, - inputToken: selectedOptionFrom.value, //_input_token - outputToken: selectedOptionTo.value, //_output_token - amount: amount.raw, //amount_in - minAmount: expectedOut.minOut, //_min_out - slippage: toBigInt(slippage * 100), - shouldMint: expectedOut.shouldMint, - statusHandler: set_txStatusZap - }); - if (result.isSuccessful) { - set_amount(toNormalizedBN(0)); - await refresh(); - toast(addToMetamaskToast); - } - } - }, [ - addToken, - amount.raw, - dismissAllToasts, - expectedOut.minOut, - expectedOut.shouldMint, - provider, - refresh, - selectedOptionFrom.chainID, - selectedOptionFrom.value, - selectedOptionFrom.zapVia, - selectedOptionTo.decimals, - selectedOptionTo.icon?.props.src, - selectedOptionTo.symbol, - selectedOptionTo.value, - slippage, - toast - ]); - - /* 🔵 - Yearn Finance ****************************************************** - ** Set of memorized values to limit the number of re-rendering of the - ** component. - **************************************************************************/ - const fromVaultAPY = useMemo((): string => { - if (toAddress(selectedOptionFrom.value) === STYBAL_TOKEN_ADDRESS) { - return `APY ${formatPercent(styBalAPY)}`; - } - return getVaultAPR(vaults, selectedOptionFrom.value); - }, [vaults, selectedOptionFrom, styBalAPY]); - - const toVaultAPY = useMemo((): string => { - if (toAddress(selectedOptionTo.value) === STYBAL_TOKEN_ADDRESS) { - return `APY ${formatPercent(styBalAPY)}`; - } - return getVaultAPR(vaults, selectedOptionTo.value); - }, [vaults, selectedOptionTo, styBalAPY]); - - const allowanceFrom = useMemo((): bigint => { - return toBigInt( - allowances?.[ - allowanceKey( - 1, - toAddress(selectedOptionFrom.value), - toAddress(selectedOptionFrom.zapVia), - toAddress(address) - ) - ] - ); - }, [allowances, selectedOptionFrom.value, selectedOptionFrom.zapVia, address]); - - return ( - - {children} - - ); -} - -export const useCardTransactor = (): TCardTransactor => useContext(CardTransactorContext); diff --git a/apps/ybal/components/CardZap.tsx b/apps/ybal/components/CardZap.tsx deleted file mode 100755 index ff885da55..000000000 --- a/apps/ybal/components/CardZap.tsx +++ /dev/null @@ -1,275 +0,0 @@ -import {useMemo} from 'react'; -import {Button} from '@yearn-finance/web-lib/components/Button'; -import {useWeb3} from '@yearn-finance/web-lib/contexts/useWeb3'; -import {toAddress} from '@yearn-finance/web-lib/utils/address'; -import {cl} from '@yearn-finance/web-lib/utils/cl'; -import { - LPYBAL_TOKEN_ADDRESS, - YBAL_BALANCER_POOL_ADDRESS, - YBAL_TOKEN_ADDRESS -} from '@yearn-finance/web-lib/utils/constants'; -import {formatToNormalizedValue, toBigInt, toNormalizedBN} from '@yearn-finance/web-lib/utils/format.bigNumber'; -import {formatCounterValue} from '@yearn-finance/web-lib/utils/format.value'; -import {handleInputChangeEventValue} from '@yearn-finance/web-lib/utils/handlers/handleInputChangeEventValue'; -import {isZero} from '@yearn-finance/web-lib/utils/isZero'; -import {performBatchedUpdates} from '@yearn-finance/web-lib/utils/performBatchedUpdates'; -import {Dropdown} from '@common/components/TokenDropdown'; -import {useWallet} from '@common/contexts/useWallet'; -import {useYearn} from '@common/contexts/useYearn'; -import {ArrowDown} from '@common/icons/ArrowDown'; -import {CardTransactorContextApp, useCardTransactor} from '@yBal/components/CardTransactorWrapper'; -import {ZAP_OPTIONS_FROM, ZAP_OPTIONS_TO} from '@yBal/constants/tokens'; - -import type {ChangeEvent, ReactElement} from 'react'; -import type {TDropdownOption} from '@common/types/types'; - -function CardZap(): ReactElement { - const {isActive} = useWeb3(); - const {getToken, getBalance} = useWallet(); - const {vaults, prices} = useYearn(); - const { - txStatusApprove, - txStatusZap, - selectedOptionFrom, - set_selectedOptionFrom, - selectedOptionTo, - set_selectedOptionTo, - amount, - set_amount, - set_hasTypedSomething, - fromVaultAPY, - toVaultAPY, - expectedOutWithSlippage, - allowanceFrom, - onApproveFrom, - onZap - } = useCardTransactor(); - - const yBalPrice = useMemo( - (): number => formatToNormalizedValue(toBigInt(prices?.[1]?.[YBAL_TOKEN_ADDRESS] || 0), 6), - [prices] - ); - - const yBalCurvePoolPrice = useMemo( - (): number => formatToNormalizedValue(toBigInt(prices?.[1]?.[YBAL_BALANCER_POOL_ADDRESS] || 0), 6), - [prices] - ); - - /* 🔵 - Yearn Finance ****************************************************** - ** useMemo to get the current possible TO vaults path for the current FROM - **************************************************************************/ - const possibleTo = useMemo((): TDropdownOption[] => { - if (selectedOptionFrom.value === YBAL_BALANCER_POOL_ADDRESS) { - const possibleOptions = ZAP_OPTIONS_TO.filter((option): boolean => option.value === LPYBAL_TOKEN_ADDRESS); - if (selectedOptionTo.value !== LPYBAL_TOKEN_ADDRESS) { - set_selectedOptionTo(possibleOptions[0]); - } - return possibleOptions; - } - return ZAP_OPTIONS_TO.filter((option): boolean => option.value !== selectedOptionFrom.value); - }, [selectedOptionFrom.value, selectedOptionTo.value, set_selectedOptionTo]); - - function renderButton(): ReactElement { - const balanceForInputToken = toBigInt( - getBalance({address: selectedOptionFrom.value, chainID: selectedOptionFrom.chainID})?.raw - ); - const isAboveBalance = amount.raw > balanceForInputToken || isZero(balanceForInputToken); - const isAboveAllowance = amount.raw > allowanceFrom; - - if (txStatusApprove.pending || isAboveAllowance) { - return ( - - ); - } - - return ( - - ); - } - - return ( - <> -
-
-

{'Swap from'}

- { - performBatchedUpdates((): void => { - if (option.value === selectedOptionTo.value) { - set_selectedOptionTo( - ZAP_OPTIONS_TO.find( - (o: TDropdownOption): boolean => o.value !== option.value - ) as TDropdownOption - ); - } - set_selectedOptionFrom(option); - set_amount( - toNormalizedBN(getBalance({address: option.value, chainID: option.chainID})?.raw) - ); - }); - }} - /> -

{fromVaultAPY}

-
-
- -
-
- ): void => { - performBatchedUpdates((): void => { - set_amount( - handleInputChangeEventValue( - e.target.value, - getToken({ - address: selectedOptionFrom.value, - chainID: selectedOptionFrom.chainID - }).decimals || 18 - ) - ); - set_hasTypedSomething(true); - }); - }} - /> - -
-
-

- {formatCounterValue( - amount?.normalized || 0, - toAddress(selectedOptionFrom.value) === YBAL_TOKEN_ADDRESS - ? yBalPrice || 0 - : toAddress(selectedOptionFrom.value) === YBAL_BALANCER_POOL_ADDRESS - ? yBalCurvePoolPrice || 0 - : Number( - getToken({ - address: selectedOptionFrom.value, - chainID: selectedOptionFrom.chainID - }).price.normalized - ) || - vaults?.[toAddress(selectedOptionFrom.value)]?.tvl?.price || - 0 - )} -

-
-
- - - -
-
-

{'Swap to'}

- set_selectedOptionTo(option)} - /> -

{toVaultAPY}

-
-
-
- -

{'You will receive min'}

-
-
- {expectedOutWithSlippage} -
-

- {formatCounterValue( - expectedOutWithSlippage, - toAddress(selectedOptionTo.value) === YBAL_TOKEN_ADDRESS - ? yBalPrice || 0 - : toAddress(selectedOptionFrom.value) === YBAL_BALANCER_POOL_ADDRESS - ? yBalCurvePoolPrice || 0 - : Number( - getToken({ - address: selectedOptionTo.value, - chainID: selectedOptionTo.chainID - }).price.normalized - ) || - vaults?.[toAddress(selectedOptionTo.value)]?.tvl?.price || - 0 - )} -

-
-
- -
{renderButton()}
- - ); -} - -export function WithCardTransactor({className}: {className: string}): ReactElement { - return ( - -
-
-

{'Supercharge your yield with yBal'}

-
-
-

- { - 'Swap any token within the yBal ecosystem for any other. Maybe you want to swap for a higher yield, or maybe you just like swapping. It’s ok, we don’t judge.' - } -

-
- -
-
- ); -} diff --git a/apps/ybal/components/Harvests.tsx b/apps/ybal/components/Harvests.tsx deleted file mode 100644 index c57bd0fe9..000000000 --- a/apps/ybal/components/Harvests.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import {useMemo, useState} from 'react'; -import {Button} from '@yearn-finance/web-lib/components/Button'; -import {isZeroAddress, toAddress} from '@yearn-finance/web-lib/utils/address'; -import {LPYBAL_TOKEN_ADDRESS, STYBAL_TOKEN_ADDRESS} from '@yearn-finance/web-lib/utils/constants'; -import {HarvestListHead} from '@yBal/components/HarvestsListHead'; -import {HarvestListRow} from '@yBal/components/HarvestsListRow'; -import {useYBal} from '@yBal/contexts/useYBal'; - -import type {ReactElement} from 'react'; -import type {TYDaemonVaultHarvest, TYDaemonVaultHarvests} from '@common/schemas/yDaemonVaultsSchemas'; - -export function Harvests(): ReactElement { - const {harvests} = useYBal(); - const [category, set_category] = useState('all'); - - const filteredHarvests = useMemo((): TYDaemonVaultHarvests => { - const _harvests = [...(harvests || [])]; - if (category === 'st-yBal') { - return _harvests.filter((harvest): boolean => toAddress(harvest.vaultAddress) === STYBAL_TOKEN_ADDRESS); - } - if (category === 'lp-yBal') { - return _harvests.filter((harvest): boolean => toAddress(harvest.vaultAddress) === LPYBAL_TOKEN_ADDRESS); - } - return _harvests; - }, [category, harvests]); - - return ( -
-
-
-

{'Harvests'}

-
-
- - - -
-
-
- - {(filteredHarvests || []) - .filter((harvest: TYDaemonVaultHarvest): boolean => { - return ( - !isZeroAddress(toAddress(harvest.vaultAddress)) && - [STYBAL_TOKEN_ADDRESS, LPYBAL_TOKEN_ADDRESS].includes(toAddress(harvest.vaultAddress)) - ); - }) - .map((harvest: TYDaemonVaultHarvest, index: number): ReactElement => { - return ( - - ); - })} -
-
- ); -} diff --git a/apps/ybal/components/HarvestsListHead.tsx b/apps/ybal/components/HarvestsListHead.tsx deleted file mode 100644 index 0788db056..000000000 --- a/apps/ybal/components/HarvestsListHead.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import {cl} from '@yearn-finance/web-lib/utils/cl'; - -import type {ReactElement} from 'react'; - -type THeadLabelProps = { - label: string; - className?: string; - datatype?: 'text' | 'number'; -}; -function HeadLabel({label, className, datatype = 'text'}: THeadLabelProps): ReactElement { - return ( -
-

{label}

-
- ); -} - -export function HarvestListHead(): ReactElement { - return ( -
-
- -
-
- - - - -
-
- ); -} diff --git a/apps/ybal/components/HarvestsListRow.tsx b/apps/ybal/components/HarvestsListRow.tsx deleted file mode 100755 index 723c8e3cd..000000000 --- a/apps/ybal/components/HarvestsListRow.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import {IconLinkOut} from '@yearn-finance/web-lib/icons/IconLinkOut'; -import {toAddress, truncateHex} from '@yearn-finance/web-lib/utils/address'; -import {cl} from '@yearn-finance/web-lib/utils/cl'; -import {STYBAL_TOKEN_ADDRESS} from '@yearn-finance/web-lib/utils/constants'; -import {formatToNormalizedAmount, toBigInt} from '@yearn-finance/web-lib/utils/format.bigNumber'; -import {formatUSD} from '@yearn-finance/web-lib/utils/format.number'; -import {formatDate} from '@yearn-finance/web-lib/utils/format.time'; -import {ImageWithFallback} from '@common/components/ImageWithFallback'; - -import type {ReactElement} from 'react'; -import type {TYDaemonVaultHarvest} from '@common/schemas/yDaemonVaultsSchemas'; - -type TRowProps = { - label: string; - value: string; - className?: string; - valueClassName?: string; -}; -function Row({label, value, className, valueClassName}: TRowProps): ReactElement { - return ( -
-

{label}

-

{value}

-
- ); -} - -export function HarvestListRow({harvest}: {harvest: TYDaemonVaultHarvest}): ReactElement { - const vaultName = toAddress(harvest.vaultAddress) === STYBAL_TOKEN_ADDRESS ? 'st-yBal' : 'lp-yBal'; - const gain = formatToNormalizedAmount(toBigInt(harvest.profit) - toBigInt(harvest.loss)); - const value = formatUSD(Number(harvest.profitValue) - Number(harvest.lossValue)); - const date = formatDate(Number(harvest.timestamp) * 1000); - - return ( -
-
-
-
- -
-

{vaultName}

-
-
- - -
- ); -} diff --git a/apps/ybal/components/header/YBalHeader.tsx b/apps/ybal/components/header/YBalHeader.tsx deleted file mode 100644 index 91a7b390d..000000000 --- a/apps/ybal/components/header/YBalHeader.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import {AppName, APPS} from '@common/components/Apps'; -import {MotionDiv} from '@common/components/MotionDiv'; - -import type {NextRouter} from 'next/router'; -import type {ReactElement} from 'react'; - -type TProps = { - pathname: NextRouter['pathname']; -}; - -export function YBalHeader({pathname}: TProps): ReactElement { - const {name, icon} = APPS[AppName.YBAL]; - - return ( - - {icon} - - ); -} diff --git a/apps/ybal/constants/index.tsx b/apps/ybal/constants/index.tsx deleted file mode 100644 index 92184b112..000000000 --- a/apps/ybal/constants/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export const YBAL_SUPPORTED_NETWORK = 1; diff --git a/apps/ybal/constants/menu.ts b/apps/ybal/constants/menu.ts deleted file mode 100644 index c2738a735..000000000 --- a/apps/ybal/constants/menu.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const YBAL_MENU = [ - {path: '/ybal', label: 'yBal'}, - {path: '/ybal/about', label: 'About'} -]; diff --git a/apps/ybal/constants/tokens.tsx b/apps/ybal/constants/tokens.tsx deleted file mode 100755 index df43693e0..000000000 --- a/apps/ybal/constants/tokens.tsx +++ /dev/null @@ -1,122 +0,0 @@ -import {toAddress} from '@yearn-finance/web-lib/utils/address'; -import { - BAL_TOKEN_ADDRESS, - BALWETH_TOKEN_ADDRESS, - LPYBAL_TOKEN_ADDRESS, - STYBAL_TOKEN_ADDRESS, - WETH_TOKEN_ADDRESS, - YBAL_TOKEN_ADDRESS -} from '@yearn-finance/web-lib/utils/constants'; -import {ImageWithFallback} from '@common/components/ImageWithFallback'; - -import type {TDropdownOption} from '@common/types/types'; - -const LOCAL_ZAP_YEARN_YBAL_ADDRESS = toAddress('0x43cA9bAe8dF108684E5EAaA720C25e1b32B0A075'); -export const BAL = { - label: 'Bal', - symbol: 'Bal', - decimals: 18, - chainID: 1, - value: BAL_TOKEN_ADDRESS, - zapVia: LOCAL_ZAP_YEARN_YBAL_ADDRESS, - icon: ( - - ) -}; -export const YBAL = { - label: 'yBal', - symbol: 'yBal', - decimals: 18, - chainID: 1, - value: YBAL_TOKEN_ADDRESS, - zapVia: LOCAL_ZAP_YEARN_YBAL_ADDRESS, - icon: ( - - ) -}; -export const BALWETH = { - label: 'BAL/wETH', - symbol: 'BAL/wETH', - decimals: 18, - chainID: 1, - value: BALWETH_TOKEN_ADDRESS, - zapVia: LOCAL_ZAP_YEARN_YBAL_ADDRESS, - icon: ( - - ) -}; -export const STYBAL = { - label: 'st-yBal', - symbol: 'st-yBal', - decimals: 18, - chainID: 1, - value: STYBAL_TOKEN_ADDRESS, - zapVia: LOCAL_ZAP_YEARN_YBAL_ADDRESS, - icon: ( - - ) -}; -export const LPYBAL = { - label: 'lp-yBal', - symbol: 'lp-yBal', - decimals: 18, - chainID: 1, - value: LPYBAL_TOKEN_ADDRESS, - zapVia: LOCAL_ZAP_YEARN_YBAL_ADDRESS, - icon: ( - - ) -}; -export const WETH = { - label: 'wETH', - symbol: 'wETH', - decimals: 18, - chainID: 1, - value: WETH_TOKEN_ADDRESS, - zapVia: LOCAL_ZAP_YEARN_YBAL_ADDRESS, - icon: ( - - ) -}; - -export const ZAP_OPTIONS_FROM: TDropdownOption[] = [BAL, WETH, BALWETH, YBAL, STYBAL, LPYBAL]; - -export const ZAP_OPTIONS_TO: TDropdownOption[] = [YBAL, STYBAL, LPYBAL]; diff --git a/apps/ybal/contexts/useAllowanceHook.tsx b/apps/ybal/contexts/useAllowanceHook.tsx deleted file mode 100644 index d9859e776..000000000 --- a/apps/ybal/contexts/useAllowanceHook.tsx +++ /dev/null @@ -1,96 +0,0 @@ -// We need the following line so that Next.js actually refetch the data a fast -// refresh is done. Cf https://nextjs.org/docs/architecture/fast-refresh#tips -// @refresh reset - -import {useMemo} from 'react'; -import {erc20ABI, useContractReads} from 'wagmi'; -import {useWeb3} from '@yearn-finance/web-lib/contexts/useWeb3'; -import {allowanceKey, toAddress} from '@yearn-finance/web-lib/utils/address'; -import { - BAL_TOKEN_ADDRESS, - BALWETH_TOKEN_ADDRESS, - LPYBAL_TOKEN_ADDRESS, - STYBAL_TOKEN_ADDRESS, - WETH_TOKEN_ADDRESS, - YBAL_TOKEN_ADDRESS -} from '@yearn-finance/web-lib/utils/constants'; -import {decodeAsBigInt} from '@yearn-finance/web-lib/utils/decoder'; - -import type {TAddress, TDict} from '@yearn-finance/web-lib/types'; - -const LOCAL_ZAP_YEARN_YBAL_ADDRESS = toAddress('0x43cA9bAe8dF108684E5EAaA720C25e1b32B0A075'); - -/* 🔵 - Yearn Finance ********************************************************** - ** This context controls the allowances computation for the yBal app - ******************************************************************************/ -export function useAllowances(): [TDict, () => void] { - const {address} = useWeb3(); - const wagmiAddress = useMemo((): TAddress => toAddress(address), [address]); - const zapAddress = useMemo((): TAddress => LOCAL_ZAP_YEARN_YBAL_ADDRESS, []); - const {data, status, refetch} = useContractReads({ - contracts: [ - { - address: BAL_TOKEN_ADDRESS, - abi: erc20ABI, - functionName: 'allowance', - args: [wagmiAddress, zapAddress] - }, - { - address: WETH_TOKEN_ADDRESS, - abi: erc20ABI, - functionName: 'allowance', - args: [wagmiAddress, zapAddress] - }, - { - address: BALWETH_TOKEN_ADDRESS, - abi: erc20ABI, - functionName: 'allowance', - args: [wagmiAddress, zapAddress] - }, - { - address: YBAL_TOKEN_ADDRESS, - abi: erc20ABI, - functionName: 'allowance', - args: [wagmiAddress, zapAddress] - }, - { - address: STYBAL_TOKEN_ADDRESS, - abi: erc20ABI, - functionName: 'allowance', - args: [wagmiAddress, zapAddress] - }, - { - address: LPYBAL_TOKEN_ADDRESS, - abi: erc20ABI, - functionName: 'allowance', - args: [wagmiAddress, zapAddress] - } - ] - }); - - return useMemo((): [TDict, () => void] => { - if (!data || status !== 'success') { - return [{}, refetch]; - } - return [ - { - [allowanceKey(1, BAL_TOKEN_ADDRESS, LOCAL_ZAP_YEARN_YBAL_ADDRESS, toAddress(address))]: decodeAsBigInt( - data[0] - ), - [allowanceKey(1, WETH_TOKEN_ADDRESS, LOCAL_ZAP_YEARN_YBAL_ADDRESS, toAddress(address))]: decodeAsBigInt( - data[1] - ), - [allowanceKey(1, BALWETH_TOKEN_ADDRESS, LOCAL_ZAP_YEARN_YBAL_ADDRESS, toAddress(address))]: - decodeAsBigInt(data[2]), - [allowanceKey(1, YBAL_TOKEN_ADDRESS, LOCAL_ZAP_YEARN_YBAL_ADDRESS, toAddress(address))]: decodeAsBigInt( - data[3] - ), - [allowanceKey(1, STYBAL_TOKEN_ADDRESS, LOCAL_ZAP_YEARN_YBAL_ADDRESS, toAddress(address))]: - decodeAsBigInt(data[4]), - [allowanceKey(1, LPYBAL_TOKEN_ADDRESS, LOCAL_ZAP_YEARN_YBAL_ADDRESS, toAddress(address))]: - decodeAsBigInt(data[5]) - }, - refetch - ]; - }, [data, status, address, refetch]); -} diff --git a/apps/ybal/contexts/useHoldingsHook.tsx b/apps/ybal/contexts/useHoldingsHook.tsx deleted file mode 100644 index 673488e99..000000000 --- a/apps/ybal/contexts/useHoldingsHook.tsx +++ /dev/null @@ -1,123 +0,0 @@ -// We need the following line so that Next.js actually refetch the data when a -// fast refresh is done. Cf https://nextjs.org/docs/architecture/fast-refresh#tips -// @refresh reset - -import {useMemo} from 'react'; -import {parseEther} from 'viem'; -import {erc20ABI, useContractReads, usePrepareContractWrite} from 'wagmi'; -import { - BALWETH_TOKEN_ADDRESS, - LPYBAL_TOKEN_ADDRESS, - STYBAL_TOKEN_ADDRESS, - VEBAL_TOKEN_ADDRESS, - VEBALPEG_QUERY_HELP_CONTRACT, - YBAL_TOKEN_ADDRESS, - YBAL_VOTER_ADDRESS, - ZERO_ADDRESS -} from '@yearn-finance/web-lib/utils/constants'; -import {decodeAsBigInt} from '@yearn-finance/web-lib/utils/decoder'; -import {STYBAL_ABI} from '@yBal/utils/abi/styBal.abi'; -import {VE_BAL_ABI} from '@yBal/utils/abi/veBAL.abi'; -import {VEBALPEG_HELPER_ABI} from '@yBal/utils/abi/veBalPegHelper.abi'; - -import type {Hex} from 'viem'; - -export type TBalHoldings = { - yBalSupply: bigint; - styBalSupply: bigint; - lpyBalSupply: bigint; - balYBalPeg: bigint; - treasury: bigint; - veBalTotalSupply: bigint; - veBalBalance: bigint; -}; - -export const defaultBalHoldings = { - yBalSupply: 0n, - styBalSupply: 0n, - lpyBalSupply: 0n, - balYBalPeg: 0n, - treasury: 0n, - veBalTotalSupply: 0n, - veBalBalance: 0n -}; - -/* 🔵 - Yearn Finance ********************************************************** - ** This context controls the Holdings computation. - ******************************************************************************/ -export function useHoldings(): TBalHoldings { - const yBalContract = {address: YBAL_TOKEN_ADDRESS, abi: erc20ABI}; - const lpyBalContract = {address: LPYBAL_TOKEN_ADDRESS, abi: erc20ABI}; - const styBalContract = {address: STYBAL_TOKEN_ADDRESS, abi: STYBAL_ABI}; - const veBalContract = {address: VEBAL_TOKEN_ADDRESS, abi: VE_BAL_ABI}; - const veBalQueryPegHelpContract = { - address: VEBALPEG_QUERY_HELP_CONTRACT, - abi: VEBALPEG_HELPER_ABI - }; - - const pegSwapArguments = { - poolId: '0xd61e198e139369a40818fe05f5d5e6e045cd6eaf000000000000000000000540' as Hex, - kind: 0, - assetIn: BALWETH_TOKEN_ADDRESS, //BALWETH - assetOut: YBAL_TOKEN_ADDRESS, //YBAL - amount: parseEther('1'), - userData: '0x' as Hex - }; - const pegFundArguments = { - sender: ZERO_ADDRESS, - fromInternalBalance: false, - recipient: ZERO_ADDRESS, - toInternalBalance: false - }; - - const {data, status} = useContractReads({ - contracts: [ - {...yBalContract, functionName: 'totalSupply'}, - {...styBalContract, functionName: 'totalAssets'}, - {...lpyBalContract, functionName: 'totalSupply'}, - {...veBalContract, functionName: 'totalSupply'}, - { - ...veBalContract, - functionName: 'balanceOf', - args: [YBAL_VOTER_ADDRESS] - } - ] - }); - const {data: peg, status: pegStatus} = usePrepareContractWrite({ - ...veBalQueryPegHelpContract, - functionName: 'querySwap', - args: [pegSwapArguments, pegFundArguments] - }); - - const baseHolding = useMemo((): TBalHoldings => { - if (!data || status !== 'success') { - return defaultBalHoldings; - } - const yBalTotalSupply = decodeAsBigInt(data[0]); - const styBalTotalSupply = decodeAsBigInt(data[1]); - const lpyBalTotalSupply = decodeAsBigInt(data[2]); - const veBalTotalSupply = decodeAsBigInt(data[3]); - const veBalBalance = decodeAsBigInt(data[4]); - return { - yBalSupply: yBalTotalSupply, - styBalSupply: styBalTotalSupply, - lpyBalSupply: lpyBalTotalSupply, - treasury: veBalBalance - yBalTotalSupply, - veBalTotalSupply: veBalTotalSupply, - veBalBalance: veBalBalance, - balYBalPeg: 0n - }; - }, [data, status]); - - const basePeg = useMemo((): bigint => { - if (!peg || pegStatus !== 'success') { - return 0n; - } - return peg.result; - }, [peg, pegStatus]); - - return { - ...(baseHolding as TBalHoldings), - balYBalPeg: basePeg - }; -} diff --git a/apps/ybal/contexts/useYBal.tsx b/apps/ybal/contexts/useYBal.tsx deleted file mode 100755 index 350dd7555..000000000 --- a/apps/ybal/contexts/useYBal.tsx +++ /dev/null @@ -1,79 +0,0 @@ -import {createContext, useContext, useMemo, useState} from 'react'; -import {LPYBAL_TOKEN_ADDRESS, STYBAL_TOKEN_ADDRESS} from '@yearn-finance/web-lib/utils/constants'; -import {useFetch} from '@common/hooks/useFetch'; -import {yDaemonVaultHarvestsSchema, yDaemonVaultSchema} from '@common/schemas/yDaemonVaultsSchemas'; -import {useYDaemonBaseURI} from '@common/utils/getYDaemonBaseURI'; -import {useAllowances} from '@yBal/contexts/useAllowanceHook'; -import {defaultBalHoldings, useHoldings} from '@yBal/contexts/useHoldingsHook'; - -import type {ReactElement} from 'react'; -import type {TBalHoldings} from '@yBal/contexts/useHoldingsHook'; -import type {TDict} from '@yearn-finance/web-lib/types'; -import type {TYDaemonVault, TYDaemonVaultHarvests} from '@common/schemas/yDaemonVaultsSchemas'; - -type TYBalContext = { - styBalAPY: number; - slippage: number; - allowances: TDict; - holdings: TBalHoldings; - harvests: TYDaemonVaultHarvests; - set_slippage: (slippage: number) => void; - refetchAllowances: () => void; -}; - -const defaultProps = { - styBalAPY: 0, - harvests: [], - allowances: {}, - slippage: 0.6, - holdings: defaultBalHoldings, - set_slippage: (): void => undefined, - refetchAllowances: (): void => undefined -}; - -/* 🔵 - Yearn Finance ********************************************************** - ** This context controls the Holdings computation. - ******************************************************************************/ -const YBalContext = createContext(defaultProps); - -export const YBalContextApp = ({children}: {children: ReactElement}): ReactElement => { - const {yDaemonBaseUri} = useYDaemonBaseURI({chainID: 1}); - const [slippage, set_slippage] = useState(0.6); - const holdings = useHoldings(); - const allowances = useAllowances(); - - const {data: styBalVault} = useFetch({ - endpoint: `${yDaemonBaseUri}/vaults/${STYBAL_TOKEN_ADDRESS}`, - schema: yDaemonVaultSchema - }); - - const {data: yBalHarvests} = useFetch({ - endpoint: `${yDaemonBaseUri}/vaults/harvests/${STYBAL_TOKEN_ADDRESS},${LPYBAL_TOKEN_ADDRESS}`, - schema: yDaemonVaultHarvestsSchema - }); - - /* 🔵 - Yearn Finance ****************************************************** - ** Compute the styBal APY based on the experimental APY and the mega boost. - **************************************************************************/ - const styBalAPY = useMemo((): number => (styBalVault?.apr?.netAPR || 0) * 100, [styBalVault]); - - /* 🔵 - Yearn Finance ****************************************************** - ** Setup and render the Context provider to use in the app. - ***************************************************************************/ - const contextValue = useMemo( - (): TYBalContext => ({ - harvests: yBalHarvests ?? [], - holdings: holdings, - allowances: allowances[0], - refetchAllowances: allowances[1], - styBalAPY, - slippage, - set_slippage - }), - [yBalHarvests, holdings, allowances, styBalAPY, slippage, set_slippage] - ); - - return {children}; -}; - -export const useYBal = (): TYBalContext => useContext(YBalContext); diff --git a/apps/ybal/utils/abi/styBal.abi.ts b/apps/ybal/utils/abi/styBal.abi.ts deleted file mode 100644 index efd3d73cb..000000000 --- a/apps/ybal/utils/abi/styBal.abi.ts +++ /dev/null @@ -1,882 +0,0 @@ -export const STYBAL_ABI = [ - { - name: 'Transfer', - inputs: [ - {name: 'sender', type: 'address', indexed: true}, - {name: 'receiver', type: 'address', indexed: true}, - {name: 'value', type: 'uint256', indexed: false} - ], - anonymous: false, - type: 'event' - }, - { - name: 'Approval', - inputs: [ - {name: 'owner', type: 'address', indexed: true}, - {name: 'spender', type: 'address', indexed: true}, - {name: 'value', type: 'uint256', indexed: false} - ], - anonymous: false, - type: 'event' - }, - { - name: 'Deposit', - inputs: [ - {name: 'recipient', type: 'address', indexed: true}, - {name: 'shares', type: 'uint256', indexed: false}, - {name: 'amount', type: 'uint256', indexed: false} - ], - anonymous: false, - type: 'event' - }, - { - name: 'Withdraw', - inputs: [ - {name: 'recipient', type: 'address', indexed: true}, - {name: 'shares', type: 'uint256', indexed: false}, - {name: 'amount', type: 'uint256', indexed: false} - ], - anonymous: false, - type: 'event' - }, - { - name: 'Sweep', - inputs: [ - {name: 'token', type: 'address', indexed: true}, - {name: 'amount', type: 'uint256', indexed: false} - ], - anonymous: false, - type: 'event' - }, - { - name: 'LockedProfitDegradationUpdated', - inputs: [{name: 'value', type: 'uint256', indexed: false}], - anonymous: false, - type: 'event' - }, - { - name: 'StrategyAdded', - inputs: [ - {name: 'strategy', type: 'address', indexed: true}, - {name: 'debtRatio', type: 'uint256', indexed: false}, - {name: 'minDebtPerHarvest', type: 'uint256', indexed: false}, - {name: 'maxDebtPerHarvest', type: 'uint256', indexed: false}, - {name: 'performanceFee', type: 'uint256', indexed: false} - ], - anonymous: false, - type: 'event' - }, - { - name: 'StrategyReported', - inputs: [ - {name: 'strategy', type: 'address', indexed: true}, - {name: 'gain', type: 'uint256', indexed: false}, - {name: 'loss', type: 'uint256', indexed: false}, - {name: 'debtPaid', type: 'uint256', indexed: false}, - {name: 'totalGain', type: 'uint256', indexed: false}, - {name: 'totalLoss', type: 'uint256', indexed: false}, - {name: 'totalDebt', type: 'uint256', indexed: false}, - {name: 'debtAdded', type: 'uint256', indexed: false}, - {name: 'debtRatio', type: 'uint256', indexed: false} - ], - anonymous: false, - type: 'event' - }, - { - name: 'FeeReport', - inputs: [ - {name: 'management_fee', type: 'uint256', indexed: false}, - {name: 'performance_fee', type: 'uint256', indexed: false}, - {name: 'strategist_fee', type: 'uint256', indexed: false}, - {name: 'duration', type: 'uint256', indexed: false} - ], - anonymous: false, - type: 'event' - }, - { - name: 'WithdrawFromStrategy', - inputs: [ - {name: 'strategy', type: 'address', indexed: true}, - {name: 'totalDebt', type: 'uint256', indexed: false}, - {name: 'loss', type: 'uint256', indexed: false} - ], - anonymous: false, - type: 'event' - }, - { - name: 'UpdateGovernance', - inputs: [{name: 'governance', type: 'address', indexed: false}], - anonymous: false, - type: 'event' - }, - { - name: 'UpdateManagement', - inputs: [{name: 'management', type: 'address', indexed: false}], - anonymous: false, - type: 'event' - }, - { - name: 'UpdateRewards', - inputs: [{name: 'rewards', type: 'address', indexed: false}], - anonymous: false, - type: 'event' - }, - { - name: 'UpdateDepositLimit', - inputs: [{name: 'depositLimit', type: 'uint256', indexed: false}], - anonymous: false, - type: 'event' - }, - { - name: 'UpdatePerformanceFee', - inputs: [{name: 'performanceFee', type: 'uint256', indexed: false}], - anonymous: false, - type: 'event' - }, - { - name: 'UpdateManagementFee', - inputs: [{name: 'managementFee', type: 'uint256', indexed: false}], - anonymous: false, - type: 'event' - }, - { - name: 'UpdateGuardian', - inputs: [{name: 'guardian', type: 'address', indexed: false}], - anonymous: false, - type: 'event' - }, - { - name: 'EmergencyShutdown', - inputs: [{name: 'active', type: 'bool', indexed: false}], - anonymous: false, - type: 'event' - }, - { - name: 'UpdateWithdrawalQueue', - inputs: [{name: 'queue', type: 'address[20]', indexed: false}], - anonymous: false, - type: 'event' - }, - { - name: 'StrategyUpdateDebtRatio', - inputs: [ - {name: 'strategy', type: 'address', indexed: true}, - {name: 'debtRatio', type: 'uint256', indexed: false} - ], - anonymous: false, - type: 'event' - }, - { - name: 'StrategyUpdateMinDebtPerHarvest', - inputs: [ - {name: 'strategy', type: 'address', indexed: true}, - {name: 'minDebtPerHarvest', type: 'uint256', indexed: false} - ], - anonymous: false, - type: 'event' - }, - { - name: 'StrategyUpdateMaxDebtPerHarvest', - inputs: [ - {name: 'strategy', type: 'address', indexed: true}, - {name: 'maxDebtPerHarvest', type: 'uint256', indexed: false} - ], - anonymous: false, - type: 'event' - }, - { - name: 'StrategyUpdatePerformanceFee', - inputs: [ - {name: 'strategy', type: 'address', indexed: true}, - {name: 'performanceFee', type: 'uint256', indexed: false} - ], - anonymous: false, - type: 'event' - }, - { - name: 'StrategyMigrated', - inputs: [ - {name: 'oldVersion', type: 'address', indexed: true}, - {name: 'newVersion', type: 'address', indexed: true} - ], - anonymous: false, - type: 'event' - }, - { - name: 'StrategyRevoked', - inputs: [{name: 'strategy', type: 'address', indexed: true}], - anonymous: false, - type: 'event' - }, - { - name: 'StrategyRemovedFromQueue', - inputs: [{name: 'strategy', type: 'address', indexed: true}], - anonymous: false, - type: 'event' - }, - { - name: 'StrategyAddedToQueue', - inputs: [{name: 'strategy', type: 'address', indexed: true}], - anonymous: false, - type: 'event' - }, - { - name: 'NewPendingGovernance', - inputs: [{name: 'pendingGovernance', type: 'address', indexed: true}], - anonymous: false, - type: 'event' - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'initialize', - inputs: [ - {name: 'token', type: 'address'}, - {name: 'governance', type: 'address'}, - {name: 'rewards', type: 'address'}, - {name: 'nameOverride', type: 'string'}, - {name: 'symbolOverride', type: 'string'} - ], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'initialize', - inputs: [ - {name: 'token', type: 'address'}, - {name: 'governance', type: 'address'}, - {name: 'rewards', type: 'address'}, - {name: 'nameOverride', type: 'string'}, - {name: 'symbolOverride', type: 'string'}, - {name: 'guardian', type: 'address'} - ], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'initialize', - inputs: [ - {name: 'token', type: 'address'}, - {name: 'governance', type: 'address'}, - {name: 'rewards', type: 'address'}, - {name: 'nameOverride', type: 'string'}, - {name: 'symbolOverride', type: 'string'}, - {name: 'guardian', type: 'address'}, - {name: 'management', type: 'address'} - ], - outputs: [] - }, - { - stateMutability: 'pure', - type: 'function', - name: 'apiVersion', - inputs: [], - outputs: [{name: '', type: 'string'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'DOMAIN_SEPARATOR', - inputs: [], - outputs: [{name: '', type: 'bytes32'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'setName', - inputs: [{name: 'name', type: 'string'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'setSymbol', - inputs: [{name: 'symbol', type: 'string'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'setGovernance', - inputs: [{name: 'governance', type: 'address'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'acceptGovernance', - inputs: [], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'setManagement', - inputs: [{name: 'management', type: 'address'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'setRewards', - inputs: [{name: 'rewards', type: 'address'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'setLockedProfitDegradation', - inputs: [{name: 'degradation', type: 'uint256'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'setDepositLimit', - inputs: [{name: 'limit', type: 'uint256'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'setPerformanceFee', - inputs: [{name: 'fee', type: 'uint256'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'setManagementFee', - inputs: [{name: 'fee', type: 'uint256'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'setGuardian', - inputs: [{name: 'guardian', type: 'address'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'setEmergencyShutdown', - inputs: [{name: 'active', type: 'bool'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'setWithdrawalQueue', - inputs: [{name: 'queue', type: 'address[20]'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'transfer', - inputs: [ - {name: 'receiver', type: 'address'}, - {name: 'amount', type: 'uint256'} - ], - outputs: [{name: '', type: 'bool'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'transferFrom', - inputs: [ - {name: 'sender', type: 'address'}, - {name: 'receiver', type: 'address'}, - {name: 'amount', type: 'uint256'} - ], - outputs: [{name: '', type: 'bool'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'approve', - inputs: [ - {name: 'spender', type: 'address'}, - {name: 'amount', type: 'uint256'} - ], - outputs: [{name: '', type: 'bool'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'increaseAllowance', - inputs: [ - {name: 'spender', type: 'address'}, - {name: 'amount', type: 'uint256'} - ], - outputs: [{name: '', type: 'bool'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'decreaseAllowance', - inputs: [ - {name: 'spender', type: 'address'}, - {name: 'amount', type: 'uint256'} - ], - outputs: [{name: '', type: 'bool'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'permit', - inputs: [ - {name: 'owner', type: 'address'}, - {name: 'spender', type: 'address'}, - {name: 'amount', type: 'uint256'}, - {name: 'expiry', type: 'uint256'}, - {name: 'signature', type: 'bytes'} - ], - outputs: [{name: '', type: 'bool'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'totalAssets', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'deposit', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'deposit', - inputs: [{name: '_amount', type: 'uint256'}], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'deposit', - inputs: [ - {name: '_amount', type: 'uint256'}, - {name: 'recipient', type: 'address'} - ], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'maxAvailableShares', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'withdraw', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'withdraw', - inputs: [{name: 'maxShares', type: 'uint256'}], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'withdraw', - inputs: [ - {name: 'maxShares', type: 'uint256'}, - {name: 'recipient', type: 'address'} - ], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'withdraw', - inputs: [ - {name: 'maxShares', type: 'uint256'}, - {name: 'recipient', type: 'address'}, - {name: 'maxLoss', type: 'uint256'} - ], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'pricePerShare', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'addStrategy', - inputs: [ - {name: 'strategy', type: 'address'}, - {name: 'debtRatio', type: 'uint256'}, - {name: 'minDebtPerHarvest', type: 'uint256'}, - {name: 'maxDebtPerHarvest', type: 'uint256'}, - {name: 'performanceFee', type: 'uint256'} - ], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'updateStrategyDebtRatio', - inputs: [ - {name: 'strategy', type: 'address'}, - {name: 'debtRatio', type: 'uint256'} - ], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'updateStrategyMinDebtPerHarvest', - inputs: [ - {name: 'strategy', type: 'address'}, - {name: 'minDebtPerHarvest', type: 'uint256'} - ], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'updateStrategyMaxDebtPerHarvest', - inputs: [ - {name: 'strategy', type: 'address'}, - {name: 'maxDebtPerHarvest', type: 'uint256'} - ], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'updateStrategyPerformanceFee', - inputs: [ - {name: 'strategy', type: 'address'}, - {name: 'performanceFee', type: 'uint256'} - ], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'migrateStrategy', - inputs: [ - {name: 'oldVersion', type: 'address'}, - {name: 'newVersion', type: 'address'} - ], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'revokeStrategy', - inputs: [], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'revokeStrategy', - inputs: [{name: 'strategy', type: 'address'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'addStrategyToQueue', - inputs: [{name: 'strategy', type: 'address'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'removeStrategyFromQueue', - inputs: [{name: 'strategy', type: 'address'}], - outputs: [] - }, - { - stateMutability: 'view', - type: 'function', - name: 'debtOutstanding', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'debtOutstanding', - inputs: [{name: 'strategy', type: 'address'}], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'creditAvailable', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'creditAvailable', - inputs: [{name: 'strategy', type: 'address'}], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'availableDepositLimit', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'expectedReturn', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'expectedReturn', - inputs: [{name: 'strategy', type: 'address'}], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'report', - inputs: [ - {name: 'gain', type: 'uint256'}, - {name: 'loss', type: 'uint256'}, - {name: '_debtPayment', type: 'uint256'} - ], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'sweep', - inputs: [{name: 'token', type: 'address'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'sweep', - inputs: [ - {name: 'token', type: 'address'}, - {name: 'amount', type: 'uint256'} - ], - outputs: [] - }, - { - stateMutability: 'view', - type: 'function', - name: 'name', - inputs: [], - outputs: [{name: '', type: 'string'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'symbol', - inputs: [], - outputs: [{name: '', type: 'string'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'decimals', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'balanceOf', - inputs: [{name: 'arg0', type: 'address'}], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'allowance', - inputs: [ - {name: 'arg0', type: 'address'}, - {name: 'arg1', type: 'address'} - ], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'totalSupply', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'token', - inputs: [], - outputs: [{name: '', type: 'address'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'governance', - inputs: [], - outputs: [{name: '', type: 'address'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'management', - inputs: [], - outputs: [{name: '', type: 'address'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'guardian', - inputs: [], - outputs: [{name: '', type: 'address'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'strategies', - inputs: [{name: 'arg0', type: 'address'}], - outputs: [ - { - name: '', - type: 'tuple', - components: [ - {name: 'performanceFee', type: 'uint256'}, - {name: 'activation', type: 'uint256'}, - {name: 'debtRatio', type: 'uint256'}, - {name: 'minDebtPerHarvest', type: 'uint256'}, - {name: 'maxDebtPerHarvest', type: 'uint256'}, - {name: 'lastReport', type: 'uint256'}, - {name: 'totalDebt', type: 'uint256'}, - {name: 'totalGain', type: 'uint256'}, - {name: 'totalLoss', type: 'uint256'} - ] - } - ] - }, - { - stateMutability: 'view', - type: 'function', - name: 'withdrawalQueue', - inputs: [{name: 'arg0', type: 'uint256'}], - outputs: [{name: '', type: 'address'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'emergencyShutdown', - inputs: [], - outputs: [{name: '', type: 'bool'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'depositLimit', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'debtRatio', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'totalIdle', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'totalDebt', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'lastReport', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'activation', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'lockedProfit', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'lockedProfitDegradation', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'rewards', - inputs: [], - outputs: [{name: '', type: 'address'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'managementFee', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'performanceFee', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'nonces', - inputs: [{name: 'arg0', type: 'address'}], - outputs: [{name: '', type: 'uint256'}] - } -] as const; diff --git a/apps/ybal/utils/abi/veBAL.abi.ts b/apps/ybal/utils/abi/veBAL.abi.ts deleted file mode 100644 index 0fb49ec78..000000000 --- a/apps/ybal/utils/abi/veBAL.abi.ts +++ /dev/null @@ -1,310 +0,0 @@ -export const VE_BAL_ABI = [ - { - name: 'Deposit', - inputs: [ - {name: 'provider', type: 'address', indexed: true}, - {name: 'value', type: 'uint256', indexed: false}, - {name: 'locktime', type: 'uint256', indexed: true}, - {name: 'type', type: 'int128', indexed: false}, - {name: 'ts', type: 'uint256', indexed: false} - ], - anonymous: false, - type: 'event' - }, - { - name: 'Withdraw', - inputs: [ - {name: 'provider', type: 'address', indexed: true}, - {name: 'value', type: 'uint256', indexed: false}, - {name: 'ts', type: 'uint256', indexed: false} - ], - anonymous: false, - type: 'event' - }, - { - name: 'Supply', - inputs: [ - {name: 'prevSupply', type: 'uint256', indexed: false}, - {name: 'supply', type: 'uint256', indexed: false} - ], - anonymous: false, - type: 'event' - }, - { - stateMutability: 'nonpayable', - type: 'constructor', - inputs: [ - {name: 'token_addr', type: 'address'}, - {name: '_name', type: 'string'}, - {name: '_symbol', type: 'string'}, - {name: '_authorizer_adaptor', type: 'address'} - ], - outputs: [] - }, - { - stateMutability: 'view', - type: 'function', - name: 'token', - inputs: [], - outputs: [{name: '', type: 'address'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'name', - inputs: [], - outputs: [{name: '', type: 'string'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'symbol', - inputs: [], - outputs: [{name: '', type: 'string'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'decimals', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'admin', - inputs: [], - outputs: [{name: '', type: 'address'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'commit_smart_wallet_checker', - inputs: [{name: 'addr', type: 'address'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'apply_smart_wallet_checker', - inputs: [], - outputs: [] - }, - { - stateMutability: 'view', - type: 'function', - name: 'get_last_user_slope', - inputs: [{name: 'addr', type: 'address'}], - outputs: [{name: '', type: 'int128'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'user_point_history__ts', - inputs: [ - {name: '_addr', type: 'address'}, - {name: '_idx', type: 'uint256'} - ], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'locked__end', - inputs: [{name: '_addr', type: 'address'}], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'checkpoint', - inputs: [], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'deposit_for', - inputs: [ - {name: '_addr', type: 'address'}, - {name: '_value', type: 'uint256'} - ], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'create_lock', - inputs: [ - {name: '_value', type: 'uint256'}, - {name: '_unlock_time', type: 'uint256'} - ], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'increase_amount', - inputs: [{name: '_value', type: 'uint256'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'increase_unlock_time', - inputs: [{name: '_unlock_time', type: 'uint256'}], - outputs: [] - }, - { - stateMutability: 'nonpayable', - type: 'function', - name: 'withdraw', - inputs: [], - outputs: [] - }, - { - stateMutability: 'view', - type: 'function', - name: 'balanceOf', - inputs: [{name: 'addr', type: 'address'}], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'balanceOf', - inputs: [ - {name: 'addr', type: 'address'}, - {name: '_t', type: 'uint256'} - ], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'balanceOfAt', - inputs: [ - {name: 'addr', type: 'address'}, - {name: '_block', type: 'uint256'} - ], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'totalSupply', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'totalSupply', - inputs: [{name: 't', type: 'uint256'}], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'totalSupplyAt', - inputs: [{name: '_block', type: 'uint256'}], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'supply', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'locked', - inputs: [{name: 'arg0', type: 'address'}], - outputs: [ - { - name: '', - type: 'tuple', - components: [ - {name: 'amount', type: 'int128'}, - {name: 'end', type: 'uint256'} - ] - } - ] - }, - { - stateMutability: 'view', - type: 'function', - name: 'epoch', - inputs: [], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'point_history', - inputs: [{name: 'arg0', type: 'uint256'}], - outputs: [ - { - name: '', - type: 'tuple', - components: [ - {name: 'bias', type: 'int128'}, - {name: 'slope', type: 'int128'}, - {name: 'ts', type: 'uint256'}, - {name: 'blk', type: 'uint256'} - ] - } - ] - }, - { - stateMutability: 'view', - type: 'function', - name: 'user_point_history', - inputs: [ - {name: 'arg0', type: 'address'}, - {name: 'arg1', type: 'uint256'} - ], - outputs: [ - { - name: '', - type: 'tuple', - components: [ - {name: 'bias', type: 'int128'}, - {name: 'slope', type: 'int128'}, - {name: 'ts', type: 'uint256'}, - {name: 'blk', type: 'uint256'} - ] - } - ] - }, - { - stateMutability: 'view', - type: 'function', - name: 'user_point_epoch', - inputs: [{name: 'arg0', type: 'address'}], - outputs: [{name: '', type: 'uint256'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'slope_changes', - inputs: [{name: 'arg0', type: 'uint256'}], - outputs: [{name: '', type: 'int128'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'future_smart_wallet_checker', - inputs: [], - outputs: [{name: '', type: 'address'}] - }, - { - stateMutability: 'view', - type: 'function', - name: 'smart_wallet_checker', - inputs: [], - outputs: [{name: '', type: 'address'}] - } -] as const; diff --git a/apps/ybal/utils/abi/veBalPegHelper.abi.ts b/apps/ybal/utils/abi/veBalPegHelper.abi.ts deleted file mode 100644 index f7b2e6a4b..000000000 --- a/apps/ybal/utils/abi/veBalPegHelper.abi.ts +++ /dev/null @@ -1,201 +0,0 @@ -export const VEBALPEG_HELPER_ABI = [ - { - inputs: [{internalType: 'contract IVault', name: '_vault', type: 'address'}], - stateMutability: 'nonpayable', - type: 'constructor' - }, - { - inputs: [ - {internalType: 'enum IVault.SwapKind', name: 'kind', type: 'uint8'}, - { - components: [ - {internalType: 'bytes32', name: 'poolId', type: 'bytes32'}, - { - internalType: 'uint256', - name: 'assetInIndex', - type: 'uint256' - }, - { - internalType: 'uint256', - name: 'assetOutIndex', - type: 'uint256' - }, - {internalType: 'uint256', name: 'amount', type: 'uint256'}, - {internalType: 'bytes', name: 'userData', type: 'bytes'} - ], - internalType: 'struct IVault.BatchSwapStep[]', - name: 'swaps', - type: 'tuple[]' - }, - { - internalType: 'contract IAsset[]', - name: 'assets', - type: 'address[]' - }, - { - components: [ - {internalType: 'address', name: 'sender', type: 'address'}, - { - internalType: 'bool', - name: 'fromInternalBalance', - type: 'bool' - }, - { - internalType: 'address payable', - name: 'recipient', - type: 'address' - }, - { - internalType: 'bool', - name: 'toInternalBalance', - type: 'bool' - } - ], - internalType: 'struct IVault.FundManagement', - name: 'funds', - type: 'tuple' - } - ], - name: 'queryBatchSwap', - outputs: [{internalType: 'int256[]', name: 'assetDeltas', type: 'int256[]'}], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - {internalType: 'bytes32', name: 'poolId', type: 'bytes32'}, - {internalType: 'address', name: 'sender', type: 'address'}, - {internalType: 'address', name: 'recipient', type: 'address'}, - { - components: [ - { - internalType: 'contract IAsset[]', - name: 'assets', - type: 'address[]' - }, - { - internalType: 'uint256[]', - name: 'minAmountsOut', - type: 'uint256[]' - }, - {internalType: 'bytes', name: 'userData', type: 'bytes'}, - { - internalType: 'bool', - name: 'toInternalBalance', - type: 'bool' - } - ], - internalType: 'struct IVault.ExitPoolRequest', - name: 'request', - type: 'tuple' - } - ], - name: 'queryExit', - outputs: [ - {internalType: 'uint256', name: 'bptIn', type: 'uint256'}, - {internalType: 'uint256[]', name: 'amountsOut', type: 'uint256[]'} - ], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - {internalType: 'bytes32', name: 'poolId', type: 'bytes32'}, - {internalType: 'address', name: 'sender', type: 'address'}, - {internalType: 'address', name: 'recipient', type: 'address'}, - { - components: [ - { - internalType: 'contract IAsset[]', - name: 'assets', - type: 'address[]' - }, - { - internalType: 'uint256[]', - name: 'maxAmountsIn', - type: 'uint256[]' - }, - {internalType: 'bytes', name: 'userData', type: 'bytes'}, - { - internalType: 'bool', - name: 'fromInternalBalance', - type: 'bool' - } - ], - internalType: 'struct IVault.JoinPoolRequest', - name: 'request', - type: 'tuple' - } - ], - name: 'queryJoin', - outputs: [ - {internalType: 'uint256', name: 'bptOut', type: 'uint256'}, - {internalType: 'uint256[]', name: 'amountsIn', type: 'uint256[]'} - ], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - components: [ - {internalType: 'bytes32', name: 'poolId', type: 'bytes32'}, - { - internalType: 'enum IVault.SwapKind', - name: 'kind', - type: 'uint8' - }, - { - internalType: 'contract IAsset', - name: 'assetIn', - type: 'address' - }, - { - internalType: 'contract IAsset', - name: 'assetOut', - type: 'address' - }, - {internalType: 'uint256', name: 'amount', type: 'uint256'}, - {internalType: 'bytes', name: 'userData', type: 'bytes'} - ], - internalType: 'struct IVault.SingleSwap', - name: 'singleSwap', - type: 'tuple' - }, - { - components: [ - {internalType: 'address', name: 'sender', type: 'address'}, - { - internalType: 'bool', - name: 'fromInternalBalance', - type: 'bool' - }, - { - internalType: 'address payable', - name: 'recipient', - type: 'address' - }, - { - internalType: 'bool', - name: 'toInternalBalance', - type: 'bool' - } - ], - internalType: 'struct IVault.FundManagement', - name: 'funds', - type: 'tuple' - } - ], - name: 'querySwap', - outputs: [{internalType: 'uint256', name: '', type: 'uint256'}], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'vault', - outputs: [{internalType: 'contract IVault', name: '', type: 'address'}], - stateMutability: 'view', - type: 'function' - } -] as const; diff --git a/apps/ybal/utils/abi/yBalBalancerPool.abi.ts b/apps/ybal/utils/abi/yBalBalancerPool.abi.ts deleted file mode 100644 index e5f15be54..000000000 --- a/apps/ybal/utils/abi/yBalBalancerPool.abi.ts +++ /dev/null @@ -1,839 +0,0 @@ -export const YBAL_BALANCER_POOL_ABI = [ - { - inputs: [ - { - components: [ - { - internalType: 'contract IVault', - name: 'vault', - type: 'address' - }, - { - internalType: 'contract IProtocolFeePercentagesProvider', - name: 'protocolFeeProvider', - type: 'address' - }, - {internalType: 'string', name: 'name', type: 'string'}, - {internalType: 'string', name: 'symbol', type: 'string'}, - { - internalType: 'contract IERC20[]', - name: 'tokens', - type: 'address[]' - }, - { - internalType: 'contract IRateProvider[]', - name: 'rateProviders', - type: 'address[]' - }, - { - internalType: 'uint256[]', - name: 'tokenRateCacheDurations', - type: 'uint256[]' - }, - { - internalType: 'bool[]', - name: 'exemptFromYieldProtocolFeeFlags', - type: 'bool[]' - }, - { - internalType: 'uint256', - name: 'amplificationParameter', - type: 'uint256' - }, - { - internalType: 'uint256', - name: 'swapFeePercentage', - type: 'uint256' - }, - { - internalType: 'uint256', - name: 'pauseWindowDuration', - type: 'uint256' - }, - { - internalType: 'uint256', - name: 'bufferPeriodDuration', - type: 'uint256' - }, - {internalType: 'address', name: 'owner', type: 'address'}, - {internalType: 'string', name: 'version', type: 'string'} - ], - internalType: 'struct ComposableStablePool.NewPoolParams', - name: 'params', - type: 'tuple' - } - ], - stateMutability: 'nonpayable', - type: 'constructor' - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'startValue', - type: 'uint256' - }, - { - indexed: false, - internalType: 'uint256', - name: 'endValue', - type: 'uint256' - }, - { - indexed: false, - internalType: 'uint256', - name: 'startTime', - type: 'uint256' - }, - { - indexed: false, - internalType: 'uint256', - name: 'endTime', - type: 'uint256' - } - ], - name: 'AmpUpdateStarted', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'currentValue', - type: 'uint256' - } - ], - name: 'AmpUpdateStopped', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'owner', - type: 'address' - }, - { - indexed: true, - internalType: 'address', - name: 'spender', - type: 'address' - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256' - } - ], - name: 'Approval', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'bool', - name: 'paused', - type: 'bool' - } - ], - name: 'PausedStateChanged', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'feeType', - type: 'uint256' - }, - { - indexed: false, - internalType: 'uint256', - name: 'protocolFeePercentage', - type: 'uint256' - } - ], - name: 'ProtocolFeePercentageCacheUpdated', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'bool', - name: 'enabled', - type: 'bool' - } - ], - name: 'RecoveryModeStateChanged', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'swapFeePercentage', - type: 'uint256' - } - ], - name: 'SwapFeePercentageChanged', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'tokenIndex', - type: 'uint256' - }, - { - indexed: false, - internalType: 'uint256', - name: 'rate', - type: 'uint256' - } - ], - name: 'TokenRateCacheUpdated', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'tokenIndex', - type: 'uint256' - }, - { - indexed: true, - internalType: 'contract IRateProvider', - name: 'provider', - type: 'address' - }, - { - indexed: false, - internalType: 'uint256', - name: 'cacheDuration', - type: 'uint256' - } - ], - name: 'TokenRateProviderSet', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address' - }, - { - indexed: true, - internalType: 'address', - name: 'to', - type: 'address' - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256' - } - ], - name: 'Transfer', - type: 'event' - }, - { - inputs: [], - name: 'DELEGATE_PROTOCOL_SWAP_FEES_SENTINEL', - outputs: [{internalType: 'uint256', name: '', type: 'uint256'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'DOMAIN_SEPARATOR', - outputs: [{internalType: 'bytes32', name: '', type: 'bytes32'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - {internalType: 'address', name: 'owner', type: 'address'}, - {internalType: 'address', name: 'spender', type: 'address'} - ], - name: 'allowance', - outputs: [{internalType: 'uint256', name: '', type: 'uint256'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - {internalType: 'address', name: 'spender', type: 'address'}, - {internalType: 'uint256', name: 'amount', type: 'uint256'} - ], - name: 'approve', - outputs: [{internalType: 'bool', name: '', type: 'bool'}], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [{internalType: 'address', name: 'account', type: 'address'}], - name: 'balanceOf', - outputs: [{internalType: 'uint256', name: '', type: 'uint256'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'decimals', - outputs: [{internalType: 'uint8', name: '', type: 'uint8'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - {internalType: 'address', name: 'spender', type: 'address'}, - {internalType: 'uint256', name: 'amount', type: 'uint256'} - ], - name: 'decreaseAllowance', - outputs: [{internalType: 'bool', name: '', type: 'bool'}], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'disableRecoveryMode', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'enableRecoveryMode', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [{internalType: 'bytes4', name: 'selector', type: 'bytes4'}], - name: 'getActionId', - outputs: [{internalType: 'bytes32', name: '', type: 'bytes32'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getActualSupply', - outputs: [{internalType: 'uint256', name: '', type: 'uint256'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getAmplificationParameter', - outputs: [ - {internalType: 'uint256', name: 'value', type: 'uint256'}, - {internalType: 'bool', name: 'isUpdating', type: 'bool'}, - {internalType: 'uint256', name: 'precision', type: 'uint256'} - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getAuthorizer', - outputs: [{internalType: 'contract IAuthorizer', name: '', type: 'address'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getBptIndex', - outputs: [{internalType: 'uint256', name: '', type: 'uint256'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getDomainSeparator', - outputs: [{internalType: 'bytes32', name: '', type: 'bytes32'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getLastJoinExitData', - outputs: [ - { - internalType: 'uint256', - name: 'lastJoinExitAmplification', - type: 'uint256' - }, - { - internalType: 'uint256', - name: 'lastPostJoinExitInvariant', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getMinimumBpt', - outputs: [{internalType: 'uint256', name: '', type: 'uint256'}], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [{internalType: 'address', name: 'account', type: 'address'}], - name: 'getNextNonce', - outputs: [{internalType: 'uint256', name: '', type: 'uint256'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getOwner', - outputs: [{internalType: 'address', name: '', type: 'address'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getPausedState', - outputs: [ - {internalType: 'bool', name: 'paused', type: 'bool'}, - { - internalType: 'uint256', - name: 'pauseWindowEndTime', - type: 'uint256' - }, - { - internalType: 'uint256', - name: 'bufferPeriodEndTime', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getPoolId', - outputs: [{internalType: 'bytes32', name: '', type: 'bytes32'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [{internalType: 'uint256', name: 'feeType', type: 'uint256'}], - name: 'getProtocolFeePercentageCache', - outputs: [{internalType: 'uint256', name: '', type: 'uint256'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getProtocolFeesCollector', - outputs: [ - { - internalType: 'contract IProtocolFeesCollector', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getProtocolSwapFeeDelegation', - outputs: [{internalType: 'bool', name: '', type: 'bool'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getRate', - outputs: [{internalType: 'uint256', name: '', type: 'uint256'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getRateProviders', - outputs: [ - { - internalType: 'contract IRateProvider[]', - name: '', - type: 'address[]' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getScalingFactors', - outputs: [{internalType: 'uint256[]', name: '', type: 'uint256[]'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getSwapFeePercentage', - outputs: [{internalType: 'uint256', name: '', type: 'uint256'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [{internalType: 'contract IERC20', name: 'token', type: 'address'}], - name: 'getTokenRate', - outputs: [{internalType: 'uint256', name: '', type: 'uint256'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [{internalType: 'contract IERC20', name: 'token', type: 'address'}], - name: 'getTokenRateCache', - outputs: [ - {internalType: 'uint256', name: 'rate', type: 'uint256'}, - {internalType: 'uint256', name: 'oldRate', type: 'uint256'}, - {internalType: 'uint256', name: 'duration', type: 'uint256'}, - {internalType: 'uint256', name: 'expires', type: 'uint256'} - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getVault', - outputs: [{internalType: 'contract IVault', name: '', type: 'address'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'inRecoveryMode', - outputs: [{internalType: 'bool', name: '', type: 'bool'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - {internalType: 'address', name: 'spender', type: 'address'}, - {internalType: 'uint256', name: 'addedValue', type: 'uint256'} - ], - name: 'increaseAllowance', - outputs: [{internalType: 'bool', name: '', type: 'bool'}], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [{internalType: 'contract IERC20', name: 'token', type: 'address'}], - name: 'isTokenExemptFromYieldProtocolFee', - outputs: [{internalType: 'bool', name: '', type: 'bool'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'name', - outputs: [{internalType: 'string', name: '', type: 'string'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [{internalType: 'address', name: 'owner', type: 'address'}], - name: 'nonces', - outputs: [{internalType: 'uint256', name: '', type: 'uint256'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - {internalType: 'bytes32', name: 'poolId', type: 'bytes32'}, - {internalType: 'address', name: 'sender', type: 'address'}, - {internalType: 'address', name: 'recipient', type: 'address'}, - {internalType: 'uint256[]', name: 'balances', type: 'uint256[]'}, - {internalType: 'uint256', name: 'lastChangeBlock', type: 'uint256'}, - { - internalType: 'uint256', - name: 'protocolSwapFeePercentage', - type: 'uint256' - }, - {internalType: 'bytes', name: 'userData', type: 'bytes'} - ], - name: 'onExitPool', - outputs: [ - {internalType: 'uint256[]', name: '', type: 'uint256[]'}, - {internalType: 'uint256[]', name: '', type: 'uint256[]'} - ], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - {internalType: 'bytes32', name: 'poolId', type: 'bytes32'}, - {internalType: 'address', name: 'sender', type: 'address'}, - {internalType: 'address', name: 'recipient', type: 'address'}, - {internalType: 'uint256[]', name: 'balances', type: 'uint256[]'}, - {internalType: 'uint256', name: 'lastChangeBlock', type: 'uint256'}, - { - internalType: 'uint256', - name: 'protocolSwapFeePercentage', - type: 'uint256' - }, - {internalType: 'bytes', name: 'userData', type: 'bytes'} - ], - name: 'onJoinPool', - outputs: [ - {internalType: 'uint256[]', name: '', type: 'uint256[]'}, - {internalType: 'uint256[]', name: '', type: 'uint256[]'} - ], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - components: [ - { - internalType: 'enum IVault.SwapKind', - name: 'kind', - type: 'uint8' - }, - { - internalType: 'contract IERC20', - name: 'tokenIn', - type: 'address' - }, - { - internalType: 'contract IERC20', - name: 'tokenOut', - type: 'address' - }, - {internalType: 'uint256', name: 'amount', type: 'uint256'}, - {internalType: 'bytes32', name: 'poolId', type: 'bytes32'}, - { - internalType: 'uint256', - name: 'lastChangeBlock', - type: 'uint256' - }, - {internalType: 'address', name: 'from', type: 'address'}, - {internalType: 'address', name: 'to', type: 'address'}, - {internalType: 'bytes', name: 'userData', type: 'bytes'} - ], - internalType: 'struct IPoolSwapStructs.SwapRequest', - name: 'swapRequest', - type: 'tuple' - }, - {internalType: 'uint256[]', name: 'balances', type: 'uint256[]'}, - {internalType: 'uint256', name: 'indexIn', type: 'uint256'}, - {internalType: 'uint256', name: 'indexOut', type: 'uint256'} - ], - name: 'onSwap', - outputs: [{internalType: 'uint256', name: '', type: 'uint256'}], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'pause', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - {internalType: 'address', name: 'owner', type: 'address'}, - {internalType: 'address', name: 'spender', type: 'address'}, - {internalType: 'uint256', name: 'value', type: 'uint256'}, - {internalType: 'uint256', name: 'deadline', type: 'uint256'}, - {internalType: 'uint8', name: 'v', type: 'uint8'}, - {internalType: 'bytes32', name: 'r', type: 'bytes32'}, - {internalType: 'bytes32', name: 's', type: 'bytes32'} - ], - name: 'permit', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - {internalType: 'bytes32', name: 'poolId', type: 'bytes32'}, - {internalType: 'address', name: 'sender', type: 'address'}, - {internalType: 'address', name: 'recipient', type: 'address'}, - {internalType: 'uint256[]', name: 'balances', type: 'uint256[]'}, - {internalType: 'uint256', name: 'lastChangeBlock', type: 'uint256'}, - { - internalType: 'uint256', - name: 'protocolSwapFeePercentage', - type: 'uint256' - }, - {internalType: 'bytes', name: 'userData', type: 'bytes'} - ], - name: 'queryExit', - outputs: [ - {internalType: 'uint256', name: 'bptIn', type: 'uint256'}, - {internalType: 'uint256[]', name: 'amountsOut', type: 'uint256[]'} - ], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - {internalType: 'bytes32', name: 'poolId', type: 'bytes32'}, - {internalType: 'address', name: 'sender', type: 'address'}, - {internalType: 'address', name: 'recipient', type: 'address'}, - {internalType: 'uint256[]', name: 'balances', type: 'uint256[]'}, - {internalType: 'uint256', name: 'lastChangeBlock', type: 'uint256'}, - { - internalType: 'uint256', - name: 'protocolSwapFeePercentage', - type: 'uint256' - }, - {internalType: 'bytes', name: 'userData', type: 'bytes'} - ], - name: 'queryJoin', - outputs: [ - {internalType: 'uint256', name: 'bptOut', type: 'uint256'}, - {internalType: 'uint256[]', name: 'amountsIn', type: 'uint256[]'} - ], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - {internalType: 'contract IERC20', name: 'token', type: 'address'}, - {internalType: 'bytes', name: 'poolConfig', type: 'bytes'} - ], - name: 'setAssetManagerPoolConfig', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'swapFeePercentage', - type: 'uint256' - } - ], - name: 'setSwapFeePercentage', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - {internalType: 'contract IERC20', name: 'token', type: 'address'}, - {internalType: 'uint256', name: 'duration', type: 'uint256'} - ], - name: 'setTokenRateCacheDuration', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - {internalType: 'uint256', name: 'rawEndValue', type: 'uint256'}, - {internalType: 'uint256', name: 'endTime', type: 'uint256'} - ], - name: 'startAmplificationParameterUpdate', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'stopAmplificationParameterUpdate', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'symbol', - outputs: [{internalType: 'string', name: '', type: 'string'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'totalSupply', - outputs: [{internalType: 'uint256', name: '', type: 'uint256'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - {internalType: 'address', name: 'recipient', type: 'address'}, - {internalType: 'uint256', name: 'amount', type: 'uint256'} - ], - name: 'transfer', - outputs: [{internalType: 'bool', name: '', type: 'bool'}], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - {internalType: 'address', name: 'sender', type: 'address'}, - {internalType: 'address', name: 'recipient', type: 'address'}, - {internalType: 'uint256', name: 'amount', type: 'uint256'} - ], - name: 'transferFrom', - outputs: [{internalType: 'bool', name: '', type: 'bool'}], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'unpause', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'updateProtocolFeePercentageCache', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [{internalType: 'contract IERC20', name: 'token', type: 'address'}], - name: 'updateTokenRateCache', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'version', - outputs: [{internalType: 'string', name: '', type: 'string'}], - stateMutability: 'view', - type: 'function' - } -] as const; diff --git a/apps/ybal/utils/actions.test.ts b/apps/ybal/utils/actions.test.ts deleted file mode 100644 index c609cc8c0..000000000 --- a/apps/ybal/utils/actions.test.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* eslint-disable @typescript-eslint/explicit-function-return-type */ -import {describe, expect, it, vi} from 'vitest'; -import {zapBal} from '@yBal/utils/actions'; - -// const mockMintBuffer = vi.fn().mockReturnValue(toBigInt('5')); - -// vi.mock('ethers', async () => { -// const actual = await vi.importActual('ethers'); -// return { -// ethers: { -// ...actual, -// providers: { -// JsonRpcProvider: vi.fn().mockImplementation(() => ({ -// getSigner: vi.fn().mockReturnValue({ -// getAddress: vi.fn().mockReturnValue('0xRecipient') -// }) -// })) -// }, -// Contract: vi.fn().mockImplementation(() => ({ -// zap: mockZap, -// callStatic: { -// queryZapOutput: mockCallStaticZap -// }, -// mint_buffer: mockMintBuffer -// })) -// }, -// BigNumber: actual.BigNumber -// }; -// }); - -vi.mock('@yearn-finance/web-lib/utils/web3/transaction', () => ({ - handleTx: vi.fn() -})); - -describe('actions', () => { - it('should export the correct actions', () => { - expect(zapBal).toBeDefined(); - }); - return; -}); diff --git a/apps/ybal/utils/actions.ts b/apps/ybal/utils/actions.ts deleted file mode 100644 index 531308317..000000000 --- a/apps/ybal/utils/actions.ts +++ /dev/null @@ -1,151 +0,0 @@ -import {prepareWriteContract, readContract} from '@wagmi/core'; -import {toAddress} from '@yearn-finance/web-lib/utils/address'; -import {LPYBAL_TOKEN_ADDRESS, STYBAL_TOKEN_ADDRESS, YBAL_TOKEN_ADDRESS} from '@yearn-finance/web-lib/utils/constants'; -import {toBigInt} from '@yearn-finance/web-lib/utils/format.bigNumber'; -import {isZero} from '@yearn-finance/web-lib/utils/isZero'; -import {handleTx, toWagmiProvider} from '@yearn-finance/web-lib/utils/wagmi/provider'; -import {assertAddress} from '@yearn-finance/web-lib/utils/wagmi/utils'; -import {assert} from '@common/utils/assert'; - -import type {TAddress} from '@yearn-finance/web-lib/types'; -import type {TWriteTransaction} from '@yearn-finance/web-lib/utils/wagmi/provider'; -import type {TTxResponse} from '@yearn-finance/web-lib/utils/web3/transaction'; - -const ZAP_BAL_ABI = [ - { - inputs: [ - {name: '_input_token', type: 'address'}, - {name: '_output_token', type: 'address'}, - {name: '_amount_in', type: 'uint256'}, - {name: '_min_out', type: 'uint256'}, - {name: '_recipient', type: 'address'}, - {name: '_mint', type: 'bool'} - ], - name: 'zap', - outputs: [{name: '', type: 'uint256'}], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'mint_buffer', - outputs: [{name: '', type: 'uint256'}], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - {name: '_input_token', type: 'address'}, - {name: '_output_token', type: 'address'}, - {name: '_amount_in', type: 'uint256'}, - {name: '_mint', type: 'bool'} - ], - name: 'queryZapOutput', - outputs: [{name: '', type: 'uint256'}], - stateMutability: 'nonpayable', - type: 'function' - } -] as const; - -const LOCAL_ZAP_YEARN_YBAL_ADDRESS = toAddress('0x43cA9bAe8dF108684E5EAaA720C25e1b32B0A075'); -const OUTPUT_TOKENS = [YBAL_TOKEN_ADDRESS, STYBAL_TOKEN_ADDRESS, LPYBAL_TOKEN_ADDRESS]; - -type TSimulateZapForMinOut = TWriteTransaction & { - inputToken: TAddress; - outputToken: TAddress; - amountIn: bigint; -}; -export async function simulateZapForMinOut( - props: TSimulateZapForMinOut -): Promise<{shouldMint: boolean; minOut: bigint}> { - if (isZero(props.amountIn)) { - return {shouldMint: false, minOut: 0n}; - } - - try { - const wagmiProvider = await toWagmiProvider(props.connector); - const baseContract = { - ...wagmiProvider, - address: LOCAL_ZAP_YEARN_YBAL_ADDRESS, - abi: ZAP_BAL_ABI, - chainID: props.chainID - }; - const {result: expectedAmountMint} = await prepareWriteContract({ - ...baseContract, - chainId: props.chainID, - functionName: 'queryZapOutput', - args: [props.inputToken, props.outputToken, props.amountIn, true] - }); - - // Check if we even need to worry about minting path. - let expectedAmountSwap = expectedAmountMint; - if (!OUTPUT_TOKENS.includes(toAddress(props.inputToken))) { - // Do another Static Call - simulating output - const {result} = await prepareWriteContract({ - ...baseContract, - chainId: props.chainID, - functionName: 'queryZapOutput', - args: [props.inputToken, props.outputToken, props.amountIn, false] - }); - expectedAmountSwap = result; - } - - // Apply Buffer - const slippage = 1; // (1%) - const buffer = await readContract({ - ...baseContract, - functionName: 'mint_buffer' - }); - const amountInBuffered = (props.amountIn * buffer) / 10_000n; - const bufferedAmount = expectedAmountSwap - amountInBuffered; - - if (bufferedAmount > expectedAmountMint) { - const minOut = bufferedAmount * (1n - toBigInt(slippage) / 100n); - return {shouldMint: false, minOut}; - } - const minOut = expectedAmountMint * (1n - toBigInt(slippage) / 100n); - return {shouldMint: true, minOut}; - } catch (error) { - console.error(error); - return {shouldMint: false, minOut: 0n}; - } -} - -/* 🔵 - Yearn Finance ********************************************************** - ** zapBal is a _WRITE_ function that can be used to zap some supported tokens - ** from the Balancer ecosystem into one of the Yearn's yBal ecosystem. - ** - ** @app - yBal - ** @param inputToken - Token to be zapped from Balancer - ** @param outputToken - Token to be zapped into Yearn's yBal ecosystem - ** @param amount - Amount of inputToken to be zapped - ** @param minAmount - Minimum amount of outputToken to be received - ** @param slippage - Slippage tolerance - ******************************************************************************/ -type TZapYBal = TWriteTransaction & { - inputToken: TAddress | undefined; - outputToken: TAddress | undefined; - amount: bigint; - minAmount: bigint; - slippage: bigint; - shouldMint: boolean; -}; -export async function zapBal(props: TZapYBal): Promise { - const minAmountWithSlippage = props.minAmount - (props.minAmount * props.slippage) / 10_000n; - - assert(props.connector, 'No connector'); - assertAddress(LOCAL_ZAP_YEARN_YBAL_ADDRESS, 'LOCAL_ZAP_YEARN_YBAL_ADDRESS'); - assertAddress(props.inputToken, 'inputToken'); - assertAddress(props.outputToken, 'outputToken'); - assert(props.amount > 0n, 'Amount must be greater than 0'); - assert(props.minAmount > 0n, 'Min amount must be greater than 0'); - - const userAddress = await props.connector.getAccount(); - assertAddress(userAddress, 'userAddress'); - return await handleTx(props, { - address: LOCAL_ZAP_YEARN_YBAL_ADDRESS, - abi: ZAP_BAL_ABI, - functionName: 'zap', - args: [props.inputToken, props.outputToken, props.amount, minAmountWithSlippage, userAddress, props.shouldMint] - }); -} diff --git a/next.config.js b/next.config.js index 23f4dd962..11af8a22e 100755 --- a/next.config.js +++ b/next.config.js @@ -125,7 +125,8 @@ const config = { // YDAEMON_BASE_URI: 'http://localhost:8080', // YDAEMON_BASE_URI: 'https://api.ycorpo.com', BASE_YEARN_ASSETS_URI: 'https://assets.smold.app/api/token', - BASE_YEARN_CHAIN_URI: 'https://assets.smold.app/api/chain' + BASE_YEARN_CHAIN_URI: 'https://assets.smold.app/api/chain', + SMOL_ASSETS_URL: 'https://assets.smold.app/api' } }; diff --git a/pages/ybal/about.tsx b/pages/ybal/about.tsx deleted file mode 100755 index 6607cf773..000000000 --- a/pages/ybal/about.tsx +++ /dev/null @@ -1,229 +0,0 @@ -import {useState} from 'react'; -import {Balancer} from 'react-wrap-balancer'; -import {Button} from '@yearn-finance/web-lib/components/Button'; -import { - LPYBAL_TOKEN_ADDRESS, - STYBAL_TOKEN_ADDRESS, - YBAL_TOKEN_ADDRESS, - ZAP_YEARN_VE_CRV_ADDRESS -} from '@yearn-finance/web-lib/utils/constants'; -import {useYBal} from '@yBal/contexts/useYBal'; -import {Wrapper} from '@yBal/Wrapper'; - -import type {NextRouter} from 'next/router'; -import type {ReactElement} from 'react'; - -type TContractListRowProps = { - label: string; - address: string; -}; - -function ContractListRow({label, address}: TContractListRowProps): ReactElement { - return ( -

- {label} - {': '} - - {address} - -

- ); -} - -export function AboutContent(): ReactElement { - const {slippage, set_slippage} = useYBal(); - const [localSlippage, set_localSlippage] = useState(slippage); - - return ( - <> -
-
-

{'Better Balancer yield,'}

-

{'with yBAL.'}

-
-
- -

- { - 'yBAL is Yearn’s liquid veBAL wrapper system. yBAL shares the same mechanics as yCRV but adapted to work within the Balancer ecosystem. (Our naming guys probably aren’t getting a raise this year).' - } -

-

- { - 'yBAL offers users the best risk-adjusted yields with the same simple auto harvesting and auto-compounding features that Yearn is known (and loved) for. ' - } -

-
-
-
- -
-
-

{'People always ask yBAL'}

-

{'never how BAL?'}

-
-
- -

- { - 'Users can mint yBAL tokens by locking their 80-20 BAL-WETH tokens to Yearn’s whitelisted voter (but pls note: this action is irreversible. Once a user mints there is no way to redeem, as the overall position is continually re-locked).' - } -

-

- { - 'Once minted, yBAL can be staked into (you guessed it) st-yBAL for more yield. Or you can provide liquidity with (you guessed it) lp-yBAL for… more yield.' - } -

-

- { - 'Users can use the yBAL UI to swap between yBAL ecosystem tokens at will, so if one token is earning more yield than the other you don’t have to miss out.' - } -

-
-
-
- -
-
-

{'Let’s talk yield'}

-
-
- -

- { - 'With yBAL users get auto compounded yield for that lovely passive hands off yield feeling. The source of this yield is from various tokens, but Yearn’s automated process take care of selling each of these tokens and compounding it back into yBAL to increase the users position. TLDR, you can relax while Yearn smart contracts do the heavy lifting.' - } -

-

- { - 'yBAL also optimizes gauge voting to further maximize the yield that flows to st-yBAL, which is streamed along with the protocol fee revenue earned by Yearn’s voter position. More yield for you, without having to lift a finger.' - } -

-
-
-
- -
-
-

{'Contract corner'}

-
-
- -

- { - "The yBAL ecosystem is powered by smart contracts; programs that run on blockchains (in yBAL’s case Ethereum) with transparent functions that can be read by anyone. It wouldn't be open and transparent finance if we didn't let you check out our contracts. Go ahead and peek anon, it's ok." - } -

- {[ - {label: 'Zap', address: ZAP_YEARN_VE_CRV_ADDRESS}, - {label: 'yBal', address: YBAL_TOKEN_ADDRESS}, - {label: 'st-yBal', address: STYBAL_TOKEN_ADDRESS}, - {label: 'lp-yBal', address: LPYBAL_TOKEN_ADDRESS} - ].map(ContractListRow)} -
-
-
- -
-
-

{'Don’t get '}

-

{'caught slippin’'}

-
-
- -

- { - 'Slippage is set to 1% and hidden by default to streamline the experience for the average user.' - } -

-

- {'For advanced apes users worried about MEV we advise using '} - - {'SecureRpc'} - - {'.'} -

-

- { - 'If the above sentence causes your brain to wrinkle and eyes to glaze over, then you do not need to worry about this step. ' - } -

-
-
-
- -
-
- { - set_localSlippage(parseFloat(e.target.value) || 0); - }} - /> -

{'%'}

-
- - - -
-
-
- - ); -} - -function About(): ReactElement { - return ( -
- -
- ); -} - -About.getLayout = function getLayout(page: ReactElement, router: NextRouter): ReactElement { - return {page}; -}; - -export default About; diff --git a/pages/ybal/index.tsx b/pages/ybal/index.tsx deleted file mode 100755 index 6b7dd7ff9..000000000 --- a/pages/ybal/index.tsx +++ /dev/null @@ -1,217 +0,0 @@ -import {Fragment, useMemo} from 'react'; -import {LPYBAL_TOKEN_ADDRESS, STYBAL_TOKEN_ADDRESS, YBAL_TOKEN_ADDRESS} from '@yearn-finance/web-lib/utils/constants'; -import {formatBigNumberOver10K, formatToNormalizedValue} from '@yearn-finance/web-lib/utils/format.bigNumber'; -import {formatAmount, formatNumberOver10K, formatPercent} from '@yearn-finance/web-lib/utils/format.number'; -import {formatCounterValue, formatCounterValueRaw} from '@yearn-finance/web-lib/utils/format.value'; -import {ValueAnimation} from '@common/components/ValueAnimation'; -import {useYearn} from '@common/contexts/useYearn'; -import {useBalance} from '@common/hooks/useBalance'; -import {useTokenPrice} from '@common/hooks/useTokenPrice'; -import {getVaultAPR} from '@common/utils'; -import {WithCardTransactor} from '@yBal/components/CardZap'; -import {Harvests} from '@yBal/components/Harvests'; -import {useYBal} from '@yBal/contexts/useYBal'; -import {Wrapper} from '@yBal/Wrapper'; - -import type {NextRouter} from 'next/router'; -import type {ReactElement} from 'react'; - -function HeaderPosition(): ReactElement { - const {holdings} = useYBal(); - const balanceOfStyBal = useBalance({address: STYBAL_TOKEN_ADDRESS, chainID: 1}); //yBal is on ETH mainnet only - const balanceOfLpyBal = useBalance({address: LPYBAL_TOKEN_ADDRESS, chainID: 1}); //yBal is on ETH mainnet only - const styBalPrice = useTokenPrice({address: STYBAL_TOKEN_ADDRESS, chainID: 1}); - const lpyBalPrice = useTokenPrice({address: LPYBAL_TOKEN_ADDRESS, chainID: 1}); - - const formatedYearnHas = useMemo( - (): string => - holdings?.veBalBalance ? formatAmount(formatToNormalizedValue(holdings.veBalBalance, 18), 0, 0) : '', - [holdings?.veBalBalance] - ); - - const formatedYouHave = useMemo( - (): string => - formatCounterValueRaw( - Number(balanceOfStyBal.normalized) * styBalPrice + Number(balanceOfLpyBal.normalized) * lpyBalPrice, - 1 - ), - [balanceOfStyBal.normalized, styBalPrice, balanceOfLpyBal.normalized, lpyBalPrice] - ); - - return ( - -
-

{'Yearn has'}

- - - -
-
-

{'You have'}

- - - -
-
- ); -} - -function Holdings(): ReactElement { - const {holdings, styBalAPY} = useYBal(); - const {vaults} = useYearn(); - - const lpyBalAPY = useMemo((): number => Number(getVaultAPR(vaults, LPYBAL_TOKEN_ADDRESS)), [vaults]); - const yBalPrice = useTokenPrice({address: YBAL_TOKEN_ADDRESS, chainID: 1}); - const styBalPrice = useTokenPrice({address: STYBAL_TOKEN_ADDRESS, chainID: 1}); - const lpyBalPrice = useTokenPrice({address: LPYBAL_TOKEN_ADDRESS, chainID: 1}); - const balanceOfStyBal = useBalance({address: STYBAL_TOKEN_ADDRESS, chainID: 1}); //yBal is on ETH mainnet only - const balanceOfLpyBal = useBalance({address: LPYBAL_TOKEN_ADDRESS, chainID: 1}); //yBal is on ETH mainnet only - - return ( -
- - -
- -
-
-
- {'yBal Ratio: '} -

- {holdings?.balYBalPeg - ? formatPercent((formatToNormalizedValue(holdings?.balYBalPeg, 18) + 0.0015) * 100) - : formatPercent(0)} -

-
-
- -
-
- {'st-yBal'} -
- -
- {'My Balance: '} -

- {formatNumberOver10K(Number(balanceOfStyBal.normalized))} -

-
-
- {'Value: '} -

- {formatCounterValue(balanceOfStyBal.normalized, styBalPrice)} -

-
- -
- -
- {'APY: '} - - {formatPercent(styBalAPY ?? 0)} - -
-
- {'Total Assets: '} -

- {holdings?.styBalSupply - ? formatCounterValue(formatToNormalizedValue(holdings.styBalSupply, 18), yBalPrice) - : formatAmount(0)} -

-
-
- {'yBal Deposits: '} -

- {formatBigNumberOver10K(holdings.styBalSupply)} -

-
-
- -
-
- {'lp-yBal'} -
- -
- {'My Balance: '} -

- {formatNumberOver10K(Number(balanceOfLpyBal.normalized))} -

-
-
- {'Value: '} -

- {formatCounterValue(balanceOfLpyBal.normalized, lpyBalPrice)} -

-
- -
- -
- {'APY: '} - - {formatPercent(lpyBalAPY ?? 0)} - -
-
- {'Total Assets: '} -

- {holdings?.lpyBalSupply - ? formatCounterValue( - formatToNormalizedValue(holdings.lpyBalSupply, 18), - lpyBalPrice - ) - : formatAmount(0)} -

-
-
- {'yBal Deposits: '} -

- {formatBigNumberOver10K(holdings.lpyBalSupply)} -

-
-
-
-
- -
- ); -} - -Holdings.getLayout = function getLayout(page: ReactElement, router: NextRouter): ReactElement { - return {page}; -}; - -export default Holdings; diff --git a/public/apps/ybal-manifest.json b/public/apps/ybal-manifest.json deleted file mode 100755 index 1a6f0be03..000000000 --- a/public/apps/ybal-manifest.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "yBal", - "short_name": "yBal", - "description": "The best Balancer yields in defi. *mic drop*", - "iconPath": "./favicons/favicon.svg", - "locale": "en-US", - "uri": "https://yearn.fi/ybal/", - "og": "https://yearn.fi/apps/ybal-og.png", - "twitter": "@iearnfinance", - "github": "https://github.com/Majorfi/y", - "icons": [ - { - "src": "./favicons/android-icon-192x192.png", - "sizes": "192x192", - "type": "image/png", - "purpose": "any maskable" - }, - { - "src": "./favicons/android-icon-144x144.png", - "sizes": "144x144", - "type": "image/png" - }, - { - "src": "./favicons/android-icon-512x512.png", - "sizes": "512x512", - "type": "image/png" - } - ], - "theme_color": "#000000", - "background_color": "#000000", - "title_color": "#ffffff", - "start_url": "/", - "display": "standalone", - "orientation": "portrait" -} diff --git a/tsconfig.json b/tsconfig.json index 0ce9e9ec7..3d444ecc2 100755 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,8 +8,7 @@ "@vaults-v3/*": ["apps/vaults-v3/*"], "@veYFI/*": ["apps/veyfi/*"], "@yBribe/*": ["apps/ybribe/*"], - "@yCRV/*": ["apps/ycrv/*"], - "@yBal/*": ["apps/ybal/*"] + "@yCRV/*": ["apps/ycrv/*"] }, /* Basic Options */ "target": "esnext", diff --git a/vitest.config.ts b/vitest.config.ts index aefdc3e90..02ee7fdfa 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -9,7 +9,6 @@ export default { resolve: { alias: { '@vaults': path.resolve(__dirname, './apps/vaults'), - '@yBal': path.resolve(__dirname, './apps/ybal'), '@common': path.resolve(__dirname, './apps/common'), '@veYFI': path.resolve(__dirname, './apps/veyfi'), '@yBribe': path.resolve(__dirname, './apps/ybribe'), From 13c5495b1311539598b61079eec54a2f9678ce6a Mon Sep 17 00:00:00 2001 From: Majorfi Date: Fri, 12 Jan 2024 14:43:42 +0100 Subject: [PATCH 2/2] fix: remove unused --- apps/common/components/AppHeader.tsx | 4 ---- apps/common/contexts/useWallet.tsx | 10 ---------- apps/common/hooks/useFeatureFlag.tsx | 25 ------------------------- 3 files changed, 39 deletions(-) delete mode 100644 apps/common/hooks/useFeatureFlag.tsx diff --git a/apps/common/components/AppHeader.tsx b/apps/common/components/AppHeader.tsx index 565fbec40..faa1cbb96 100644 --- a/apps/common/components/AppHeader.tsx +++ b/apps/common/components/AppHeader.tsx @@ -166,10 +166,6 @@ export function AppHeader(): ReactElement { return [HOME_MENU, ...APPS[AppName.YCRV].menu]; } - if (pathname.startsWith('/ybal')) { - return [HOME_MENU, ...APPS[AppName.YBAL].menu]; - } - if (pathname.startsWith('/v3')) { return [HOME_MENU, ...APPS[AppName.VAULTSV3].menu]; } diff --git a/apps/common/contexts/useWallet.tsx b/apps/common/contexts/useWallet.tsx index 934fa5299..f21fd2c8f 100755 --- a/apps/common/contexts/useWallet.tsx +++ b/apps/common/contexts/useWallet.tsx @@ -3,16 +3,11 @@ import {useDeepCompareMemo} from '@react-hookz/web'; import {onLoadDone, onLoadStart} from '@yearn-finance/web-lib/contexts/useUI'; import {toAddress, zeroAddress} from '@yearn-finance/web-lib/utils/address'; import { - BAL_TOKEN_ADDRESS, - BALWETH_TOKEN_ADDRESS, CRV_TOKEN_ADDRESS, CVXCRV_TOKEN_ADDRESS, ETH_TOKEN_ADDRESS, - LPYBAL_TOKEN_ADDRESS, LPYCRV_TOKEN_ADDRESS, LPYCRV_V2_TOKEN_ADDRESS, - STYBAL_TOKEN_ADDRESS, - YBAL_TOKEN_ADDRESS, YCRV_CURVE_POOL_V2_ADDRESS, YCRV_TOKEN_ADDRESS, YVBOOST_TOKEN_ADDRESS, @@ -90,11 +85,6 @@ function useYearnTokens({shouldUseForknetBalances}: {shouldUseForknetBalances: b {chainID: 1, address: YVBOOST_TOKEN_ADDRESS}, {chainID: 1, address: YVECRV_TOKEN_ADDRESS}, {chainID: 1, address: CVXCRV_TOKEN_ADDRESS}, - {chainID: 1, address: BAL_TOKEN_ADDRESS}, - {chainID: 1, address: YBAL_TOKEN_ADDRESS}, - {chainID: 1, address: BALWETH_TOKEN_ADDRESS}, - {chainID: 1, address: STYBAL_TOKEN_ADDRESS}, - {chainID: 1, address: LPYBAL_TOKEN_ADDRESS}, {chainID: 1, address: YCRV_CURVE_POOL_V2_ADDRESS}, {chainID: 1, address: LPYCRV_V2_TOKEN_ADDRESS} ] diff --git a/apps/common/hooks/useFeatureFlag.tsx b/apps/common/hooks/useFeatureFlag.tsx deleted file mode 100644 index 5ce79057d..000000000 --- a/apps/common/hooks/useFeatureFlag.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import {useSearchParams} from 'next/navigation'; - -/** - * Determines if a specific feature flag is enabled based on the URL's search parameters. - * - * @function - * @name useFeatureFlag - * @param {string} flag - The name of the feature flag to check for. - * @returns {[boolean]} A boolean value inside an array indicating if the provided feature flag is enabled (`true` if enabled, `false` otherwise). - * - * @example - * const [isFeatureEnabled] = useFeatureFlag('newFeature'); - * if (isFeatureEnabled) { - * // render or implement the new feature - * } - */ -export function useFeatureFlag(flag: string): [boolean] { - const searchParams = useSearchParams(); - - const flags = searchParams.get('features')?.split(',') ?? []; - - const isEnabled = flags.includes(flag); - - return [isEnabled]; -}