Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
54 changes: 0 additions & 54 deletions .env

This file was deleted.

3 changes: 0 additions & 3 deletions .env.development

This file was deleted.

31 changes: 31 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Backend
REACT_APP_USER_SETTINGS_URL=
REACT_APP_JUSTIFICATIONS_URL=https://kleros-api.netlify.app/.netlify/functions
REACT_APP_METAEVIDENCE_URL=https://kleros-api.netlify.app/.netlify/functions/get-dispute-metaevidence


# Mainnet
REACT_APP_WEB3_FALLBACK_MAINNET_URL=wss://...
REACT_APP_WEB3_FALLBACK_MAINNET_HTTPS_URL=https://...

# Gnosis
REACT_APP_WEB3_FALLBACK_GNOSIS_URL=wss://...
REACT_APP_WEB3_FALLBACK_GNOSIS_HTTPS_URL=https://...

# Goerli
REACT_APP_WEB3_FALLBACK_GOERLI_URL=wss://...
REACT_APP_WEB3_FALLBACK_GOERLI_HTTPS_URL=https://...

# Chiado
REACT_APP_WEB3_FALLBACK_CHIADO_URL=wss://...
REACT_APP_WEB3_FALLBACK_CHIADO_HTTPS_URL=https://...

# Sepolia
REACT_APP_WEB3_FALLBACK_SEPOLIA_URL=wss://...
REACT_APP_WEB3_FALLBACK_SEPOLIA_HTTPS_URL=https://...

# Polygon
REACT_APP_WEB3_FALLBACK_POLYGON_HTTPS_URL=https://...

# Mumbai
REACT_APP_WEB3_FALLBACK_MUMBAI_HTTPS_URL=https://...
3 changes: 0 additions & 3 deletions .env.production

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The Kleros Court user interface.
3. Configure MetaMask on the Goerli Test Network.
4. Run `yarn` to install dependencies and then `yarn start` to start the dev server.

> To allow view-only mode, you can the REACT_APP_WEB3_FALLBACK_URL variable to a provider of your choice. Example: REACT_APP_WEB3_FALLBACK_URL=wss://mainnet.infura.io/ws/v3/<api-key>
> To allow view-only mode, you can the REACT_APP_WEB3_FALLBACK_MAINNET_URL variable to a provider of your choice. Example: REACT_APP_WEB3_FALLBACK_MAINNET_URL=wss://mainnet.infura.io/ws/v3/<api-key>

## Other Scripts

Expand Down
60 changes: 0 additions & 60 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,68 +3,8 @@
NODE_VERSION='16.20.2'
REACT_APP_CONTEXT='staging'

REACT_APP_KLEROS_ADDRESS='0x211f01e59b425253c0a0e9a7bf612605b42ce82c'
REACT_APP_KLEROS_LIQUID_ADDRESS='0x988b3a538b618c7a603e1c11ab82cd16dbe28069'
REACT_APP_KLEROS_LIQUID_EXTRA_VIEWS_ADDRESS='0x2B562ea613ad2f58746935C842d09EB147E1E940'
REACT_APP_PINAKION_ADDRESS='0x93ed3fbe21207ec2e8f2d3c3de6e058cb73bc04d'
REACT_APP_POLICY_REGISTRY_ADDRESS='0xCf1f07713d5193FaE5c1653C9f61953D048BECe4'
REACT_APP_UNISWAP_EXCHANGE_ADDRESS='0xF506828B166de88cA2EDb2A98D960aBba0D2402A'
REACT_APP_TOKEN_BRIDGE_ADDRESS='0x88ad09518695c6c3712AC10a214bE5109a655671'
REACT_APP_DRAW_EVENT_LISTENER_BLOCK_NUMBER='7303699'
REACT_APP_USER_SETTINGS_URL='https://8aoprv935h.execute-api.us-east-2.amazonaws.com/staging/user-settings'
REACT_APP_JUSTIFICATIONS_URL='https://kleros-api.netlify.app/.netlify/functions'
REACT_APP_METAEVIDENCE_URL='https://kleros-api.netlify.app/.netlify/functions/get-dispute-metaevidence'
REACT_APP_APPLICATION_SERVER_KEY='BNqPp3phfZUqu4G1SCkqNuZ_FDL4YuSeAEV97U_G3UbrOuOsTeaI9jHE3QNRJ-O8EH3F2OUdnJJ4ZOhp80FthKU'
REACT_APP_WEB3_FALLBACK_URL='wss://mainnet.infura.io/ws/v3/54fb3d87cd07464591ad2be29a1db32f'
REACT_APP_WEB3_FALLBACK_HTTPS_URL='https://mainnet.infura.io/v3/54fb3d87cd07464591ad2be29a1db32f'

