Skip to content

Commit

Permalink
Merge pull request #944 from makerdao/develop
Browse files Browse the repository at this point in the history
release v0.13.0 - migrate to v2 delegate contracts, use subgraph for delegate history, remove comments
  • Loading branch information
b-pmcg authored Oct 24, 2024
2 parents bcd26fa + aadf438 commit 74f5e4f
Show file tree
Hide file tree
Showing 99 changed files with 906 additions and 2,855 deletions.
2 changes: 0 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ ALCHEMY_KEY=
ETHERSCAN_KEY=
POCKET_KEY=
GITHUB_TOKEN=
MONGODB_URI=
MONGODB_COMMENTS_DB=
USE_CACHE=true
REDIS_URL=
MIGRATION_WEBHOOK_URL=
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ jobs:
runs-on: ubuntu-latest
env:
INFURA_KEY: ${{ secrets.INFURA_KEY }}
MONGODB_COMMENTS_DB: ${{ secrets.MONGODB_COMMENTS_DB }}
MONGODB_URI: ${{ secrets.MONGODB_URI }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ETHERSCAN_KEY: ${{ secrets.ETHERSCAN_KEY }}
POCKET_KEY: ${{ secrets.POCKET_KEY }}
Expand All @@ -43,7 +41,7 @@ jobs:
- name: Build sdk
run: yarn build-sdk

- run: yarn exec playwright install --with-deps
- run: yarn exec playwright install --with-deps

- name: Run E2E Test
run: yarn run e2e ${{ matrix.test }}
Expand Down
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ The tag and versioning should be done on develop, and then merged to master thro
The portal seeks to rely on on-chain data as much as possible and to minimize reliance on data stored on centralized servers. However, due to the large volume of data that is relevant to Maker governance, fetching this data from on-chain is both time and resource-intensive. In order to improve the user's experience, some reliance on third-party services has been added, and we recommend a few configuration steps for optimal use. These services include:

- [GitHub](https://github.com/makerdao/community/tree/master/governance) for storing markdown related to [polls](https://github.com/makerdao/community/tree/master/governance/polls), [executives](https://github.com/makerdao/community/tree/master/governance/votes), and [aligned delegates](https://github.com/makerdao/community/tree/master/governance/delegates)
- MongoDB for storing comments related to votes on polls and executives

#### Network providers

Expand All @@ -87,10 +86,6 @@ The following configuration values can be added to the `.env` file:

- Set `GITHUB_TOKEN` to fetch polls, executives, and aligned delegates information from GitHub (optionally set `GITHUB_TOKEN_2` and `GITHUB_TOKEN_3`)

- Set `MONGODB_URI` to a full MongoDB uri (ex: `mongodb+srv://...`)

- Set `MONGODB_COMMENTS_DB` the MongoDB db name to be used for vote comments

- Set `USE_CACHE` to true if you want to use cache, if `REDIS_URL` is set it will use REDIS otherwise filesystem cache

- Set `GASLESS_DISABLED` to `true` to disable gasless voting in UI (pre-check endpoint will fail)
Expand Down
4 changes: 0 additions & 4 deletions lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ type SystemConfig = {
ETHERSCAN_KEY: string;
POCKET_KEY: string;
TRACING_RPC_NODE: string;
MONGODB_URI: string;
MONGODB_COMMENTS_DB: string;
NODE_ENV: 'development' | 'production' | 'test';
GITHUB_TOKEN: string;
GITHUB_TOKEN_2: string;
Expand Down Expand Up @@ -44,8 +42,6 @@ export const config: SystemConfig = {
ETHERSCAN_KEY: process.env.ETHERSCAN_KEY || '',
POCKET_KEY: process.env.POCKET_KEY || '',
TRACING_RPC_NODE: process.env.TRACING_RPC_NODE || '',
MONGODB_URI: process.env.MONGODB_URI || '',
MONGODB_COMMENTS_DB: process.env.MONGODB_COMMENTS_DB || '',
NODE_ENV: process.env.NODE_ENV || 'development',
GITHUB_TOKEN: process.env.GITHUB_TOKEN || '',
GITHUB_TOKEN_2: process.env.GITHUB_TOKEN_2 || '',
Expand Down
23 changes: 0 additions & 23 deletions lib/theme/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -1338,29 +1338,6 @@ export const icons = {
</g>
)
},
yourComment: {
viewBox: '0 0 12 12',
path: (
<g>
<path
d="M8.90692 0.887358H3.54629C2.13911 0.887358 1 2.02654 1 3.43365V6.51601C1 7.82934 2.00512 8.91489 3.27824 9.04891L3.30507 10.8447C3.30507 10.9519 3.3721 11.0323 3.45249 11.0859C3.49269 11.0992 3.53289 11.1127 3.57308 11.1127C3.62665 11.1127 3.69368 11.0993 3.73387 11.0591L6.32037 9.06228H8.90687C10.3141 9.06228 11.4532 7.9231 11.4532 6.51598V3.43362C11.4532 2.02644 10.3141 0.887329 8.90687 0.887329L8.90692 0.887358ZM10.9171 6.51601C10.9171 7.62834 10.0192 8.52624 8.90692 8.52624H6.22661C6.17304 8.52624 6.10601 8.53961 6.06582 8.57981L3.84113 10.2952L3.8143 8.79426C3.8143 8.64684 3.69371 8.52625 3.5463 8.52625C2.43397 8.52625 1.53606 7.62835 1.53606 6.51602V3.43366C1.53606 2.32133 2.43397 1.42343 3.5463 1.42343H8.90692C10.0192 1.42343 10.9172 2.32133 10.9172 3.43366L10.9171 6.51601Z"
fill="currentColor"
stroke="currentColor"
strokeWidth="0.7"
/>
<path
d="M1.5 7.88733V3.7793C1.5 2.71783 2.32923 1.84126 3.38906 1.78238L10.5 1.38733L11 8.38733H6L4 9.88733V8.38733L1.5 7.88733Z"
fill="currentColor"
/>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M8.84898 3.0992C9.02933 3.24824 9.05126 3.51119 8.89797 3.68653L5.25512 7.85319C5.17438 7.94553 5.0563 7.99912 4.93164 7.99999C4.80699 8.00086 4.68813 7.94892 4.60604 7.85771L3.10604 6.19105C2.95018 6.01787 2.96823 5.75463 3.14636 5.6031C3.32449 5.45156 3.59525 5.46911 3.75111 5.64229L4.92387 6.94536L8.24488 3.14682C8.39817 2.97149 8.66864 2.95016 8.84898 3.0992Z"
fill="white"
/>
</g>
)
},
'Gnosis Safe': {
viewBox: '0 0 20 20',
path: (
Expand Down
7 changes: 5 additions & 2 deletions modules/address/components/Address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { formatAddress } from 'lib/utils';
import { useWeb3 } from 'modules/web3/hooks/useWeb3';
import { getENS } from 'modules/web3/helpers/ens';
import React, { useEffect, useState } from 'react';
import { getDefaultProvider } from 'modules/web3/helpers/getDefaultProvider';
import { SupportedNetworks } from 'modules/web3/constants/networks';

export const Address = React.memo(function Address({
address,
Expand All @@ -19,14 +21,15 @@ export const Address = React.memo(function Address({
address: string;
maxLength?: number;
}): React.ReactElement {
const { provider } = useWeb3();
const [addressFormated, setAddressFormatted] = useState(formatAddress(address || '').toLowerCase());

async function fetchENSName() {
if (!address || !provider) {
if (!address) {
return;
}

const provider = getDefaultProvider(SupportedNetworks.MAINNET);

const ens = await getENS({ address, provider });

ens ? setAddressFormatted(ens) : setAddressFormatted(formatAddress(address).toLowerCase());
Expand Down
8 changes: 6 additions & 2 deletions modules/address/components/AddressDelegatedTo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const CollapsableRow = ({ delegate, network, bpi, totalDelegated }: CollapsableR
const { address, lockAmount, events } = delegate;
const sortedEvents = events.sort((prev, next) => (prev.blockTimestamp > next.blockTimestamp ? -1 : 1));

const formattedDate = formatDateWithTime(delegate.expirationDate);
const formattedDate = delegate.expirationDate ? formatDateWithTime(delegate.expirationDate) : '';
const dateText = delegate.isExpired
? `This contract expired ${formattedDate}`
: `This contract will expire ${formattedDate}`;
Expand Down Expand Up @@ -84,7 +84,7 @@ const CollapsableRow = ({ delegate, network, bpi, totalDelegated }: CollapsableR
</Text>
{expanded && (
<Flex sx={{ flexDirection: 'column' }}>
{sortedEvents.map(({ blockTimestamp, lockAmount }) => {
{sortedEvents.map(({ blockTimestamp, lockAmount, isLockstake }) => {
return (
<Flex
key={blockTimestamp}
Expand All @@ -104,6 +104,10 @@ const CollapsableRow = ({ delegate, network, bpi, totalDelegated }: CollapsableR
parseUnits(lockAmount.indexOf('-') === 0 ? lockAmount.substring(1) : lockAmount)
)}${bpi > 0 ? ' MKR' : ''}`}
</Text>

<Text key={blockTimestamp} variant="smallCaps" sx={{ pl: 2 }}>
{isLockstake ? '(Seal)' : ''}
</Text>
</Flex>
);
})}
Expand Down
6 changes: 1 addition & 5 deletions modules/address/components/AddressDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { AddressMKRDelegatedStats } from './AddressMKRDelegatedStats';
import AddressIconBox from './AddressIconBox';
import { useWeb3 } from 'modules/web3/hooks/useWeb3';
import { ErrorBoundary } from 'modules/app/components/ErrorBoundary';
import AccountComments from 'modules/comments/components/AccountComments';
import Tabs from 'modules/app/components/Tabs';
import { useDelegatedTo } from 'modules/delegates/hooks/useDelegatedTo';
import { InternalLink } from 'modules/app/components/InternalLink';
Expand All @@ -43,7 +42,7 @@ export function AddressDetail({ addressInfo }: { addressInfo: AddressApiResponse

const { data: delegatedToData } = useDelegatedTo(addressInfo.address, network);

const tabTitles = ['Account Details', 'Comments'];
const tabTitles = ['Account Details'];

const tabPanels = [
<Box key="account-detail">
Expand Down Expand Up @@ -134,9 +133,6 @@ export function AddressDetail({ addressInfo }: { addressInfo: AddressApiResponse
<PollingParticipationOverview votes={statsData.pollVoteHistory} />
</ErrorBoundary>
)}
</Box>,
<Box key="account-comments" sx={{ p: [3, 4] }}>
<AccountComments address={addressInfo.address} />
</Box>
];

Expand Down
7 changes: 5 additions & 2 deletions modules/app/components/DateWithHover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ export function DateWithHover({
timeago,
label
}: {
date: Date | string | number;
date?: Date | string | number | null;
timeago?: boolean;
label?: string;
}): React.ReactElement {
if (!date) {
return <Text>N/A</Text>;
}
return (
<Tooltip label={label ? label : formatDateWithTime(date ?? '')}>
<Tooltip label={label ? label : formatDateWithTime(date)}>
<Text>{timeago ? `${formatTimeAgo(date ?? '')}` : `${formatDateWithTime(date ?? '')}`}</Text>
</Tooltip>
);
Expand Down
45 changes: 0 additions & 45 deletions modules/comments/api/getCommentTransaction.ts

This file was deleted.

73 changes: 0 additions & 73 deletions modules/comments/api/getCommentsByAddress.ts

This file was deleted.

72 changes: 0 additions & 72 deletions modules/comments/api/getExecutiveComments.ts

This file was deleted.

Loading

0 comments on commit 74f5e4f

Please sign in to comment.