diff --git a/projects/subgraph-basin/src/utils/Well.ts b/projects/subgraph-basin/src/utils/Well.ts index bc7d5c276b..6dd907913b 100644 --- a/projects/subgraph-basin/src/utils/Well.ts +++ b/projects/subgraph-basin/src/utils/Well.ts @@ -197,7 +197,9 @@ export function incrementWellWithdraw(wellAddress: Address): void { export function checkForSnapshot(wellAddress: Address, timestamp: BigInt, blockNumber: BigInt): void { // We check for the prior period snapshot and then take one if needed - let dayID = dayFromTimestamp(timestamp) - 1; + // Schedule the "day" to begin at 9am PT/12pm ET. + // Future work could include properly adjusting this when DST occurs. + let dayID = dayFromTimestamp(timestamp, 8 * 60 * 60) - 1; let hourID = hourFromTimestamp(timestamp) - 1; let well = loadWell(wellAddress); diff --git a/projects/subgraph-core/utils/Dates.ts b/projects/subgraph-core/utils/Dates.ts index fbc08e918d..b298406b11 100644 --- a/projects/subgraph-core/utils/Dates.ts +++ b/projects/subgraph-core/utils/Dates.ts @@ -1,7 +1,14 @@ import { BigInt } from "@graphprotocol/graph-ts"; -export function dayFromTimestamp(timestamp: BigInt): i32 { - let day_ts = timestamp.toI32() - (timestamp.toI32() % 86400); +/** + * Optionally accepts an offset, which adjusts the start of the day from UTC 00:00. + * @param timestamp - the timestamp to extract the day from + * @param offset - how much sooner the day should roll over (relative to UTC) + * for example, for PST (UTC-7), an appropriate offset would be -7 * 60 * 60. + * This would make the day roll over 7 hours later. + */ +export function dayFromTimestamp(timestamp: BigInt, offset: i32 = 0): i32 { + let day_ts = timestamp.toI32() + offset - ((timestamp.toI32() + offset) % 86400); return day_ts / 86400; } diff --git a/projects/ui/src/components/Balances/SiloBalances.tsx b/projects/ui/src/components/Balances/SiloBalances.tsx index e6a6e139fc..07d886a8ad 100644 --- a/projects/ui/src/components/Balances/SiloBalances.tsx +++ b/projects/ui/src/components/Balances/SiloBalances.tsx @@ -20,17 +20,17 @@ import { UNRIPE_BEAN_WETH, } from '~/constants/tokens'; import useWhitelist from '~/hooks/beanstalk/useWhitelist'; -import { BeanstalkPalette, IconSize } from '../App/muiTheme'; import Fiat from '~/components/Common/Fiat'; -import Row from '../Common/Row'; import { displayFullBN, displayTokenAmount } from '~/util'; -import TokenIcon from '../Common/TokenIcon'; import { AppState } from '~/state'; import { ONE_BN, ZERO_BN } from '~/constants'; import useFarmerStalkByToken from '~/hooks/farmer/useFarmerStalkByToken'; import useGetChainToken from '~/hooks/chain/useGetChainToken'; import useUnripeUnderlyingMap from '~/hooks/beanstalk/useUnripeUnderlying'; +import TokenIcon from '../Common/TokenIcon'; +import Row from '../Common/Row'; +import { BeanstalkPalette, IconSize } from '../App/muiTheme'; import Stat from '../Common/Stat'; const ARROW_CONTAINER_WIDTH = 20; @@ -243,7 +243,9 @@ const SiloBalances: React.FC<{}> = () => { )} -  {token.symbol} + +  {token.symbol} + {/** diff --git a/projects/ui/src/components/Barn/Actions/Transfer.tsx b/projects/ui/src/components/Barn/Actions/Transfer.tsx index f33b5921c2..270787cdb2 100644 --- a/projects/ui/src/components/Barn/Actions/Transfer.tsx +++ b/projects/ui/src/components/Barn/Actions/Transfer.tsx @@ -27,19 +27,19 @@ import { useFetchFarmerBarn } from '~/state/farmer/barn/updater'; import { FertilizerBalance } from '~/state/farmer/barn'; export type TransferFormValues = { - fertilizerIds: number[]; - amounts: number[]; - to: string | null; - totalSelected: number; + fertilizerIds: number[]; + amounts: number[]; + to: string | null; + totalSelected: number; }; export type FullFertilizerBalance = FertilizerBalance & { - pctRepaid: BigNumber, - status: string, - humidity: BigNumber, - debt: BigNumber, - sprouts: BigNumber, - rinsableSprouts: BigNumber + pctRepaid: BigNumber; + status: string; + humidity: BigNumber; + debt: BigNumber; + sprouts: BigNumber; + rinsableSprouts: BigNumber; }; const TransferForm: FC> = ({ @@ -48,7 +48,7 @@ const TransferForm: FC> = ({ isSubmitting, }) => { const sdk = useSdk(); - + /// Data const beanstalkBarn = useSelector( (state) => state._beanstalk.barn @@ -70,8 +70,12 @@ const TransferForm: FC> = ({ ); /// Derived - const isReady = values.fertilizerIds && values.to && values.amounts && isValid; - const totalFertAmount = values.amounts.reduce((total, current) => (current || 0) + total, 0); + const isReady = + values.fertilizerIds && values.to && values.amounts && isValid; + const totalFertAmount = values.amounts.reduce( + (total, current) => (current || 0) + total, + 0 + ); const fertilizers = useMemo(() => { const output: FullFertilizerBalance[] = []; @@ -79,9 +83,7 @@ const TransferForm: FC> = ({ const pct = pctRepaid(balance); const status = pct.eq(1) ? 'used' : 'active'; const humidity = balance.token.humidity; - const debt = balance.amount.multipliedBy( - humidity.div(100).plus(1) - ); + const debt = balance.amount.multipliedBy(humidity.div(100).plus(1)); const sprouts = debt.multipliedBy(ONE_BN.minus(pct)); const rinsableSprouts = debt.multipliedBy(pct); @@ -92,7 +94,7 @@ const TransferForm: FC> = ({ humidity: humidity, debt: debt, sprouts: sprouts, - rinsableSprouts: rinsableSprouts + rinsableSprouts: rinsableSprouts, }; output.push(fullBalance); @@ -102,11 +104,16 @@ const TransferForm: FC> = ({ const sproutAmounts = []; for (let i = 0; i < fertilizers.length; i += 1) { - const pctRatio = BigNumber(values.amounts[i] || 0).div(fertilizers[i].amount); + const pctRatio = BigNumber(values.amounts[i] || 0).div( + fertilizers[i].amount + ); const sprouts = fertilizers[i].sprouts.multipliedBy(pctRatio); sproutAmounts.push(sprouts); - }; - const totalSprouts = sproutAmounts.reduce((total: BigNumber, current: BigNumber) => total.plus(current), BigNumber(0)); + } + const totalSprouts = sproutAmounts.reduce( + (total: BigNumber, current: BigNumber) => total.plus(current), + BigNumber(0) + ); return (
@@ -118,44 +125,46 @@ const TransferForm: FC> = ({ )} {/* Txn info */} - {values.to && values.amounts.length > 0 && values.fertilizerIds.length > 0 && ( - <> - - - - - - - - - 0 && - values.to ? - [ - { - type: ActionType.TRANSFER_FERTILIZER, - fertAmount: BigNumber(totalFertAmount), - sproutAmount: totalSprouts, - to: values.to, - }, - { - type: ActionType.END_TOKEN, - token: SPROUTS, - }, - ] + {values.to && + values.amounts.length > 0 && + values.fertilizerIds.length > 0 && ( + <> + + + + + + + + + 0 && + values.to + ? [ + { + type: ActionType.TRANSFER_FERTILIZER, + fertAmount: BigNumber(totalFertAmount), + sproutAmount: totalSprouts, + to: values.to, + }, + { + type: ActionType.END_TOKEN, + token: SPROUTS, + }, + ] : [] - } - /> - - - - - )} + } + /> + + + + + )} = () => { if (values.fertilizerIds[i]) { fertilizers.push(values.fertilizerIds[i]); amounts.push(values.amounts[i]); - }; - }; + } + } if (!account) throw new Error('Connect a wallet first.'); - if (!to || !fertilizers || !amounts || fertilizers.length === 0) throw new Error('Missing data.'); + if (!to || !fertilizers || !amounts || fertilizers.length === 0) + throw new Error('Missing data.'); txToast = new TransactionToast({ loading: `Transferring Fertilizers...`, success: 'Fertilizer Transfer successful.', }); - let call + let call; if (fertilizers.length === 1) { call = fertilizer.safeTransferFrom( account, to, fertilizers[0], amounts[0], - "0x00" + '0x00' ); } else { call = fertilizer.safeBatchTransferFrom( @@ -238,9 +248,9 @@ const Transfer: FC<{}> = () => { to, fertilizers, amounts, - "0x00" + '0x00' ); - }; + } const txn = await call; txToast.confirming(txn); diff --git a/projects/ui/src/components/Barn/FertilizerImage.tsx b/projects/ui/src/components/Barn/FertilizerImage.tsx index d22b06be07..5a270295df 100644 --- a/projects/ui/src/components/Barn/FertilizerImage.tsx +++ b/projects/ui/src/components/Barn/FertilizerImage.tsx @@ -30,7 +30,7 @@ const FertilizerImage: FC = ({ progress, id, noOpenseaLink, - verySmallIdStyling + verySmallIdStyling, }) => { const inner = ( = ({ zIndex: verySmallIdStyling ? 3 : 1, }} > - #{id.toString()} @@ -115,7 +115,7 @@ const FertilizerImage: FC = ({ {inner} ); - }; + } return ( ); diff --git a/projects/ui/src/components/Common/Form/SmartSubmitButton.tsx b/projects/ui/src/components/Common/Form/SmartSubmitButton.tsx index 486a44f94c..7621962bb0 100644 --- a/projects/ui/src/components/Common/Form/SmartSubmitButton.tsx +++ b/projects/ui/src/components/Common/Form/SmartSubmitButton.tsx @@ -15,15 +15,6 @@ import { BEANSTALK_FERTILIZER_ADDRESSES, } from '~/constants/addresses'; import { CHAIN_INFO, SupportedChainId, MAX_UINT256 } from '~/constants'; -import { - StyledDialog, - StyledDialogActions, - StyledDialogContent, - StyledDialogTitle, -} from '../Dialog'; -import TransactionToast from '../TxnToast'; -import { FormState, FormStateNew, FormTokenState, FormTokenStateNew } from '.'; -import WalletButton from '../Connection/WalletButton'; import Row from '~/components/Common/Row'; import useChainId from '~/hooks/chain/useChainId'; import NetworkButton from '~/components/Common/Connection/NetworkButton'; @@ -36,6 +27,15 @@ import NetworkButton from '~/components/Common/Connection/NetworkButton'; import { FC } from '~/types'; import { getNewToOldToken } from '~/hooks/sdk'; import useSetting from '~/hooks/app/useSetting'; +import WalletButton from '../Connection/WalletButton'; +import { FormState, FormStateNew, FormTokenState, FormTokenStateNew } from '.'; +import TransactionToast from '../TxnToast'; +import { + StyledDialog, + StyledDialogActions, + StyledDialogContent, + StyledDialogTitle, +} from '../Dialog'; const CONTRACT_NAMES: { [address: string]: string } = { [BEANSTALK_ADDRESSES[SupportedChainId.MAINNET]]: 'Beanstalk', @@ -116,7 +116,8 @@ const SmartSubmitButton: FC< const isApproving = !!values?.approving; // Are we impersonating a different account while not in dev mode - const isImpersonating = !!useSetting('impersonatedAccount')[0] && !import.meta.env.DEV; + const isImpersonating = + !!useSetting('impersonatedAccount')[0] && !import.meta.env.DEV; // Dialog state and handlers const [open, setOpen] = useState(false); @@ -198,9 +199,11 @@ const SmartSubmitButton: FC< if (isImpersonating) { return ( - Impersonating Account + + Impersonating Account + ); - }; + } if (!SupportedChainId[chainId]) { return ( diff --git a/projects/ui/src/components/Common/Form/TxnPreview.tsx b/projects/ui/src/components/Common/Form/TxnPreview.tsx index 14bf1a9665..e4f72b3e22 100644 --- a/projects/ui/src/components/Common/Form/TxnPreview.tsx +++ b/projects/ui/src/components/Common/Form/TxnPreview.tsx @@ -530,7 +530,7 @@ const TxnPreview: FC<{ return null; })} {customOrder - ? actions.map((action, index) => + ? actions.map((action, index) => action ? ( To claim non-Deposited Unripe Beans and Unripe BEAN:ETH LP, they must - be Picked. You can Pick assets to your wallet, or Pick - and Deposit them directly in the Silo. + be Picked. You can Pick assets to your wallet, or Pick and Deposit + them directly in the Silo.

Unripe Deposited assets do not need to be Picked and were be @@ -420,9 +421,7 @@ const PickBeansDialog: FC< * Section 2b: Total Unripe LP */} - - Unripe BEAN:ETH LP available to Pick - + Unripe BEAN:ETH LP available to Pick Circulating Beans diff --git a/projects/ui/src/components/Governance/Actions/Vote.tsx b/projects/ui/src/components/Governance/Actions/Vote.tsx index 971441dc47..3318a2e6b2 100644 --- a/projects/ui/src/components/Governance/Actions/Vote.tsx +++ b/projects/ui/src/components/Governance/Actions/Vote.tsx @@ -81,12 +81,15 @@ const VoteForm: FC< /// Derived const isNFT = proposal.space.id === GovSpace.BeanNFT; - const isViewOnly = proposal.space.id === GovSpace.BeanstalkBugBounty || proposal.space.id === GovSpace.BeanstalkFarmsBudget; + const isViewOnly = + proposal.space.id === GovSpace.BeanstalkBugBounty || + proposal.space.id === GovSpace.BeanstalkFarmsBudget; const canVote = farmerVP.votingPower.total.gt(0); const isClosed = differenceInTime <= 0; // Are we impersonating a different account while not in dev mode - const isImpersonating = !!useSetting('impersonatedAccount')[0] && !import.meta.env.DEV; + const isImpersonating = + !!useSetting('impersonatedAccount')[0] && !import.meta.env.DEV; /// Handlers const handleClick = useCallback( @@ -112,7 +115,7 @@ const VoteForm: FC< if (isViewOnly) return null; if (isImpersonating) { return ( - ); - }; + } switch (proposal.type) { case 'single-choice': { /// Option isn't selected or the voting period has ended diff --git a/projects/ui/src/components/NFT/NFTDialog.tsx b/projects/ui/src/components/NFT/NFTDialog.tsx index 07effb5366..2771a9abd5 100644 --- a/projects/ui/src/components/NFT/NFTDialog.tsx +++ b/projects/ui/src/components/NFT/NFTDialog.tsx @@ -26,7 +26,8 @@ const NFTDialog: FC = ({ const nftImage = ; // Are we impersonating a different account outside dev mode - const isImpersonating = !!useSetting('impersonatedAccount')[0] && !import.meta.env.DEV; + const isImpersonating = + !!useSetting('impersonatedAccount')[0] && !import.meta.env.DEV; return ( = ({ disabled={nft.claimed === ClaimStatus.CLAIMED || isImpersonating} sx={{ height: '45px', width: '100%' }} > - {nft.claimed === ClaimStatus.CLAIMED ? 'Minted' : isImpersonating ? 'Impersonating Account' : 'Mint'} + {nft.claimed === ClaimStatus.CLAIMED + ? 'Minted' + : isImpersonating + ? 'Impersonating Account' + : 'Mint'} diff --git a/projects/ui/src/components/Nav/SettingsDialog.tsx b/projects/ui/src/components/Nav/SettingsDialog.tsx index c01e4c52ea..dbc5420ea2 100644 --- a/projects/ui/src/components/Nav/SettingsDialog.tsx +++ b/projects/ui/src/components/Nav/SettingsDialog.tsx @@ -82,31 +82,38 @@ const SettingsDialog: FC<{ open: boolean; onClose?: () => void }> = ({ const [denomination, setDenomination] = useSetting('denomination'); const [subgraphEnv, setSubgraphEnv] = useSetting('subgraphEnv'); const [datasource, setDataSource] = useSetting('datasource'); - const [impersonatedAccount, setImpersonatedAccount] = useSetting('impersonatedAccount'); + const [impersonatedAccount, setImpersonatedAccount] = useSetting( + 'impersonatedAccount' + ); const [internalAccount, setInternalAccount] = useState(impersonatedAccount); - const [isAddressValid, setIsAddressValid] = useState(undefined); + const [isAddressValid, setIsAddressValid] = useState( + undefined + ); const dispatch = useDispatch(); const siloBalances = useFarmerSiloBalances(); const account = useAccount(); - const checkAddress = useCallback((address: string) => { - if (address) { - const isValid = ethers.utils.isAddress(address); - if (isValid) { - setInternalAccount(address); - }; - setIsAddressValid(isValid); - } else { - setIsAddressValid(undefined); - } - }, [setInternalAccount]); + const checkAddress = useCallback( + (address: string) => { + if (address) { + const isValid = ethers.utils.isAddress(address); + if (isValid) { + setInternalAccount(address); + } + setIsAddressValid(isValid); + } else { + setIsAddressValid(undefined); + } + }, + [setInternalAccount] + ); useMemo(() => { if (!account.address) { - setInternalAccount('') + setInternalAccount(''); setIsAddressValid(undefined); setImpersonatedAccount(''); - }; + } }, [account.address, setImpersonatedAccount]); /// Cache @@ -168,7 +175,7 @@ const SettingsDialog: FC<{ open: boolean; onClose?: () => void }> = ({ const closeDialog = () => { if (impersonatedAccount !== internalAccount) { setImpersonatedAccount(internalAccount); - }; + } onClose && onClose(); }; @@ -241,7 +248,9 @@ const SettingsDialog: FC<{ open: boolean; onClose?: () => void }> = ({ - Impersonate Account + + Impersonate Account + {internalAccount ? ( @@ -264,26 +273,33 @@ const SettingsDialog: FC<{ open: boolean; onClose?: () => void }> = ({ - {setInternalAccount('')}}> - + { + setInternalAccount(''); + }} + > + ) : ( - - - + startAdornment: isAddressValid === false && ( + + + ), }} - onChange={(e) => {checkAddress(e.target.value)}} + onChange={(e) => { + checkAddress(e.target.value); + }} /> )} diff --git a/projects/ui/src/components/Silo/Actions/Migrate.tsx b/projects/ui/src/components/Silo/Actions/Migrate.tsx index e6ecd3002b..913e208d2c 100644 --- a/projects/ui/src/components/Silo/Actions/Migrate.tsx +++ b/projects/ui/src/components/Silo/Actions/Migrate.tsx @@ -61,7 +61,8 @@ export const Migrate: FC<{}> = () => { const [migrating, setMigrating] = useState(false); // Are we impersonating a different account while not in dev mode - const isImpersonating = !!useSetting('impersonatedAccount')[0] && !import.meta.env.DEV; + const isImpersonating = + !!useSetting('impersonatedAccount')[0] && !import.meta.env.DEV; const migrate = useCallback(() => { (async () => { @@ -202,10 +203,10 @@ export const Migrate: FC<{}> = () => { What happens to my Grown Stalk?
- All of your Grown Stalk will be Mown and added to your - Stalk balance during the Migration. + All of your Grown Stalk will be Mown and added to your Stalk + balance during the Migration. - {farmerSilo.stalk.grown.gt(0) && + {farmerSilo.stalk.grown.gt(0) && ( = () => { > {`${displayFullBN(farmerSilo.stalk.grown)} Grown Stalk will be Mown.`} - } + )}
- I had Withdrawn a Deposit but didn't Claim it, will I lose it when Migrating? + I had Withdrawn a Deposit but didn't Claim it, will I lose it + when Migrating? - No. After Migrating, you can Claim your previously Withdrawn assets on the - Claim tab of each individual Deposit page. + No. After Migrating, you can Claim your previously Withdrawn + assets on the Claim tab of each individual Deposit page. diff --git a/projects/ui/src/components/Silo/RewardsDialog.tsx b/projects/ui/src/components/Silo/RewardsDialog.tsx index 7aae434c9a..a570936458 100644 --- a/projects/ui/src/components/Silo/RewardsDialog.tsx +++ b/projects/ui/src/components/Silo/RewardsDialog.tsx @@ -13,14 +13,14 @@ import { import { ClaimRewardsAction } from '~/util'; import { UNRIPE_BEAN, UNRIPE_BEAN_WETH } from '~/constants/tokens'; import DescriptionButton from '~/components/Common/DescriptionButton'; -import RewardsSummary, { RewardsBarProps } from './RewardsSummary'; import { hoverMap } from '~/constants/silo'; import { BeanstalkPalette } from '~/components/App/muiTheme'; import useFarmerSiloBalances from '~/hooks/farmer/useFarmerSiloBalances'; import useGetChainToken from '~/hooks/chain/useGetChainToken'; import { FC } from '~/types'; -import RewardsForm, { ClaimCalls, ClaimGasResults } from './RewardsForm'; import useSetting from '~/hooks/app/useSetting'; +import RewardsForm, { ClaimCalls, ClaimGasResults } from './RewardsForm'; +import RewardsSummary, { RewardsBarProps } from './RewardsSummary'; export type SendFormValues = { to?: string; @@ -73,7 +73,8 @@ const ClaimRewardsForm: FC< const getChainToken = useGetChainToken(); // Are we impersonating a different account while not in dev mode - const isImpersonating = !!useSetting('impersonatedAccount')[0] && !import.meta.env.DEV; + const isImpersonating = + !!useSetting('impersonatedAccount')[0] && !import.meta.env.DEV; /// State const balances = useFarmerSiloBalances(); @@ -108,8 +109,8 @@ const ClaimRewardsForm: FC< selectedAction !== undefined ? selectedAction : hoveredAction !== undefined - ? hoveredAction - : undefined; + ? hoveredAction + : undefined; // Checks if the current hoverState includes a given ClaimRewardsAction const isHovering = (c: ClaimRewardsAction) => { @@ -204,14 +205,16 @@ const ClaimRewardsForm: FC< fullWidth size="large" loading={isSubmitting} - disabled={isSubmitting || values.action === undefined || isImpersonating} + disabled={ + isSubmitting || values.action === undefined || isImpersonating + } onClick={submitForm} > - {isImpersonating + {isImpersonating ? 'Impersonating Account' - : selectedAction === undefined - ? 'Select Claim type' - : `${options[selectedAction].title}`} + : selectedAction === undefined + ? 'Select Claim type' + : `${options[selectedAction].title}`} diff --git a/projects/ui/src/components/Silo/RewardsForm.tsx b/projects/ui/src/components/Silo/RewardsForm.tsx index ef947dafe4..12953d7c85 100644 --- a/projects/ui/src/components/Silo/RewardsForm.tsx +++ b/projects/ui/src/components/Silo/RewardsForm.tsx @@ -52,7 +52,8 @@ const RewardsForm: React.FC = ({ open, children }) => { const { data: signer } = useSigner(); // Are we impersonating a different account while not in dev mode - const isImpersonating = !!useSetting('impersonatedAccount')[0] && !import.meta.env.DEV; + const isImpersonating = + !!useSetting('impersonatedAccount')[0] && !import.meta.env.DEV; /// Helpers const unripeTokens = useTokenMap(UNRIPE_TOKENS); @@ -208,7 +209,7 @@ const RewardsForm: React.FC = ({ open, children }) => { signer, siloBalances, unripeTokens, - isImpersonating + isImpersonating, ]); useTimedRefresh(estimateGas, 20 * 1000, open); diff --git a/projects/ui/src/components/Silo/SiloAssetApyChip.tsx b/projects/ui/src/components/Silo/SiloAssetApyChip.tsx index 032674e5b2..5152bfc659 100644 --- a/projects/ui/src/components/Silo/SiloAssetApyChip.tsx +++ b/projects/ui/src/components/Silo/SiloAssetApyChip.tsx @@ -42,7 +42,7 @@ const SiloAssetApyChip: FC = ({ ? Bean : ({ symbol: 'Stalk', logo: stalkIconBlue } as Token); - function getDisplayString(val: (BigNumber | null)) { + function getDisplayString(val: BigNumber | null) { return `${val ? (val.gt(0) && val.lt(0.1) ? '< 0.1' : val.toFixed(1)) : '0.0'}%`; } @@ -59,34 +59,44 @@ const SiloAssetApyChip: FC = ({ Total Beans per Season - - - - 24H - - - {latestYield ? displayFullBN(latestYield.beansPerSeasonEMA24h, Bean.displayDecimals) : '0'} + + + 24H + + {latestYield + ? displayFullBN( + latestYield.beansPerSeasonEMA24h, + Bean.displayDecimals + ) + : '0'} - - - 7D - - - {latestYield ? displayFullBN(latestYield.beansPerSeasonEMA7d, Bean.displayDecimals) : '0'} + + 7D + + {latestYield + ? displayFullBN( + latestYield.beansPerSeasonEMA7d, + Bean.displayDecimals + ) + : '0'} - - - 30D - - - {latestYield ? displayFullBN(latestYield.beansPerSeasonEMA30d, Bean.displayDecimals) : '0'} + + 30D + + {latestYield + ? displayFullBN( + latestYield.beansPerSeasonEMA30d, + Bean.displayDecimals + ) + : '0'} - 24-hour/7-day/30-day exponential moving average of Beans earned by all Stalkholders per Season. + 24-hour/7-day/30-day exponential moving average of Beans + earned by all Stalkholders per Season. @@ -129,21 +139,30 @@ const SiloAssetApyChip: FC = ({ variant="filled" color={metric === 'bean' ? 'primary' : 'secondary'} sx={{ - "& .MuiChip-label": { - overflow: "visible" - } + '& .MuiChip-label': { + overflow: 'visible', + }, }} label={ - + {variant === 'labeled' && ( <> vAPY:{' '} )} - {metric === 'bean' ? + {metric === 'bean' ? ( <> - + {isLoading ? ( = ({ /> ) : ( <> - {getDisplayString(apys ? apys['24h'][metric].times(100) : null)} + {getDisplayString( + apys ? apys['24h'][metric].times(100) : null + )} )} - | - + + | + + {isLoading ? ( = ({ /> ) : ( <> - {getDisplayString(apys ? apys['7d'][metric].times(100) : null)} + {getDisplayString( + apys ? apys['7d'][metric].times(100) : null + )} )} - | + + | + - : null } - + ) : null} + {isLoading ? ( - + ) : ( <> - {getDisplayString(apys ? apys['30d'][metric].times(100) : null)} + {getDisplayString( + apys ? apys['30d'][metric].times(100) : null + )} )} diff --git a/projects/ui/src/components/Silo/SiloAssetOverviewCard.tsx b/projects/ui/src/components/Silo/SiloAssetOverviewCard.tsx index e65a608a40..7a904325c4 100644 --- a/projects/ui/src/components/Silo/SiloAssetOverviewCard.tsx +++ b/projects/ui/src/components/Silo/SiloAssetOverviewCard.tsx @@ -27,7 +27,10 @@ const DepositRewards: FC<{ token: ERC20Token }> = ({ token }) => ( - + {token.rewards?.stalk} @@ -37,14 +40,17 @@ const DepositRewards: FC<{ token: ERC20Token }> = ({ token }) => ( {/* This vAPY chip is only shown on larger screens */} - + ); const SiloAssetOverviewCard: FC<{ token: ERC20Token }> = ({ token }) => { - const { total, tvdByToken } = useTVD(); const whitelist = useWhitelist(); @@ -108,8 +114,15 @@ const SiloAssetOverviewCard: FC<{ token: ERC20Token }> = ({ token }) => { /> {/* This vAPY chip is only shown on mobile screens */} - - + + {/* Card Carousel */} diff --git a/projects/ui/src/components/Silo/Whitelist.tsx b/projects/ui/src/components/Silo/Whitelist.tsx index e87c3cc0a6..83f1833d64 100644 --- a/projects/ui/src/components/Silo/Whitelist.tsx +++ b/projects/ui/src/components/Silo/Whitelist.tsx @@ -111,18 +111,28 @@ const Whitelist: FC<{ Rewards - + - - vAPY 24H - | - 7D - | + + vAPY 24H + + | + + 7D + + | + 30D } @@ -131,15 +141,19 @@ const Whitelist: FC<{ /> - + - {' '}vAPY + token={{ symbol: 'Stalk', logo: stalkIcon } as Token} + />{' '} + vAPY @@ -282,7 +296,7 @@ const Whitelist: FC<{ md={2} xs={0} display={{ xs: 'none', md: 'flex' }} - justifyContent='center' + justifyContent="center" > @@ -295,7 +309,7 @@ const Whitelist: FC<{ md={1.25} xs={0} display={{ xs: 'none', md: 'flex' }} - justifyContent='center' + justifyContent="center" > diff --git a/projects/ui/src/components/Sun/SunriseButton.tsx b/projects/ui/src/components/Sun/SunriseButton.tsx index 2344d4d958..27512e508e 100644 --- a/projects/ui/src/components/Sun/SunriseButton.tsx +++ b/projects/ui/src/components/Sun/SunriseButton.tsx @@ -47,7 +47,8 @@ const SunriseButton: FC<{}> = () => { >((state) => state._beanstalk.sun.sunrise.awaiting); // Are we impersonating a different account while not in dev mode - const isImpersonating = !!useSetting('impersonatedAccount')[0] && !import.meta.env.DEV; + const isImpersonating = + !!useSetting('impersonatedAccount')[0] && !import.meta.env.DEV; useEffect(() => { if (awaiting) { diff --git a/projects/ui/src/graph/endpoints.ts b/projects/ui/src/graph/endpoints.ts index d9bb529942..0dbbb7ff2d 100644 --- a/projects/ui/src/graph/endpoints.ts +++ b/projects/ui/src/graph/endpoints.ts @@ -35,8 +35,7 @@ export const SUBGRAPH_ENVIRONMENTS: Record = { [SGEnvironments.BF_TEST]: { name: 'Beanstalk Farms / Test', subgraphs: { - beanstalk: - 'https://graph.node.bean.money/subgraphs/name/beanstalk', // fixme + beanstalk: 'https://graph.node.bean.money/subgraphs/name/beanstalk', // fixme bean: 'https://graph.node.bean.money/subgraphs/name/bean-testing', beanft: 'https://graph.node.bean.money/subgraphs/name/beanft-dev', }, diff --git a/projects/ui/src/hooks/beanstalk/useAPY.ts b/projects/ui/src/hooks/beanstalk/useAPY.ts index 433ffc064e..8e33b43008 100644 --- a/projects/ui/src/hooks/beanstalk/useAPY.ts +++ b/projects/ui/src/hooks/beanstalk/useAPY.ts @@ -21,7 +21,6 @@ type APYs = { }; export default function useAPY() { - const apyQuery = useLatestApyQuery({ fetchPolicy: 'cache-and-network', nextFetchPolicy: 'cache-first', @@ -29,7 +28,6 @@ export default function useAPY() { return useMemo(() => { if (apyQuery.data?.day?.[0]) { - const siloYield24h = apyQuery.data.day[0]; const siloYield7d = apyQuery.data.week[0]; const siloYield30d = apyQuery.data.month[0]; diff --git a/projects/ui/src/hooks/ledger/useAccount.ts b/projects/ui/src/hooks/ledger/useAccount.ts index 503090556f..1b47072121 100644 --- a/projects/ui/src/hooks/ledger/useAccount.ts +++ b/projects/ui/src/hooks/ledger/useAccount.ts @@ -11,9 +11,9 @@ export default function useAccount() { if (account.address) { if (impersonatedAccount) { return getAccount(impersonatedAccount); - }; + } return getAccount(account?.address); - }; + } return undefined; }, [impersonatedAccount, account?.address]); } diff --git a/projects/ui/src/pages/silo/index.tsx b/projects/ui/src/pages/silo/index.tsx index 2979529597..70d2fab183 100644 --- a/projects/ui/src/pages/silo/index.tsx +++ b/projects/ui/src/pages/silo/index.tsx @@ -115,7 +115,8 @@ const RewardsBar: FC<{ const sdk = useSdk(); // Are we impersonating a different account while not in dev mode - const isImpersonating = !!useSetting('impersonatedAccount')[0] && !import.meta.env.DEV; + const isImpersonating = + !!useSetting('impersonatedAccount')[0] && !import.meta.env.DEV; /// Calculate Unripe Silo Balance const urBean = getChainToken(UNRIPE_BEAN); @@ -418,7 +419,13 @@ const RewardsBar: FC<{ size="medium" variant="contained" sx={{ width: '100%', whiteSpace: 'nowrap' }} - endIcon={} + endIcon={ + + } onClick={open ? hide : show} disabled={!canClaim} > @@ -619,7 +626,9 @@ const RewardsBar: FC<{ size="large" onClick={handleSubmit} > - {isImpersonating ? 'Impersonating Account' : 'Claim Rewards'} + {isImpersonating + ? 'Impersonating Account' + : 'Claim Rewards'} {isEstimatingGas ? ( diff --git a/projects/ui/src/util/Actions.ts b/projects/ui/src/util/Actions.ts index 34ab408e41..a72f164a79 100644 --- a/projects/ui/src/util/Actions.ts +++ b/projects/ui/src/util/Actions.ts @@ -290,13 +290,21 @@ export const parseActionMessage = (a: Action) => { case ActionType.END_TOKEN: return null; case ActionType.SWAP: - if (a.tokenOut.isLP && a.tokenOut.symbol !== CRV3[1].symbol && !a.tokenOut.isUnripe) { + if ( + a.tokenOut.isLP && + a.tokenOut.symbol !== CRV3[1].symbol && + !a.tokenOut.isUnripe + ) { return `Add ${displayTokenAmount( a.amountIn, a.tokenIn )} of liquidity for ${displayTokenAmount(a.amountOut, a.tokenOut)}.`; } - if (a.tokenIn.isLP && a.tokenIn.symbol !== CRV3[1].symbol && !a.tokenIn.isUnripe) { + if ( + a.tokenIn.isLP && + a.tokenIn.symbol !== CRV3[1].symbol && + !a.tokenIn.isUnripe + ) { return `Burn ${displayTokenAmount( a.amountIn, a.tokenIn