diff --git a/src/app/api/common/metrics/getMetrics.ts b/src/app/api/common/metrics/getMetrics.ts index cb5d1984f..da8606dce 100644 --- a/src/app/api/common/metrics/getMetrics.ts +++ b/src/app/api/common/metrics/getMetrics.ts @@ -4,9 +4,9 @@ import { cache } from "react"; async function getMetrics() { const { namespace, contracts } = Tenant.current(); - const totalSupply = await contracts.token.contract.totalSupply(); try { + const totalSupply = await contracts.token.contract.totalSupply(); const votableSupply = await prisma[`${namespace}VotableSupply`].findFirst( {} ); @@ -18,7 +18,7 @@ async function getMetrics() { // Handle prisma errors for new tenants return { votableSupply: "0", - totalSupply: totalSupply.toString(), + totalSupply: "0", }; } } diff --git a/src/app/info/components/InfoHero.tsx b/src/app/info/components/InfoHero.tsx index 00421778d..b47c1cc79 100644 --- a/src/app/info/components/InfoHero.tsx +++ b/src/app/info/components/InfoHero.tsx @@ -3,9 +3,10 @@ import Image, { StaticImageData } from "next/image"; import Link from "next/link"; import Tenant from "@/lib/tenant/tenant"; import { icons } from "@/assets/icons/icons"; +import { TENANT_NAMESPACES } from "@/lib/constants"; export const InfoHero = () => { - const { ui } = Tenant.current(); + const { ui, namespace } = Tenant.current(); const page = ui!.page("info"); const rotationClasses = ["-rotate-2", "rotate-4", "-rotate-5", "rotate-1"]; @@ -20,17 +21,20 @@ export const InfoHero = () => { {page!.description}

-
- {page!.links!.map((link, idx) => ( - - ))} -
+ + {namespace !== TENANT_NAMESPACES.SCROLL && ( +
+ {page!.links!.map((link, idx) => ( + + ))} +
+ )} ); }; diff --git a/src/components/Dialogs/DelegateDialog/DelegateDialog.tsx b/src/components/Dialogs/DelegateDialog/DelegateDialog.tsx index 8db569390..f57436285 100644 --- a/src/components/Dialogs/DelegateDialog/DelegateDialog.tsx +++ b/src/components/Dialogs/DelegateDialog/DelegateDialog.tsx @@ -32,7 +32,7 @@ export function DelegateDialog({ addressOrENSName: string ) => Promise; }) { - const { contracts, slug } = Tenant.current(); + const { ui, contracts, slug, token } = Tenant.current(); const { address: accountAddress } = useAccount(); @@ -42,6 +42,8 @@ export function DelegateDialog({ const { setRefetchDelegate } = useConnectButtonContext(); const sameDelegatee = delegate.address === delegatee?.delegatee; + const isDisabledInTenant = ui.toggle("delegates/delegate")?.enabled === false; + const { data: delegateEnsName } = useEnsName({ chainId: 1, address: delegate.address as `0x${string}`, @@ -71,16 +73,26 @@ export function DelegateDialog({ setIsReady(false); if (!accountAddress) return; - const vp = await fetchBalanceForDirectDelegation(accountAddress); - setVotingPower(vp.toString()); - - const direct = await fetchDirectDelegatee(accountAddress); - setDelegatee(direct); + try { + const vp = await fetchBalanceForDirectDelegation(accountAddress); + setVotingPower(vp.toString()); - setIsReady(true); + const direct = await fetchDirectDelegatee(accountAddress); + setDelegatee(direct); + } finally { + setIsReady(true); + } }, [fetchBalanceForDirectDelegation, accountAddress, fetchDirectDelegatee]); const renderActionButtons = () => { + if (isDisabledInTenant) { + return ( + + ); + } + if (sameDelegatee) { return ( diff --git a/src/hooks/useConnectedDelegate.ts b/src/hooks/useConnectedDelegate.ts index 068a6c494..fe6643d49 100644 --- a/src/hooks/useConnectedDelegate.ts +++ b/src/hooks/useConnectedDelegate.ts @@ -8,6 +8,8 @@ import { useConnectButtonContext } from "@/contexts/ConnectButtonContext"; import { useQuery } from "@tanstack/react-query"; import { timeout } from "@/lib/utils"; import { fetchDelegate } from "@/app/delegates/actions"; +import Tenant from "@/lib/tenant/tenant"; +import { ZERO_ADDRESS } from "@/lib/constants"; /** * Define maximum number of retries, max retries 10 means 180 seconds waiting in total (advanced delegation voting power @@ -18,13 +20,16 @@ const MAX_RETRIES = 10; // TODO: think about strategy to fetch, since balance and voting power can change on every block, // also to prevent additional unnecessary fetches being done right now const useConnectedDelegate = () => { + const { contracts } = Tenant.current(); + const isTestToken = contracts.token.address === ZERO_ADDRESS; + const { refetchDelegate, setRefetchDelegate } = useConnectButtonContext(); const { address } = useAccount(); const [retries, setRetries] = useState(0); const [lastVotingPower, setLastVotingPower] = useState(null); const data = useQuery({ - enabled: !!address, + enabled: !(!address || isTestToken), queryKey: ["useConnectedDelegate", address, refetchDelegate, retries], queryFn: async () => { const [delegate, advancedDelegators, balance] = diff --git a/src/icons/beaker.svg b/src/icons/beaker.svg new file mode 100644 index 000000000..9f3416dc2 --- /dev/null +++ b/src/icons/beaker.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/codeBracketSquare.svg b/src/icons/codeBracketSquare.svg new file mode 100644 index 000000000..266cd5823 --- /dev/null +++ b/src/icons/codeBracketSquare.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/icons/globeAlt.svg b/src/icons/globeAlt.svg new file mode 100644 index 000000000..8addc1d16 --- /dev/null +++ b/src/icons/globeAlt.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/icons.ts b/src/icons/icons.ts index 2cd224822..e2c4f711e 100644 --- a/src/icons/icons.ts +++ b/src/icons/icons.ts @@ -39,10 +39,23 @@ import vote from "./vote.svg"; import wallet from "./wallet.svg"; import walletConnected from "./walletConnected.svg"; import world from "./world.svg"; +import wrenchScrewdriverIcon from "./wrenchScredriver.svg"; +import globeAlt from "./globeAlt.svg"; +import presentationChartLine from "./presentationChartLine.svg"; +import scale from "./scale.svg"; +import codeBracketSquare from "./codeBracketSquare.svg"; +import beaker from "./beaker.svg"; +import shieldCheck from "./shieldCheck.svg"; export const icons = { anonNoun, badge, + scale, + codeBracketSquare, + beaker, + shieldCheck, + wrenchScrewdriverIcon, + presentationChartLine, ballot, banknotes, cardView, @@ -58,6 +71,7 @@ export const icons = { expand, github, globe, + globeAlt, info, link, liquid, diff --git a/src/icons/presentationChartLine.svg b/src/icons/presentationChartLine.svg new file mode 100644 index 000000000..cf00829c5 --- /dev/null +++ b/src/icons/presentationChartLine.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/scale.svg b/src/icons/scale.svg new file mode 100644 index 000000000..cbdc189dc --- /dev/null +++ b/src/icons/scale.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/shieldCheck.svg b/src/icons/shieldCheck.svg new file mode 100644 index 000000000..bce2f0894 --- /dev/null +++ b/src/icons/shieldCheck.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/wrenchScredriver.svg b/src/icons/wrenchScredriver.svg new file mode 100644 index 000000000..36dac7b49 --- /dev/null +++ b/src/icons/wrenchScredriver.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 1e0b8f22c..5de438f92 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -2,6 +2,8 @@ export const INDEXER_DELAY = 3000; export const SECONDS_IN_HOUR = 3600; +export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; + export enum FREQUENCY_FILTERS { DAY = "24h", WEEK = "7d", diff --git a/src/lib/tenant/configs/contracts/scroll.ts b/src/lib/tenant/configs/contracts/scroll.ts index 5c08992f8..5f4ca1f92 100644 --- a/src/lib/tenant/configs/contracts/scroll.ts +++ b/src/lib/tenant/configs/contracts/scroll.ts @@ -9,6 +9,7 @@ import { scroll } from "viem/chains"; import { IGovernorContract } from "@/lib/contracts/common/interfaces/IGovernorContract"; import { JsonRpcProvider } from "ethers"; +import { ZERO_ADDRESS } from "@/lib/constants"; interface Props { isProd: boolean; @@ -19,9 +20,9 @@ export const scrollTenantContractConfig = ({ isProd, alchemyId, }: Props): TenantContracts => { - const TOKEN = "0x5300000000000000000000000000000000000004"; - const GOVERNOR = "0x0000000000000000000000000000000000000000"; - const TREASURY = "0x0000000000000000000000000000000000000000"; + const TOKEN = ZERO_ADDRESS; + const GOVERNOR = ZERO_ADDRESS; + const TREASURY = ZERO_ADDRESS; const provider = new JsonRpcProvider( `https://scroll-mainnet.g.alchemy.com/v2/${alchemyId}` ); diff --git a/src/lib/tenant/configs/ui/scroll.ts b/src/lib/tenant/configs/ui/scroll.ts index 8bd8dd75e..763431c66 100644 --- a/src/lib/tenant/configs/ui/scroll.ts +++ b/src/lib/tenant/configs/ui/scroll.ts @@ -47,6 +47,49 @@ export const scrollTenantUIConfig = new TenantUI({ brandSecondary: "#F2F2F2", }, + governanceIssues: [ + { + icon: "wrenchScrewdriverIcon", + title: "Builders", + key: "builders", + }, + { + icon: "community", + title: "Community", + key: "community", + }, + { + icon: "globeAlt", + title: "Decentralization", + key: "decentralization", + }, + { + icon: "presentationChartLine", + title: "Ecosystem Growth", + key: "ecosystemGrowth", + }, + { + icon: "scale", + title: "Governance", + key: "governance", + }, + { + icon: "codeBracketSquare", + title: "Protocol", + key: "protocol", + }, + { + icon: "beaker", + title: "Research & Development", + key: "researchDevelopment", + }, + { + icon: "shieldCheck", + title: "Security", + key: "security", + }, + ], + pages: [ { route: "/", @@ -148,12 +191,16 @@ export const scrollTenantUIConfig = new TenantUI({ }, { name: "delegates/endorsed-filter", - enabled: true, + enabled: false, }, { name: "delegates/edit", enabled: true, }, + { + name: "delegates/delegate", + enabled: false, + }, { name: "delegates/code-of-conduct", enabled: true, diff --git a/src/lib/tenant/tenantTokenFactory.ts b/src/lib/tenant/tenantTokenFactory.ts index a566e95c0..ba44135ae 100644 --- a/src/lib/tenant/tenantTokenFactory.ts +++ b/src/lib/tenant/tenantTokenFactory.ts @@ -40,7 +40,7 @@ export default class TenantTokenFactory { case TENANT_NAMESPACES.SCROLL: return { name: "Scroll", - symbol: "SCROLL", + symbol: "SCR", decimals: 18, }; default: