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

feat: testnet #1092

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
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
10 changes: 5 additions & 5 deletions apps/web/app/api/space/deploy/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { DaoCreationSteps } from '@aragon/sdk-client';
import { ContextParams, DaoCreationError, MissingExecPermissionError, PermissionIds } from '@aragon/sdk-client-common';
import { id } from '@ethersproject/hash';
import { VotingMode, getChecksumAddress } from '@graphprotocol/grc-20';
import { MAINNET } from '@graphprotocol/grc-20/contracts';
import { TESTNET } from '@graphprotocol/grc-20/contracts';
import { EditProposal } from '@graphprotocol/grc-20/proto';
import { Duration, Effect, Either, Schedule } from 'effect';
import { ethers, providers } from 'ethers';
Expand Down Expand Up @@ -40,8 +40,8 @@ const deployParams = {
network: SupportedNetworks.LOCAL, // I don't think this matters but is required by Aragon SDK
signer: signer,
web3Providers: new providers.JsonRpcProvider(Environment.variables.rpcEndpoint),
DAOFactory: MAINNET.DAO_FACTORY_ADDRESS,
ENSRegistry: MAINNET.ENS_REGISTRY_ADDRESS,
DAOFactory: TESTNET.DAO_FACTORY_ADDRESS,
ENSRegistry: TESTNET.ENS_REGISTRY_ADDRESS,
};