REACT_APP_KLEROS_LIQUID_GOERLI_ADDRESS='0x1128eD55ab2d796fa92D2F8E1f336d745354a77A'
REACT_APP_KLEROS_LIQUID_EXTRA_VIEWS_GOERLI_ADDRESS='0x36780f8011f07683aacA36d5faC42AeBeAA96Cfe'
REACT_APP_PINAKION_GOERLI_ADDRESS='0xA3B02bA6E10F55fb177637917B1b472da0110CcC'
REACT_APP_POLICY_REGISTRY_GOERLI_ADDRESS='0x28c8A3A2E3c8Cd3F795DB83764316a1129a069bA'
REACT_APP_TOKEN_BRIDGE_GOERLI_ADDRESS='0x00147c84f13764dCDAbAF1cbAe622fa6f6839085'
REACT_APP_KLEROS_LIQUID_GOERLI_BLOCK_NUMBER='5893969'
REACT_APP_WEB3_FALLBACK_GOERLI_URL='wss://goerli.infura.io/ws/v3/f1c9535b961648f7bd18209b00e11163'
REACT_APP_WEB3_FALLBACK_GOERLI_HTTPS_URL='https://rpc.ankr.com/eth_goerli'

REACT_APP_KLEROS_LIQUID_CHIADO_ADDRESS='0xD8798DfaE8194D6B4CD6e2Da6187ae4209d06f27'
REACT_APP_KLEROS_LIQUID_EXTRA_VIEWS_CHIADO_ADDRESS='0xfDD698D6c9393d08c5DaD8488AF6d08c151e4860'
REACT_APP_PINAKION_CHIADO_ADDRESS='0xA353A70c8B3C7d38A869436d4CDeBe8e5611681a'
REACT_APP_POLICY_REGISTRY_CHIADO_ADDRESS='0x53FC70FE1EC3a60f8939A62aBCc61bf1A57938D7'
REACT_APP_TOKEN_BRIDGE_CHIADO_ADDRESS='0x09D549a48AC52F3f9945E7de6402c609c92aa2E1'
REACT_APP_KLEROS_LIQUID_CHIADO_BLOCK_NUMBER='1165867'
REACT_APP_WEB3_FALLBACK_CHIADO_URL='wss://rpc.chiado.gnosis.gateway.fm/ws'
REACT_APP_WEB3_FALLBACK_CHIADO_HTTPS_URL='https://rpc.chiado.gnosis.gateway.fm'

REACT_APP_KLEROS_LIQUID_SEPOLIA_ADDRESS='0x90992fb4E15ce0C59aEFfb376460Fda4Ee19C879'
REACT_APP_KLEROS_LIQUID_EXTRA_VIEWS_SEPOLIA_ADDRESS='0x5562Ac605764DC4039fb6aB56a74f7321396Cdf2'
REACT_APP_PINAKION_SEPOLIA_ADDRESS='0xA1eE4D32bdBcA69cdb445D66fAA3804aFFa24bFE'
REACT_APP_POLICY_REGISTRY_SEPOLIA_ADDRESS='0x88Fb25D399310c07d35cB9091b8346d8b1893aa5'
REACT_APP_KLEROS_LIQUID_SEPOLIA_BLOCK_NUMBER='3635742'
REACT_APP_WEB3_FALLBACK_SEPOLIA_URL='wss://sepolia.infura.io/ws/v3/f1c9535b961648f7bd18209b00e11163'
REACT_APP_WEB3_FALLBACK_SEPOLIA_HTTPS_URL='https://eth-sepolia.g.alchemy.com/v2/demo'

