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

Disable submitting proposals on chain (temporary for OffchainVoting contract upgrade) #470

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
14 changes: 14 additions & 0 deletions src/components/proposals/SubmitAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type SubmitActionProps = {
};

type ActionDisabledReasons = {
daoUpgradeMessage: string;
invalidApplicantMessage: string;
};

Expand Down Expand Up @@ -105,6 +106,7 @@ export default function SubmitAction(props: SubmitActionProps) {
*/

const actionDisabledReasonsRef = useRef<ActionDisabledReasons>({
daoUpgradeMessage: '',
invalidApplicantMessage: '',
});

Expand Down Expand Up @@ -168,6 +170,18 @@ export default function SubmitAction(props: SubmitActionProps) {
if (checkApplicant && checkApplicantStatus === FULFILLED) {
// 1. Determine and set reasons why action would be disabled

// @todo Remove this disabled reason after the OffchainVoting contract is
// upgraded.
/**
* Reason: Pending proposals are temporarily blocked from being sponsored
* until the OffchainVoting contract is upgraded.
*/
actionDisabledReasonsRef.current = {
...actionDisabledReasonsRef.current,
daoUpgradeMessage:
'Sponsoring is temporarily disabled while the DAO voting contract is being upgraded.',
};

/**
* Reason: If the applicant address is invalid (see `useCheckApplicant`
* hook for reasons) the `submitProposal` smart contract transaction will
Expand Down
3 changes: 2 additions & 1 deletion src/components/proposals/SubmitAction.unit.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import {TX_CYCLE_MESSAGES} from '../web3/config';
import SubmitAction from './SubmitAction';
import Wrapper from '../../test/Wrapper';

describe('SubmitAction unit tests', () => {
// @todo Enable tests after the OffchainVoting contract is upgraded.
describe.skip('SubmitAction unit tests', () => {
const sponsorButtonRegex: RegExp = /^sponsor$/i;
const awaitingConfirmationRegex: RegExp = /^awaiting your confirmation/i;
const viewProgressRegex: RegExp = /^view progress$/i;
Expand Down
16 changes: 16 additions & 0 deletions src/pages/transfers/CreateTransferProposal.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @todo Remove this eslint disable after the OffchainVoting contract is
// upgraded.
/* eslint-disable no-unreachable */
import {
SnapshotType,
SnapshotProposalData,
Expand Down Expand Up @@ -583,6 +586,19 @@ export default function CreateTransferProposal() {
);
}

// @todo Remove this disabled message after the OffchainVoting contract is
// upgraded.
return (
<RenderWrapper>
<div className="form__description--unauthorized">
<p>
New transfer proposals are temporarily disabled while the DAO voting
contract is being upgraded.
</p>
</div>
</RenderWrapper>
);

return (
<RenderWrapper>
<form className="form" onSubmit={(e) => e.preventDefault()}>
Expand Down