Skip to content

Commit

Permalink
fix: remove proposal rejected flow (#47)
Browse files Browse the repository at this point in the history
Signed-off-by: John Shutt <[email protected]>
  • Loading branch information
pemulis authored Jan 19, 2023
1 parent 51c2f6a commit 6340e42
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 88 deletions.
1 change: 0 additions & 1 deletion src/locales/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
56 changes: 4 additions & 52 deletions src/plugins/safeSnap/components/HandleOutcomeUma.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
});
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -464,15 +429,6 @@ onMounted(async () => {
</BaseButton>
</div>
<div v-if="questionState === questionStates.proposalRejected" class="my-4">
<BaseButton
:loading="action2InProgress === 'delete-rejected-proposal'"
@click="deleteRejectedProposal"
>
{{ $t('safeSnap.labels.deleteRejectedProposal') }}
</BaseButton>
</div>
<div
v-if="questionState === questionStates.proposalApproved"
class="my-4 inline-block"
Expand Down Expand Up @@ -516,8 +472,4 @@ onMounted(async () => {
<div v-if="questionState === questionStates.completelyExecuted" class="my-4">
{{ $t('safeSnap.labels.executed') }}
</div>
<div v-if="questionState === questionStates.proposalRejected" class="my-4">
{{ $t('safeSnap.labels.rejected') }}
</div>
</template>
17 changes: 0 additions & 17 deletions src/plugins/safeSnap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
18 changes: 0 additions & 18 deletions src/plugins/safeSnap/utils/umaModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
};
});
Expand Down

2 comments on commit 6340e42

@vercel
Copy link

@vercel vercel bot commented on 6340e42 Jan 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

snapshot-goerli – ./

snapshot-goerli-uma.vercel.app
snapshot-goerli-git-uma-uma.vercel.app
snapshot-goerli.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 6340e42 Jan 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

snapshot – ./

snapshot-uma.vercel.app
snapshot-swart-two.vercel.app
snapshot-git-uma-uma.vercel.app

Please sign in to comment.