Skip to content

Commit

Permalink
allow arbitrum UI
Browse files Browse the repository at this point in the history
  • Loading branch information
brucedonovan authored and Jacob Bryant committed Mar 14, 2023
1 parent 2a498b7 commit 73200e1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .env.local
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
REACT_APP_DEFAULT_CHAINID=1
REACT_APP_DEFAULT_CHAINID=42161
REACT_APP_VERSION=$npm_package_version

REACT_APP_RPC_URL_1='https://eth-mainnet.g.alchemy.com/v2/ZXDCq5iy0KrKR0XjsqC6E4QG7Z_FuXDv'
Expand Down Expand Up @@ -26,4 +26,5 @@ ALCHEMY_MAINNET_KEY=ZXDCq5iy0KrKR0XjsqC6E4QG7Z_FuXDv
GENERATE_SOURCEMAP=false

KILLSWITCH_ACTIVE=true
KILLSWITCH_CHAIN=1
KILLSWITCH_TEXT='Due to an Euler Finance security incident, we are suspending UI interaction with the Yield Protocol until we have fully assessed the implications of the breach'
3 changes: 2 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const nextConfig = {
ENV: process.env.NODE_ENV,

KILLSWITCH_ACTIVE: process.env.KILLSWITCH_ACTIVE,
KILLSWITCH_TEXT: process.env.KILLSWITCH_TEXT
KILLSWITCH_TEXT: process.env.KILLSWITCH_TEXT,
KILLSWITCH_CHAIN: process.env.KILLSWITCH_CHAIN,
},
async redirects() {
return [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "app-v2",
"version": "2.5.8",
"version": "2.5.9",
"private": true,
"dependencies": {
"@ethersproject/providers": "^5.6.8",
Expand Down
17 changes: 16 additions & 1 deletion src/components/KillSwitch.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { Box, Layer, Text } from 'grommet';
import React from 'react';
import { FiAlertCircle } from 'react-icons/fi';
import { useChain } from '../hooks/useChain';
import useChainId from '../hooks/useChainId';

/* A kill switch is a way to disable the entire app. It is set in the .env file. ( AND next.config.js ) */
const KillSwitch = (props: any) => {

const chainId = useChainId();

return (
<>
{process.env.KILLSWITCH_ACTIVE === 'true' ? (
{ ( process.env.KILLSWITCH_ACTIVE === 'true' && chainId === parseInt(process.env.KILLSWITCH_CHAIN!) ) ? (
<Layer>
<Box background="white" pad="large" round="16px" gap="medium">
<Box direction="row" gap="small" align="center">
Expand All @@ -21,6 +26,16 @@ const KillSwitch = (props: any) => {
{process.env.KILLSWITCH_TEXT}
</Text>
</Box>

<Box direction="row" gap="small">
<Text size="xsmall" weight={'bold'}>
Affects Chain:
</Text>
<Text size="xsmall" weight={'normal'}>
{parseInt(process.env.KILLSWITCH_CHAIN!) === 1 ? 'Ethereum Mainnet' : 'Arbitrum One' }
</Text>
</Box>

</Box>
</Layer>
) : (
Expand Down

0 comments on commit 73200e1

Please sign in to comment.