diff --git a/README.md b/README.md
index bba6d805..6fcb5d03 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
-
+
## Get Started
@@ -42,4 +42,4 @@ When setting up the repo for publishing on netlify:
REACT_APP_RPC_URLS
REACT_APP_FORMATIC_API_KEYS
REACT_APP_NOTIFICATIONS_API_URL
-```
\ No newline at end of file
+```
diff --git a/src/hooks/appeal-time.js b/src/hooks/appeal-time.js
index 1a07cab0..ff8cd0f2 100644
--- a/src/hooks/appeal-time.js
+++ b/src/hooks/appeal-time.js
@@ -1,22 +1,16 @@
import { useMemo } from 'react'
import { DISPUTE_STATUS } from '../utils/item-status'
-import { bigNumberify } from 'ethers/utils'
const useAppealTime = item =>
useMemo(() => {
if (!item || item.disputeStatus !== DISPUTE_STATUS.APPEALABLE) return {}
- const { appealStart, appealEnd } = item
- const appealDuration = appealEnd.sub(appealStart)
- const appealEndLoser = appealStart.add(appealDuration.div(bigNumberify(2)))
+ const { appealEnd } = item
const appealRemainingTime =
appealEnd.toNumber() * 1000 - Math.floor(Date.now())
- const appealRemainingTimeLoser =
- appealEndLoser.toNumber() * 1000 - Math.floor(Date.now())
return {
- appealRemainingTime,
- appealRemainingTimeLoser
+ appealRemainingTime
}
}, [item])
diff --git a/src/pages/item-details/crowdfunding-card.js b/src/pages/item-details/crowdfunding-card.js
index bec6a7b7..acd8e48f 100644
--- a/src/pages/item-details/crowdfunding-card.js
+++ b/src/pages/item-details/crowdfunding-card.js
@@ -1,19 +1,17 @@
import React, { useContext } from 'react'
-import { Card, Typography, Progress } from 'antd'
+import { Card, Typography } from 'antd'
import styled from 'styled-components/macro'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import {
DISPUTE_STATUS,
- PARTY,
itemToStatusCode,
STATUS_CODE
} from 'utils/item-status'
import { TCRViewContext } from 'contexts/tcr-view-context'
-import useRequiredFees from 'hooks/required-fees'
-import { formatEther } from 'ethers/utils'
import itemPropType from 'prop-types/item'
import BNPropType from 'prop-types/bn'
-import useNativeCurrency from 'hooks/native-currency'
+import { WalletContext } from 'contexts/wallet-context'
+import getNetworkEnv from 'utils/network-env'
const StyledCard = styled(Card)`
background: linear-gradient(111.6deg, #4d00b4 46.25%, #6500b4 96.25%);
@@ -57,34 +55,14 @@ const StyledIcon = styled(FontAwesomeIcon)`
margin: 12px;
`
-const CrowdfundingCard = ({ item, timestamp }) => {
- const {
- challengePeriodDuration,
- sharedStakeMultiplier,
- winnerStakeMultiplier,
- loserStakeMultiplier,
- MULTIPLIER_DIVISOR
- } = useContext(TCRViewContext)
- const nativeCurrency = useNativeCurrency()
-
- const requesterFees = useRequiredFees({
- side: PARTY.REQUESTER,
- sharedStakeMultiplier,
- winnerStakeMultiplier,
- loserStakeMultiplier,
- currentRuling: item && item.currentRuling,
- item,
- MULTIPLIER_DIVISOR
- })
- const challengerFees = useRequiredFees({
- side: PARTY.CHALLENGER,
- sharedStakeMultiplier,
- winnerStakeMultiplier,
- loserStakeMultiplier,
- currentRuling: item && item.currentRuling,
- item,
- MULTIPLIER_DIVISOR
- })
+const CrowdfundingCard = ({ item, timestamp, request }) => {
+ const { networkId } = useContext(WalletContext)
+ const { arbitrator: klerosAddress, uiURL } =
+ getNetworkEnv('REACT_APP_KLEROS_ADDRESSES', networkId) || {}
+
+ const { disputeID, arbitrator } = request || {}
+
+ const { challengePeriodDuration } = useContext(TCRViewContext)
if (
!item ||
@@ -93,93 +71,37 @@ const CrowdfundingCard = ({ item, timestamp }) => {
)
return null
- const { hasPaid, amountPaid, currentRuling } = item
-
- if (
- !requesterFees ||
- !challengerFees ||
- !challengerFees.requiredForSide ||
- !challengerFees.potentialReward ||
- !requesterFees.requiredForSide ||
- !requesterFees.potentialReward
- )
- return null
-
const statusCode = itemToStatusCode(item, timestamp, challengePeriodDuration)
if (statusCode === STATUS_CODE.WAITING_ENFORCEMENT) return null
- const requesterPercentage =
- amountPaid[PARTY.REQUESTER]
- .mul(MULTIPLIER_DIVISOR)
- .div(requesterFees.requiredForSide)
- .toNumber() / 100
- const challengerPercentage =
- amountPaid[PARTY.CHALLENGER]
- .mul(MULTIPLIER_DIVISOR)
- .div(challengerFees.requiredForSide)
- .toNumber() / 100
-
return (
- Appeal Crowdfunding
+ Appeal Phase
Contribute appeal fees and earn rewards if the side you back wins
- the round
-
-
-
-
- Submitter
-
-
-
-
- {hasPaid[PARTY.REQUESTER]
- ? `Submitter funded. The challenger must now fully fund his side of the appeal before the deadline in order not to lose the dispute.`
- : `Contribute arbitration fees to the submitter's appeal for a chance to win at most ${formatEther(
- requesterFees.potentialReward
- )} ${nativeCurrency}.`}
-
-
-
-
- Challenger
-
-
-
-
- {hasPaid[PARTY.CHALLENGER]
- ? 'Challenger fully funded. The submitter must now fully fund his side of the appeal before the deadline in order not to lose the dispute.'
- : `Contribute arbitration fees to the challenger's appeal for a chance to win at most ${formatEther(
- challengerFees.potentialReward
- )} ${nativeCurrency}.`}
-
-
-
-
-
- {currentRuling === PARTY.NONE
- ? 'The arbitrator did not give a decisive ruling. If a party fully funds his side of an appeal, the other must also fund in order to not lose the dispute.'
- : `If the ${
- currentRuling === PARTY.REQUESTER ? 'challenger' : 'submitter'
- } fully funds his side of the appeal, the ${
- currentRuling === PARTY.REQUESTER ? 'submitter' : 'challenger'
- } must also fund his side of the appeal in order not to lose the case.`}
+ the round.
+ {klerosAddress.toLowerCase() === arbitrator.toLowerCase() ? (
+
+ Please{' '}
+
+ go to the Kleros Court
+ {' '}
+ to manage this step.
+
+ ) : (
+
+ The arbitrator that rules the inclusion of this item is not
+ compatible with Kleros Court. If you wanted to appeal, please
+ request assistance in Telegram.
+
+ )}
diff --git a/src/pages/item-details/index.js b/src/pages/item-details/index.js
index 4f25abdf..4a873054 100644
--- a/src/pages/item-details/index.js
+++ b/src/pages/item-details/index.js
@@ -333,7 +333,12 @@ const ItemDetails = ({ itemID, search }) => {
itemMetaEvidence={itemMetaEvidence}
/>
{/* Crowdfunding card is only rendered if the item has an appealable dispute. */}
-
+ {/* V2 arbitrator handles appeals internally, so appeal logic is removed. */}
+
{/* Spread the `requests` parameter to convert elements from array to an object */}
)}
- {/* Decisive ruling winner countdown. */}
- {currentRuling !== PARTY.NONE &&
- (statusCode === STATUS_CODE.CROWDFUNDING ||
- statusCode === STATUS_CODE.CROWDFUNDING_WINNER) && (
-
- {appealCountdown}
-
- )}
- {/* Decisive ruling loser countdown. */}
- {currentRuling !== PARTY.NONE &&
- statusCode === STATUS_CODE.CROWDFUNDING && (
-
- {appealLoserCountdown}
-
- )}
{/* Only render modal if the item status requires it. */}
diff --git a/src/pages/light-item-details/crowdfunding-card.js b/src/pages/light-item-details/crowdfunding-card.js
index d74016f5..25d98d8b 100644
--- a/src/pages/light-item-details/crowdfunding-card.js
+++ b/src/pages/light-item-details/crowdfunding-card.js
@@ -1,19 +1,17 @@
import React, { useContext } from 'react'
-import { Card, Typography, Progress } from 'antd'
+import { Card, Typography } from 'antd'
import styled from 'styled-components/macro'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import {
DISPUTE_STATUS,
- PARTY,
itemToStatusCode,
STATUS_CODE
} from 'utils/item-status'
import { LightTCRViewContext } from 'contexts/light-tcr-view-context'
-import useRequiredFees from 'hooks/required-fees'
-import { formatEther } from 'ethers/utils'
import itemPropType from 'prop-types/item'
import BNPropType from 'prop-types/bn'
-import useNativeCurrency from 'hooks/native-currency'
+import { WalletContext } from 'contexts/wallet-context'
+import getNetworkEnv from 'utils/network-env'
const StyledCard = styled(Card)`
background: linear-gradient(111.6deg, #4d00b4 46.25%, #6500b4 96.25%);
@@ -57,34 +55,14 @@ const StyledIcon = styled(FontAwesomeIcon)`
margin: 12px;
`
-const CrowdfundingCard = ({ item, timestamp }) => {
- const {
- challengePeriodDuration,
- sharedStakeMultiplier,
- winnerStakeMultiplier,
- loserStakeMultiplier,
- MULTIPLIER_DIVISOR
- } = useContext(LightTCRViewContext)
- const nativeCurrency = useNativeCurrency()
-
- const requesterFees = useRequiredFees({
- side: PARTY.REQUESTER,
- sharedStakeMultiplier,
- winnerStakeMultiplier,
- loserStakeMultiplier,
- currentRuling: item && item.currentRuling,
- item,
- MULTIPLIER_DIVISOR
- })
- const challengerFees = useRequiredFees({
- side: PARTY.CHALLENGER,
- sharedStakeMultiplier,
- winnerStakeMultiplier,
- loserStakeMultiplier,
- currentRuling: item && item.currentRuling,
- item,
- MULTIPLIER_DIVISOR
- })
+const CrowdfundingCard = ({ item, timestamp, request }) => {
+ const { networkId } = useContext(WalletContext)
+ const { arbitrator: klerosAddress, uiURL } =
+ getNetworkEnv('REACT_APP_KLEROS_ADDRESSES', networkId) || {}
+
+ const { disputeID, arbitrator } = request || {}
+
+ const { challengePeriodDuration } = useContext(LightTCRViewContext)
if (
!item ||
@@ -93,93 +71,37 @@ const CrowdfundingCard = ({ item, timestamp }) => {
)
return null
- const { hasPaid, amountPaid, currentRuling } = item
-
- if (
- !requesterFees ||
- !challengerFees ||
- !challengerFees.requiredForSide ||
- !challengerFees.potentialReward ||
- !requesterFees.requiredForSide ||
- !requesterFees.potentialReward
- )
- return null
-
const statusCode = itemToStatusCode(item, timestamp, challengePeriodDuration)
if (statusCode === STATUS_CODE.WAITING_ENFORCEMENT) return null
- const requesterPercentage =
- amountPaid[PARTY.REQUESTER]
- .mul(MULTIPLIER_DIVISOR)
- .div(requesterFees.requiredForSide)
- .toNumber() / 100
- const challengerPercentage =
- amountPaid[PARTY.CHALLENGER]
- .mul(MULTIPLIER_DIVISOR)
- .div(challengerFees.requiredForSide)
- .toNumber() / 100
-
return (
- Appeal Crowdfunding
+ Appeal Phase
Contribute appeal fees and earn rewards if the side you back wins
- the round
-
-
-
-
- Submitter
-
-
-
-
- {hasPaid[PARTY.REQUESTER]
- ? `Submitter funded. The challenger must now fully fund his side of the appeal before the deadline in order not to lose the dispute.`
- : `Contribute arbitration fees to the submitter's appeal for a chance to win at most ${formatEther(
- requesterFees.potentialReward
- )} ${nativeCurrency}.`}
-
-
-
-
- Challenger
-
-
-
-
- {hasPaid[PARTY.CHALLENGER]
- ? 'Challenger fully funded. The submitter must now fully fund his side of the appeal before the deadline in order not to lose the dispute.'
- : `Contribute arbitration fees to the challenger's appeal for a chance to win at most ${formatEther(
- challengerFees.potentialReward
- )} ${nativeCurrency}.`}
-
-
-
-
-
- {currentRuling === PARTY.NONE
- ? 'The arbitrator did not give a decisive ruling. If a party fully funds his side of an appeal, the other must also fund in order to not lose the dispute.'
- : `If the ${
- currentRuling === PARTY.REQUESTER ? 'challenger' : 'submitter'
- } fully funds his side of the appeal, the ${
- currentRuling === PARTY.REQUESTER ? 'submitter' : 'challenger'
- } must also fund his side of the appeal in order not to lose the case.`}
+ the round.
+ {klerosAddress.toLowerCase() === arbitrator.toLowerCase() ? (
+
+ Please{' '}
+
+ go to the Kleros Court
+ {' '}
+ to manage this step.
+
+ ) : (
+
+ The arbitrator that rules the inclusion of this item is not
+ compatible with Kleros Court. If you wanted to appeal, please
+ request assistance in Telegram.
+
+ )}
diff --git a/src/pages/light-item-details/index.js b/src/pages/light-item-details/index.js
index d0fff4a1..39293e24 100644
--- a/src/pages/light-item-details/index.js
+++ b/src/pages/light-item-details/index.js
@@ -346,8 +346,12 @@ const ItemDetails = ({ itemID, search }) => {
itemMetaEvidence={itemMetaEvidence}
/>
{/* Crowdfunding card is only rendered if the item has an appealable dispute. */}
-
-
+ {/* V2 arbitrator handles appeals internally, so appeal logic is removed. */}
+
{/* Spread the `requests` parameter to convert elements from array to an object */}
)}
- {/* Decisive ruling winner countdown. */}
- {currentRuling !== PARTY.NONE &&
- (statusCode === STATUS_CODE.CROWDFUNDING ||
- statusCode === STATUS_CODE.CROWDFUNDING_WINNER) && (
-
- {appealCountdown}
-
- )}
- {/* Decisive ruling loser countdown. */}
- {currentRuling !== PARTY.NONE &&
- statusCode === STATUS_CODE.CROWDFUNDING && (
-
- {appealLoserCountdown}
-
- )}
{/* Only render modal if the item status requires it. */}
diff --git a/src/utils/item-status.js b/src/utils/item-status.js
index ef7cf53f..ea0af7d5 100644
--- a/src/utils/item-status.js
+++ b/src/utils/item-status.js
@@ -139,7 +139,6 @@ export const itemToStatusCode = (
disputed,
submissionTime,
disputeStatus,
- hasPaid,
currentRuling,
appealStart,
appealEnd
@@ -177,18 +176,7 @@ export const itemToStatusCode = (
// Arbitrator gave a decisive ruling (i.e. Ruled in favor of either the requester or challenger).
if (timestamp.gt(appealEnd)) return STATUS_CODE.WAITING_ARBITRATOR
- const appealPeriodDuration = appealEnd.sub(appealStart)
- const appealHalfTime = appealStart.add(
- appealPeriodDuration.div(bigNumberify(2))
- )
- if (timestamp.lt(appealHalfTime)) return STATUS_CODE.CROWDFUNDING // In first half of appeal period
-
- // If the party that lost the previous round is not fully funded
- // before the end of the first half, the dispute is over
- // and awaits enforecement.
- const loser =
- currentRuling === PARTY.REQUESTER ? PARTY.CHALLENGER : PARTY.REQUESTER
- if (hasPaid[loser]) return STATUS_CODE.CROWDFUNDING_WINNER
- else return STATUS_CODE.WAITING_ENFORCEMENT
+
+ return STATUS_CODE.CROWDFUNDING
}
}