REACT_APP_KLEROS_XDAI_ADDRESS='0x0000000000000000000000000000000000000000'
REACT_APP_KLEROS_LIQUID_XDAI_ADDRESS='0x9C1dA9A04925bDfDedf0f6421bC7EEa8305F9002'
REACT_APP_KLEROS_LIQUID_EXTRA_VIEWS_XDAI_ADDRESS='0x1c0D5A1fF532715a58d0456ef10532e3eb6ec5de'
REACT_APP_PINAKION_XDAI_ADDRESS='0xcb3231aBA3b451343e0Fddfc45883c842f223846'
REACT_APP_RAW_PINAKION_XDAI_ADDRESS='0x37b60f4e9a31a64ccc0024dce7d0fd07eaa0f7b3'
REACT_APP_POLICY_REGISTRY_XDAI_ADDRESS='0x9d494768936b6bDaabc46733b8D53A937A6c6D7e'
REACT_APP_UNISWAP_V2_ROUTER_02_XDAI_ADDRESS='0x0000000000000000000000000000000000000000'
REACT_APP_UNISWAP_V2_FACTORY_XDAI_ADDRESS='0x0000000000000000000000000000000000000000'
REACT_APP_TOKEN_BRIDGE_XDAI_ADDRESS='0xf6A78083ca3e2a662D6dd1703c939c8aCE2e268d'
REACT_APP_KLEROS_LIQUID_XDAI_BLOCK_NUMBER='16895601'
REACT_APP_WEB3_FALLBACK_XDAI_URL='wss://rpc.gnosis.gateway.fm/ws'
REACT_APP_WEB3_FALLBACK_XDAI_HTTPS_URL='https://rpc.gnosis.gateway.fm'

REACT_APP_WEB3_FALLBACK_POLYGON_HTTPS_URL='https://polygon-mainnet.g.alchemy.com/v2/Y2IRJuoY0G-LAkHTqyXdVetLFm4R2NZT'
REACT_APP_WEB3_FALLBACK_MUMBAI_HTTPS_URL='https://polygon-mumbai.g.alchemy.com/v2/demo'

[context.production.environment]
REACT_APP_CONTEXT='production'
REACT_APP_USER_SETTINGS_URL='https://hgyxlve79a.execute-api.us-east-2.amazonaws.com/production/user-settings'
REACT_APP_JUSTIFICATIONS_URL='https://kleros-api.netlify.app/.netlify/functions'
REACT_APP_METAEVIDENCE_URL='https://kleros-api.netlify.app/.netlify/functions/get-dispute-metaevidence'

[[redirects]]
from = "/*"
Expand Down
26 changes: 9 additions & 17 deletions src/api/side-chain/chain-params.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import logoXPNK from "../../assets/images/xPNK.png";
import logoStPNK from "../../assets/images/stPNK.png";

import mainnet from "../../assets/deployments/mainnet.json";
import gnosis from "../../assets/deployments/gnosis.json";
import { getBaseUrl } from "../../helpers/block-explorer";
import { GNOSIS, getFallbackHttpsUrl } from "../../helpers/networks";