class DeployDaoError extends Error {
Expand Down Expand Up @@ -325,7 +325,7 @@ async function* createDao(params: CreateGeoDaoParams, context: ContextParams) {
// This check isn't 100% correct all the time
// simulate the DAO creation to get an address
// const pluginSetupProcessorAddr = await daoFactoryInstance.pluginSetupProcessor();
const pluginSetupProcessor = PluginSetupProcessor__factory.connect(MAINNET.PLUGIN_SETUP_PROCESSOR_ADDRESS, signer);
const pluginSetupProcessor = PluginSetupProcessor__factory.connect(TESTNET.PLUGIN_SETUP_PROCESSOR_ADDRESS, signer);
let execPermissionFound = false;

// using the DAO base because it reflects a newly created DAO the best
Expand Down Expand Up @@ -354,7 +354,7 @@ async function* createDao(params: CreateGeoDaoParams, context: ContextParams) {
// write the tx using the geo signer.
// @TODO can this just be a smart account client?
const hash = await walletClient.sendTransaction({
to: MAINNET.DAO_FACTORY_ADDRESS as `0x${string}`,
to: TESTNET.DAO_FACTORY_ADDRESS as `0x${string}`,
data: encodeFunctionData({
abi: DaoFactoryAbi,
functionName: 'createDao',
Expand Down
10 changes: 4 additions & 6 deletions apps/web/app/api/space/deploy/encodings.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { CreateDaoParams } from '@aragon/sdk-client';
import { VotingMode } from '@graphprotocol/grc-20';
import {
MAINNET
} from '@graphprotocol/grc-20/contracts';
import { TESTNET } from '@graphprotocol/grc-20/contracts';
import { ethers } from 'ethers';
import { encodeAbiParameters } from 'viem';

Expand Down Expand Up @@ -61,7 +59,7 @@ export function getSpacePluginInstallItem({
]);

return {
id: MAINNET.SPACE_PLUGIN_REPO_ADDRESS as `0x${string}`,
id: TESTNET.SPACE_PLUGIN_REPO_ADDRESS as `0x${string}`,
data: encodedParams,
};
}
Expand All @@ -85,7 +83,7 @@ export function getPersonalSpaceGovernancePluginInstallItem({
const encodedParams = encodeAbiParameters(prepareInstallationInputs, [initialEditor]);

return {
id: MAINNET.PERSONAL_SPACE_ADMIN_PLUGIN_REPO_ADDRESS as `0x${string}`,
id: TESTNET.PERSONAL_SPACE_ADMIN_PLUGIN_REPO_ADDRESS as `0x${string}`,
data: encodedParams,
};
}
Expand Down Expand Up @@ -149,7 +147,7 @@ export function getGovernancePluginInstallItem(params: {
]);

return {
id: MAINNET.GOVERNANCE_PLUGIN_REPO_ADDRESS as `0x${string}`,
id: TESTNET.GOVERNANCE_PLUGIN_REPO_ADDRESS as `0x${string}`,
data: encodedParams,
};
}
6 changes: 2 additions & 4 deletions apps/web/app/root/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { SYSTEM_IDS } from '@graphprotocol/grc-20';

import * as React from 'react';

import { Metadata } from 'next';

import { DEFAULT_OPENGRAPH_IMAGE } from '~/core/constants';
import { DEFAULT_OPENGRAPH_IMAGE, ROOT_SPACE_ID } from '~/core/constants';

import Layout from '../space/[id]/layout';

Expand Down Expand Up @@ -41,6 +39,6 @@ export const metadata: Metadata = {
export const revalidate = 60; // 1 minute

export default function RootLayout({ children }: { children: React.ReactNode }) {
const params = new Promise<{ id: string }>(resolve => resolve({ id: SYSTEM_IDS.ROOT_SPACE_ID }));
const params = new Promise<{ id: string }>(resolve => resolve({ id: ROOT_SPACE_ID }));
return <Layout params={params}>{children}</Layout>;
}
4 changes: 2 additions & 2 deletions apps/web/app/root/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { SYSTEM_IDS } from '@graphprotocol/grc-20';
import { ROOT_SPACE_ID } from '~/core/constants';

import Page from '../space/[id]/page';

export default function RootPage() {
const params = new Promise<{ id: string }>(resolve => resolve({ id: SYSTEM_IDS.ROOT_SPACE_ID }));
const params = new Promise<{ id: string }>(resolve => resolve({ id: ROOT_SPACE_ID }));
return <Page params={params} />;
}
1 change: 1 addition & 0 deletions apps/web/core/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export const DEFAULT_OPENGRAPH_DESCRIPTION =
export const IPFS_GATEWAY_PATH = 'https://node.lighthouse.storage';
export const IPFS_GATEWAY_READ_PATH = `https://gateway.lighthouse.storage/ipfs/`;
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
export const ROOT_SPACE_ID = '2xBvgiT53h7njMQB4APGAu';
12 changes: 6 additions & 6 deletions apps/web/core/environment/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
WALLETCONNECT_PROJECT_ID,
} from './config';

type SupportedChainId = '31337' | '80451';
type SupportedChainId = '31337' | '19411';

export type AppConfig = {
chainId: SupportedChainId;
Expand Down Expand Up @@ -54,18 +54,18 @@ export const options: Record<AppEnv, AppConfig> = {
bundler: `https://api.pimlico.io/v2/80451/rpc?apikey=${variables.accountAbstractionApiKey}`,
},
production: {
chainId: '80451',
chainId: '19411',
rpc: variables.rpcEndpoint,
ipfs: IPFS_GATEWAY_PATH,
api: 'https://hypergraph.up.railway.app/graphql',
bundler: `https://api.pimlico.io/v2/80451/rpc?apikey=${variables.accountAbstractionApiKey}`,
api: 'https://geo-conduit.up.railway.app/graphql',
bundler: `https://api.pimlico.io/v2/geo-testnet/rpc?apikey=${variables.accountAbstractionApiKey}`,
},
testnet: {
chainId: '80451',
chainId: '19411',
rpc: variables.rpcEndpoint,
ipfs: IPFS_GATEWAY_PATH,
api: 'https://geo-conduit.up.railway.app/graphql',
bundler: `https://api.pimlico.io/v2/80451/rpc?apikey=${variables.accountAbstractionApiKey}`,
bundler: `https://api.pimlico.io/v2/geo-testnet/rpc?apikey=${variables.accountAbstractionApiKey}`,
},
};

Expand Down
12 changes: 9 additions & 3 deletions apps/web/core/hooks/use-smart-account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
createSmartAccountClient,
walletClientToSmartAccountSigner,
} from 'permissionless';
import { signerToSafeSmartAccount } from 'permissionless/accounts';
import { signerToSimpleSmartAccount } from 'permissionless/accounts';
import { pimlicoBundlerActions, pimlicoPaymasterActions } from 'permissionless/actions/pimlico';
import { useCookies } from 'react-cookie';
import { createClient, createPublicClient, http } from 'viem';
Expand Down Expand Up @@ -39,10 +39,16 @@ export function useSmartAccount() {

const signer = walletClientToSmartAccountSigner(walletClient);

const safeAccount = await signerToSafeSmartAccount(publicClient, {
// const safeAccount = await signerToSafeSmartAccount(publicClient, {
// signer: signer,
// entryPoint: ENTRYPOINT_ADDRESS_V07,
// safeVersion: '1.4.1',
// });

const safeAccount = await signerToSimpleSmartAccount(publicClient, {
signer: signer,
entryPoint: ENTRYPOINT_ADDRESS_V07,
safeVersion: '1.4.1',
factoryAddress: '0x91E60e0613810449d098b0b5Ec8b51A0FE8c8985',
});

const bundlerClient = createClient({
Expand Down
3 changes: 2 additions & 1 deletion apps/web/core/utils/contracts/clone-entity.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { CONTENT_IDS, Op, Relation, SYSTEM_IDS } from '@graphprotocol/grc-20';

import { ROOT_SPACE_ID } from '~/core/constants';
import { ID } from '~/core/id';
import { Subgraph } from '~/core/io';
import { Relation as RelationType } from '~/core/types';
Expand All @@ -23,7 +24,7 @@ export const cloneEntity = async (

const { oldEntityId, entityId = null, entityName, parentEntityId = null, parentEntityName = null } = options;

const oldEntity = await Subgraph.fetchEntity({ id: oldEntityId, spaceId: SYSTEM_IDS.ROOT_SPACE_ID });
const oldEntity = await Subgraph.fetchEntity({ id: oldEntityId, spaceId: ROOT_SPACE_ID });

if (!oldEntity) return [[], previouslySeenEntityIds ?? new Set()];

Expand Down
5 changes: 2 additions & 3 deletions apps/web/core/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { BASE58_ALLOWED_CHARS } from '@graphprotocol/grc-20';
import { SYSTEM_IDS } from '@graphprotocol/grc-20';
import { validate as uuidValidate, version as uuidVersion } from 'uuid';
import { getAddress } from 'viem';

import { IPFS_GATEWAY_READ_PATH } from '~/core/constants';
import { IPFS_GATEWAY_READ_PATH, ROOT_SPACE_ID } from '~/core/constants';
import { EntityId } from '~/core/io/schema';

import { Entity } from '../io/dto/entities';
Expand All @@ -21,7 +20,7 @@ export const NavUtils = {
toRoot: () => '/root',
toHome: () => `/home`,
toAdmin: (spaceId: string) => `/space/${spaceId}/access-control`,
toSpace: (spaceId: string) => (spaceId === SYSTEM_IDS.ROOT_SPACE_ID ? `/root` : `/space/${spaceId}`),
toSpace: (spaceId: string) => (spaceId === ROOT_SPACE_ID ? `/root` : `/space/${spaceId}`),
toProposal: (spaceId: string, proposalId: string) => `/space/${spaceId}/governance?proposalId=${proposalId}`,
toEntity: (spaceId: string, newEntityId: string) => {
return `/space/${spaceId}/${newEntityId}`;
Expand Down
3 changes: 2 additions & 1 deletion apps/web/design-system/find-entity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import pluralize from 'pluralize';
import * as React from 'react';
import { startTransition, useState } from 'react';

import { ROOT_SPACE_ID } from '~/core/constants';
import { useSearch } from '~/core/hooks/use-search';
import { SearchResult } from '~/core/io/dto/search';
import { EntityId } from '~/core/io/schema';
Expand Down Expand Up @@ -125,7 +126,7 @@ export const FindEntity = ({
<button
onClick={event => {
event.stopPropagation();
window.open(NavUtils.toEntity(SYSTEM_IDS.ROOT_SPACE_ID, result.id));
window.open(NavUtils.toEntity(ROOT_SPACE_ID, result.id));
}}
className="relative text-text hover:text-ctaPrimary"
>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@ethersproject/abi": "^5.6.4",
"@ethersproject/hash": "^5.7.0",
"@ethersproject/providers": "^5.6.8",
"@graphprotocol/grc-20": "^0.4.1",
"@graphprotocol/grc-20": "^0.5.0",
"@mobily/ts-belt": "^4.0.0-rc.2",
"@privy-io/react-auth": "^2.1.0",
"@privy-io/wagmi": "^1.0.2",
Expand Down
4 changes: 2 additions & 2 deletions apps/web/partials/navbar/navbar-actions.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client';

import { SYSTEM_IDS } from '@graphprotocol/grc-20';
import { useLogout } from '@privy-io/react-auth';
import * as Popover from '@radix-ui/react-popover';
import { cva } from 'class-variance-authority';
Expand All @@ -10,6 +9,7 @@ import { useParams } from 'next/navigation';

import * as React from 'react';

import { ROOT_SPACE_ID } from '~/core/constants';
import { Cookie } from '~/core/cookie';
import { useGeoProfile } from '~/core/hooks/use-geo-profile';
import { useKeyboardShortcuts } from '~/core/hooks/use-keyboard-shortcuts';
Expand Down Expand Up @@ -192,7 +192,7 @@ const useSpaceId = () => {
const segment = usePathSegments();

if (segment[0] === 'root') {
return SYSTEM_IDS.ROOT_SPACE_ID;
return ROOT_SPACE_ID;
}

const spaceId = params?.['id'] as string | undefined;
Expand Down
2 changes: 2 additions & 0 deletions apps/web/partials/navbar/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export function Navbar({ onSearchClick }: Props) {
</a>
)}

<p>TESTNET</p>

<CreateSpaceDropdown />

<button
Expand Down
4 changes: 2 additions & 2 deletions apps/web/partials/space-page/space-notices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useRouter } from 'next/navigation';
import * as React from 'react';
import { useCallback } from 'react';

import { IPFS_GATEWAY_READ_PATH, PLACEHOLDER_SPACE_IMAGE } from '~/core/constants';
import { IPFS_GATEWAY_READ_PATH, PLACEHOLDER_SPACE_IMAGE, ROOT_SPACE_ID } from '~/core/constants';
import { useAccessControl } from '~/core/hooks/use-access-control';
import { useCreateEntityFromType } from '~/core/hooks/use-create-entity-from-type';
import { useUserIsEditing } from '~/core/hooks/use-user-is-editing';
Expand Down Expand Up @@ -219,7 +219,7 @@ const FindProjects = ({ spaceId }: FindProjectsProps) => {
<SelectEntity
placeholder=""
onDone={result => {
const destination = NavUtils.toEntity(SYSTEM_IDS.ROOT_SPACE_ID, result.id);
const destination = NavUtils.toEntity(ROOT_SPACE_ID, result.id);
router.push(destination);
}}
spaceId={spaceId}
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,10 @@
"rimraf": "^3.0.2",
"turbo": "^1.10.6"
},
"packageManager": "pnpm@9.15.4"
"packageManager": "pnpm@9.15.4",
"pnpm": {
"patchedDependencies": {
"permissionless@0.1.29": "patches/permissionless@0.1.29.patch"
}
}
}
Loading