Skip to content

Commit 34346c4

Browse files
authored
Merge pull request #49 from kleros/release/xdai-chain
Release: xDAI Chain
2 parents dc353d0 + 15c660b commit 34346c4

File tree

23 files changed

+282
-108
lines changed

23 files changed

+282
-108
lines changed

netlify.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
IPFS_GATEWAY_ADDRESS='https://ipfs.kleros.io'
88
AVAILABLE_LANGUAGE_GROUP_PAIRS='["en|fr","en|es","en|pt","de|en","en|ru","en|tr","en|zh"]'
99
USER_SETTINGS_API_BASE_URLS='{"1":"https://iioeu1ljqf.execute-api.us-east-2.amazonaws.com/mainnet","77":"https://xa1qxy0wp6.execute-api.us-east-2.amazonaws.com/sokol"}'
10-
LINGUO_CONTRACT_ADDRESSES='{"1":{"de|en":["0x54f1f7b58c1Dc646a6c639C5d909B62652129b33","0x950f5AB863075C685227EfEDb41Ef167Be0099ad"],"en|es":["0x460f688f655610de5e3d92beb7892fa200b9060d","0xD8F8019c025C2Ba6745543D9a3C338DE1b98C103"],"en|fr":["0xFEe86325d5C96AE9E20EaBe7B157813c67bBccFA","0xf1A9589880DbF393F32A5b2d5a0054Fa10385074"],"en|ja":["0x5Cd1ff55282db11e526Fe13fA0F7C014f74acF11","0xc3162705Af0e10108FF837E450A14669b2711129"],"en|ko":["0xf8D4c1436ACA89A5DEEf36F06f662bAdfEb5AE63","0xFE721DD8Ac8e47A4228A6147A25C65136f213EaA"],"en|pt":["0x48032Ad54DB49d8E0d4f135A687b98E5731961f9","0x1c839fd542563182BFD0C337c8AaD1Be412F0fd2"],"en|ru":["0x0Bc3B51673dCdF3b45c628066761dA7331E8fBA2","0x464c84c41f3C25Ba5a75B006D8B20600A8777306"],"en|tr":["0xa3E4348BDDc32AfcedC5e088e0E21FD6154A0180","0x44863f5b7AAb7ceE181C0d84E244540125eF7AF7"],"en|zh":["0xaB0D90943A58b1A64c0171Ee8e743d9998Be6AC3","0xD67C12734dC12240a6324Db63ccd426964B71Fe7"]},"42":{"de|en":["0x8A4290298D65717a3BaEd546e4Ef9Eb2fe0b187D","0x5Af02E0E04c2042345E15Ed6dc7CC0c220f2C2Fa"],"en|es":["0x082aA0BeBE8C32042F77d123B6a657Fe907D8C33","0x6eb2D062E808a67828d27aD3926912C9309E5417"],"en|fr":["0x963Df99387a2b350264B5847ff9AbFF674e7BdFA","0x152c7F0948Fd0B2741a934aA7bfceB41cd4b5bFD"],"en|ja":["0x8B819D13d90Fcf9F0a235fe85d860E3C9763D470","0x033B08AAC5A3a2E7C306dd5Ee360904eC8d45DF6"],"en|ko":["0xe026cA59Bc31960D3060390D8667ceBc5D42B46d","0x499aD7D07f6EF0bD17656559312D0DdCBA0e79Ce"],"en|pt":["0xaD9Dec9c66cEbAa7e8624a528f65A3FA1Df8027d","0xb9534aB9b71e26949F9bdF9C05897Ee4619d144F"],"en|ru":["0xF4E6294201Ef99f1E83586Ef5AC8bCBaA4DB45CF","0x243a0431DE8d0B6D9837B53d3A10088b53B52918"],"en|tr":["0x10Dde936662A674F35ab36641017342B75Bb1D58","0xB93b8c9FD90724C036Ac56c5D3306333A67cFbFB"],"en|zh":["0xffb2BB47F4CD36426134706A849590471622519C","0xBc19B6fBAEEC0a2b50f3AD6F53b670ac03Bd1C6F"]},"77":{"de|en":["0x598fdd74b56F949cF84904D03B8774cb4F0e679C"],"en|es":["0x598fdd74b56F949cF84904D03B8774cb4F0e679C"],"en|fr":["0x598fdd74b56F949cF84904D03B8774cb4F0e679C"],"en|ja":["0x598fdd74b56F949cF84904D03B8774cb4F0e679C"],"en|ko":["0x598fdd74b56F949cF84904D03B8774cb4F0e679C"],"en|pt":["0x598fdd74b56F949cF84904D03B8774cb4F0e679C"],"en|ru":["0x598fdd74b56F949cF84904D03B8774cb4F0e679C"],"en|tr":["0x598fdd74b56F949cF84904D03B8774cb4F0e679C"],"en|zh":["0x598fdd74b56F949cF84904D03B8774cb4F0e679C"]}}'
10+
LINGUO_CONTRACT_ADDRESSES='{"1":{"de|en":["0x54f1f7b58c1Dc646a6c639C5d909B62652129b33","0x950f5AB863075C685227EfEDb41Ef167Be0099ad"],"en|es":["0x460f688f655610de5e3d92beb7892fa200b9060d","0xD8F8019c025C2Ba6745543D9a3C338DE1b98C103"],"en|fr":["0xFEe86325d5C96AE9E20EaBe7B157813c67bBccFA","0xf1A9589880DbF393F32A5b2d5a0054Fa10385074"],"en|ja":["0x5Cd1ff55282db11e526Fe13fA0F7C014f74acF11","0xc3162705Af0e10108FF837E450A14669b2711129"],"en|ko":["0xf8D4c1436ACA89A5DEEf36F06f662bAdfEb5AE63","0xFE721DD8Ac8e47A4228A6147A25C65136f213EaA"],"en|pt":["0x48032Ad54DB49d8E0d4f135A687b98E5731961f9","0x1c839fd542563182BFD0C337c8AaD1Be412F0fd2"],"en|ru":["0x0Bc3B51673dCdF3b45c628066761dA7331E8fBA2","0x464c84c41f3C25Ba5a75B006D8B20600A8777306"],"en|tr":["0xa3E4348BDDc32AfcedC5e088e0E21FD6154A0180","0x44863f5b7AAb7ceE181C0d84E244540125eF7AF7"],"en|zh":["0xaB0D90943A58b1A64c0171Ee8e743d9998Be6AC3","0xD67C12734dC12240a6324Db63ccd426964B71Fe7"]},"42":{"de|en":["0x8A4290298D65717a3BaEd546e4Ef9Eb2fe0b187D","0x5Af02E0E04c2042345E15Ed6dc7CC0c220f2C2Fa"],"en|es":["0x082aA0BeBE8C32042F77d123B6a657Fe907D8C33","0x6eb2D062E808a67828d27aD3926912C9309E5417"],"en|fr":["0x963Df99387a2b350264B5847ff9AbFF674e7BdFA","0x152c7F0948Fd0B2741a934aA7bfceB41cd4b5bFD"],"en|ja":["0x8B819D13d90Fcf9F0a235fe85d860E3C9763D470","0x033B08AAC5A3a2E7C306dd5Ee360904eC8d45DF6"],"en|ko":["0xe026cA59Bc31960D3060390D8667ceBc5D42B46d","0x499aD7D07f6EF0bD17656559312D0DdCBA0e79Ce"],"en|pt":["0xaD9Dec9c66cEbAa7e8624a528f65A3FA1Df8027d","0xb9534aB9b71e26949F9bdF9C05897Ee4619d144F"],"en|ru":["0xF4E6294201Ef99f1E83586Ef5AC8bCBaA4DB45CF","0x243a0431DE8d0B6D9837B53d3A10088b53B52918"],"en|tr":["0x10Dde936662A674F35ab36641017342B75Bb1D58","0xB93b8c9FD90724C036Ac56c5D3306333A67cFbFB"],"en|zh":["0xffb2BB47F4CD36426134706A849590471622519C","0xBc19B6fBAEEC0a2b50f3AD6F53b670ac03Bd1C6F"]},"77":{"de|en":["0x8539cb2fB9186f3DcF8F9A0AeD3De395Fd6d9870"],"en|es":["0x5a9F70ED50e16010f0B9d5bb5a3EFdb42fEcaD23"],"en|fr":["0x9CA979a165EF741BF120A3FEbb4F5C083De40708"],"en|ja":["0x753d611eAdF324B1f23A3A417BceB08eeda80ec6"],"en|ko":["0xC578de969Dd2A2a08d6Bd5A4F7AaA9b1a2e6A395"],"en|pt":["0x457b2BAb823c772fA4457517C97E6BF13065c21D"],"en|ru":["0x6cD5BAb73135966008d969bE23Ff940e6fa3Bb87"],"en|tr":["0xa9426b235E12897A99B015CbcF4D064e86fde418"],"en|zh":["0x09CE835FaB6051a18b2FC11743c01DAAD3122f1F"]},"100":{"de|en":["0xc3162705Af0e10108FF837E450A14669b2711129"],"en|es":["0xA2BfFF0553DE7405781FE0C39C04A383F04b9C80"],"en|fr":["0x464c84c41f3C25Ba5a75B006D8B20600A8777306"],"en|ja":["0x852550982e0984F9CCeF18a7276D35AFDc30242c"],"en|ko":["0xD67C12734dC12240a6324Db63ccd426964B71Fe7"],"en|pt":["0xFE721DD8Ac8e47A4228A6147A25C65136f213EaA"],"en|ru":["0x44863f5b7AAb7ceE181C0d84E244540125eF7AF7"],"en|tr":["0x1D48a279966f37385b4AB963530C6dC813b3A8Df"],"en|zh":["0x0B928165A67df8254412483ae8C3b8cc7F2b4D36"]}}'
1111