export const Tokens = {
PNK: "PNK",
Expand All @@ -10,24 +12,24 @@ export const Tokens = {

const supportedSideChains = {
// xDai
100: {
chainId: 100,
[GNOSIS]: {
chainId: GNOSIS,
chainName: "Gnosis Chain",
nativeCurrency: { name: "xDAI", symbol: "xDAI", decimals: 18 },
rpcUrls: [ensureEnv("REACT_APP_WEB3_FALLBACK_XDAI_HTTPS_URL")],
rpcUrls: getFallbackHttpsUrl(GNOSIS),
blockExplorerUrls: [getBaseUrl(100)],
bridgeAppUrl: `https://omni.gnosischain.com/bridge?from=1&to=100&token=${ensureEnv("REACT_APP_PINAKION_ADDRESS")}`,
bridgeAppUrl: `https://omni.gnosischain.com/bridge?from=1&to=100&token=${mainnet.pinakionAddress}`,
bridgeAppHistoryUrl: "https://omni.gnosischain.com/history",
mainChainId: 1,
tokens: {
[Tokens.PNK]: {
address: ensureEnv("REACT_APP_RAW_PINAKION_XDAI_ADDRESS"),
address: gnosis.rawPinakionAddress,
symbol: "PNK",
decimals: 18,
image: `${window.location.origin}${logoXPNK}`,
},
[Tokens.stPNK]: {
address: ensureEnv("REACT_APP_PINAKION_XDAI_ADDRESS"),
address: gnosis.pinakionAddress,
symbol: "stPNK",
decimals: 18,
image: `${window.location.origin}${logoStPNK}`,
Expand Down Expand Up @@ -88,13 +90,3 @@ const mainChainIdToSideChainParams = Object.values(supportedSideChains).reduce(
(acc, chainParams) => Object.assign(acc, { [chainParams.mainChainId]: chainParams }),
{}
);

function ensureEnv(key, msg = `process.env.${key} is not defined`) {
const value = process.env[key];

if (value === "" || value === undefined || value === null) {
throw new Error(msg);
}

return value;
}
24 changes: 6 additions & 18 deletions src/api/side-chain/create-side-chain-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import KlerosLiquid from "../../assets/contracts/kleros-liquid.json";
import TokenBridgeXDai from "../../assets/contracts/token-bridge-xdai.json";
import WrappedPinakion from "../../assets/contracts/wrapped-pinakion.json";
import XPinakion from "../../assets/contracts/x-pinakion.json";
import gnosis from "../../assets/deployments/gnosis.json";
import { getCounterPartyChainId, isSupportedSideChain } from "./chain-params";
import * as xDai from "./xdai-api";

Expand All @@ -22,14 +23,11 @@ export default async function createSideChainApi(provider) {

const xDaiParametersFactory = (web3) => {
const contracts = {
tokenBridge: new web3.eth.Contract(TokenBridgeXDai.abi, ensureEnv("REACT_APP_TOKEN_BRIDGE_XDAI_ADDRESS")),
wrappedPinakion: new web3.eth.Contract(WrappedPinakion.abi, ensureEnv("REACT_APP_PINAKION_XDAI_ADDRESS")),
xPinakion: new web3.eth.Contract(XPinakion.abi, ensureEnv("REACT_APP_RAW_PINAKION_XDAI_ADDRESS")),
klerosLiquidExtraViews: new web3.eth.Contract(
KlerosLiquidExtraViews.abi,
ensureEnv("REACT_APP_KLEROS_LIQUID_EXTRA_VIEWS_XDAI_ADDRESS")
),
klerosLiquid: new web3.eth.Contract(KlerosLiquid.abi, ensureEnv("REACT_APP_KLEROS_LIQUID_XDAI_ADDRESS")),
tokenBridge: new web3.eth.Contract(TokenBridgeXDai.abi, gnosis.tokenBridgeAddress),
wrappedPinakion: new web3.eth.Contract(WrappedPinakion.abi, gnosis.pinakionAddress),
xPinakion: new web3.eth.Contract(XPinakion.abi, gnosis.rawPinakionAddress),
klerosLiquidExtraViews: new web3.eth.Contract(KlerosLiquidExtraViews.abi, gnosis.klerosLiquidExtraViewsAddress),
klerosLiquid: new web3.eth.Contract(KlerosLiquid.abi, gnosis.klerosLiquidAddress),
};

contracts.tokenBridge.options.handleRevert = true;
Expand All @@ -43,13 +41,3 @@ const xDaiParametersFactory = (web3) => {
destinationChainId: getCounterPartyChainId(100),
};
};

function ensureEnv(key, msg = `process.env.${key} is not defined`) {
const value = process.env[key];

if (value === "" || value === undefined || value === null) {
throw new Error(msg);
}

return value;
}
8 changes: 8 additions & 0 deletions src/assets/deployments/chiado.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"klerosLiquidAddress": "0xD8798DfaE8194D6B4CD6e2Da6187ae4209d06f27",
"klerosLiquidExtraViewsAddress": "0xfDD698D6c9393d08c5DaD8488AF6d08c151e4860",
"pinakionAddress": "0xA353A70c8B3C7d38A869436d4CDeBe8e5611681a",
"policyRegistryAddress": "0x53FC70FE1EC3a60f8939A62aBCc61bf1A57938D7",
"tokenBridgeAddress": "0x09D549a48AC52F3f9945E7de6402c609c92aa2E1",
"klerosLiquidBlockNumber": 1165867
}
12 changes: 12 additions & 0 deletions src/assets/deployments/gnosis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"klerosAddress": "0x0000000000000000000000000000000000000000",
"klerosLiquidAddress": "0x9C1dA9A04925bDfDedf0f6421bC7EEa8305F9002",
"klerosLiquidExtraViewsAddress": "0x1c0D5A1fF532715a58d0456ef10532e3eb6ec5de",
"pinakionAddress": "0xcb3231aBA3b451343e0Fddfc45883c842f223846",
"rawPinakionAddress": "0x37b60f4e9a31a64ccc0024dce7d0fd07eaa0f7b3",
"policyRegistryAddress": "0x9d494768936b6bDaabc46733b8D53A937A6c6D7e",
"uniswapV2Router02Address": "0x0000000000000000000000000000000000000000",
"uniswapV2FactoryAddress": "0x0000000000000000000000000000000000000000",
"tokenBridgeAddress": "0xf6A78083ca3e2a662D6dd1703c939c8aCE2e268d",
"klerosLiquidBlockNumber": 16895601
}
8 changes: 8 additions & 0 deletions src/assets/deployments/goerli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"klerosLiquidAddress": "0x1128eD55ab2d796fa92D2F8E1f336d745354a77A",
"klerosLiquidExtraViewsAddress": "0x36780f8011f07683aacA36d5faC42AeBeAA96Cfe",
"pinakionAddress": "0xA3B02bA6E10F55fb177637917B1b472da0110CcC",
"policyRegistryAddress": "0x28c8A3A2E3c8Cd3F795DB83764316a1129a069bA",
"tokenBridgeAddress": "0x00147c84f13764dCDAbAF1cbAe622fa6f6839085",
"klerosLiquidBlockNumber": 5893969
}
11 changes: 11 additions & 0 deletions src/assets/deployments/mainnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"klerosAddress": "0x211f01e59b425253c0a0e9a7bf612605b42ce82c",
"klerosLiquidAddress": "0x988b3a538b618c7a603e1c11ab82cd16dbe28069",
"klerosLiquidExtraViewsAddress": "0x2B562ea613ad2f58746935C842d09EB147E1E940",
"pinakionAddress": "0x93ed3fbe21207ec2e8f2d3c3de6e058cb73bc04d",
"policyRegistryAddress": "0xCf1f07713d5193FaE5c1653C9f61953D048BECe4",
"uniswapV2Router02Address": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
"uniswapV2FactoryAddress": "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
Comment on lines +7 to +8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These addresses are from the old .env but are not present on netlify.toml 🤔
.env

REACT_APP_UNISWAP_V2_ROUTER_02_ADDRESS=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
REACT_APP_UNISWAP_V2_FACTORY_ADDRESS=0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f

netlify.toml

REACT_APP_UNISWAP_EXCHANGE_ADDRESS='0xF506828B166de88cA2EDb2A98D960aBba0D2402A'

"tokenBridgeAddress": "0x88ad09518695c6c3712AC10a214bE5109a655671",
"klerosLiquidBlockNumber": 7303699
}
7 changes: 7 additions & 0 deletions src/assets/deployments/sepolia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"klerosLiquidAddress": "0x90992fb4E15ce0C59aEFfb376460Fda4Ee19C879",
"klerosLiquidExtraViewsAddress": "0x5562Ac605764DC4039fb6aB56a74f7321396Cdf2",
"pinakionAddress": "0xA1eE4D32bdBcA69cdb445D66fAA3804aFFa24bFE",
"policyRegistryAddress": "0x88Fb25D399310c07d35cB9091b8346d8b1893aa5",
"klerosLiquidBlockNumber": 3635742
}
Loading