From 6340e42623fdfbfe1e9f15abb34d55fde7934b66 Mon Sep 17 00:00:00 2001 From: John Shutt Date: Thu, 19 Jan 2023 14:43:20 -0800 Subject: [PATCH] fix: remove proposal rejected flow (#47) Signed-off-by: John Shutt --- src/locales/default.json | 1 - .../safeSnap/components/HandleOutcomeUma.vue | 56 ++----------------- src/plugins/safeSnap/index.ts | 17 ------ src/plugins/safeSnap/utils/umaModule.ts | 18 ------ 4 files changed, 4 insertions(+), 88 deletions(-) diff --git a/src/locales/default.json b/src/locales/default.json index a30129f64..bbb9ba2b9 100644 --- a/src/locales/default.json +++ b/src/locales/default.json @@ -649,7 +649,6 @@ "confirmVoteResults": "Click to confirm the proposal passed", "executeTxsUma": "Execute transaction batch", "deleteDisputedProposal": "Delete disputed proposal", - "deleteRejectedProposal": "Delete rejected proposal", "confirmVoteResultsToolTip": "Make sure this proposal was approved by this Snapshot vote before proposing on-chain. If the Snapshot vote rejected the proposal, the on-chain proposal will be rejected as well and you will lose your bond.", "approveBondToolTip": "On-chain proposals require a bond from the proposer. This will approve tokens from your wallet to be posted as a bond. If you make an invalid proposal, it will be disputed and you will lose your bond. If the proposal is valid, your bond will be returned when the transactions are executed.", "requestToolTip": "This will propose the transactions from this Snapshot vote on-chain. After a challenge window, if the proposal is valid, the transactions can be executed and your bond will be returned.", diff --git a/src/plugins/safeSnap/components/HandleOutcomeUma.vue b/src/plugins/safeSnap/components/HandleOutcomeUma.vue index 2ea944400..15be3a10f 100644 --- a/src/plugins/safeSnap/components/HandleOutcomeUma.vue +++ b/src/plugins/safeSnap/components/HandleOutcomeUma.vue @@ -37,11 +37,10 @@ const QuestionStates = { waitingForVoteConfirmation: 2, noTransactions: 3, completelyExecuted: 4, - proposalRejected: 5, - disputedButNotResolved: 6, - waitingForProposal: 7, - waitingForLiveness: 8, - proposalApproved: 9 + disputedButNotResolved: 5, + waitingForProposal: 6, + waitingForLiveness: 7, + proposalApproved: 8 }; Object.freeze(QuestionStates); @@ -249,38 +248,6 @@ const deleteDisputedProposal = async () => { } }; -const deleteRejectedProposal = async () => { - if (!getInstance().isAuthenticated.value) return; - action2InProgress.value = 'delete-rejected-proposal'; - try { - await ensureRightNetwork(props.network); - } catch (e) { - console.error(e); - action2InProgress.value = null; - return; - } - - try { - clearBatchError(); - const deletingRejectedProposal = plugin.deleteRejectedProposal( - getInstance().web3, - props.umaAddress, - questionDetails.value.proposalEvent.proposalHash - ); - await deletingRejectedProposal.next(); - action2InProgress.value = null; - pendingCount.value++; - await deletingRejectedProposal.next(); - notify(t('notify.youDidIt')); - pendingCount.value--; - await sleep(3e3); - await updateDetails(); - } catch (err) { - pendingCount.value--; - action2InProgress.value = null; - } -}; - const usingMetaMask = computed(() => { return window.ethereum && getInstance().provider.value?.isMetaMask; }); @@ -318,8 +285,6 @@ const questionState = computed(() => { if (!activeProposal && voteResultsConfirmed) return QuestionStates.waitingForProposal; - // Proposal can be deleted if it has been rejected. - if (proposalEvent.isRejected) return QuestionStates.proposalRejected; // If disputed, a proposal can be deleted to enable a proposal to be proposed again. if (proposalEvent.isDisputed) return QuestionStates.disputedButNotResolved; @@ -464,15 +429,6 @@ onMounted(async () => { -
- - {{ $t('safeSnap.labels.deleteRejectedProposal') }} - -
-
{
{{ $t('safeSnap.labels.executed') }}
- -
- {{ $t('safeSnap.labels.rejected') }} -
diff --git a/src/plugins/safeSnap/index.ts b/src/plugins/safeSnap/index.ts index 902301f9b..091a85429 100644 --- a/src/plugins/safeSnap/index.ts +++ b/src/plugins/safeSnap/index.ts @@ -221,23 +221,6 @@ export default class Plugin { console.log('[DAO module] deleted disputed proposal:', receipt); } - async *deleteRejectedProposal( - web3: any, - moduleAddress: string, - transactionHash: any - ) { - const tx = await sendTransaction( - web3, - moduleAddress, - UMA_MODULE_ABI, - 'deleteRejectedProposal', - [transactionHash] - ); - yield; - const receipt = await tx.wait(); - console.log('[DAO module] deleted rejected proposal:', receipt); - } - async getModuleDetailsUma( network: string, moduleAddress: string, diff --git a/src/plugins/safeSnap/utils/umaModule.ts b/src/plugins/safeSnap/utils/umaModule.ts index 34f2d0d4b..11936c9ca 100644 --- a/src/plugins/safeSnap/utils/umaModule.ts +++ b/src/plugins/safeSnap/utils/umaModule.ts @@ -157,16 +157,6 @@ export const getModuleDetailsUma = async ( // Get the full proposal events (with state and disputer). const thisModuleFullProposalEvent = await Promise.all( thisModuleProposalEvent.map(async event => { - const settledPriceResponse = await oracleContract.callStatic - .settleAndGetPrice( - event.args?.identifier, - event.args?.timestamp, - event.args?.ancillaryData, - { from: event.args?.requester } - ) - .then(price => price.toString()) - .catch(() => undefined); - return oracleContract .getRequest( event.args?.requester, @@ -184,19 +174,11 @@ export const getModuleDetailsUma = async ( Math.floor(Date.now() / 1000) >= Number(event.args?.expirationTimestamp); - const isRejected = - settledPriceResponse !== undefined && - settledPriceResponse !== validResponse - ? true - : false; - return { expirationTimestamp: event.args?.expirationTimestamp, isExpired: isExpired, isDisputed: isDisputed, - isRejectable: isRejected, isSettled: result.settled, - resolvedPrice: result.resolvedPrice, proposalHash: proposalHash }; });