1212
[context.production.environment]
13-
DEFAULT_CHAIN_ID='1'
13+
DEFAULT_CHAIN_ID='100'
1414

1515
[[redirects]]
1616
from = "/*"

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
"@ethersproject/providers": "^5.0.14",
3737
"@ethersproject/solidity": "^5.0.5",
3838
"@hot-loader/react-dom": "^17.0.1",
39-
"@kleros/archon": "^1.2.0",
39+
"@kleros/archon": "^2.2.0",
4040
"@kleros/erc-792": "^7.0.0",
41-
"@kleros/linguo-contracts": "~0.4.0",
41+
"@kleros/linguo-contracts": "~0.5.0",
4242
"@kleros/react-components": "^6.0.0",
4343
"@loadable/component": "^5.12.0",
4444
"@reduxjs/toolkit": "^1.6.1",

src/app/MainRouter.jsx

Lines changed: 77 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
import React from 'react';
22
import t from 'prop-types';
3-
import { useSelector } from 'react-redux';
3+
import { useDispatch, useSelector } from 'react-redux';
44
import { Redirect, Route, Switch } from 'react-router-dom';
55
import loadable from '@loadable/component';
66
import { Layout } from 'antd';
77
import { ConnectedRouter } from 'connected-react-router';
8-
import { Spin } from '~/adapters/antd';
9-
import { selectPreference } from '~/features/ui/uiSlice';
8+
import { Alert, Spin } from '~/adapters/antd';
109
import DismissableAlert from '~/features/ui/DismissableAlert';
10+
import { selectPreference } from '~/features/ui/uiSlice';
11+
import { getNetworkName, useSwitchToChainFromUrl } from '~/features/web3';
12+
import { getCounterPartyChainId, isSupportedSideChain } from '~/features/web3/supportedChains';
1113
import Web3ErrorAlert from '~/features/web3/Web3ErrorAlert';
14+
import { selectChainId, switchChain } from '~/features/web3/web3Slice';
15+
import { WarningIcon } from '~/shared/icons';
16+
import Button from '~/shared/Button';
1217
import Footer from '~/shared/Footer';
1318
import { DrawerMenu } from '~/shared/Menu';
1419
import Navbar from '~/shared/Navbar';
1520
import { history } from '~/store';
1621
import Content from './Content';
1722
import * as r from './routes';
18-
import { useSwitchToChainFromUrl } from '~/features/web3';
1923

