diff --git a/.github/workflows/release-governance.yml b/.github/workflows/release-governance.yml
index da93308b5..492ce9865 100644
--- a/.github/workflows/release-governance.yml
+++ b/.github/workflows/release-governance.yml
@@ -31,7 +31,7 @@ jobs:
- run: yarn workspaces focus @snx-v3/governance
working-directory: v3ui
- - run: yarn workspace @snx-v3/governance build TESTNET=true
+ - run: yarn workspace @snx-v3/governance build
working-directory: v3ui
- run: rm -rf ./governance/*
diff --git a/governance/cypress/package.json b/governance/cypress/package.json
index b29bec31b..f7a73d5c2 100644
--- a/governance/cypress/package.json
+++ b/governance/cypress/package.json
@@ -5,7 +5,7 @@
"version": "0.0.1",
"scripts": {
"anvil:snax": "anvil --fork-url https://testnet.snaxchain.io --fork-block-number 296528",
- "e2e": "cypress open --e2e --browser chrome"
+ "e2e": "cypress open --e2e --browser firefox"
},
"devDependencies": {
"@chakra-ui/react": "^2.8.2",
diff --git a/governance/ui/src/components/CouncilCard/CouncilCard.tsx b/governance/ui/src/components/CouncilCard/CouncilCard.tsx
index bcbe9573e..ad93ae65a 100644
--- a/governance/ui/src/components/CouncilCard/CouncilCard.tsx
+++ b/governance/ui/src/components/CouncilCard/CouncilCard.tsx
@@ -137,13 +137,10 @@ export function CouncilCard({ council }: CouncilCardProps) {
mb="1"
onClick={(e) => {
e.stopPropagation();
- if (
- nominationInformation?.isNominated &&
- nominationInformation.council.slug === council.slug
- ) {
- navigate(`/councils/${council.slug}?editNomination=true`);
+ if (!activeWallet?.address) {
+ navigate(`/councils/${council.slug}`);
} else {
- navigate(`/councils/${council.slug}?nominate=true`);
+ navigate(`/councils/${council.slug}?view=${activeWallet?.address}`);
}
}}
>
diff --git a/governance/ui/src/components/CouncilNominees/CouncilNominees.tsx b/governance/ui/src/components/CouncilNominees/CouncilNominees.tsx
index 05601cc10..15275cfa5 100644
--- a/governance/ui/src/components/CouncilNominees/CouncilNominees.tsx
+++ b/governance/ui/src/components/CouncilNominees/CouncilNominees.tsx
@@ -203,16 +203,13 @@ export default function CouncilNominees({ activeCouncil }: { activeCouncil: Coun
: a.username.localeCompare(b.username) * -1;
}
return sortConfig[0]
- ? a?.address.localeCompare(b.address)
- : a?.address.localeCompare(b.address) * -1;
+ ? a?.address.localeCompare(b.address) * -1
+ : a?.address.localeCompare(b.address);
});
}}
>
Name {sortConfig[1] === 'name' && }
- {/* @ts-ignore */}
- {sortConfig[1] === 'start' && sortConfig[1] !== 'name' && (
-
- )}
+ {sortConfig[1] === 'start' && }
{councilPeriod === '2' && (
|
diff --git a/governance/ui/src/components/EditNomination/EditNomination.tsx b/governance/ui/src/components/EditNomination/EditNomination.tsx
index 7faa3c3f7..884e2f4f4 100644
--- a/governance/ui/src/components/EditNomination/EditNomination.tsx
+++ b/governance/ui/src/components/EditNomination/EditNomination.tsx
@@ -44,7 +44,13 @@ export default function EditNomination({ activeCouncil, ...props }: EditNominati
{...props}
>
navigate(`/councils/${activeCouncil}`)}
+ onClick={() => {
+ if (showConfirm) {
+ setShowConfirm(false);
+ } else {
+ navigate(`/councils/${activeCouncil}`);
+ }
+ }}
size="xs"
aria-label="close button"
icon={}
diff --git a/governance/ui/src/components/EditNomination/EditNominationConfirmation.tsx b/governance/ui/src/components/EditNomination/EditNominationConfirmation.tsx
index ada18f43b..70b0d6ad7 100644
--- a/governance/ui/src/components/EditNomination/EditNominationConfirmation.tsx
+++ b/governance/ui/src/components/EditNomination/EditNominationConfirmation.tsx
@@ -32,7 +32,7 @@ export default function EditNominationConfirmation({
useEffect(() => {
if (isSuccess) {
setShowConfirm(false);
- navigate(`/councils/${selectedCouncil}?nominate=false`);
+ navigate(`/councils/${selectedCouncil ? selectedCouncil : 'spartan'}?nominate=false`);
}
}, [isSuccess, setShowConfirm, navigate, selectedCouncil]);
diff --git a/governance/ui/src/components/EditNomination/EditNominationSelect.tsx b/governance/ui/src/components/EditNomination/EditNominationSelect.tsx
index feacaf34e..1d5bb4f4b 100644
--- a/governance/ui/src/components/EditNomination/EditNominationSelect.tsx
+++ b/governance/ui/src/components/EditNomination/EditNominationSelect.tsx
@@ -106,6 +106,9 @@ export default function EditNominationSelect({
padding="2"
alignItems="center"
mb="2"
+ _hover={{
+ bg: 'linear-gradient(0deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.06) 100%), #0B0B22;',
+ }}
>
{user?.username ? user.username : prettyString(user?.address || '')}
@@ -70,7 +70,7 @@ export default function UserListItem({
Nominee
)}
- {councilPeriod === '1' ? (
+ {councilPeriod === '1' && isNominatedFetched && !!nominationInformation ? (
);
diff --git a/governance/ui/src/components/UserProfileCard/UserProfileDetails.tsx b/governance/ui/src/components/UserProfileCard/UserProfileDetails.tsx
index ee68f6d6f..ba4f68677 100644
--- a/governance/ui/src/components/UserProfileCard/UserProfileDetails.tsx
+++ b/governance/ui/src/components/UserProfileCard/UserProfileDetails.tsx
@@ -1,5 +1,5 @@
import { CloseIcon, CopyIcon } from '@chakra-ui/icons';
-import { Flex, IconButton, Button, Text, Tooltip } from '@chakra-ui/react';
+import { Flex, IconButton, Button, Text, Tooltip, Box } from '@chakra-ui/react';
import { prettyString } from '@snx-v3/format';
import { Socials } from '../Socials';
import { GetUserDetails } from '../../queries/useGetUserDetailsQuery';
@@ -9,7 +9,7 @@ import { useVoteContext } from '../../context/VoteContext';
import { ProfilePicture } from './ProfilePicture';
import { EditIcon, ShareIcon } from '../Icons';
import { useGetUserBallot, useNetwork } from '../../queries';
-import { useState } from 'react';
+import { useEffect, useRef, useState } from 'react';
import { useRecoilState } from 'recoil';
import { voteCardState } from '../../state/vote-card';
@@ -38,6 +38,8 @@ export const UserProfileDetails = ({
const { dispatch, state } = useVoteContext();
const navigate = useNavigate();
const { data: ballot } = useGetUserBallot(activeCouncil);
+ const elementRef = useRef(null);
+ const [isOverflowing, setIsOverflowing] = useState(false);
const isSelected = state[networkForState]
? state[networkForState][activeCouncil]?.toLowerCase() === userData?.address?.toLowerCase()
@@ -47,6 +49,45 @@ export const UserProfileDetails = ({
!!ballot?.votedCandidates &&
ballot?.votedCandidates[0]?.toLowerCase() === userData?.address?.toLowerCase();
+ useEffect(() => {
+ const checkOverflow = () => {
+ const el = elementRef.current;
+ if (el) {
+ const isOverflowing = el.scrollHeight > el.clientHeight || el.scrollWidth > el.clientWidth;
+ setIsOverflowing(isOverflowing);
+ }
+ };
+ checkOverflow();
+ window.addEventListener('resize', checkOverflow);
+ return () => {
+ window.removeEventListener('resize', checkOverflow);
+ };
+ }, []);
+
+ useEffect(() => {
+ const handleScroll = () => {
+ if (elementRef.current) {
+ const { scrollTop, scrollHeight, clientHeight } = elementRef.current;
+ if (scrollTop + clientHeight >= scrollHeight - 10) {
+ setIsOverflowing(false);
+ } else {
+ setIsOverflowing(true);
+ }
+ }
+ };
+
+ const refCurrent = elementRef.current;
+ if (refCurrent) {
+ refCurrent.addEventListener('scroll', handleScroll);
+ }
+
+ return () => {
+ if (refCurrent) {
+ refCurrent.removeEventListener('scroll', handleScroll);
+ }
+ };
+ }, []);
+
return (
<>
@@ -90,7 +131,7 @@ export const UserProfileDetails = ({
whiteSpace="nowrap"
overflow="hidden"
>
- {userData?.username ? userData.username : prettyString(userData!.address)}
+ {userData?.username ? userData.username : prettyString(userData?.address || '')}
{
navigator.clipboard.writeText(window.location.href);
setTooltipLabel('Profile Link Copied');
- setTimeout(() => setTooltipLabel('Copy Profile Link'), 5000);
+ setTimeout(() => setTooltipLabel('Copy Profile Link'), 3000);
}}
/>
@@ -155,8 +196,24 @@ export const UserProfileDetails = ({
Governance Pitch
-
+
{userData?.delegationPitch}
+ {isOverflowing && (
+
+ )}
>
)}
@@ -226,10 +283,12 @@ export const UserProfileDetails = ({
setVoteCard(true);
}}
>
- {isAlreadyVoted ? 'Withdraw Vote ' : isSelected ? 'Remove ' : 'Select '}
- {userData?.ens || userData?.username
- ? userData.username.slice(0, 20).concat('...')
- : prettyString(userData!.address)}
+
+ {isAlreadyVoted ? 'Withdraw Vote ' : isSelected ? 'Remove ' : 'Select '}
+ {userData?.ens || userData?.username
+ ? userData.username
+ : prettyString(userData!.address)}
+
)}
diff --git a/governance/ui/src/components/UserProfileForm/UserProfileEditPreview.tsx b/governance/ui/src/components/UserProfileForm/UserProfileEditPreview.tsx
index f1fb40b2e..e7e6cfed2 100644
--- a/governance/ui/src/components/UserProfileForm/UserProfileEditPreview.tsx
+++ b/governance/ui/src/components/UserProfileForm/UserProfileEditPreview.tsx
@@ -9,10 +9,8 @@ export default function UserProfileEditPreview({
userData,
activeWallet,
isPending,
- onSave,
isDirty,
}: {
- onSave: () => void;
isPending: boolean;
activeWallet?: string;
isDirty: boolean;
@@ -26,6 +24,10 @@ export default function UserProfileEditPreview({
p={{ base: 0, xl: '4' }}
bg="navy.700"
flexDir="column"
+ w="451px"
+ h="612px"
+ position={{ base: 'unset', xl: 'sticky' }}
+ top="105px"
>
@@ -95,6 +97,8 @@ export default function UserProfileEditPreview({
overflow="scroll"
maxH="50vh"
mb="4"
+ h="350px"
+ whiteSpace="pre-wrap"
data-cy="governance-pitch-preview"
>
{userData.delegationPitch}
@@ -104,7 +108,7 @@ export default function UserProfileEditPreview({
diff --git a/governance/ui/src/components/UserProfileForm/UserProfileForm.tsx b/governance/ui/src/components/UserProfileForm/UserProfileForm.tsx
index 20c77df40..3f0aefc0f 100644
--- a/governance/ui/src/components/UserProfileForm/UserProfileForm.tsx
+++ b/governance/ui/src/components/UserProfileForm/UserProfileForm.tsx
@@ -33,17 +33,7 @@ export function UserProfileForm() {
onClose: onBlockerClose,
onOpen: onBlockerOpen,
} = useDisclosure({ id: 'blocker' });
-
- const blocker = useBlocker(() => {
- if (formState.isDirty) {
- onBlockerOpen();
- return true;
- }
- onBlockerClose();
- return false;
- });
-
- const { register, getValues, setValue, watch, formState } = useForm({
+ const { register, getValues, setValue, watch, formState, reset, handleSubmit } = useForm({
defaultValues: {
address: user?.about,
username: user?.username,
@@ -70,8 +60,18 @@ export function UserProfileForm() {
}
}, [user, setValue]);
- const handleOnFormSave = () => {
- mutation.mutateAsync({
+ const handleOnFormSave = async () => {
+ reset({
+ about: getValues('about')!,
+ address: user!.address,
+ delegationPitch: getValues('delegationPitch')!,
+ discord: getValues('discord')!,
+ github: getValues('github')!,
+ pfpUrl: getValues('pfpUrl')!,
+ twitter: getValues('twitter')!,
+ username: getValues('username')!,
+ });
+ await mutation.mutateAsync({
about: getValues('about')!,
address: user!.address,
email: '',
@@ -94,6 +94,15 @@ export function UserProfileForm() {
});
};
+ const blocker = useBlocker(() => {
+ if (formState.isDirty) {
+ onBlockerOpen();
+ return true;
+ }
+ onBlockerClose();
+ return false;
+ });
+
if (isLoading)
return (
@@ -102,20 +111,22 @@ export function UserProfileForm() {
);
return (
-
-
- {/*
+ <>
+
-
- Governance Pitch
-
-
-
- {
- handleOnFormSave();
- }}
- isDisabled={!formState.isDirty}
- >
- Save Changes
-
- onOpen()}>
- Preview
-
-
+ {blocker.state === 'blocked' && (
+
-
+
onClose()}
+ onClick={() => onBlockerClose()}
size="xs"
aria-label="close button"
icon={}
@@ -252,75 +327,19 @@ export function UserProfileForm() {
top="10px"
right="10px"
/>
- {
- handleOnFormSave();
- }}
- />
+ You have unsaved changes
+
+ You have unsaved changes. Do you want to leave without saving?
+
+ blocker.proceed()}>Leave without Saving
+ blocker.reset()}>
+ Keep Editing
+
-
-
-
-
- Preview
- {
- handleOnFormSave();
- }}
- />
-
-
- {blocker.state === 'blocked' && (
-
-
-
-
- onBlockerClose()}
- size="xs"
- aria-label="close button"
- icon={}
- variant="ghost"
- colorScheme="whiteAlpha"
- color="white"
- position="absolute"
- top="10px"
- right="10px"
- />
- You have unsaved changes
-
- You have unsaved changes. Do you want to leave without saving?
-
- blocker.proceed()}>Leave without Saving
- blocker.reset()}>
- Keep Editing
-
-
-
-
- )}
-
+ )}
+
+ >
);
}
diff --git a/governance/ui/src/components/UserTableView/UserTableView.tsx b/governance/ui/src/components/UserTableView/UserTableView.tsx
index d5684bc42..2ffffd0b9 100644
--- a/governance/ui/src/components/UserTableView/UserTableView.tsx
+++ b/governance/ui/src/components/UserTableView/UserTableView.tsx
@@ -7,10 +7,43 @@ import { CouncilSlugs } from '../../utils/councils';
import { ProfilePicture } from '../UserProfileCard/ProfilePicture';
import { prettyString } from '@snx-v3/format';
+function renderCorrectBorder(
+ column: 'place' | 'name' | 'votes' | 'power',
+ position: 'left' | 'right' | 'bottom',
+ period: string | undefined,
+ isSelected: boolean
+) {
+ if (column === 'place') {
+ if (position === 'left') {
+ return isSelected ? '1px solid' : '';
+ } else if (position === 'bottom') {
+ return isSelected ? '1px solid' : '';
+ }
+ } else if (column === 'name') {
+ if (position === 'left') {
+ if (period === '2') {
+ return '';
+ }
+ if (period === '0') {
+ return '';
+ }
+ return isSelected ? '1px solid' : '';
+ } else if (position === 'bottom') {
+ return isSelected ? '1px solid' : '';
+ }
+ } else if (column === 'votes') {
+ if (position === 'bottom') return isSelected ? '1px solid' : '';
+ } else if (column === 'power') {
+ if (position === 'bottom') return isSelected ? '1px solid' : '';
+ if (position === 'right') {
+ if (period === '2') return isSelected ? '1px solid' : '';
+ }
+ }
+}
+
export default function UserTableView({
user,
activeCouncil,
- isNomination,
place,
}: {
place: number;
@@ -35,8 +68,8 @@ export default function UserTableView({
{councilIsInAdminOrVoting && (
@@ -57,8 +90,8 @@ export default function UserTableView({
textTransform="unset"
px="3"
borderTop="1px solid"
- borderBottom={!councilIsInAdminOrVoting && !isSelected ? '' : '1px solid'}
- borderLeft={councilIsInAdminOrVoting ? '' : '1px solid'}
+ borderBottom={renderCorrectBorder('name', 'bottom', councilPeriod, isSelected)}
+ borderLeft={renderCorrectBorder('name', 'left', councilPeriod, isSelected)}
borderLeftRadius={isSelected && councilPeriod === '1' ? 'base' : ''}
borderColor={isSelected ? 'cyan.500' : 'gray.900'}
>
@@ -86,7 +119,7 @@ export default function UserTableView({
{councilIsInAdminOrVoting && (
|
- {isNomination && 'View'}
+ View
|
)}
diff --git a/governance/ui/src/context/VoteContext.tsx b/governance/ui/src/context/VoteContext.tsx
index a2993d353..e40c22cfe 100644
--- a/governance/ui/src/context/VoteContext.tsx
+++ b/governance/ui/src/context/VoteContext.tsx
@@ -1,6 +1,13 @@
-import React, { createContext, useContext, useReducer, ReactNode } from 'react';
-import { removeCandidate, setCandidate } from '../utils/localstorage';
+import React, {
+ createContext,
+ ReactNode,
+ useContext,
+ useEffect,
+ useReducer,
+ useState,
+} from 'react';
import { useNetwork } from '../queries';
+import { removeCandidate, setCandidate } from '../utils/localstorage';
export interface VoteStateForNetwork {
spartan: string | undefined;
@@ -20,7 +27,7 @@ type Action = {
const parsedState = JSON.parse(localStorage.getItem('voteSelection') || '{}');
const initialState = (chainId?: string) => {
- const customChainId = chainId || Object.keys(parsedState)[0] || '2492';
+ const customChainId = chainId || Object.keys(parsedState)[0] || '2192';
return {
[customChainId]: {
spartan: parsedState[customChainId]?.spartan || undefined,
@@ -89,7 +96,23 @@ const voteReducer = (state: VoteState, action: Action): VoteState => {
const VoteProvider: React.FC<{ children: ReactNode }> = ({ children }) => {
const { network } = useNetwork();
+ const [init, setInit] = useState(false);
const [state, dispatch] = useReducer(voteReducer, initialState(network?.id.toString()));
+ useEffect(() => {
+ if (network && !init) {
+ const initState = initialState(network.id.toString());
+ Object.keys(initState[network.id]).forEach((key) => {
+ dispatch({
+ payload: {
+ action: initState[network.id][key as keyof VoteStateForNetwork],
+ network: network.id.toString(),
+ },
+ type: key.toUpperCase(),
+ });
+ });
+ setInit(true);
+ }
+ }, [network, init]);
return {children};
};
@@ -101,4 +124,4 @@ const useVoteContext = () => {
return context;
};
-export { VoteProvider, useVoteContext };
+export { useVoteContext, VoteProvider };
diff --git a/governance/ui/src/mutations/useCastVotes.ts b/governance/ui/src/mutations/useCastVotes.ts
index 1b9a7b45b..ba3feda21 100644
--- a/governance/ui/src/mutations/useCastVotes.ts
+++ b/governance/ui/src/mutations/useCastVotes.ts
@@ -5,11 +5,14 @@ import { getCouncilContract, SnapshotRecordContract } from '../utils/contracts';
import { BigNumber, utils } from 'ethers';
import { useVoteContext } from '../context/VoteContext';
import { useMulticall } from '../hooks/useMulticall';
+import { useToast } from '@chakra-ui/react';
+import { CustomToast } from '../components/CustomToast';
export function useCastVotes(
councils: CouncilSlugs[],
candidates: { spartan?: string; ambassador?: string; treasury?: string }
) {
+ const toast = useToast();
const query = useQueryClient();
const signer = useSigner();
const { network } = useNetwork();
@@ -113,6 +116,13 @@ export function useCastVotes(
console.error('signer not connected');
}
},
+ onError: () => {
+ toast({
+ description: 'Could not cast votes.',
+ status: 'error',
+ render: CustomToast,
+ });
+ },
onSuccess: async () => {
councils.map((council) => {
const shouldWithdrawVote = candidates[council] === 'remove';
diff --git a/governance/ui/src/mutations/useUpdateUserDetailsMutation.ts b/governance/ui/src/mutations/useUpdateUserDetailsMutation.ts
index 911c4d08a..b4b4f8ea8 100644
--- a/governance/ui/src/mutations/useUpdateUserDetailsMutation.ts
+++ b/governance/ui/src/mutations/useUpdateUserDetailsMutation.ts
@@ -57,7 +57,7 @@ function useUpdateUserDetailsMutation() {
const boardroomSignIn = async () => {
const domain = 'governance.synthetix.io';
- const chainId = 10;
+ const chainId = 2192;
if (signer && activeWallet?.address) {
try {
diff --git a/governance/ui/src/pages/MyProfile.tsx b/governance/ui/src/pages/MyProfile.tsx
index 93e29aee3..182f37d28 100644
--- a/governance/ui/src/pages/MyProfile.tsx
+++ b/governance/ui/src/pages/MyProfile.tsx
@@ -1,4 +1,4 @@
-import { Flex, Heading, Text } from '@chakra-ui/react';
+import { Container, Flex, Heading, Text } from '@chakra-ui/react';
import { UserProfileForm } from '../components/UserProfileForm';
import { useWallet } from '../queries';
import CouncilTabs from '../components/CouncilTabs/CouncilTabs';
@@ -12,7 +12,7 @@ export default function MyProfile() {
);
return (
- <>
+
@@ -23,6 +23,6 @@ export default function MyProfile() {
- >
+
);
}
diff --git a/governance/ui/src/pages/MyVotes.tsx b/governance/ui/src/pages/MyVotes.tsx
index 87409a633..294b35988 100644
--- a/governance/ui/src/pages/MyVotes.tsx
+++ b/governance/ui/src/pages/MyVotes.tsx
@@ -6,7 +6,7 @@ import { useGetCurrentPeriod } from '../queries/useGetCurrentPeriod';
import { useGetEpochSchedule } from '../queries/useGetEpochSchedule';
import { Timer } from '../components/Timer';
import CouncilTabs from '../components/CouncilTabs/CouncilTabs';
-import { useGetUserVotingPower, useNetwork } from '../queries/';
+import { useGetUserVotingPower, useNetwork, useWallet } from '../queries/';
import { useCastVotes } from '../mutations';
import { formatNumber } from '@snx-v3/formatters';
import MyVoteRow from '../components/MyVoteRow/MyVoteRow';
@@ -16,6 +16,7 @@ export default function MyVotes() {
const { data: period } = useGetCurrentPeriod('spartan');
const { data: schedule } = useGetEpochSchedule('spartan');
const { network } = useNetwork();
+ const { connect } = useWallet();
const networkForState = network?.id.toString() || process.env.CI === 'true' ? 13001 : 2192;
const { data: votingPowerSpartan } = useGetUserVotingPower('spartan');
@@ -173,10 +174,14 @@ export default function MyVotes() {
size="md"
isDisabled={period !== '2' || !councilToCastVote.length}
onClick={async () => {
- await mutateAsync();
+ if (!network?.id) {
+ connect();
+ } else {
+ await mutateAsync();
+ }
}}
>
- Cast Votes
+ {!network?.id ? 'Connect Wallet' : 'Cast Votes'}
diff --git a/governance/ui/src/queries/useGetCouncilMembers.ts b/governance/ui/src/queries/useGetCouncilMembers.ts
index 3a5c45645..5bc4595a8 100644
--- a/governance/ui/src/queries/useGetCouncilMembers.ts
+++ b/governance/ui/src/queries/useGetCouncilMembers.ts
@@ -10,7 +10,7 @@ export function useGetCouncilMembers(council: CouncilSlugs) {
queryKey: ['members', council, network?.id],
queryFn: async () => {
const members = (await getCouncilContract(council)
- .connect(motherShipProvider(network?.id))
+ .connect(motherShipProvider(network?.id || 13001))
.getCouncilMembers()) as string[];
return members;
},
diff --git a/governance/ui/src/queries/useGetCouncilNominees.ts b/governance/ui/src/queries/useGetCouncilNominees.ts
index 984836e77..d359d49ce 100644
--- a/governance/ui/src/queries/useGetCouncilNominees.ts
+++ b/governance/ui/src/queries/useGetCouncilNominees.ts
@@ -10,7 +10,7 @@ export function useGetCouncilNominees(council: CouncilSlugs) {
queryKey: ['nominees', council, network?.id],
queryFn: async () => {
return (await getCouncilContract(council)
- .connect(motherShipProvider(network?.id))
+ .connect(motherShipProvider(network?.id || 13001))
.getNominees()) as string[];
},
enabled: !!council,
diff --git a/governance/ui/src/queries/useGetCurrentPeriod.ts b/governance/ui/src/queries/useGetCurrentPeriod.ts
index 4f69b253c..2dda526c3 100644
--- a/governance/ui/src/queries/useGetCurrentPeriod.ts
+++ b/governance/ui/src/queries/useGetCurrentPeriod.ts
@@ -11,7 +11,7 @@ export function useGetCurrentPeriod(council?: CouncilSlugs) {
queryFn: async () => {
return (
await getCouncilContract(council!)
- .connect(motherShipProvider(network?.id))
+ .connect(motherShipProvider(network?.id || 13001))
.getCurrentPeriod()
).toString() as string | undefined;
},
diff --git a/governance/ui/src/queries/useGetElectionSettings.ts b/governance/ui/src/queries/useGetElectionSettings.ts
index 13bd91229..bcd325c4d 100644
--- a/governance/ui/src/queries/useGetElectionSettings.ts
+++ b/governance/ui/src/queries/useGetElectionSettings.ts
@@ -10,7 +10,7 @@ export function useGetElectionSettings(council: CouncilSlugs) {
queryKey: ['useGetElectionSettings', council],
queryFn: async () => {
return (await getCouncilContract(council)
- .connect(motherShipProvider(network?.id))
+ .connect(motherShipProvider(network?.id || 13001))
.getElectionSettings()) as Promise<{
epochSeatCount: number;
minimumActiveMembers: number;
diff --git a/governance/ui/src/queries/useGetEpochSchedule.ts b/governance/ui/src/queries/useGetEpochSchedule.ts
index b2fa0e4c6..60839092b 100644
--- a/governance/ui/src/queries/useGetEpochSchedule.ts
+++ b/governance/ui/src/queries/useGetEpochSchedule.ts
@@ -11,7 +11,7 @@ export function useGetEpochSchedule(council?: CouncilSlugs) {
queryKey: ['epoch-schedule', council, network?.id],
queryFn: async () => {
const schedule = await getCouncilContract(council!)
- .connect(motherShipProvider(network?.id))
+ .connect(motherShipProvider(network?.id || 13001))
.getEpochSchedule();
return {
startDate: Number(schedule.startDate.toString()),
diff --git a/governance/ui/src/queries/useGetIsNominated.ts b/governance/ui/src/queries/useGetIsNominated.ts
index ab039b30f..9d5aea498 100644
--- a/governance/ui/src/queries/useGetIsNominated.ts
+++ b/governance/ui/src/queries/useGetIsNominated.ts
@@ -10,7 +10,7 @@ export function useGetIsNominated(address?: string) {
return useQuery({
queryKey: ['isNominated', address, network?.id],
queryFn: async () => {
- const provider = motherShipProvider(network?.id);
+ const provider = motherShipProvider(network?.id || 13001);
const isNominatedForSpartanCouncil = (await getCouncilContract('spartan')
.connect(provider)
.isNominated(address)) as boolean | undefined;
diff --git a/governance/ui/src/queries/useGetNextElectionSettings.ts b/governance/ui/src/queries/useGetNextElectionSettings.ts
index 1ccba7287..57375d1b1 100644
--- a/governance/ui/src/queries/useGetNextElectionSettings.ts
+++ b/governance/ui/src/queries/useGetNextElectionSettings.ts
@@ -10,7 +10,7 @@ export function useGetNextElectionSettings(council: CouncilSlugs) {
queryKey: ['next-epoch-settings', council],
queryFn: async () => {
const schedule = await getCouncilContract(council)
- .connect(motherShipProvider(network?.id))
+ .connect(motherShipProvider(network?.id || 13001))
.getNextElectionSettings();
return Number(schedule.epochDuration.toString()) as number | undefined;
},
diff --git a/governance/ui/src/utils/contracts.ts b/governance/ui/src/utils/contracts.ts
index 8b119f924..0e2b3865c 100644
--- a/governance/ui/src/utils/contracts.ts
+++ b/governance/ui/src/utils/contracts.ts
@@ -4,32 +4,26 @@ import { CouncilSlugs } from './councils';
const SpartanCouncilContract = new Contract(
'0xBC85F11300A8EF619592fD678418Ec4eF26FBdFD',
- process.env.DEV ? electionModuleABITest : electionModuleABITest
+ electionModuleABITest
);
const AmbassadorCouncilContract = new Contract(
'0xCdbEf5753cE3CEbF361e143117e345ADd7498F80',
- process.env.DEV ? electionModuleABITest : electionModuleABITest
+ electionModuleABITest
);
const TreasuryCouncilContract = new Contract(
'0xe3aB2C6F1C9E46Fb53eD6b297c6fff68e935B161',
- process.env.DEV ? electionModuleABITest : electionModuleABITest
+ electionModuleABITest
);
export function getCouncilContract(council: CouncilSlugs) {
switch (council) {
case 'spartan':
- if (process.env.DEV === 'true')
- return SpartanCouncilContract.attach('0x4066a172DD5D21E4f787C07D3118D0876296750B');
return SpartanCouncilContract;
case 'ambassador':
- if (process.env.DEV === 'true')
- return AmbassadorCouncilContract.attach('0x4066a172DD5D21E4f787C07D3118D0876296750B');
return AmbassadorCouncilContract;
case 'treasury':
- if (process.env.DEV === 'true')
- return TreasuryCouncilContract.attach('0x4066a172DD5D21E4f787C07D3118D0876296750B');
return TreasuryCouncilContract;
default:
throw new Error('could not find contract');
@@ -41,35 +35,20 @@ export const SnapshotRecordContract = (chainId: number, council: CouncilSlugs) =
case 13001: {
switch (council) {
case 'spartan':
- return new Contract(
- process.env.DEV === 'true'
- ? '0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9'
- : '0x552E469B7C88cd501C08e7759d35dC58f08C9648',
- [
- 'function balanceOfOnPeriod(address, uint256) view returns (uint256)',
- 'function setBalanceOfOnPeriod(address, uint256, uint256) external',
- ]
- );
+ return new Contract('0x552E469B7C88cd501C08e7759d35dC58f08C9648', [
+ 'function balanceOfOnPeriod(address, uint256) view returns (uint256)',
+ 'function setBalanceOfOnPeriod(address, uint256, uint256) external',
+ ]);
case 'ambassador':
- return new Contract(
- process.env.DEV === 'true'
- ? '0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9'
- : '0x3a0186E03137B9b971EC911350A0F2D88D24FDF2',
- [
- 'function balanceOfOnPeriod(address, uint256) view returns (uint256)',
- 'function setBalanceOfOnPeriod(address, uint256, uint256) external',
- ]
- );
+ return new Contract('0x3a0186E03137B9b971EC911350A0F2D88D24FDF2', [
+ 'function balanceOfOnPeriod(address, uint256) view returns (uint256)',
+ 'function setBalanceOfOnPeriod(address, uint256, uint256) external',
+ ]);
case 'treasury':
- return new Contract(
- process.env.DEV === 'true'
- ? '0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9'
- : '0xC0bFA9aC792cF691734F7b2BD252d1c2B9fBa343',
- [
- 'function balanceOfOnPeriod(address, uint256) view returns (uint256)',
- 'function setBalanceOfOnPeriod(address, uint256, uint256) external',
- ]
- );
+ return new Contract('0xC0bFA9aC792cF691734F7b2BD252d1c2B9fBa343', [
+ 'function balanceOfOnPeriod(address, uint256) view returns (uint256)',
+ 'function setBalanceOfOnPeriod(address, uint256, uint256) external',
+ ]);
}
}
}
diff --git a/governance/ui/src/utils/councils.ts b/governance/ui/src/utils/councils.ts
index 80bad178a..810cfb508 100644
--- a/governance/ui/src/utils/councils.ts
+++ b/governance/ui/src/utils/councils.ts
@@ -25,7 +25,7 @@ const councils: {
image: '/councils/ac.svg',
address: getCouncilContract('ambassador').address,
description:
- "The Ambassador Council, established via SIP 157 is responsible for promoting Synthetix's interest in the DeFi ecosystem. This advocation comes through two primary means: governance and partnerships. Governance includes seeking governance power in protocols that may be beneficial for Synthetix, and voting for proposals in the interest of the community. Partnerships include working with Synthetix integrators to help them integrate within the Synthetix Ecosystem.",
+ "The Ambassador Council, established via SIP 157, is responsible for promoting Synthetix's interest in the DeFi ecosystem. This advocation comes through two primary means: governance and partnerships. Governance includes seeking governance power in protocols that may be beneficial for Synthetix, and voting for proposals in the interest of the community. Partnerships include working with Synthetix integrators to help them integrate within the Synthetix Ecosystem.",
stipends: '2,000 SNX',
docLink: 'https://docs.synthetix.io/dao/governance-framework/ambassador-council',
},
diff --git a/governance/ui/src/utils/providers.ts b/governance/ui/src/utils/providers.ts
index 3a27ae1d2..afa00b099 100644
--- a/governance/ui/src/utils/providers.ts
+++ b/governance/ui/src/utils/providers.ts
@@ -6,6 +6,6 @@ export const motherShipProvider = (networkId?: number) => {
? process.env.CI_RPC_MOTHERSHIP
: networkId === 13001
? 'https://testnet.snaxchain.io/'
- : 'https://testnet.snaxchain.io/'
+ : 'https://mainnet.snaxchain.io/'
);
};
diff --git a/governance/ui/webpack.config.js b/governance/ui/webpack.config.js
index 6759bc19e..c993ca99f 100644
--- a/governance/ui/webpack.config.js
+++ b/governance/ui/webpack.config.js
@@ -173,12 +173,9 @@ module.exports = {
)
.concat(
new webpack.DefinePlugin({
- 'process.env.DEV': JSON.stringify(process.env.DEV) || 'false',
'process.env.CI': JSON.stringify(process.env.CI) || 'false',
'process.env.CI_RPC_MOTHERSHIP':
JSON.stringify(process.env.CI_RPC_MOTHERSHIP) || 'http://127.0.0.1:8545',
- 'process.env.DEV_RPC_MOTHERSHIP':
- JSON.stringify(process.env.DEV_RPC_MOTHERSHIP) || 'http://127.0.0.1:19000',
'process.env.WC_PROJECT_ID':
JSON.stringify(process.env.WC_PROJECT_ID) || '5075a2da602e17eec34aa77b40b321be',
'process.env.BOARDROOM_KEY':
diff --git a/liquidity/lib/useBlockchain/useBlockchain.tsx b/liquidity/lib/useBlockchain/useBlockchain.tsx
index 404fe4821..a8ad76367 100644
--- a/liquidity/lib/useBlockchain/useBlockchain.tsx
+++ b/liquidity/lib/useBlockchain/useBlockchain.tsx
@@ -225,7 +225,7 @@ export const SNAX: Network = {
token: 'ETH',
name: 'SNAX',
rpcUrl: () => 'https://mainnet.snaxchain.io/',
- label: 'SNAX CHAIN',
+ label: 'Snaxchain',
isSupported: true,
publicRpcUrl: 'https://mainnet.snaxchain.io/',
isTestnet: false,
@@ -238,7 +238,7 @@ export const SNAXTESTNET: Network = {
token: 'ETH',
name: 'SNAX',
rpcUrl: () => 'https://testnet.snaxchain.io/',
- label: 'SNAX CHAIN',
+ label: 'Snaxchain',
isSupported: true,
publicRpcUrl: 'https://testnet.snaxchain.io/',
isTestnet: true,