Skip to content
Merged
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
2 changes: 2 additions & 0 deletions subgraph/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interface DisputeKitDispute {
coreDispute: Dispute!
localRounds: [DisputeKitRound!]! @derivedFrom(field: "localDispute")
currentLocalRoundIndex: BigInt!
timestamp: BigInt!
}

interface DisputeKitRound {
Expand Down Expand Up @@ -236,6 +237,7 @@ type ClassicDispute implements DisputeKitDispute @entity {
coreDispute: Dispute!
localRounds: [DisputeKitRound!]! @derivedFrom(field: "localDispute")
currentLocalRoundIndex: BigInt!
timestamp: BigInt!

numberOfChoices: BigInt!
extraData: Bytes!
Expand Down
1 change: 1 addition & 0 deletions subgraph/src/entities/ClassicDispute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ export function createClassicDisputeFromEvent(event: DisputeCreation): void {
classicDispute.currentLocalRoundIndex = ZERO;
classicDispute.numberOfChoices = event.params._numberOfChoices;
classicDispute.extraData = event.params._extraData;
classicDispute.timestamp = event.block.timestamp;
classicDispute.save();
}
13 changes: 10 additions & 3 deletions web/src/hooks/queries/useClassicAppealQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { graphqlQueryFnHelper } from "utils/graphqlQueryFnHelper";
export type { ClassicAppealQuery };

const classicAppealQuery = graphql(`
query ClassicAppeal($disputeID: ID!) {
query ClassicAppeal($disputeID: ID!, $orderBy: DisputeKitDispute_orderBy, $orderDirection: OrderDirection) {
dispute(id: $disputeID) {
period
court {
Expand All @@ -16,7 +16,7 @@ const classicAppealQuery = graphql(`
id
}
lastPeriodChange
disputeKitDispute {
disputeKitDispute(orderBy: $orderBy, orderDirection: $orderDirection) {
id
currentLocalRoundIndex
localRounds {
Expand All @@ -37,6 +37,13 @@ export const useClassicAppealQuery = (id?: string | number) => {
return useQuery<ClassicAppealQuery>({
queryKey: ["refetchOnBlock", `classicAppealQuery${id}`],
enabled: isEnabled,
queryFn: async () => await graphqlQueryFnHelper(classicAppealQuery, { disputeID: id?.toString() }),
queryFn: async () =>
isEnabled
? await graphqlQueryFnHelper(classicAppealQuery, {
disputeID: id?.toString(),
orderBy: "timestamp",
orderDirection: "asc",
})
: undefined,
});
};
2 changes: 1 addition & 1 deletion web/src/hooks/useClassicAppealContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const getCurrentLocalRound = (dispute?: ClassicAppealQuery["dispute"]) => {
if (!dispute) return undefined;

const period = dispute.period;
const currentLocalRoundIndex = dispute.disputeKitDispute?.currentLocalRoundIndex;
const currentLocalRoundIndex = dispute.disputeKitDispute.at(-1)?.currentLocalRoundIndex;
const adjustedRoundIndex = ["appeal", "execution"].includes(period)
? currentLocalRoundIndex
: currentLocalRoundIndex - 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
useOptionsContext,
useSelectedOptionContext,
} from "hooks/useClassicAppealContext";
import { isUndefined } from "utils/index";
import { formatUnitsWei } from "utils/format";

const Container = styled.div`
Expand All @@ -30,14 +31,15 @@ const StageOne: React.FC<IStageOne> = ({ setAmount }) => {
const options = useOptionsContext();
const loserSideCountdown = useLoserSideCountdownContext();
const { selectedOption, setSelectedOption } = useSelectedOptionContext();

return (
<Container>
<StageExplainer {...{ loserSideCountdown }} />
<label> Which option do you want to fund? </label>
<OptionsContainer>
{typeof paidFees !== "undefined" &&
typeof winnerRequiredFunding !== "undefined" &&
typeof loserRequiredFunding !== "undefined" &&
{!isUndefined(paidFees) &&
!isUndefined(winnerRequiredFunding) &&
!isUndefined(loserRequiredFunding) &&
options?.map((answer: string, i: number) => {
const requiredFunding = i.toString() === winningChoice ? winnerRequiredFunding : loserRequiredFunding;
return (
Expand Down