diff --git a/apps/admin/src/components/DaoCard.tsx b/apps/admin/src/components/DaoCard.tsx index 6f93edeb..bc4b6616 100644 --- a/apps/admin/src/components/DaoCard.tsx +++ b/apps/admin/src/components/DaoCard.tsx @@ -56,7 +56,6 @@ export const DaoCard = ({ dao, daoAvatarImg, activeMemberCount, - fiatTotal, activeProposalCount, totalProposalCount, votingPower, diff --git a/apps/admin/src/components/DaoTable.tsx b/apps/admin/src/components/DaoTable.tsx index 4d65c42d..84f577b4 100644 --- a/apps/admin/src/components/DaoTable.tsx +++ b/apps/admin/src/components/DaoTable.tsx @@ -76,7 +76,6 @@ export const DaoTable = ({ daoData }: IDaoTableData) => { networkId: dao.networkId, }, activeProposalCount: dao.activeProposalCount, - fiatTotal: dao.fiatTotal, activeMemberCount: dao.activeMemberCount, votingPower: dao.votingPower, networkId: dao.networkId, @@ -139,19 +138,6 @@ export const DaoTable = ({ daoData }: IDaoTableData) => { ); }, }, - { - Header: 'Vaults', - accessor: 'fiatTotal', - Cell: ({ value }: { value?: number }) => { - return ( - - {value != null - ? readableNumbers.toDollars({ value, separator: ' ' }) - : '--'} - - ); - }, - }, { Header: 'Members', accessor: 'activeMemberCount', diff --git a/libs/moloch-v3-data/src/daos.ts b/libs/moloch-v3-data/src/daos.ts index 60c90f5f..65fa0326 100644 --- a/libs/moloch-v3-data/src/daos.ts +++ b/libs/moloch-v3-data/src/daos.ts @@ -88,7 +88,6 @@ export const findDao = async ({ return { ...vault, - fiatTotal: vaultResMatch?.data?.fiatTotal, tokenBalances: vaultResMatch?.data?.tokenBalances, }; }); @@ -99,10 +98,6 @@ export const findDao = async ({ ...daoRes.data.dao, ...addDaoProfileFields(daoRes.data.dao), vaults: hydratedVaults, - fiatTotal: tokenData.reduce((sum, vault) => { - sum += Number(vault.data?.fiatTotal); - return sum; - }, 0), }, }, }; diff --git a/libs/moloch-v3-data/src/types/dao.types.ts b/libs/moloch-v3-data/src/types/dao.types.ts index 5323c244..bcc645fb 100644 --- a/libs/moloch-v3-data/src/types/dao.types.ts +++ b/libs/moloch-v3-data/src/types/dao.types.ts @@ -19,7 +19,6 @@ type DaoWithProfileQuery = { dao: DaoWithProfile | undefined; }; export type DaoSafe = DaoWithProfile['vaults'][number] & { - fiatTotal: number; tokenBalances: TokenBalance[]; }; type MolochV3DaoQuery = { @@ -27,7 +26,6 @@ type MolochV3DaoQuery = { }; export type MolochV3Dao = Omit & { vaults: DaoSafe[]; - fiatTotal: number; }; export type FindDaoQueryRes = | DaoWithProfileQuery diff --git a/libs/moloch-v3-data/src/utils/transformers.ts b/libs/moloch-v3-data/src/utils/transformers.ts index 00170e27..53aa4cf2 100644 --- a/libs/moloch-v3-data/src/utils/transformers.ts +++ b/libs/moloch-v3-data/src/utils/transformers.ts @@ -29,15 +29,7 @@ export const transformTokenBalances = ( tokenBalanceRes: TokenBalance[], safeAddress: string ): DaoTokenBalances => { - const fiatTotal = tokenBalanceRes.reduce( - (sum: number, balance: TokenBalance): number => { - sum += Number(balance.fiatBalance); - return sum; - }, - 0 - ); - - return { safeAddress, tokenBalances: tokenBalanceRes, fiatTotal }; + return { safeAddress, tokenBalances: tokenBalanceRes }; }; export const transformMembershipList = ( diff --git a/libs/moloch-v3-data/src/vaults.ts b/libs/moloch-v3-data/src/vaults.ts index 2f81b726..bcbb6cb6 100644 --- a/libs/moloch-v3-data/src/vaults.ts +++ b/libs/moloch-v3-data/src/vaults.ts @@ -16,6 +16,7 @@ export const listTokenBalances = async ({ safeAddress: string; }): Promise> => { const url = ENDPOINTS['GNOSIS_API'][networkId]; + if (!url) { return { error: formatFetchError({ type: 'INVALID_NETWORK_ERROR' }), @@ -24,7 +25,7 @@ export const listTokenBalances = async ({ try { const res = await fetch.get( - `${url}/safes/${getAddress(safeAddress)}/balances/usd/` + `${url}/safes/${getAddress(safeAddress)}/balances/` ); return { data: transformTokenBalances(res, safeAddress) }; diff --git a/libs/moloch-v3-fields/src/fields/RagequitTokenList.tsx b/libs/moloch-v3-fields/src/fields/RagequitTokenList.tsx index 07685bc0..b4f4d341 100644 --- a/libs/moloch-v3-fields/src/fields/RagequitTokenList.tsx +++ b/libs/moloch-v3-fields/src/fields/RagequitTokenList.tsx @@ -3,7 +3,6 @@ import { useFormContext } from 'react-hook-form'; import { formatValueTo, memberTokenBalanceShare, - memberUsdValueShare, NETWORK_TOKEN_ETH_ADDRESS, } from '@daohaus/utils'; import { getNetwork } from '@daohaus/keychain-utils'; @@ -48,7 +47,6 @@ const DataColumn = styled(Column)` type TokenTable = { tokenCheckboxes: CheckboxProps[]; amounts: React.ReactNode[]; - usdValue: React.ReactNode[]; }; export const RagequitTokenList = (props: Buildable) => { @@ -139,26 +137,12 @@ export const RagequitTokenList = (props: Buildable) => { , ]; - acc.usdValue = [ - ...acc.usdValue, - - {formatValueTo({ - value: memberUsdValueShare( - token.fiatBalance, - dao.totalShares || 0, - dao.totalLoot || 0, - sharesToBurn || 0, - lootToBurn || 0 - ), - decimals: 2, - format: 'currency', - })} - , - ]; - return acc; }, - { tokenCheckboxes: [], amounts: [], usdValue: [] } + { + tokenCheckboxes: [], + amounts: [], + } ); }, [ dao, @@ -210,9 +194,6 @@ export const RagequitTokenList = (props: Buildable) => { Amount - - USD Value - @@ -223,7 +204,6 @@ export const RagequitTokenList = (props: Buildable) => { /> {tokenTable.amounts} - {tokenTable.usdValue} ); diff --git a/libs/moloch-v3-macro-ui/src/components/DaoOverview/DaoOverview.tsx b/libs/moloch-v3-macro-ui/src/components/DaoOverview/DaoOverview.tsx index 0c241511..e21b79d2 100644 --- a/libs/moloch-v3-macro-ui/src/components/DaoOverview/DaoOverview.tsx +++ b/libs/moloch-v3-macro-ui/src/components/DaoOverview/DaoOverview.tsx @@ -36,14 +36,6 @@ export const DaoOverview = ({ - - - - )} diff --git a/libs/moloch-v3-macro-ui/src/components/MemberProfileCard/MemberTokens.tsx b/libs/moloch-v3-macro-ui/src/components/MemberProfileCard/MemberTokens.tsx index 2abac896..b4188419 100644 --- a/libs/moloch-v3-macro-ui/src/components/MemberProfileCard/MemberTokens.tsx +++ b/libs/moloch-v3-macro-ui/src/components/MemberProfileCard/MemberTokens.tsx @@ -9,7 +9,6 @@ import { charLimit, formatValueTo, memberTokenBalanceShare, - memberUsdValueShare, NETWORK_TOKEN_ETH_ADDRESS, } from '@daohaus/utils'; @@ -21,7 +20,6 @@ type TokenTableType = { name: string | undefined; }; balance: string; - fiatBalance: string; }; type MemberTokensProps = { @@ -53,17 +51,6 @@ export const MemberTokens = ({ daoChain, dao, member }: MemberTokensProps) => { address: bal.tokenAddress || NETWORK_TOKEN_ETH_ADDRESS, name: charLimit(bal.token?.name, 21), }, - fiatBalance: formatValueTo({ - value: memberUsdValueShare( - bal.fiatBalance, - dao.totalShares || 0, - dao.totalLoot || 0, - member.shares || 0, - member.loot || 0 - ), - decimals: 2, - format: 'currency', - }), balance: formatValueTo({ value: memberTokenBalanceShare( bal.balance, @@ -108,15 +95,6 @@ export const MemberTokens = ({ daoChain, dao, member }: MemberTokensProps) => { return
{value}
; }, }, - { - Header: () => { - return
USD Value
; - }, - accessor: 'fiatBalance', - Cell: ({ value }: { value: string }) => { - return
{value}
; - }, - }, ], [daoChain, networks] ); diff --git a/libs/moloch-v3-macro-ui/src/components/SafeCard/SafeCard.tsx b/libs/moloch-v3-macro-ui/src/components/SafeCard/SafeCard.tsx index f856f796..97d1b964 100644 --- a/libs/moloch-v3-macro-ui/src/components/SafeCard/SafeCard.tsx +++ b/libs/moloch-v3-macro-ui/src/components/SafeCard/SafeCard.tsx @@ -10,7 +10,7 @@ import { ParXs, Tag, } from '@daohaus/ui'; -import { formatValueTo, generateGnosisUiLink } from '@daohaus/utils'; +import { generateGnosisUiLink } from '@daohaus/utils'; import { Keychain } from '@daohaus/keychain-utils'; import { DataGrid } from '../Layout'; import { @@ -78,14 +78,6 @@ export const SafeCard = ({ - diff --git a/libs/utils/src/types/query.ts b/libs/utils/src/types/query.ts index 41c30846..dd5249fa 100644 --- a/libs/utils/src/types/query.ts +++ b/libs/utils/src/types/query.ts @@ -12,7 +12,6 @@ export interface MolochV3Membership { delegatingTo?: string; isDelegate: boolean; memberAddress: string; - fiatTotal?: number; totalProposalCount: string; contractType: string; tokenBalances?: TokenBalance[]; @@ -32,13 +31,9 @@ export type TokenBalance = { balance: string; ethValue: string; timestamp: string; - fiatBalance: string; - fiatConversion: string; - fiatCode: string; }; export type DaoTokenBalances = { safeAddress: string; - fiatTotal: number; tokenBalances: TokenBalance[]; }; export type AccountProfile = { diff --git a/libs/utils/src/utils/general.ts b/libs/utils/src/utils/general.ts index 9f692710..09423aa7 100644 --- a/libs/utils/src/utils/general.ts +++ b/libs/utils/src/utils/general.ts @@ -37,6 +37,7 @@ export const memberTokenBalanceShare = ( return memberSharesWei / 10 ** Number(decimals); }; +// if we have a usd value of the Safe, we can calculate the usd value of the member's shares export const memberUsdValueShare = ( usdValue: string | number, daoTotalShares: string | number,