Skip to content

Commit

Permalink
warn about disputed proposals
Browse files Browse the repository at this point in the history
Signed-off-by: ryanwolhuter <[email protected]>
  • Loading branch information
ryanwolhuter committed Oct 24, 2023
1 parent e6a36fb commit a9d5fb8
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 258 deletions.
19 changes: 3 additions & 16 deletions src/plugins/oSnap/components/HandleOutcome/HandleOutcome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import {
getUserCollateralBalance,
submitProposal
} from '../../utils';
import AssertionFailedInOO from './steps/AssertionFailedInOO.vue';
import AssertionDisputedInOO from './steps/AssertionDisputedInOO.vue';
import AssertionPassedInOO from './steps/AssertionPassedInOO.vue';
import InOOChallengePeriod from './steps/InOOChallengePeriod.vue';
import ReadyForOOAssertion from './steps/ReadyForOOAssertion.vue';
Expand Down Expand Up @@ -340,7 +338,7 @@ onMounted(async () => {
/>
<ReadyForOOAssertion
v-if="
transactionExecutionState.status === 'ready-for-oo-assertion' &&
transactionExecutionState.status === 'can-propose-to-og' &&
!!collateralDetails &&
!!ogModuleDetails &&
!!userCollateralBalance &&
Expand All @@ -356,6 +354,7 @@ onMounted(async () => {
:challenge-period="Number(ogModuleDetails.challengePeriod.toString())"
:quorum="quorum"
:scores-total="proposal.scores_total"
:is-disputed="transactionExecutionState.isDisputed"
@submit-proposal="onSubmitProposal"
@approve-bond="onApproveBond"
/>
Expand All @@ -366,20 +365,8 @@ onMounted(async () => {
:assertion-hash="transactionExecutionState.assertionHash"
:assertion-log-index="transactionExecutionState.assertionLogIndex"
/>
<AssertionDisputedInOO
v-if="transactionExecutionState.status === 'assertion-disputed-in-oo'"
:network="network"
:assertion-hash="transactionExecutionState.assertionHash"
:assertion-log-index="transactionExecutionState.assertionLogIndex"
/>
<AssertionFailedInOO
v-if="transactionExecutionState.status === 'assertion-failed-in-oo'"
:network="network"
:assertion-hash="transactionExecutionState.assertionHash"
:assertion-log-index="transactionExecutionState.assertionLogIndex"
/>
<AssertionPassedInOO
v-if="transactionExecutionState.status === 'assertion-passed-in-oo'"
v-if="transactionExecutionState.status === 'can-request-tx-execution'"
:transaction-count="transactions.length"
@execute-proposal="onExecuteProposal"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const expirationDateLocaleString = new Date(

<template>
<span>
Proposal can be executed at
Transactions can be executed at
<strong>{{ expirationDateLocaleString }}</strong>
</span>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const { formatDuration } = useIntl();
const props = defineProps<{
hasSufficientAllowance: boolean;
hasSufficientBalance: boolean;
isDisputed: boolean;
minimumBond: BigNumber;
userBalance: BigNumber;
decimals: BigNumber;
Expand Down Expand Up @@ -69,12 +70,17 @@ const hasReachedQuorum = computed(() => props.scoresTotal >= props.quorum);
</BaseButton>
</div>

<BaseButton
v-else
@click="emit('submitProposal')"
class="my-1 w-full"
:disabled="!hasReachedQuorum || !hasSufficientBalance"
>
Make assertion on Oracle
</BaseButton>
<div v-else>
<p v-if="isDisputed" class="mb-2">
Warning: This proposal was disputed on-chain. Exercise caution when
proposing, because your proposal may be disputed too.
</p>
<BaseButton
@click="emit('submitProposal')"
class="my-1 w-full"
:disabled="!hasReachedQuorum || !hasSufficientBalance"
>
Make assertion on Oracle
</BaseButton>
</div>
</template>
4 changes: 3 additions & 1 deletion src/plugins/oSnap/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1483,4 +1483,6 @@ export const contractData = [
}
] as const;

export const transactionTypes = ['transferFunds', 'transferNFT', 'contractInteraction', 'raw'] as const
export const transactionTypes = ['transferFunds', 'transferNFT', 'contractInteraction', 'raw'] as const

export const solidityZeroHexString = '0x0000000000000000000000000000000000000000000000000000000000000000';
41 changes: 5 additions & 36 deletions src/plugins/oSnap/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,38 +300,14 @@ export type AssertionEvent = {
rejectedByOracle: boolean;
}

/**
* Represents the data associated with a proposal.
*
* Holds one object with this shape per proposal created. This is the shape of the data that is persisted by the plugin, along with information from the chain / graph about the Optimistic Oracle assertion associated with the proposal.
*
* We also include user data such as collateral balance and allowance so that we can determine if they can afford the bond associated with submitting a proposal.
*/
export type ProposalDetails = {
isInChallengePeriod: boolean;
isSettled: boolean;
isDisputed: boolean;
isExecuted: boolean;
}

export type ProposalStatus = 'live' | 'settled' | 'disputed' | 'executed';

export type OGModuleDetails = {
moduleAddress: string;
safeAddress: string;
oracleAddress: string;
rules: string;
minimumBond: BigNumber;
challengePeriod: BigNumber;
}

/**
* Combines the proposal details with the proposal id and explanation.
*/
export type ProposalExecutionDetails = ProposalDetails & {
proposalId: string;
explanation: string;
}

export type CollateralDetails = {
erc20Contract: Contract;
Expand All @@ -349,7 +325,7 @@ export type AssertionMadeEvent = {
callbackRecipient: string;
escalationManager: string;
caller: string;
expirationTime: string;
expirationTime: BigNumber;
currency: string;
bond: BigNumber;
identifier: string; // indexed
Expand Down Expand Up @@ -402,20 +378,13 @@ export type AssertionDetails = {
assertionLogIndex: string;
}
export type OGProposalState = {
status: 'ready-for-oo-assertion'
status: 'can-propose-to-og';
isDisputed: boolean;
} | AssertionDetails & {
status: 'in-oo-challenge-period';
expirationTime: number;
} | AssertionDetails & {
status: 'assertion-disputed-in-oo';
disputeHash: string;
} | AssertionDetails & {
status: 'assertion-passed-in-oo'
settlementHash: string;
} | AssertionDetails & {
status: 'assertion-failed-in-oo';
settlementHash: string;
} | AssertionDetails & {
status: 'can-request-tx-execution'
}| AssertionDetails & {
status: 'transactions-executed';
settlementHash: string;
}
Loading

0 comments on commit a9d5fb8

Please sign in to comment.