2024
const fallback = <Spin $centered tip="Loading page content..." />;
2125

@@ -47,41 +51,7 @@ export default function MainRouter() {
4751
position: relative;
4852
`}
4953
></div>
50-
<div
51-
css={`
52-
position: relative;
53-
54-
:empty {
55-
display: none;
56-
}
57-
58-
@media (max-width: 991.98px) {
59-
margin-bottom: 0.5rem;
60-
}
61-
62-
@media (max-width: 767.98px) {
63-
margin-bottom: 1rem;
64-
}
65-
66-
@media (max-width: 575.98px) {
67-
margin-bottom: 4.5rem;
68-
}
69-
`}
70-
>
71-
<DismissableAlert
72-
banner
73-
type="warning"
74-
id="global.betaWarning"
75-
message="This is a beta version, use at your own risk. Linguo is currently very sensitive to gas prices. An optimized version will be available soon."
76-
css={`
77-
position: absolute;
78-
z-index: 1;
79-
top: 0;
80-
left: 0;
81-
right: 0;
82-
`}
83-
/>
84-
</div>
54+
<GlobalWarnings />
8555
<Web3ErrorAlert />
8656
<Content>
8757
<Switch>
@@ -130,3 +100,71 @@ _RouterInitializer.propTypes = {
130100
};
131101

132102
const RouterInitializer = React.memo(_RouterInitializer);
103+
104+
function GlobalWarnings() {
105+
const dispatch = useDispatch();
106+
const chainId = useSelector(selectChainId);
107+
const counterPartyChainId = getCounterPartyChainId(chainId);
108+
109+
return (
110+
<div
111+
css={`
112+
position: relative;
113+
114+
:empty {
115+
display: none;
116+
}
117+
118+
@media (max-width: 991.98px) {
119+
margin-bottom: 0.5rem;
120+
}
121+
122+
@media (max-width: 767.98px) {
123+
margin-bottom: 1rem;
124+
}
125+
126+
@media (max-width: 575.98px) {
127+
margin-bottom: 2.5rem;
128+
}
129+
`}
130+
>
131+
{isSupportedSideChain(chainId) && (
132+
<DismissableAlert
133+
banner
134+
type="warning"
135+
id="global.betaWarning"
136+
message="Linguo is still in beta. Use it at your own risk."
137+
css={`
138+
position: absolute;
139+
z-index: 1;
140+
top: 0;
141+
left: 0;
142+
right: 0;
143+
`}
144+
/>
145+
)}
146+
{!isSupportedSideChain(chainId) && (
147+
<Alert
148+
banner
149+
type="warning"
150+
icon={<WarningIcon />}
151+
message={
152+
<>
153+
Linguo is moving to a side-chain for more affordable gas prices:{' '}
154+
<Button variant="link" onClick={() => dispatch(switchChain({ chainId: counterPartyChainId }))}>
155+
Switch to {getNetworkName(counterPartyChainId)}.
156+
</Button>
157+
</>
158+
}
159+
css={`
160+
position: absolute;
161+
z-index: 1;
162+
top: 0;
163+
left: 0;
164+
right: 0;
165+
`}
166+
/>
167+
)}
168+
</div>
169+
);
170+
}

src/features/linguo/api/createApiFacade.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import IArbitrator from '@kleros/erc-792/build/contracts/IArbitrator.json';
2-
import Linguo from '@kleros/linguo-contracts/artifacts/Linguo.json';
2+
import Linguo from '@kleros/linguo-contracts/artifacts/contracts/0.7.x/Linguo.sol/Linguo.json';
33
import { subtract } from '~/adapters/big-number';
44
import { combination } from '~/adapters/js-combinatorics';
55
import { withProvider } from '~/app/archon';

src/features/linguo/api/createContractApi.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,7 @@ const chainIdToCurrentEvidenceDisplayInterfaceURI = {
847847
1: '/ipfs/QmXGDMfcxjfQi5SFwpBSb73pPjoZq2N8c6eWCgxx8pVqj7/index.html',
848848
42: '/ipfs/QmYbtF7K6qCfSYfu2k6nYnVRY8HY97rEAF6mgBWtDgfovw/index.html',
849849
77: '/ipfs/Qmb5n6PgbshktJqGpwMAxP1moXEPaqq7ZvRufeXXhSPXxW/linguo-evidence-display/index.html',
850+
100: '/ipfs/Qmb5n6PgbshktJqGpwMAxP1moXEPaqq7ZvRufeXXhSPXxW/linguo-evidence-display/index.html',
850851
};
851852

852853
/**
@@ -856,12 +857,14 @@ const chainIdToValidEvidenceDisplayInterfaceURIs = {
856857
1: [chainIdToCurrentEvidenceDisplayInterfaceURI[1]],
857858
42: [chainIdToCurrentEvidenceDisplayInterfaceURI[42]],
858859
77: [chainIdToCurrentEvidenceDisplayInterfaceURI[77]],
860+
100: [chainIdToCurrentEvidenceDisplayInterfaceURI[100]],
859861
};
860862

861863
const chainIdToCurrentDynamicScriptURI = {
862864
1: '/ipfs/QmchWC6L3dT23wwQiJJLWCeS1EDnDYrLcYat93C4Lm4P4E/linguo-dynamic-script.js',
863865
42: '/ipfs/QmZFcqdsR76jyHyLsBefc4SBuegj2boBDr2skxGauM5DNf/linguo-dynamic-script.js',
864866
77: '/ipfs/QmPAHCRtSU844fdjNoEws8AgTpzzwsYwMF2wydtpvXAcoZ/linguo-script.js',
867+
100: '/ipfs/QmPAHCRtSU844fdjNoEws8AgTpzzwsYwMF2wydtpvXAcoZ/linguo-script.js',
865868
};
866869

867870
/**
@@ -871,6 +874,7 @@ const chainIdToValidDynamicScriptURIs = {
871874
1: [chainIdToCurrentDynamicScriptURI[1]],
872875
42: [chainIdToCurrentDynamicScriptURI[42]],
873876
77: [chainIdToCurrentDynamicScriptURI[77]],
877+
100: [chainIdToCurrentDynamicScriptURI[100]],
874878
};
875879

876880
const getFileTypeFromPath = path => (path ?? '').split('.').slice(-1)?.[0];

src/features/requester/requesterSlice.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ export default createPersistedReducer(requesterSlice.reducer);
9292
export const selectStatusFilter = state => state.requester.tasks?.filters?.status ?? statusFilters.all;
9393

9494
const selectLoadingState = (state, { account = null, chainId }) =>
95-
state.requester.tasks.byAccount[account]?.byChainId[chainId]?.loadingState ?? 'idle';
95+
state.requester.tasks.byAccount[account]?.byChainId?.[chainId]?.loadingState ?? 'idle';
9696

9797
export const selectIsIdle = createSelector([selectLoadingState], loadingState => loadingState === 'idle');
9898
export const selectIsLoading = createSelector([selectLoadingState], loadingState => loadingState === 'loading');
9999
export const selectHasSucceeded = createSelector([selectLoadingState], loadingState => loadingState === 'succeeded');
100100
export const selectHasFailed = createSelector([selectLoadingState], loadingState => loadingState === 'failed');
101101

102102
export const selectAllTasks = (state, { account, chainId }) => {
103-
const taskIds = state.requester.tasks.byAccount[account]?.byChainId[chainId]?.ids ?? [];
103+
const taskIds = state.requester.tasks.byAccount[account]?.byChainId?.[chainId]?.ids ?? [];
104104
return selectAllFilterByIds(taskIds)(state);
105105
};
106106

src/features/tasks/TaskStatusFilter.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,27 @@ import styled from 'styled-components';
44
import { Badge, Select } from 'antd';
55
import theme from '~/features/ui/theme';
66

7-
export default function TaskStatusFilter({ fullWidth, onChange, defaultValue }) {
7+
export default function TaskStatusFilter({ fullWidth, onChange, value, defaultValue }) {
8+
const controlledProps = value !== undefined ? { value } : {};
9+
810
return (
911
<StyledSelect
1012
filterOption={false}
1113
size="large"
1214
listHeight={368}
1315
dropdownRender={menu => <StyledItemWrapper>{menu}</StyledItemWrapper>}
1416
$fullWidth={fullWidth}
15-
onChange={onChange}
1617
defaultValue={defaultValue}
18+
onChange={onChange}
1719
options={filterOptions}
20+
{...controlledProps}
1821
/>
1922
);
2023
}
2124

2225
TaskStatusFilter.propTypes = {
2326
onChange: t.func,
27+
value: t.string,
2428
defaultValue: t.string,
2529
fullWidth: t.bool,
2630
};

src/features/transactions/transactionsSlice.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ function* createTxNotification(
403403
template: {
404404
id: 'link',
405405
params: {
406-
text: 'View on Etherscan',
406+
text: 'View on Block Explorer',
407407
url,
408408
},
409409
},

src/features/translator/tasksSlice.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export const selectStatusFilter = state => state.filters?.status ?? statusFilter
8080
export const selectAllTasksFilter = state => state.filters?.allTasks ?? false;
8181

8282
export const selectLoadingState = (state, { account = null, chainId }) =>
83-
state.byAccount[account]?.byChainId[chainId]?.loadingState ?? 'idle';
83+
state.byAccount[account]?.byChainId?.[chainId]?.loadingState ?? 'idle';
8484
export const selectIsIdle = (state, { account, chainId }) => selectLoadingState(state, { account, chainId }) === 'idle';
8585
export const selectIsLoading = (state, { account, chainId }) =>
8686
selectLoadingState(state, { account, chainId }) === 'loading';
@@ -89,7 +89,7 @@ export const selectHasFetched = (state, { account, chainId }) =>
8989
export const selectHasFailed = (state, { account, chainId }) =>
9090
selectLoadingState(state, { account, chainId }) === 'failed';
9191

92-
export const selectTaskIds = (state, { account, chainId }) => state.byAccount[account]?.byChainId[chainId]?.ids ?? [];
92+
export const selectTaskIds = (state, { account, chainId }) => state.byAccount[account]?.byChainId?.[chainId]?.ids ?? [];
9393

9494
export const selectors = {
9595
selectStatusFilter,

src/features/ui/uiSlice.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ const { set } = preferences.actions;
3131

3232
export { dismiss as dismissAlert, notify, close as closeNotification, set as setPreference };
3333

34-
export const selectAlertIsVisible = id => state => alerts.selectors.selectIsVisible(id)(state.ui.alerts);
35-
export const selectPreference = key => state => preferences.selectors.selectByKey(key)(state.ui.preferences);
34+
export const selectAlertIsVisible = id => state => alerts.selectors.selectIsVisible(id)(state.ui.alerts ?? {});
35+
export const selectPreference = key => state => preferences.selectors.selectByKey(key)(state.ui.preferences ?? {});
3636

3737
export const sagas = {
3838
...popupNotifications.sagas,

0 commit comments

Comments
 (0)