Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APP-3220 - Add support for ZkSync Sepolia network #1358

Merged
merged 17 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
VITE_ARBISCAN_API_KEY: ${{secrets.VITE_ARBISCAN_API_KEY}}
VITE_BASESCAN_API_KEY: ${{secrets.VITE_BASESCAN_API_KEY}}
VITE_GATEWAY_RPC_API_KEY: ${{secrets.VITE_GATEWAY_RPC_API_KEY}}
VITE_GATEWAY_RPC_API_KEY_ALCHEMY: ${{secrets.VITE_GATEWAY_RPC_API_KEY_ALCHEMY}}
VITE_WALLET_CONNECT_PROJECT_ID: ${{secrets.VITE_WALLET_CONNECT_PROJECT_ID}}
VITE_COVALENT_API_KEY: ${{secrets.VITE_COVALENT_API_KEY}}

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pull_request_webapp_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
VITE_ETHERSCAN_API_KEY: ${{secrets.VITE_ETHERSCAN_API_KEY}}
VITE_POLYGONSCAN_API_KEY: ${{secrets.VITE_POLYGONSCAN_API_KEY}}
VITE_GATEWAY_RPC_API_KEY: ${{secrets.VITE_GATEWAY_RPC_API_KEY}}
VITE_GATEWAY_RPC_API_KEY_ALCHEMY: ${{secrets.VITE_GATEWAY_RPC_API_KEY_ALCHEMY}}
VITE_WALLET_CONNECT_PROJECT_ID: ${{secrets.VITE_WALLET_CONNECT_PROJECT_ID}}
VITE_COVALENT_API_KEY: ${{secrets.VITE_COVALENT_API_KEY}}
VITE_SENTRY_DNS: ${{secrets.VITE_SENTRY_DNS}}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/webapp-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
VITE_BASESCAN_API_KEY: ${{secrets.VITE_BASESCAN_API_KEY}}
VITE_WALLET_CONNECT_PROJECT_ID: ${{secrets.VITE_WALLET_CONNECT_PROJECT_ID}}
VITE_GATEWAY_RPC_API_KEY: ${{secrets.VITE_GATEWAY_RPC_API_KEY}}
VITE_GATEWAY_RPC_API_KEY_ALCHEMY: ${{secrets.VITE_GATEWAY_RPC_API_KEY_ALCHEMY}}
VITE_COVALENT_API_KEY: ${{secrets.VITE_COVALENT_API_KEY}}
VITE_SENTRY_DNS: ${{secrets.VITE_SENTRY_DNS}}
VITE_PINATA_CID_VERSION: ${{vars.VITE_PINATA_CID_VERSION}}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"dependencies": {
"@apollo/client": "^3.5.8",
"@aragon/ods": "^1.0.20",
"@aragon/osx-commons-configs": "^0.4.0",
"@aragon/sdk-client": "^1.23.5",
"@aragon/sdk-client-common": "^1.15.3",
"@aragon/osx-commons-configs": "^0.5.0",
"@aragon/sdk-client": "^1.24.0",
"@aragon/sdk-client-common": "^1.16.0",
"@playwright/test": "^1.42.1",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-dialog": "^1.0.4",
Expand Down
4 changes: 3 additions & 1 deletion src/assets/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,9 @@
"member": "Wallet-based",
"governanceType": "Governance type",
"arbitrum": "Arbitrum",
"ethereumSepolia": "Ethereum Sepolia"
"ethereumSepolia": "Ethereum Sepolia",
"zksync": "ZkSync Era",
"zksyncSepolia": "ZkSync Sepolia"
},
"ctaLabel": {
"see0": "See 0 DAOs",
Expand Down
6 changes: 3 additions & 3 deletions src/containers/selectChainForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ const networks: SelectableNetworks = {
security: ['ethereum', 'base', 'arbitrum', 'polygon'],
},
test: {
cost: ['sepolia'],
popularity: ['sepolia'],
security: ['sepolia'],
cost: ['zksyncSepolia', 'sepolia'],
popularity: ['zksyncSepolia', 'sepolia'],
security: ['zksyncSepolia', 'sepolia'],
},
};
4 changes: 3 additions & 1 deletion src/hooks/useDaoMembers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ export const useDaoMembers = (
const enabled = opts?.enabled || true;

const covalentSupportedNetwork = !(
network === 'arbitrum' || network === 'base'
network === 'arbitrum' ||
network === 'base' ||
network === 'zksyncSepolia'
);

const useGraphql =
Expand Down
22 changes: 17 additions & 5 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ import {createWeb3Modal} from '@web3modal/wagmi/react';
import {http, createConfig, WagmiProvider} from 'wagmi';
import {walletConnect, coinbaseWallet} from 'wagmi/connectors';

import {Chain, arbitrum, base, mainnet, polygon, sepolia} from 'wagmi/chains';
import {
Chain,
arbitrum,
base,
mainnet,
polygon,
sepolia,
zkSyncSepoliaTestnet,
} from 'wagmi/chains';
import {AlertProvider} from 'context/alert';
import {GlobalModalsProvider} from 'context/globalModals';
import {NetworkProvider} from 'context/network';
Expand All @@ -32,10 +40,14 @@ import {App} from './app';
import {aragonGateway} from 'utils/aragonGateway';
import {HttpTransport} from 'viem';

const chains = [mainnet, polygon, base, arbitrum, sepolia] as [
Chain,
...Chain[],
];
const chains = [
mainnet,
polygon,
base,
arbitrum,
sepolia,
zkSyncSepoliaTestnet,
] as [Chain, ...Chain[]];

const transports = chains.reduce(
(RPCs, value) => {
Expand Down
6 changes: 3 additions & 3 deletions src/pages/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ export const Dashboard: React.FC = () => {
}
);

const isPendingDao = pendingDao || !(census3Token?.status.synced ?? false);
const isPendingDao =
pendingDao || (isGasless && !(census3Token?.status.synced ?? false));

const isLoading = liveDaoLoading || pendingDaoLoading || followedDaosLoading;

Expand Down Expand Up @@ -167,8 +168,7 @@ export const Dashboard: React.FC = () => {
isPendingDao &&
liveDao &&
daoCreationState === DaoCreationState.ASSEMBLING_DAO &&
isGasless &&
census3Token?.status.synced
(!isGasless || census3Token?.status.synced === true)
) {
setPollInterval(0);
setDaoCreationState(DaoCreationState.DAO_READY);
Expand Down
6 changes: 4 additions & 2 deletions src/services/transactions/transactionsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
import {ITransaction} from './domain/transaction';
import {decodeProposalId, hexToBytes} from '@aragon/sdk-client-common';
import {isMultisigClient, isTokenVotingClient} from 'hooks/usePluginClient';
import {ContractNames} from '@aragon/osx-commons-configs';
import {FrameworkContractsNames} from '@aragon/osx-commons-configs';

class TransactionsService {
buildCreateDaoTransaction = async (
Expand All @@ -37,7 +37,9 @@ class TransactionsService {
} = params;

const signer = client.web3.getConnectedSigner();
const daoFactoryAddress = client.web3.getAddress(ContractNames.DAO_FACTORY);
const daoFactoryAddress = client.web3.getAddress(
FrameworkContractsNames.DAO_FACTORY
);

const daoFactoryInstance = DAOFactory__factory.connect(
daoFactoryAddress,
Expand Down
15 changes: 12 additions & 3 deletions src/utils/aragonGateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
class AragonGateway {
private rpcVersion = '1.0';
private ipfsVersion = '1.0';
private baseUrl = import.meta.env.VITE_GATEWAY_URL;
private baseUrl = import.meta.env.VITE_GATEWAY_URL as string;

getRpcProvider = (
chainIdOrNetwork: number | SupportedNetworks
Expand Down Expand Up @@ -54,8 +54,17 @@ class AragonGateway {
}

const {gatewayNetwork} = CHAIN_METADATA[network];
const gatewayKey = import.meta.env.VITE_GATEWAY_RPC_API_KEY;
const rpcUrl = `${this.baseUrl}/v${this.rpcVersion}/rpc/${gatewayNetwork}/${gatewayKey}`;
const gatewayKey =
network === 'zksyncSepolia'
? import.meta.env.VITE_GATEWAY_RPC_API_KEY_ALCHEMY
: import.meta.env.VITE_GATEWAY_RPC_API_KEY;

const baseUrl =
network === 'zksyncSepolia'
? this.baseUrl.replace('app', 'alchemy')
: this.baseUrl;

const rpcUrl = `${baseUrl}/v${this.rpcVersion}/rpc/${gatewayNetwork}/${gatewayKey}`;
return rpcUrl;
};

Expand Down
2 changes: 2 additions & 0 deletions src/utils/constants/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export const SUBGRAPH_API_URL: SubgraphNetworkUrl = {
'https://subgraph.satsuma-prod.com/qHR2wGfc5RLi6/aragon/osx-polygon/version/1.4.2/api',
sepolia:
'https://subgraph.satsuma-prod.com/qHR2wGfc5RLi6/aragon/osx-sepolia/version/1.4.2/api',
zksyncSepolia:
'https://subgraph.satsuma-prod.com/qHR2wGfc5RLi6/aragon/osx-zksync-era-sepolia/version/1.4.2/api',
unsupported: undefined,
};

Expand Down
53 changes: 52 additions & 1 deletion src/utils/constants/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import {i18n} from '../../../i18n.config';

export const SUPPORTED_CHAIN_ID = [
1, 5, 137, 8453, 80001, 84531, 42161, 421613, 11155111,
1, 5, 137, 300, 324, 8453, 80001, 84531, 42161, 421613, 11155111,
] as const;

export type SupportedChainID = (typeof SUPPORTED_CHAIN_ID)[number];
Expand All @@ -23,6 +23,8 @@ export const NETWORKS_WITH_CUSTOM_REGISTRY: SupportedNetworks[] = [
'base',
'polygon',
'sepolia',
// 'zksync',
'zksyncSepolia',
];

export const L2_NETWORKS = NETWORKS_WITH_CUSTOM_REGISTRY;
Expand All @@ -33,6 +35,8 @@ const SUPPORTED_NETWORKS = [
'ethereum',
'polygon',
'sepolia',
// 'zksync',
'zksyncSepolia',
] as const;

export type SupportedNetworks =
Expand Down Expand Up @@ -230,6 +234,53 @@ export const CHAIN_METADATA: Record<SupportedNetworks, ChainData> = {
},
supportsEns: false,
},
// zksync: {
// id: 324,
// name: i18n.t('explore.modal.filterDAOs.label.zksync'),
// domain: 'L2 Blockchain',
// logo: 'https://assets.coingecko.com/asset_platforms/images/121/large/zksync.jpeg',
// explorer: 'https://explorer.zksync.io/',
// isTestnet: false,
// explorerName: 'ZkSync Explorer',
// publicRpc: 'https://zksync.meowrpc.com',
// gatewayNetwork: 'ethereum/zksync',
// nativeCurrency: {
// name: 'Ether',
// symbol: 'ETH',
// decimals: 18,
// },
// etherscanApi: 'https://block-explorer-api.mainnet.zksync.io/api',
// etherscanApiKey: '',
// covalent: {
// networkId: 'zksync-mainnet',
// nativeTokenId: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
// },
// supportsEns: false,
// },
zksyncSepolia: {
id: 300,
name: i18n.t('explore.modal.filterDAOs.label.zksyncSepolia'),
domain: 'L2 Blockchain',
logo: 'https://assets.coingecko.com/asset_platforms/images/121/large/zksync.jpeg',
explorer: 'https://sepolia.explorer.zksync.io/',
isTestnet: true,
// mainnet: 'zksync',
explorerName: 'ZkSync Sepolia Explorer',
publicRpc: 'https://endpoints.omniatech.io/v1/zksync-era/sepolia/public',
gatewayNetwork: 'zksync/sepolia',
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
etherscanApi: 'https://block-explorer-api.sepolia.zksync.dev/api',
etherscanApiKey: '',
covalent: {
networkId: 'zksync-sepolia-testnet',
nativeTokenId: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
},
supportsEns: false,
},
unsupported: {
id: 1,
name: 'Unsupported',
Expand Down
8 changes: 6 additions & 2 deletions src/utils/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,8 @@ export const translateToAppNetwork = (
return 'polygon';
case SdkSupportedNetworks.SEPOLIA:
return 'sepolia';
case SdkSupportedNetworks.ZKSYNC_SEPOLIA:
return 'zksyncSepolia';
default:
return 'unsupported';
}
Expand Down Expand Up @@ -897,6 +899,8 @@ export function translateToNetworkishName(
return SdkSupportedNetworks.POLYGON;
case 'sepolia':
return SdkSupportedNetworks.SEPOLIA;
case 'zksyncSepolia':
return SdkSupportedNetworks.ZKSYNC_SEPOLIA;
}

return 'unsupported';
Expand Down Expand Up @@ -1313,8 +1317,8 @@ export function getPluginRepoAddress(
) {
return pluginType === 'multisig.plugin.dao.eth'
? getNetworkDeployments(translatedNetwork)[version]?.MultisigRepoProxy
.address
?.address
: getNetworkDeployments(translatedNetwork)[version]?.TokenVotingRepoProxy
.address;
?.address;
}
}
30 changes: 15 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@
dependencies:
tslib "^2.6.2"

"@aragon/osx-commons-configs@^0.4.0":
version "0.4.0"
resolved "https://registry.yarnpkg.com/@aragon/osx-commons-configs/-/osx-commons-configs-0.4.0.tgz#5b6ae025de1ccf7f9a135bfbcb0aa822c774acf9"
integrity sha512-/2wIQCbv/spMRdOjRXK0RrXG1TK5aMcbD73RvMgMwQwSrKcA1dCntUuSxmTm2W8eEtOzs8E1VPjqZk0cXL4SSQ==
"@aragon/osx-commons-configs@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@aragon/osx-commons-configs/-/osx-commons-configs-0.5.0.tgz#4c9006d61dbec8f13af5f5110f2d84ab00986ded"
integrity sha512-1ylzs0sbb9sOSisQc01IOXdC7rVhxuRD64GRtwE5KUCq8nyzQ1jk+yXscYh3Uw+B6B8DLKeLN9xFquR7y1grZA==
dependencies:
tslib "^2.6.2"

Expand Down Expand Up @@ -132,12 +132,12 @@
graphql-request "^4.3.0"
yup "^1.2.0"

"@aragon/sdk-client-common@^1.15.3":
version "1.15.3"
resolved "https://registry.yarnpkg.com/@aragon/sdk-client-common/-/sdk-client-common-1.15.3.tgz#039efbdb41fead05f34f999086ec198d1201a1c2"
integrity sha512-quZiR9UEYE5atEcFPyohkpU9RvAtal9gqitEv+15IFxf8bkQyH/g/tG7icFseYcCZkHAgzBnjgk/PNfqr4attw==
"@aragon/sdk-client-common@^1.16.0":
version "1.16.0"
resolved "https://registry.yarnpkg.com/@aragon/sdk-client-common/-/sdk-client-common-1.16.0.tgz#7d1ee5a8d68f3ddf5394773c5cf2161d048c5a95"
integrity sha512-ELWO7+8PrjZ6yqW1rEqFlDljp6G04aAji1pPTEp+MU9a+TMWZno2yQgvGCT492IK1EMSQATblEczVZ7PkP04rQ==
dependencies:
"@aragon/osx-commons-configs" "^0.4.0"
"@aragon/osx-commons-configs" "^0.5.0"
"@aragon/osx-ethers" "^1.3.1"
"@aragon/osx-ethers-v1.0.0" "npm:@aragon/[email protected]"
"@aragon/sdk-ipfs" "^1.1.0"
Expand Down Expand Up @@ -171,14 +171,14 @@
graphql-request "^4.3.0"
yup "^1.2.0"

"@aragon/sdk-client@^1.23.5":
version "1.23.5"
resolved "https://registry.yarnpkg.com/@aragon/sdk-client/-/sdk-client-1.23.5.tgz#84cc4047e4fad766a175002befced605bd8e6b16"
integrity sha512-EcQv10RkASZQPLyDOLGRY1ZnVRVWV1cKpNjJWEbOkwCicihH5JuPp8XFPfRp5794yEpkCAxfq1SFl9NYyS1qeA==
"@aragon/sdk-client@^1.24.0":
version "1.24.0"
resolved "https://registry.yarnpkg.com/@aragon/sdk-client/-/sdk-client-1.24.0.tgz#a2312d47354ee390d099f829dd5df94bc92aede9"
integrity sha512-U99kX4+PM2TPQJ+OfZ08jN5EhcXZzgwMr9wQYmAexOTnjSE9ec1TvmkydBfDAuHGW8eNyNzJIu5Uze8gqXw6Ug==
dependencies:
"@aragon/osx-commons-configs" "^0.4.0"
"@aragon/osx-commons-configs" "^0.5.0"
"@aragon/osx-ethers" "1.3.0"
"@aragon/sdk-client-common" "^1.15.3"
"@aragon/sdk-client-common" "^1.16.0"
"@aragon/sdk-ipfs" "^1.1.0"
"@ethersproject/abstract-signer" "^5.5.0"
"@ethersproject/bignumber" "^5.6.0"
Expand Down
Loading