Skip to content

Commit

Permalink
Merge pull request #460 from humanprotocol/develop
Browse files Browse the repository at this point in the history
Release 20230511
  • Loading branch information
portuu3 authored May 11, 2023
2 parents 0ed7340 + ed5b9f4 commit d2c6738
Show file tree
Hide file tree
Showing 76 changed files with 2,267 additions and 401 deletions.
30 changes: 8 additions & 22 deletions .github/workflows/cd-deploy-contracts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
runs-on: ubuntu-latest
environment: deploy-contracts
env:
PRIVATE_KEY: ${{ secrets[matrix.network.private_key] }}
ETH_GOERLI_TESTNET_URL: ${{ secrets.ETH_GOERLI_TESTNET_URL }}
ETH_POLYGON_URL: ${{ secrets.ETH_POLYGON_URL }}
ETH_POLYGON_MUMBAI_URL: ${{ secrets.ETH_POLYGON_MUMBAI_URL }}
Expand All @@ -38,7 +37,6 @@ jobs:
POLYGONSCAN_API_KEY: ${{ secrets.POLYGONSCAN_API_KEY }}
BSC_API_KEY: ${{ secrets.BSC_API_KEY }}
MOONSCAN_API_KEY: ${{ secrets.MOONSCAN_API_KEY }}
SUBGRAPH: ${{ matrix.network.subgraph }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3 #Temporal until this gets fixed https://github.com/NomicFoundation/hardhat/issues/3877
Expand Down Expand Up @@ -117,40 +115,28 @@ jobs:
esac
- name: Upgrade Escrow Factory Proxy
if: github.event.inputs.escrowFactory == 'true'
run: yarn upgrade:proxy --network ${{ github.event.inputs.network }}
run: |
echo "ESCROW_FACTORY_ADDRESS=$(if [ ${{github.event.inputs.escrowFactory == 'true' }} ]; then echo '${{ steps.networks.outputs.escrow_factory }}'; else echo ''; fi)" >> $GITHUB_ENV
echo "STAKING_ADDRESS=$(if [ ${{github.event.inputs.staking == 'true' }} ]; then echo '${{ steps.networks.outputs.staking }}'; else echo ''; fi)" >> $GITHUB_ENV
echo "REWARD_POOL_ADDRESS=$(if [ ${{github.event.inputs.rewardPool == 'true' }} ]; then echo '${{ steps.networks.outputs.reward_pool }}'; else echo ''; fi)" >> $GITHUB_ENV
echo "REPUTATION_ADDRESS=$(if [ ${{github.event.inputs.reputation == 'true' }} ]; then echo '${{ steps.networks.outputs.reputation }}'; else echo ''; fi)" >> $GITHUB_ENV
yarn upgrade:proxy --network ${{ github.event.inputs.network }}
working-directory: ./packages/core
env:
ESCROW_FACTORY_ADDRESS: ${{ steps.networks.outputs.escrow_factory }}
PRIVATE_KEY: ${{ secrets[steps.networks.outputs.private_key] }}
SUBGRAPH: ${{ steps.networks.outputs.subgraph }}
- name: Verify Escrow Factory Proxy
if: github.event.inputs.escrowFactory == 'true'
run: npx hardhat verify --network ${{ github.event.inputs.network }} ${{ steps.networks.outputs.escrow_factory }}
working-directory: ./packages/core
- name: Upgrade Staking Proxy
if: github.event.inputs.staking == 'true'
run: yarn upgrade:proxy --network ${{ github.event.inputs.network }}
working-directory: ./packages/core
env:
STAKING_ADDRESS: ${{ steps.networks.outputs.staking }}
- name: Verify Staking Proxy
if: github.event.inputs.staking == 'true'
run: npx hardhat verify --network ${{ github.event.inputs.network }} ${{ steps.networks.outputs.staking }}
working-directory: ./packages/core
- name: Upgrade Reward Pool Proxy
if: github.event.inputs.rewardPool == 'true'
run: yarn upgrade:proxy --network ${{ github.event.inputs.network }}
working-directory: ./packages/core
env:
REWARD_POOL_ADDRESS: ${{ steps.networks.outputs.reward_pool }}
- name: Verify Reward Pool Proxy
if: github.event.inputs.rewardPool== 'true'
run: npx hardhat verify --network ${{ github.event.inputs.network }} ${{ steps.networks.outputs.reward_pool }}
working-directory: ./packages/core
- name: Upgrade Reputation Proxy
if: github.event.inputs.reputation == 'true' && steps.networks.outputs.reputation != ''
run: yarn upgrade:proxy --network ${{ github.event.inputs.network }}
working-directory: ./packages/core
env:
REPUTATION_ADDRESS: ${{ steps.networks.outputs.reputation }}
- name: Verify Reputation Proxy
if: github.event.inputs.reputation == 'true' && steps.networks.outputs.reputation != ''
run: npx hardhat verify --network ${{ github.event.inputs.network }} ${{ steps.networks.outputs.reputation }}
Expand Down
5 changes: 5 additions & 0 deletions packages/apps/escrow-dashboard/src/assets/human-token.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions packages/apps/escrow-dashboard/src/assets/my-hmt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import Box from '@mui/material/Box';
import Box, { BoxProps } from '@mui/material/Box';
import { FC, PropsWithChildren } from 'react';

type ContainerProps = {
type ContainerProps = BoxProps & {
densed?: boolean;
};

export const Container: FC<PropsWithChildren<ContainerProps>> = ({
children,
densed = false,
...rest
}) => {
return (
<Box
Expand All @@ -23,6 +24,7 @@ export const Container: FC<PropsWithChildren<ContainerProps>> = ({
height: '100%',
position: 'relative',
}}
{...rest}
>
{children}
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { setChainId as setEscrowChainId } from 'src/state/escrow/reducer';
import { setChainId as setLeaderChainId } from 'src/state/leader/reducer';

const NETWORK_ICONS: { [chainId in ChainId]?: ReactElement } = {
[ChainId.MAINNET]: <EthereumIcon />,
[ChainId.RINKEBY]: <EthereumIcon />,
[ChainId.GOERLI]: <EthereumIcon />,
[ChainId.POLYGON]: <PolygonIcon />,
Expand Down
75 changes: 56 additions & 19 deletions packages/apps/escrow-dashboard/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import {
Close as CloseIcon,
Menu as MenuIcon,
Search as SearchIcon,
// Search as SearchIcon,
} from '@mui/icons-material';
import {
Alert,
AppBar,
Box,
Button,
ButtonProps,
Collapse,
Drawer,
IconButton,
Expand All @@ -17,13 +19,14 @@ import {
useMediaQuery,
useTheme,
} from '@mui/material';
import { FC, useState } from 'react';
import { FC, useEffect, useState } from 'react';

import { useAccount } from 'wagmi';
import { ConnectButton } from '../ConnectButton';
import { SearchBox } from '../SearchBox';
import { SocialIcons } from '../SocialIcons';

import logoSvg from 'src/assets/logo.svg';
import myHMTSvg from 'src/assets/my-hmt.svg';

type NavLink = {
title: string;
Expand All @@ -41,14 +44,31 @@ const NAV_LINKS: NavLink[] = [
{ title: 'HUMAN Website', href: 'https://humanprotocol.org', external: true },
];

const MyHMTButton = (props: ButtonProps) => {
return (
<Button
variant="contained"
color="primary"
sx={{ borderRadius: '40px', boxShadow: 'none', p: 1, pr: 2 }}
{...props}
>
<img src={myHMTSvg} alt="my-hmt" />
<Typography variant="body2" fontWeight={600} sx={{ ml: 1 }}>
My HMT
</Typography>
</Button>
);
};

export const Header: FC = () => {
const [drawerOpen, setDrawerOpen] = useState(false);
const [searchOpen, setSearchOpen] = useState(false);
const theme = useTheme();
const isDownLg = useMediaQuery(theme.breakpoints.down('lg'));
const isDownMd = useMediaQuery(theme.breakpoints.down('md'));
// const isDownMd = useMediaQuery(theme.breakpoints.down('md'));
const { address } = useAccount();

const [showWarning, setShowWarning] = useState(true);
const [showWarning, setShowWarning] = useState(false);

/**
* @TODO: Remove the flag once it's implemented
Expand Down Expand Up @@ -79,13 +99,29 @@ export const Header: FC = () => {
</Stack>
);

const handleCloseWarning = () => {
localStorage.setItem('HUMAN_ESCROW_DASHBOARD_SHOW_WARNING', 'false');
setShowWarning(false);
};

useEffect(() => {
const cacheValue = localStorage.getItem(
'HUMAN_ESCROW_DASHBOARD_SHOW_WARNING'
);
if (cacheValue === 'false') {
setShowWarning(false);
} else {
setShowWarning(true);
}
}, []);

return (
<Box sx={{ flexGrow: 1 }}>
<AppBar
position="fixed"
sx={{
background: 'rgba(255, 255, 255, 0.8)',
boxShadow: '0px 4px 120px rgba(218, 222, 240, 0.8)',
boxShadow: 'none',
backdropFilter: 'blur(9px)',
}}
>
Expand All @@ -99,9 +135,7 @@ export const Header: FC = () => {
aria-label="close"
color="inherit"
size="small"
onClick={() => {
setShowWarning(false);
}}
onClick={handleCloseWarning}
>
<CloseIcon fontSize="inherit" />
</IconButton>
Expand All @@ -126,6 +160,7 @@ export const Header: FC = () => {
justifyContent: 'space-between',
alignItems: 'center',
width: '100%',
height: '104px',
boxSizing: 'border-box',
padding: {
xs: '30px 8px 26px',
Expand Down Expand Up @@ -160,31 +195,32 @@ export const Header: FC = () => {
Dashboard
</Typography>
</Link>
{!isDownLg && (
{!isDownLg && showSearchBox && (
<Box sx={{ minWidth: '400px' }}>
{showSearchBox && <SearchBox />}
<SearchBox />
</Box>
)}
{!isDownMd && (
<Box display="flex" alignItems="center" gap={3}>
{isDownLg && (
{!isDownLg && (
<Box display="flex" alignItems="center" gap={2}>
{/* {isDownLg && (
<IconButton color="primary" onClick={toggleSearchBox}>
<SearchIcon />
</IconButton>
)}
)} */}
{renderNavLinks()}
<ConnectButton />
{address && <MyHMTButton href="/staking" />}
</Box>
)}
{isDownMd && (
{isDownLg && (
<Box>
<IconButton
{/* <IconButton
color="primary"
sx={{ ml: 1 }}
onClick={toggleSearchBox}
>
<SearchIcon />
</IconButton>
</IconButton> */}
<IconButton
color="primary"
sx={{ ml: 1 }}
Expand Down Expand Up @@ -216,8 +252,9 @@ export const Header: FC = () => {
<Box display="flex">
<Box flex="1" sx={{ p: 6 }}>
{renderNavLinks('vertical')}
<Box mt={8}>
<Box mt={4} sx={{ display: 'flex', flexWrap: 'wrap', gap: 2 }}>
<ConnectButton />
{address && <MyHMTButton href="/staking" />}
</Box>
</Box>
<Box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Header } from '../Header';
export const Layout: FC<PropsWithChildren<{}>> = ({ children }) => (
<Box
sx={{
marginTop: '110px',
marginTop: '104px',
}}
>
<Header />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Box, Button, TextField } from '@mui/material';
import React, { FC } from 'react';

type CurrencyInputProps = {
placeholder?: string;
};

export const CurrencyInput: FC<CurrencyInputProps> = ({ placeholder }) => {
return (
<Box sx={{ position: 'relative' }}>
<TextField
fullWidth
helperText="HMT Available: 0.000"
placeholder={placeholder}
/>
<Button
variant="text"
sx={{
position: 'absolute',
right: '10px',
top: '12px',
color: '#858EC6',
}}
>
MAX
</Button>
</Box>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { Box } from '@mui/material';
import React, { FC } from 'react';
import { Pie, PieChart, ResponsiveContainer } from 'recharts';
import { Container } from '../Cards/Container';

const data = [
{ name: 'Allocated', value: 11, fill: '#f9faff' },
{ name: 'Locked', value: 29, fill: '#858EC6' },
{ name: 'Avaliable', value: 48, fill: '#320A8D' },
];

type HMTStatusChartProps = {};

export const HMTStatusChart: FC<HMTStatusChartProps> = () => {
return (
<Container densed>
<Box sx={{ width: '100%', height: '360px' }}>
<ResponsiveContainer>
<PieChart width={730} height={360}>
<Pie
data={data}
dataKey="value"
nameKey="name"
cx="50%"
cy="50%"
outerRadius={120}
label={({
cx,
cy,
midAngle,
innerRadius,
outerRadius,
value,
index,
}) => {
const RADIAN = Math.PI / 180;
const radius = 50 + innerRadius + (outerRadius - innerRadius);
const x = cx + radius * Math.cos(-midAngle * RADIAN);
const y = Math.min(
cy + radius * Math.sin(-midAngle * RADIAN),
310
);
return (
<text
x={x}
y={y}
fill="#320A8D"
textAnchor={x > cx ? 'start' : 'end'}
dominantBaseline="central"
>
<tspan x={x} dy="1em">
{value}%
</tspan>
<tspan x={x} dy="1em">
{data[index].name}
</tspan>
</text>
);
}}
labelLine={false}
/>
</PieChart>
</ResponsiveContainer>
</Box>
</Container>
);
};
Loading

2 comments on commit d2c6738

@vercel
Copy link

@vercel vercel bot commented on d2c6738 May 11, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

escrow-dashboard – ./packages/apps/escrow-dashboard

escrow-dashboard-git-main-humanprotocol.vercel.app
escrow-dashboard-humanprotocol.vercel.app
dashboard.humanprotocol.org

@vercel
Copy link

@vercel vercel bot commented on d2c6738 May 11, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

faucet-server – ./packages/apps/faucet-server/

faucet-server-humanprotocol.vercel.app
faucet-server.vercel.app
faucet-server-git-main-humanprotocol.vercel.app

Please sign in to comment.