Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Legacy app: Disable write contract interactions #994

Open
wants to merge 1 commit into
base: feat/wallet-migration
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/delegates/components/DelegateOverviewCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ export const DelegateOverviewCard = memo(
<Button
variant="primaryLarge"
data-testid="button-delegate"
disabled={!account || !!delegate.next || delegate.expired}
// disabled={!account || !!delegate.next || delegate.expired}
disabled={true}
onClick={() => {
setShowDelegateModal(true);
}}
Expand Down
3 changes: 2 additions & 1 deletion modules/delegates/components/ManageDelegation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export default function ManageDelegation({
<Button
variant="primaryLarge"
data-testid="button-delegate"
disabled={!account}
// disabled={!account}
disabled={true}
onClick={() => {
setShowDelegateModal(true);
}}
Expand Down
7 changes: 4 additions & 3 deletions modules/delegates/components/TopDelegates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { DelegatePicture } from './DelegatePicture';
import { DelegatePaginated } from '../types';
import { DelegateModal } from './modals/DelegateModal';
import { useState } from 'react';
import { useAccount } from 'modules/app/hooks/useAccount';
// import { useAccount } from 'modules/app/hooks/useAccount';
import { calculatePercentage } from 'lib/utils';
import { parseEther } from 'viem';

Expand All @@ -24,7 +24,7 @@ export default function TopDelegates({
topDelegates: DelegatePaginated[];
totalMKRDelegated: bigint;
}): React.ReactElement {
const { account } = useAccount();
// const { account } = useAccount();
const [showDelegateModal, setShowDelegateModal] = useState<DelegatePaginated | null>(null);

return (
Expand Down Expand Up @@ -125,7 +125,8 @@ export default function TopDelegates({
<Button
variant="outline"
data-testid="button-delegate"
disabled={!account}
// disabled={!account}
disabled={true}
onClick={() => {
setShowDelegateModal(delegate);
}}
Expand Down
5 changes: 3 additions & 2 deletions modules/delegates/hooks/useDelegateCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { WriteHook, WriteHookParams } from 'modules/web3/types/hooks';

export const useDelegateCreate = ({
gas,
enabled: paramEnabled = true,
// enabled: paramEnabled = true,
onSuccess,
onError,
onStart
Expand All @@ -25,7 +25,8 @@ export const useDelegateCreate = ({
abi: voteDelegateFactoryAbi,
functionName: 'create',
chainId,
enabled: paramEnabled,
// enabled: paramEnabled,
enabled: false,
gas,
onSuccess,
onError,
Expand Down
5 changes: 3 additions & 2 deletions modules/delegates/hooks/useDelegateLock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const useDelegateLock = ({
voteDelegateAddress,
mkrToDeposit,
gas,
enabled: paramEnabled = true,
// enabled: paramEnabled = true,
onSuccess,
onError,
onStart
Expand All @@ -31,7 +31,8 @@ export const useDelegateLock = ({
functionName: 'lock',
args: [mkrToDeposit],
chainId,
enabled: paramEnabled,
// enabled: paramEnabled,
enabled: false,
gas,
onSuccess,
onError,
Expand Down
5 changes: 3 additions & 2 deletions modules/esm/hooks/useEsmBurn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { esmAbi, esmAddress } from 'modules/contracts/generated';
export const useEsmBurn = ({
burnAmount,
gas,
enabled: paramEnabled = true,
// enabled: paramEnabled = true,
onSuccess,
onError,
onStart
Expand All @@ -29,7 +29,8 @@ export const useEsmBurn = ({
functionName: 'join',
args: [burnAmount],
chainId,
enabled: paramEnabled,
// enabled: paramEnabled,
enabled: false,
gas,
onSuccess,
onError,
Expand Down
5 changes: 3 additions & 2 deletions modules/esm/hooks/useEsmShutdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { esmAbi, esmAddress } from 'modules/contracts/generated';

export const useEsmShutdown = ({
gas,
enabled: paramEnabled = true,
// enabled: paramEnabled = true,
onSuccess,
onError,
onStart
Expand All @@ -25,7 +25,8 @@ export const useEsmShutdown = ({
abi: esmAbi,
functionName: 'fire',
chainId,
enabled: paramEnabled,
// enabled: paramEnabled,
enabled: false,
gas,
onSuccess,
onError,
Expand Down
13 changes: 7 additions & 6 deletions modules/executive/components/ExecutiveOverviewCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { CardSummary } from 'modules/app/components/Card/CardSummary';
import { ZERO_ADDRESS } from 'modules/web3/constants/addresses';
import { StatBox } from 'modules/app/components/StatBox';
import { StatusText } from 'modules/app/components/StatusText';
import { useMigrationStatus } from 'modules/migration/hooks/useMigrationStatus';
// import { useMigrationStatus } from 'modules/migration/hooks/useMigrationStatus';

type Props = {
proposal: Proposal;
Expand Down Expand Up @@ -64,7 +64,7 @@ export default function ExecutiveOverviewCard({

const canVote = !!account;

const { isDelegateContractExpired } = useMigrationStatus();
// const { isDelegateContractExpired } = useMigrationStatus();

return (
<Card
Expand Down Expand Up @@ -144,10 +144,11 @@ export default function ExecutiveOverviewCard({
<Button
variant="primaryOutline"
sx={{ width: 122 }}
disabled={
(hasVotedFor && votedProposals && votedProposals.length === 1) ||
isDelegateContractExpired
}
// disabled={
// (hasVotedFor && votedProposals && votedProposals.length === 1) ||
// isDelegateContractExpired
// }
disabled={true}
onClick={ev => {
setVoting(true);
ev.stopPropagation();
Expand Down
5 changes: 3 additions & 2 deletions modules/executive/hooks/useChiefVote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { chiefAbi, chiefAddress } from 'modules/contracts/generated';
export const useChiefVote = ({
slateOrProposals,
gas,
enabled: paramEnabled = true,
// enabled: paramEnabled = true,
onSuccess,
onError,
onStart
Expand All @@ -29,7 +29,8 @@ export const useChiefVote = ({
functionName: 'vote',
args: [slateOrProposals],
chainId,
enabled: paramEnabled,
// enabled: paramEnabled,
enabled: false,
gas,
onSuccess,
onError,
Expand Down
5 changes: 3 additions & 2 deletions modules/executive/hooks/useDelegateVote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useWriteContractFlow } from 'modules/web3/hooks/useWriteContractFlow';
export const useDelegateVote = ({
slateOrProposals,
gas,
enabled: paramEnabled = true,
// enabled: paramEnabled = true,
onSuccess,
onError,
onStart
Expand All @@ -31,7 +31,8 @@ export const useDelegateVote = ({
functionName: 'vote',
args: [slateOrProposals],
chainId,
enabled: paramEnabled,
// enabled: paramEnabled,
enabled: false,
gas,
onSuccess,
onError,
Expand Down
5 changes: 3 additions & 2 deletions modules/executive/hooks/useVoteProxyVote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { voteProxyAbi } from 'modules/contracts/ethers/abis';
export const useVoteProxyVote = ({
slateOrProposals,
gas,
enabled: paramEnabled = true,
// enabled: paramEnabled = true,
onSuccess,
onError,
onStart
Expand All @@ -31,7 +31,8 @@ export const useVoteProxyVote = ({
functionName: 'vote',
args: [slateOrProposals],
chainId,
enabled: paramEnabled,
// enabled: paramEnabled,
enabled: false,
gas,
onSuccess,
onError,
Expand Down
1 change: 1 addition & 0 deletions modules/mkr/components/Deposit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ const Deposit = ({
onClick={() => {
open();
}}
disabled={true}
data-testid="deposit-button"
>
Deposit
Expand Down
5 changes: 3 additions & 2 deletions modules/mkr/hooks/useLock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { voteProxyAbi } from 'modules/contracts/ethers/abis';
export const useLock = ({
mkrToDeposit,
gas,
enabled: paramEnabled = true,
// enabled: paramEnabled = true,
onSuccess,
onError,
onStart
Expand All @@ -30,7 +30,8 @@ export const useLock = ({
functionName: 'lock',
args: [mkrToDeposit],
chainId,
enabled: paramEnabled,
// enabled: paramEnabled,
enabled: false,
gas,
onSuccess,
onError,
Expand Down
3 changes: 2 additions & 1 deletion modules/polling/components/BallotBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export default function BallotBox({ activePollCount, network, activePollIds }: P
<Flex p={3} sx={{ flexDirection: 'column' }}>
<Button
variant="primaryLarge"
disabled={!ballotCount}
// disabled={!ballotCount}
disabled={true}
sx={{ width: '100%', cursor: !ballotCount ? 'not-allowed' : 'pointer' }}
>
<InternalLink href="/polling/review" title="Review & submit your ballot">
Expand Down
2 changes: 1 addition & 1 deletion modules/polling/components/ChoiceSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const ChoiceSummary = ({
</Flex>
{showReviewButton && onBallot && (
<InternalLink href="/polling/review" title="Review & submit your ballot">
<Button variant="primaryLarge" sx={{ width: '100%', cursor: 'pointer', mt: 3 }}>
<Button variant="primaryLarge" sx={{ width: '100%', cursor: 'pointer', mt: 3 }} disabled={true}>
Review & Submit Your Ballot
</Button>
</InternalLink>
Expand Down
7 changes: 4 additions & 3 deletions modules/polling/components/poll-vote-input/QuickVote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,10 @@ const QuickVote = ({
submit();
}}
mt={2}
disabled={
!isChoiceValid || !votingWeight || !(votingWeight.total > 0n) || isDelegateContractExpired
}
// disabled={
// !isChoiceValid || !votingWeight || !(votingWeight.total > 0n) || isDelegateContractExpired
// }
disabled={true}
>
{loading
? 'Loading MKR balance...'
Expand Down
13 changes: 8 additions & 5 deletions modules/polling/context/BallotContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later
import { fetchJson } from 'lib/fetchJson';
import { localStorage } from 'modules/app/client/storage/localStorage';
import { useAccount } from 'modules/app/hooks/useAccount';
import { signTypedBallotData } from 'modules/web3/helpers/signTypedBallotData';
// import { signTypedBallotData } from 'modules/web3/helpers/signTypedBallotData';
import { useNetwork } from 'modules/app/hooks/useNetwork';
import useTransactionsStore, {
transactionsApi,
Expand Down Expand Up @@ -298,7 +298,8 @@ export const BallotProvider = ({ children }: PropTypes): React.ReactElement => {
functionName: 'votePoll',
args: [pollIds, optionIds],
chainId,
enabled: !!voteDelegateContractAddress,
// enabled: !!voteDelegateContractAddress,
enabled: false,
onStart: (txHash: string) => {
onPendingHandler(txHash);
},
Expand All @@ -316,7 +317,8 @@ export const BallotProvider = ({ children }: PropTypes): React.ReactElement => {
functionName: 'vote',
args: [pollIds, optionIds],
chainId,
enabled: !voteDelegateContractAddress,
// enabled: !voteDelegateContractAddress,
enabled: false,
onStart: (txHash: string) => {
onPendingHandler(txHash);
},
Expand Down Expand Up @@ -381,8 +383,9 @@ export const BallotProvider = ({ children }: PropTypes): React.ReactElement => {

let signature;
try {
signature = await signTypedBallotData(signatureValues, signTypedDataAsync, network);
setStep('awaiting-relayer');
signature = undefined;
// signature = await signTypedBallotData(signatureValues, signTypedDataAsync, network);
// setStep('awaiting-relayer');
} catch (error) {
toast.error(error);
setSubmissionError(parseTxError(error));
Expand Down
5 changes: 3 additions & 2 deletions modules/polling/hooks/usePollCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const usePollCreate = ({
multiHash,
url,
gas,
enabled: paramEnabled = true,
// enabled: paramEnabled = true,
onSuccess,
onError,
onStart
Expand All @@ -29,7 +29,8 @@ export const usePollCreate = ({
}): WriteHook => {
const chainId = useChainId();

const enabled = paramEnabled && !!startDate && !!endDate && !!multiHash && !!url;
// const enabled = paramEnabled && !!startDate && !!endDate && !!multiHash && !!url;
const enabled = false;

return useWriteContractFlow({
address: pollingOldAddress[chainId],
Expand Down
5 changes: 4 additions & 1 deletion modules/web3/hooks/useApproveUnlimitedToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ export const useApproveUnlimitedToken = ({
const chainId = useChainId();
const tokenConfig = tokenNameToConfig(name);

// Only enable token approvals for IOU tokens, used for undelegating and withdrawing MKR
const enabled = paramEnabled && (name === 'iou' || name === 'iouOld');

return useWriteContractFlow({
address: tokenConfig?.address[chainId],
abi: tokenConfig?.abi,
functionName: 'approve',
args: [addressToApprove as `0x${string}`],
chainId,
enabled: paramEnabled,
enabled,
gas,
onSuccess,
onError,
Expand Down
1 change: 1 addition & 0 deletions pages/esmodule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ const ESModule = (): React.ReactElement => {
{totalStaked && account ? (
<Button
onClick={() => setShowDialog(true)}
disabled={true}
variant="outline"
sx={{ color: 'onNotice', borderColor: 'notice' }}
>
Expand Down
7 changes: 4 additions & 3 deletions pages/polling/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Hash from 'ipfs-only-hash';
import { formatDateWithTime } from 'lib/datetime';
import { markdownToHtml } from 'lib/markdown';
import { HeadComponent } from 'modules/app/components/layout/Head';
import { useAccount } from 'modules/app/hooks/useAccount';
// import { useAccount } from 'modules/app/hooks/useAccount';
import { InternalLink } from 'modules/app/components/InternalLink';
import { ExternalLink } from 'modules/app/components/ExternalLink';
import { PollMarkdownEditor } from 'modules/polling/components/PollMarkdownEditor';
Expand Down Expand Up @@ -66,7 +66,7 @@ const PollingCreate = (): React.ReactElement => {
const [pollErrors, setPollErrors] = useState<string[]>([]);
const [contentHtml, setContentHtml] = useState<string>('');
const [creating, setCreating] = useState(false);
const { account } = useAccount();
// const { account } = useAccount();

const resetForm = () => {
setPoll(undefined);
Expand Down Expand Up @@ -203,7 +203,8 @@ const PollingCreate = (): React.ReactElement => {
variant="primary"
data-testid="button-create-poll"
onClick={() => setCreating(true)}
disabled={typeof poll === 'undefined' || pollErrors.length > 0 || !account}
// disabled={typeof poll === 'undefined' || pollErrors.length > 0 || !account}
disabled={true}
>
Create Poll
</Button>
Expand Down
2 changes: 1 addition & 1 deletion tenderlyTestnetData.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "TENDERLY_TESTNET_ID": "", "TENDERLY_RPC_URL": "" }
{"TENDERLY_TESTNET_ID":"39c0f00a-c075-4be8-98e1-7dfaa7b4340d","TENDERLY_RPC_URL":"https://virtual.mainnet.rpc.tenderly.co/1eae13a2-f58d-49d7-886d-49890f1e61a9"}
Loading