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
4 changes: 3 additions & 1 deletion src/components/LivenessProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface Props {
endTime: number;
fontSize?: number;
marginBottom?: number;
endedLabel?: string;
}
/**
* A progress bar that shows the time remaining until a request or assertion
Expand All @@ -24,6 +25,7 @@ export function LivenessProgressBar({
endTime,
fontSize,
marginBottom,
endedLabel = "Ended",
}: Props) {
const [now, setNow] = useState(new Date());

Expand Down Expand Up @@ -67,7 +69,7 @@ export function LivenessProgressBar({
} as CSSProperties
}
>
{isEnded ? "Ended" : timeRemainingString}
{isEnded ? endedLabel : timeRemainingString}
</Text>
<_Root value={normalizedPercent}>
<_Indicator
Expand Down
9 changes: 8 additions & 1 deletion src/components/OracleQueryList/ItemDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export function ItemDetails({
reward,
valueText,
proposeOptions,
oracleType,
} = item;
const isManaged = oracleType === "Managed Optimistic Oracle V2";

const valuesToShow = Array.isArray(valueText)
? valueText
Expand Down Expand Up @@ -55,12 +57,17 @@ export function ItemDetails({
{livenessEndsMilliseconds !== undefined &&
timeMilliseconds !== undefined ? (
<ItemDetailsInnerWrapper>
<ItemDetailsText>Challenge Period Left</ItemDetailsText>
<ItemDetailsText>
{isManaged
? "Minimum Challenge Period Left"
: "Challenge Period Left"}
</ItemDetailsText>
<LivenessProgressBar
startTime={timeMilliseconds}
endTime={livenessEndsMilliseconds}
fontSize={12}
marginBottom={0}
endedLabel={isManaged ? "Challenge Period Extended" : undefined}
/>
</ItemDetailsInnerWrapper>
) : undefined}
Expand Down
2 changes: 1 addition & 1 deletion src/components/OracleQueryTable/Headers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import styled from "styled-components";
* @param page - the page of the app, used to determine which columns to show
*/
export function Headers({ page }: { page: PageName }) {
const verify = ["Query", "Proposal", "Bond", "Challenge period left"];
const verify = ["Query", "Proposal", "Bond", "Minimum challenge period left"];

const propose = ["Query", "Type", "Bond", "Reward"];

Expand Down
3 changes: 3 additions & 0 deletions src/components/OracleQueryTable/VerifyCells.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export function VerifyCells({
bond,
chainId,
tokenAddress,
oracleType,
}: OracleQueryUI) {
const isManaged = oracleType === "Managed Optimistic Oracle V2";
const valuesToShow = Array.isArray(valueText)
? valueText
: [maybeGetValueTextFromOptions(valueText, proposeOptions)];
Expand Down Expand Up @@ -48,6 +50,7 @@ export function VerifyCells({
<LivenessProgressBar
startTime={timeMilliseconds}
endTime={livenessEndsMilliseconds}
endedLabel={isManaged ? "Challenge Period Extended" : undefined}
/>
</TD>
) : undefined}
Expand Down
6 changes: 5 additions & 1 deletion src/components/Panel/Actions/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ export function Details({
formattedLivenessEndsIn,
tokenAddress,
chainId,
oracleType,
}: OracleQueryUI) {
const hasReward = reward !== null;
const isManaged = oracleType === "Managed Optimistic Oracle V2";

return (
<div className="mb-4 bg-white rounded-md py-2 px-3">
Expand Down Expand Up @@ -45,7 +47,9 @@ export function Details({
)}
<TextWrapper>
<Text>
Challenge period ends
{isManaged
? "Minimum challenge period ends"
: "Challenge period ends"}
<InformationIcon content={livenessInformation} />
</Text>
<Text>{formattedLivenessEndsIn}</Text>
Expand Down
12 changes: 10 additions & 2 deletions src/helpers/converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type {
Assertion,
ChainId,
ChainName,
OracleType,
ParsedOOV1GraphEntity,
ParsedOOV2GraphEntity,
Request,
Expand Down Expand Up @@ -146,7 +147,10 @@ export function isSupportedChain(chainId: number): chainId is ChainId {
return chainId in chainsById;
}

function getRequestActionType(state: RequestState | undefined): ActionType {
function getRequestActionType(
state: RequestState | undefined,
oracleType: OracleType,
): ActionType {
// goes to `propose` page
if (state === "Requested") {
return "propose";
Expand All @@ -155,6 +159,10 @@ function getRequestActionType(state: RequestState | undefined): ActionType {
if (state === "Proposed") {
return "dispute";
}
// MOOv2 requests may still be disputed after challenge period ends
if (state === "Expired" && oracleType === "Managed Optimistic Oracle V2") {
return "dispute";
}
// also goes to `verify` page
if (state === "Disputed" || state === "Expired") {
return "settle";
Expand Down Expand Up @@ -696,7 +704,7 @@ export function requestToOracleQuery(request: Request): OracleQueryUI {
oracleType,
oracleAddress,
chainName: getChainName(chainId),
actionType: getRequestActionType(state),
actionType: getRequestActionType(state, oracleType),
moreInformation: [],
project: "Unknown",
};
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export function isValidChainId(
export function isValidOracleType(
oracleType: string | undefined,
): oracleType is OracleType {
return !!oracleType && oracleType in oracleTypes;
return !!oracleType && oracleTypes.includes(oracleType as OracleType);
}

export function isWagmiAddress(
Expand Down