From 9643a984cc601cd6a9e0772fe775c62b306e295e Mon Sep 17 00:00:00 2001 From: neokry Date: Fri, 5 Jan 2024 13:53:23 -0800 Subject: [PATCH 1/9] Adds metadata indexing for mainnet and goerli --- apps/subgraph/config/base-goerli.json | 3 +- apps/subgraph/config/base.json | 3 +- apps/subgraph/config/goerli.json | 3 +- apps/subgraph/config/mainnet.json | 3 +- apps/subgraph/config/optimism-goerli.json | 3 +- apps/subgraph/config/optimism.json | 3 +- apps/subgraph/config/zora-goerli.json | 3 +- apps/subgraph/config/zora.json | 3 +- apps/subgraph/package.json | 16 ++--- apps/subgraph/schema.graphql | 20 ++++++ apps/subgraph/src/metadata.ts | 85 ++++++++++++++++++++++- apps/subgraph/subgraph.yaml.mustache | 7 ++ 12 files changed, 135 insertions(+), 17 deletions(-) diff --git a/apps/subgraph/config/base-goerli.json b/apps/subgraph/config/base-goerli.json index f36807468..f15496289 100644 --- a/apps/subgraph/config/base-goerli.json +++ b/apps/subgraph/config/base-goerli.json @@ -3,5 +3,6 @@ "manager": { "address": "0x550c326d688fD51ae65AC6A2d48749E631023A03", "startBlock": 6585050 - } + }, + "callHandlers": false } diff --git a/apps/subgraph/config/base.json b/apps/subgraph/config/base.json index 4b2f5dddf..c37f802c3 100644 --- a/apps/subgraph/config/base.json +++ b/apps/subgraph/config/base.json @@ -3,5 +3,6 @@ "manager": { "address": "0x3ac0e64fe2931f8e082c6bb29283540de9b5371c", "startBlock": 1991500 - } + }, + "callHandlers": false } diff --git a/apps/subgraph/config/goerli.json b/apps/subgraph/config/goerli.json index 9ceb97b50..19eb9fdb6 100644 --- a/apps/subgraph/config/goerli.json +++ b/apps/subgraph/config/goerli.json @@ -3,5 +3,6 @@ "manager": { "address": "0x0E9F3382Cf2508E3bc83248B5b4707FbA86D7Ee0", "startBlock": 7810600 - } + }, + "callHandlers": true } diff --git a/apps/subgraph/config/mainnet.json b/apps/subgraph/config/mainnet.json index 4f69e2b50..4ffc68bb6 100644 --- a/apps/subgraph/config/mainnet.json +++ b/apps/subgraph/config/mainnet.json @@ -3,5 +3,6 @@ "manager": { "address": "0xd310a3041dfcf14def5ccbc508668974b5da7174", "startBlock": 15799000 - } + }, + "callHandlers": true } diff --git a/apps/subgraph/config/optimism-goerli.json b/apps/subgraph/config/optimism-goerli.json index 842d04418..4344ad16d 100644 --- a/apps/subgraph/config/optimism-goerli.json +++ b/apps/subgraph/config/optimism-goerli.json @@ -3,5 +3,6 @@ "manager": { "address": "0x5f9c1e7E31875beAa6ba6B0AB573a4AbEcC95d67", "startBlock": 11032400 - } + }, + "callHandlers": false } diff --git a/apps/subgraph/config/optimism.json b/apps/subgraph/config/optimism.json index 7a51227f9..d999368fd 100644 --- a/apps/subgraph/config/optimism.json +++ b/apps/subgraph/config/optimism.json @@ -3,5 +3,6 @@ "manager": { "address": "0x3ac0E64Fe2931f8e082C6Bb29283540DE9b5371C", "startBlock": 107290000 - } + }, + "callHandlers": false } diff --git a/apps/subgraph/config/zora-goerli.json b/apps/subgraph/config/zora-goerli.json index c842dac15..f30fd81b0 100644 --- a/apps/subgraph/config/zora-goerli.json +++ b/apps/subgraph/config/zora-goerli.json @@ -3,5 +3,6 @@ "manager": { "address": "0xc521f85613985b7e417fccd5b348f64263d79397", "startBlock": 597700 - } + }, + "callHandlers": false } diff --git a/apps/subgraph/config/zora.json b/apps/subgraph/config/zora.json index ca3a84ab3..533af9aa1 100644 --- a/apps/subgraph/config/zora.json +++ b/apps/subgraph/config/zora.json @@ -3,5 +3,6 @@ "manager": { "address": "0x3ac0E64Fe2931f8e082C6Bb29283540DE9b5371C", "startBlock": 1778012 - } + }, + "callHandlers": false } diff --git a/apps/subgraph/package.json b/apps/subgraph/package.json index f26408603..93c17bc5f 100644 --- a/apps/subgraph/package.json +++ b/apps/subgraph/package.json @@ -13,14 +13,14 @@ "prepare:optimism-goerli": "mustache config/optimism-goerli.json subgraph.yaml.mustache > subgraph.yaml", "prepare:zora": "mustache config/zora.json subgraph.yaml.mustache > subgraph.yaml", "prepare:zora-goerli": "mustache config/zora-goerli.json subgraph.yaml.mustache > subgraph.yaml", - "deploy:goerli": "pnpm clean && pnpm prepare:goerli && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-goerli-testnet/1.0.2", - "deploy:mainnet": "pnpm clean && pnpm prepare:mainnet && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-ethereum-mainnet/1.0.2", - "deploy:base": "pnpm clean && pnpm prepare:base && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-base-mainnet/1.0.2", - "deploy:base-goerli": "pnpm clean && pnpm prepare:base-goerli && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-base-testnet/1.0.2", - "deploy:optimism": "pnpm clean && pnpm prepare:optimism && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-optimism-mainnet/1.0.2", - "deploy:optimism-goerli": "pnpm clean && pnpm prepare:optimism-goerli && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-optimism-testnet/1.0.2", - "deploy:zora": "pnpm clean && pnpm prepare:zora && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-zora-mainnet/1.0.2", - "deploy:zora-goerli": "pnpm clean && pnpm prepare:zora-goerli && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-zora-testnet/1.0.2", + "deploy:goerli": "pnpm clean && pnpm prepare:goerli && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-goerli-testnet/1.1.0", + "deploy:mainnet": "pnpm clean && pnpm prepare:mainnet && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-ethereum-mainnet/1.1.0", + "deploy:base": "pnpm clean && pnpm prepare:base && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-base-mainnet/1.1.0", + "deploy:base-goerli": "pnpm clean && pnpm prepare:base-goerli && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-base-testnet/1.1.0", + "deploy:optimism": "pnpm clean && pnpm prepare:optimism && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-optimism-mainnet/1.1.0", + "deploy:optimism-goerli": "pnpm clean && pnpm prepare:optimism-goerli && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-optimism-testnet/1.1.0", + "deploy:zora": "pnpm clean && pnpm prepare:zora && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-zora-mainnet/1.1.0", + "deploy:zora-goerli": "pnpm clean && pnpm prepare:zora-goerli && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-zora-testnet/1.1.0", "create:local": "graph create --node http://localhost:8020/ nouns-builder", "remove:local": "graph remove --node http://localhost:8020/ nouns-builder", "deploy:local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 --network goerli nouns-builder" diff --git a/apps/subgraph/schema.graphql b/apps/subgraph/schema.graphql index 1f829ebbf..14b0d98b0 100644 --- a/apps/subgraph/schema.graphql +++ b/apps/subgraph/schema.graphql @@ -16,6 +16,7 @@ type DAO @entity { totalAuctionSales: BigInt! auctionConfig: AuctionConfig! currentAuction: Auction + metadataProperties: [MetadataProperty!] owners: [DAOTokenOwner!]! @derivedFrom(field: "dao") tokens: [Token!]! @derivedFrom(field: "dao") proposals: [Proposal!]! @derivedFrom(field: "dao") @@ -120,3 +121,22 @@ type AuctionBid @entity { auction: Auction! bidTime: BigInt! } + +type MetadataProperty @entity { + id: ID! + dao: DAO! + names: [String!]! + items: [MetadataItem!]! @derivedFrom(field: "property") + ipfsBaseUri: String! + ipfsExtension: String! + createdAt: BigInt! + deleted: Boolean! +} + +type MetadataItem @entity { + id: ID! + property: MetadataProperty! + propertyId: BigInt! + name: String! + isNewProperty: Boolean! +} diff --git a/apps/subgraph/src/metadata.ts b/apps/subgraph/src/metadata.ts index 8e4c6c6a4..b04de7823 100644 --- a/apps/subgraph/src/metadata.ts +++ b/apps/subgraph/src/metadata.ts @@ -1,6 +1,8 @@ -import { DAO } from '../generated/schema' +import { DAO, MetadataItem, MetadataProperty } from '../generated/schema' import { + AddPropertiesCall as AddPropertiesFunctionCall, ContractImageUpdated as ContractImageUpdatedEvent, + DeleteAndRecreatePropertiesCall as DeleteAndRecreatePropertiesFunctionCall, DescriptionUpdated as DescriptionUpdatedEvent, WebsiteURIUpdated as URIUpdatedEvent, } from '../generated/templates/MetadataRenderer/MetadataRenderer' @@ -26,3 +28,84 @@ export function handleDescriptionUpdated(event: DescriptionUpdatedEvent): void { dao.description = event.params.newDescription dao.save() } + +export function handleAddProperties(event: AddPropertiesFunctionCall): void { + let context = dataSource.context() + + let inputs = event.inputs + let dao = DAO.load(context.getString('tokenAddress'))! + let id = dao.id + '-' + event.transaction.hash.toHexString() + + let property = new MetadataProperty(id) + property.dao = dao.id + property.names = inputs._names + property.ipfsBaseUri = inputs._ipfsGroup.baseUri + property.ipfsExtension = inputs._ipfsGroup.extension + property.createdAt = event.block.timestamp + property.deleted = false + + for (let i = 0; i < inputs._items.length; i++) { + let input = inputs._items[i] + let item = new MetadataItem(id + '-' + i.toString()) + item.name = input.name + item.property = property.id + item.propertyId = input.propertyId + item.isNewProperty = input.isNewProperty + item.save() + } + + property.save() + + let properties: string[] = + dao.metadataProperties === null ? [] : dao.metadataProperties! + + properties.push(property.id) + dao.metadataProperties = properties + dao.save() +} + +export function handleDeleteAndRecreateProperties( + event: DeleteAndRecreatePropertiesFunctionCall +): void { + let context = dataSource.context() + + let inputs = event.inputs + let dao = DAO.load(context.getString('tokenAddress'))! + let id = dao.id + '-' + event.transaction.hash.toHexString() + + let property = new MetadataProperty(id) + property.dao = dao.id + property.names = inputs._names + property.ipfsBaseUri = inputs._ipfsGroup.baseUri + property.ipfsExtension = inputs._ipfsGroup.extension + property.createdAt = event.block.timestamp + property.deleted = false + + for (let i = 0; i < inputs._items.length; i++) { + let input = inputs._items[i] + let item = new MetadataItem(id + '-' + i.toString()) + item.name = input.name + item.property = property.id + item.propertyId = input.propertyId + item.isNewProperty = input.isNewProperty + item.save() + } + + property.save() + + // Mark old properties as deleted + if (dao.metadataProperties !== null) { + let currentProperties = dao.metadataProperties! + for (let i = 0; i < currentProperties.length; i++) { + let property = MetadataProperty.load(currentProperties[i])! + property.deleted = true + property.save() + } + } + + let properties: string[] = [] + + properties.push(property.id) + dao.metadataProperties = properties + dao.save() +} diff --git a/apps/subgraph/subgraph.yaml.mustache b/apps/subgraph/subgraph.yaml.mustache index 6d07ecc4e..a567ec75f 100644 --- a/apps/subgraph/subgraph.yaml.mustache +++ b/apps/subgraph/subgraph.yaml.mustache @@ -104,6 +104,13 @@ templates: handler: handleDescriptionUpdated - event: WebsiteURIUpdated(string,string) handler: handleWebsiteURIUpdated + {{#callHandlers}} + callHandlers: + - function: addProperties(string[],(uint256,string,bool)[],(string,string)) + handler: handleAddProperties + - function: deleteAndRecreateProperties(string[],(uint256,string,bool)[],(string,string)) + handler: handleDeleteAndRecreateProperties + {{/callHandlers}} file: ./src/metadata.ts - kind: ethereum name: Auction From 88ef149389ee47f91a32ca02c1c759d7c85203f1 Mon Sep 17 00:00:00 2001 From: neokry Date: Mon, 8 Jan 2024 12:11:06 -0800 Subject: [PATCH 2/9] rename property on metadata item --- apps/subgraph/schema.graphql | 4 ++-- apps/subgraph/src/metadata.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/subgraph/schema.graphql b/apps/subgraph/schema.graphql index 14b0d98b0..30fd8f726 100644 --- a/apps/subgraph/schema.graphql +++ b/apps/subgraph/schema.graphql @@ -126,7 +126,7 @@ type MetadataProperty @entity { id: ID! dao: DAO! names: [String!]! - items: [MetadataItem!]! @derivedFrom(field: "property") + items: [MetadataItem!]! @derivedFrom(field: "propertyInfo") ipfsBaseUri: String! ipfsExtension: String! createdAt: BigInt! @@ -135,7 +135,7 @@ type MetadataProperty @entity { type MetadataItem @entity { id: ID! - property: MetadataProperty! + propertyInfo: MetadataProperty! propertyId: BigInt! name: String! isNewProperty: Boolean! diff --git a/apps/subgraph/src/metadata.ts b/apps/subgraph/src/metadata.ts index b04de7823..00196154a 100644 --- a/apps/subgraph/src/metadata.ts +++ b/apps/subgraph/src/metadata.ts @@ -48,7 +48,7 @@ export function handleAddProperties(event: AddPropertiesFunctionCall): void { let input = inputs._items[i] let item = new MetadataItem(id + '-' + i.toString()) item.name = input.name - item.property = property.id + item.propertyInfo = property.id item.propertyId = input.propertyId item.isNewProperty = input.isNewProperty item.save() @@ -85,7 +85,7 @@ export function handleDeleteAndRecreateProperties( let input = inputs._items[i] let item = new MetadataItem(id + '-' + i.toString()) item.name = input.name - item.property = property.id + item.propertyInfo = property.id item.propertyId = input.propertyId item.isNewProperty = input.isNewProperty item.save() From 8854afd81e163473410843ec90dafc317bb39745 Mon Sep 17 00:00:00 2001 From: neokry Date: Tue, 16 Jan 2024 13:57:48 -0800 Subject: [PATCH 3/9] add index to metadata item --- apps/subgraph/schema.graphql | 1 + apps/subgraph/src/metadata.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/apps/subgraph/schema.graphql b/apps/subgraph/schema.graphql index 30fd8f726..464f4e9fa 100644 --- a/apps/subgraph/schema.graphql +++ b/apps/subgraph/schema.graphql @@ -135,6 +135,7 @@ type MetadataProperty @entity { type MetadataItem @entity { id: ID! + index: Int! propertyInfo: MetadataProperty! propertyId: BigInt! name: String! diff --git a/apps/subgraph/src/metadata.ts b/apps/subgraph/src/metadata.ts index 00196154a..672df463a 100644 --- a/apps/subgraph/src/metadata.ts +++ b/apps/subgraph/src/metadata.ts @@ -47,6 +47,7 @@ export function handleAddProperties(event: AddPropertiesFunctionCall): void { for (let i = 0; i < inputs._items.length; i++) { let input = inputs._items[i] let item = new MetadataItem(id + '-' + i.toString()) + item.index = i item.name = input.name item.propertyInfo = property.id item.propertyId = input.propertyId @@ -84,6 +85,7 @@ export function handleDeleteAndRecreateProperties( for (let i = 0; i < inputs._items.length; i++) { let input = inputs._items[i] let item = new MetadataItem(id + '-' + i.toString()) + item.index = i item.name = input.name item.propertyInfo = property.id item.propertyId = input.propertyId From 5214a4c2ef89d84f1689cedf8210db2091907424 Mon Sep 17 00:00:00 2001 From: neokry Date: Tue, 16 Jan 2024 16:54:39 -0800 Subject: [PATCH 4/9] make image optional --- apps/subgraph/schema.graphql | 2 +- apps/subgraph/src/token.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/subgraph/schema.graphql b/apps/subgraph/schema.graphql index 464f4e9fa..dea84a903 100644 --- a/apps/subgraph/schema.graphql +++ b/apps/subgraph/schema.graphql @@ -34,7 +34,7 @@ type DAOTokenOwner @entity { type Token @entity { id: ID! name: String! - image: String! + image: String tokenContract: Bytes! tokenId: BigInt! owner: Bytes! diff --git a/apps/subgraph/src/token.ts b/apps/subgraph/src/token.ts index e9b5f34d9..a0eb306e9 100644 --- a/apps/subgraph/src/token.ts +++ b/apps/subgraph/src/token.ts @@ -21,7 +21,7 @@ export function handleTransfer(event: TransferEvent): void { let metadataContract = MetadataContract.bind(Address.fromString(metadataAddress)) - let attributes = metadataContract.getAttributes(event.params.tokenId) + let attributes = metadataContract.try_getAttributes(event.params.tokenId) token = new Token(tokenId) @@ -32,7 +32,7 @@ export function handleTransfer(event: TransferEvent): void { .rendererBase() .replace('https://api.zora.co', 'https://nouns.build/api') - token.image = `${rendererBase}${attributes.value1}` + if (!attributes.reverted) token.image = `${rendererBase}${attributes.value.value1}` token.tokenContract = event.address token.tokenId = event.params.tokenId From 698ed93f407635c47f2bdb592e2f7202db15aedb Mon Sep 17 00:00:00 2001 From: neokry Date: Thu, 18 Jan 2024 11:23:08 -0800 Subject: [PATCH 5/9] Add support for manager v2 --- apps/web/src/data/contract/abis/ManagerV2.ts | 866 ++++++++++++++++++ .../ReviewAndDeploy/ReviewAndDeploy.tsx | 51 +- .../components/Upgrade/Upgrade.tsx | 3 +- .../components/Upgrade/versions/2.0.0.md | 21 + .../components/Upgrade/versions/index.ts | 1 + .../create-proposal/constants/versions.ts | 5 + .../src/pages/dao/[network]/[token]/index.tsx | 12 +- 7 files changed, 943 insertions(+), 16 deletions(-) create mode 100644 apps/web/src/data/contract/abis/ManagerV2.ts create mode 100644 apps/web/src/modules/create-proposal/components/Upgrade/versions/2.0.0.md diff --git a/apps/web/src/data/contract/abis/ManagerV2.ts b/apps/web/src/data/contract/abis/ManagerV2.ts new file mode 100644 index 000000000..77c33baa5 --- /dev/null +++ b/apps/web/src/data/contract/abis/ManagerV2.ts @@ -0,0 +1,866 @@ +export const managerV2Abi = [ + { + inputs: [ + { + internalType: 'address', + name: '_tokenImpl', + type: 'address', + }, + { + internalType: 'address', + name: '_metadataImpl', + type: 'address', + }, + { + internalType: 'address', + name: '_auctionImpl', + type: 'address', + }, + { + internalType: 'address', + name: '_treasuryImpl', + type: 'address', + }, + { + internalType: 'address', + name: '_governorImpl', + type: 'address', + }, + { + internalType: 'address', + name: '_builderRewardsRecipient', + type: 'address', + }, + ], + stateMutability: 'payable', + type: 'constructor', + }, + { + inputs: [], + name: 'ADDRESS_ZERO', + type: 'error', + }, + { + inputs: [], + name: 'ALREADY_INITIALIZED', + type: 'error', + }, + { + inputs: [], + name: 'DELEGATE_CALL_FAILED', + type: 'error', + }, + { + inputs: [], + name: 'FOUNDER_REQUIRED', + type: 'error', + }, + { + inputs: [], + name: 'INITIALIZING', + type: 'error', + }, + { + inputs: [], + name: 'INVALID_TARGET', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'impl', + type: 'address', + }, + ], + name: 'INVALID_UPGRADE', + type: 'error', + }, + { + inputs: [], + name: 'NOT_INITIALIZING', + type: 'error', + }, + { + inputs: [], + name: 'ONLY_CALL', + type: 'error', + }, + { + inputs: [], + name: 'ONLY_DELEGATECALL', + type: 'error', + }, + { + inputs: [], + name: 'ONLY_OWNER', + type: 'error', + }, + { + inputs: [], + name: 'ONLY_PENDING_OWNER', + type: 'error', + }, + { + inputs: [], + name: 'ONLY_PROXY', + type: 'error', + }, + { + inputs: [], + name: 'ONLY_TOKEN_OWNER', + type: 'error', + }, + { + inputs: [], + name: 'ONLY_UUPS', + type: 'error', + }, + { + inputs: [], + name: 'UNSUPPORTED_UUID', + type: 'error', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'metadata', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'auction', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'treasury', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'governor', + type: 'address', + }, + ], + name: 'DAODeployed', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'version', + type: 'uint256', + }, + ], + name: 'Initialized', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'renderer', + type: 'address', + }, + ], + name: 'MetadataRendererUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'canceledOwner', + type: 'address', + }, + ], + name: 'OwnerCanceled', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'pendingOwner', + type: 'address', + }, + ], + name: 'OwnerPending', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'prevOwner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'OwnerUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'baseImpl', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'upgradeImpl', + type: 'address', + }, + ], + name: 'UpgradeRegistered', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'baseImpl', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'upgradeImpl', + type: 'address', + }, + ], + name: 'UpgradeRemoved', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'impl', + type: 'address', + }, + ], + name: 'Upgraded', + type: 'event', + }, + { + inputs: [], + name: 'acceptOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'auctionImpl', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'builderRewardsRecipient', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'cancelOwnershipTransfer', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'contractVersion', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + internalType: 'address', + name: 'wallet', + type: 'address', + }, + { + internalType: 'uint256', + name: 'ownershipPct', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'vestExpiry', + type: 'uint256', + }, + ], + internalType: 'struct IManager.FounderParams[]', + name: '_founderParams', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'bytes', + name: 'initStrings', + type: 'bytes', + }, + { + internalType: 'address', + name: 'metadataRenderer', + type: 'address', + }, + { + internalType: 'uint256', + name: 'reservedUntilTokenId', + type: 'uint256', + }, + ], + internalType: 'struct IManager.TokenParams', + name: '_tokenParams', + type: 'tuple', + }, + { + components: [ + { + internalType: 'uint256', + name: 'reservePrice', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'duration', + type: 'uint256', + }, + { + internalType: 'address', + name: 'founderRewardRecipent', + type: 'address', + }, + { + internalType: 'uint16', + name: 'founderRewardBps', + type: 'uint16', + }, + ], + internalType: 'struct IManager.AuctionParams', + name: '_auctionParams', + type: 'tuple', + }, + { + components: [ + { + internalType: 'uint256', + name: 'timelockDelay', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'votingDelay', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'votingPeriod', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'proposalThresholdBps', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'quorumThresholdBps', + type: 'uint256', + }, + { + internalType: 'address', + name: 'vetoer', + type: 'address', + }, + ], + internalType: 'struct IManager.GovParams', + name: '_govParams', + type: 'tuple', + }, + ], + name: 'deploy', + outputs: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'address', + name: 'metadata', + type: 'address', + }, + { + internalType: 'address', + name: 'auction', + type: 'address', + }, + { + internalType: 'address', + name: 'treasury', + type: 'address', + }, + { + internalType: 'address', + name: 'governor', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_token', + type: 'address', + }, + ], + name: 'getAddresses', + outputs: [ + { + internalType: 'address', + name: 'metadata', + type: 'address', + }, + { + internalType: 'address', + name: 'auction', + type: 'address', + }, + { + internalType: 'address', + name: 'treasury', + type: 'address', + }, + { + internalType: 'address', + name: 'governor', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + ], + name: 'getDAOVersions', + outputs: [ + { + components: [ + { + internalType: 'string', + name: 'token', + type: 'string', + }, + { + internalType: 'string', + name: 'metadata', + type: 'string', + }, + { + internalType: 'string', + name: 'auction', + type: 'string', + }, + { + internalType: 'string', + name: 'treasury', + type: 'string', + }, + { + internalType: 'string', + name: 'governor', + type: 'string', + }, + ], + internalType: 'struct IManager.DAOVersionInfo', + name: '', + type: 'tuple', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getLatestVersions', + outputs: [ + { + components: [ + { + internalType: 'string', + name: 'token', + type: 'string', + }, + { + internalType: 'string', + name: 'metadata', + type: 'string', + }, + { + internalType: 'string', + name: 'auction', + type: 'string', + }, + { + internalType: 'string', + name: 'treasury', + type: 'string', + }, + { + internalType: 'string', + name: 'governor', + type: 'string', + }, + ], + internalType: 'struct IManager.DAOVersionInfo', + name: '', + type: 'tuple', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'governorImpl', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_newOwner', + type: 'address', + }, + ], + name: 'initialize', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_baseImpl', + type: 'address', + }, + { + internalType: 'address', + name: '_upgradeImpl', + type: 'address', + }, + ], + name: 'isRegisteredUpgrade', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'metadataImpl', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'owner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'pendingOwner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'proxiableUUID', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_baseImpl', + type: 'address', + }, + { + internalType: 'address', + name: '_upgradeImpl', + type: 'address', + }, + ], + name: 'registerUpgrade', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_baseImpl', + type: 'address', + }, + { + internalType: 'address', + name: '_upgradeImpl', + type: 'address', + }, + ], + name: 'removeUpgrade', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_newOwner', + type: 'address', + }, + ], + name: 'safeTransferOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_token', + type: 'address', + }, + { + internalType: 'address', + name: '_newRendererImpl', + type: 'address', + }, + { + internalType: 'bytes', + name: '_setupRenderer', + type: 'bytes', + }, + ], + name: 'setMetadataRenderer', + outputs: [ + { + internalType: 'address', + name: 'metadata', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'tokenImpl', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_newOwner', + type: 'address', + }, + ], + name: 'transferOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'treasuryImpl', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_newImpl', + type: 'address', + }, + ], + name: 'upgradeTo', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_newImpl', + type: 'address', + }, + { + internalType: 'bytes', + name: '_data', + type: 'bytes', + }, + ], + name: 'upgradeToAndCall', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, +] as const diff --git a/apps/web/src/modules/create-dao/components/ReviewAndDeploy/ReviewAndDeploy.tsx b/apps/web/src/modules/create-dao/components/ReviewAndDeploy/ReviewAndDeploy.tsx index cd5c6d5e6..3a0e815fd 100644 --- a/apps/web/src/modules/create-dao/components/ReviewAndDeploy/ReviewAndDeploy.tsx +++ b/apps/web/src/modules/create-dao/components/ReviewAndDeploy/ReviewAndDeploy.tsx @@ -3,7 +3,7 @@ import { ethers } from 'ethers' import { getFetchableUrl } from 'ipfs-service' import React, { useState } from 'react' import { getAddress, parseEther } from 'viem' -import { useAccount } from 'wagmi' +import { useAccount, useContractRead } from 'wagmi' import { WriteContractUnpreparedArgs, prepareWriteContract, @@ -17,6 +17,7 @@ import { Icon } from 'src/components/Icon' import { PUBLIC_MANAGER_ADDRESS } from 'src/constants/addresses' import { NULL_ADDRESS } from 'src/constants/addresses' import { managerAbi } from 'src/data/contract/abis' +import { managerV2Abi } from 'src/data/contract/abis/ManagerV2' import { formatAuctionDuration, formatFounderAllocation } from 'src/modules/create-dao' import { useChainStore } from 'src/stores/useChainStore' import { @@ -61,6 +62,12 @@ export const ReviewAndDeploy: React.FC = ({ title }) => { const [hasConfirmedChain, setHasConfirmedChain] = useState(false) const [deploymentError, setDeploymentError] = useState() const chain = useChainStore((x) => x.chain) + const { data: version, isLoading: isVersionLoading } = useContractRead({ + abi: managerAbi, + address: PUBLIC_MANAGER_ADDRESS[chain.id], + functionName: 'contractVersion', + chainId: chain.id, + }) const { address } = useAccount() const { @@ -106,7 +113,9 @@ export const ReviewAndDeploy: React.FC = ({ title }) => { ] ) - const tokenParams = { initStrings: ethers.utils.hexlify(tokenParamsHex) as AddressType } + const tokenParams = { + initStrings: ethers.utils.hexlify(tokenParamsHex) as AddressType, + } const auctionParams = { reservePrice: auctionSettings.auctionReservePrice @@ -163,13 +172,34 @@ export const ReviewAndDeploy: React.FC = ({ title }) => { setIsPendingTransaction(true) let transaction try { - const config = await prepareWriteContract({ - address: PUBLIC_MANAGER_ADDRESS[chain.id], - chainId: chain.id, - abi: managerAbi, - functionName: 'deploy', - args: [founderParams, tokenParams, auctionParams, govParams], - }) + let config: any + if (version?.startsWith('2')) { + config = await prepareWriteContract({ + address: PUBLIC_MANAGER_ADDRESS[chain.id], + chainId: chain.id, + abi: managerV2Abi, + functionName: 'deploy', + args: [ + founderParams, + { ...tokenParams, reservedUntilTokenId: 0n, metadataRenderer: NULL_ADDRESS }, + { + ...auctionParams, + founderRewardRecipent: NULL_ADDRESS, + founderRewardBps: 0, + }, + govParams, + ], + }) + } else { + config = await prepareWriteContract({ + address: PUBLIC_MANAGER_ADDRESS[chain.id], + chainId: chain.id, + abi: managerAbi, + functionName: 'deploy', + args: [founderParams, tokenParams, auctionParams, govParams], + }) + } + const tx = await writeContract(config) if (tx.hash) transaction = await waitForTransaction({ hash: tx.hash }) } catch (e) { @@ -356,7 +386,8 @@ export const ReviewAndDeploy: React.FC = ({ title }) => { !address || !hasConfirmedTerms || !hasConfirmedChain || - isPendingTransaction + isPendingTransaction || + isVersionLoading } className={ deployContractButtonStyle[isPendingTransaction ? 'pending' : 'default'] diff --git a/apps/web/src/modules/create-proposal/components/Upgrade/Upgrade.tsx b/apps/web/src/modules/create-proposal/components/Upgrade/Upgrade.tsx index 4a1dcd2e9..0bc6db30c 100644 --- a/apps/web/src/modules/create-proposal/components/Upgrade/Upgrade.tsx +++ b/apps/web/src/modules/create-proposal/components/Upgrade/Upgrade.tsx @@ -10,9 +10,10 @@ import { DaoContractAddresses } from '../../../dao' import { useAvailableUpgrade } from '../../hooks' import { useProposalStore } from '../../stores' import { UpgradeCard } from '../UpgradeCard' -import { v1_1_0, v1_2_0 } from './versions' +import { v1_1_0, v1_2_0, v2_0_0 } from './versions' export const VERSION_PROPOSAL_SUMMARY: { [key: string]: string } = { + '2.0.0': v2_0_0, '1.2.0': v1_2_0, '1.1.0': v1_1_0, } diff --git a/apps/web/src/modules/create-proposal/components/Upgrade/versions/2.0.0.md b/apps/web/src/modules/create-proposal/components/Upgrade/versions/2.0.0.md new file mode 100644 index 000000000..647cb1eac --- /dev/null +++ b/apps/web/src/modules/create-proposal/components/Upgrade/versions/2.0.0.md @@ -0,0 +1,21 @@ +![](https://i.imgur.com/HrQKZMG.png) + +## Summary + +This proposal upgrades the DAO to V2 "Bali" to add several features, improvements and bug fixes. + +### Token Reserve + +Reserve n tokens for claiming when a DAO is created. Used for DAOs that want to offer reserved token claims via minters. + +### Merkle Reserve Minter + +Allow reserved token claiming via merkle proofs. Used for DAOs that want to include a preset list of members to claim tokens. + +### Alternate Metadata Renderers: + +Allow current DAOs to set a new metadata renderer. Allow new deployments to choose an alternate renderer. + +### Protocol Rewards: + +Rewards taken as a percent of protocol auctions distributed to bid referrals, DAO founders and BuilderDAO diff --git a/apps/web/src/modules/create-proposal/components/Upgrade/versions/index.ts b/apps/web/src/modules/create-proposal/components/Upgrade/versions/index.ts index 33b43804e..8751441db 100644 --- a/apps/web/src/modules/create-proposal/components/Upgrade/versions/index.ts +++ b/apps/web/src/modules/create-proposal/components/Upgrade/versions/index.ts @@ -1,2 +1,3 @@ export { default as v1_1_0 } from './1.1.0.md' export { default as v1_2_0 } from './1.2.0.md' +export { default as v2_0_0 } from './2.0.0.md' diff --git a/apps/web/src/modules/create-proposal/constants/versions.ts b/apps/web/src/modules/create-proposal/constants/versions.ts index 9386f6749..e74e74704 100644 --- a/apps/web/src/modules/create-proposal/constants/versions.ts +++ b/apps/web/src/modules/create-proposal/constants/versions.ts @@ -46,6 +46,11 @@ export const CONTRACT_VERSION_ADDRESSES = { } export const CONTRACT_VERSION_DETAILS: ContractVersion = { + '2.0.0': { + description: + 'This optional release upgrades the DAO to V2 to add custom metadata renderers, protocol rewards and more.', + date: '2024-01-17', + }, '1.2.0': { description: 'This release upgrades the DAO to V1.2 to add several features, improvements and bug fixes.', diff --git a/apps/web/src/pages/dao/[network]/[token]/index.tsx b/apps/web/src/pages/dao/[network]/[token]/index.tsx index f0a8754e9..ecca0d6bb 100644 --- a/apps/web/src/pages/dao/[network]/[token]/index.tsx +++ b/apps/web/src/pages/dao/[network]/[token]/index.tsx @@ -23,26 +23,28 @@ import { useDaoStore, } from 'src/modules/dao' import { NextPageWithLayout } from 'src/pages/_app' -import { AddressType, Chain } from 'src/typings' +import { useChainStore } from 'src/stores/useChainStore' +import { AddressType, CHAIN_ID } from 'src/typings' import { unpackOptionalArray } from 'src/utils/helpers' interface DaoPageProps { - chain: Chain + chainId: CHAIN_ID addresses: DaoContractAddresses collectionAddress: AddressType } -const DaoPage: NextPageWithLayout = ({ chain, collectionAddress }) => { +const DaoPage: NextPageWithLayout = ({ chainId, collectionAddress }) => { const { query } = useRouter() const { address: signerAddress } = useAccount() const { addresses } = useDaoStore() + const chain = useChainStore((x) => x.chain) const { data: owner } = useContractRead({ abi: auctionAbi, address: addresses.auction, functionName: 'owner', - chainId: chain.id, + chainId: chainId, }) const sections = [ @@ -157,7 +159,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => { if (!initialized) { return { props: { - chain, + chainId: chain.id, addresses, collectionAddress, }, From 6762db459f8de809361e72caafb1aab1544c385b Mon Sep 17 00:00:00 2001 From: neokry Date: Tue, 23 Jan 2024 10:47:46 -0500 Subject: [PATCH 6/9] Add audit info to V2 upgrade proposal --- .../create-proposal/components/Upgrade/versions/2.0.0.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/web/src/modules/create-proposal/components/Upgrade/versions/2.0.0.md b/apps/web/src/modules/create-proposal/components/Upgrade/versions/2.0.0.md index 647cb1eac..93c1d7bdb 100644 --- a/apps/web/src/modules/create-proposal/components/Upgrade/versions/2.0.0.md +++ b/apps/web/src/modules/create-proposal/components/Upgrade/versions/2.0.0.md @@ -6,7 +6,7 @@ This proposal upgrades the DAO to V2 "Bali" to add several features, improvement ### Token Reserve -Reserve n tokens for claiming when a DAO is created. Used for DAOs that want to offer reserved token claims via minters. +Reserve a set of tokens for claiming when a DAO is created. Used for DAOs that want to offer reserved token claims via minters. ### Merkle Reserve Minter @@ -19,3 +19,7 @@ Allow current DAOs to set a new metadata renderer. Allow new deployments to choo ### Protocol Rewards: Rewards taken as a percent of protocol auctions distributed to bid referrals, DAO founders and BuilderDAO + +## Audit + +This upgrade audited by Sherlock in December 2023. [View the report here](https://audits.sherlock.xyz/contests/111) From 4f16e02753d8944dd2160b1da4cc24de1eec9d84 Mon Sep 17 00:00:00 2001 From: neokry Date: Tue, 23 Jan 2024 11:33:10 -0500 Subject: [PATCH 7/9] Add audit to summary section --- .../create-proposal/components/Upgrade/versions/2.0.0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/web/src/modules/create-proposal/components/Upgrade/versions/2.0.0.md b/apps/web/src/modules/create-proposal/components/Upgrade/versions/2.0.0.md index 93c1d7bdb..0569f88a8 100644 --- a/apps/web/src/modules/create-proposal/components/Upgrade/versions/2.0.0.md +++ b/apps/web/src/modules/create-proposal/components/Upgrade/versions/2.0.0.md @@ -4,6 +4,10 @@ This proposal upgrades the DAO to V2 "Bali" to add several features, improvements and bug fixes. +### Audit + +This upgrade audited by Sherlock in December 2023. [View the report here](https://audits.sherlock.xyz/contests/111) + ### Token Reserve Reserve a set of tokens for claiming when a DAO is created. Used for DAOs that want to offer reserved token claims via minters. @@ -19,7 +23,3 @@ Allow current DAOs to set a new metadata renderer. Allow new deployments to choo ### Protocol Rewards: Rewards taken as a percent of protocol auctions distributed to bid referrals, DAO founders and BuilderDAO - -## Audit - -This upgrade audited by Sherlock in December 2023. [View the report here](https://audits.sherlock.xyz/contests/111) From 1efd59c1893035de59a30512bdc27d539502ac88 Mon Sep 17 00:00:00 2001 From: neokry Date: Tue, 23 Jan 2024 15:14:22 -0500 Subject: [PATCH 8/9] Fix issue with availible upgrade hook --- .../hooks/useAvailableUpgrade.ts | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/apps/web/src/modules/create-proposal/hooks/useAvailableUpgrade.ts b/apps/web/src/modules/create-proposal/hooks/useAvailableUpgrade.ts index b10aae4d5..60d9b9a1c 100644 --- a/apps/web/src/modules/create-proposal/hooks/useAvailableUpgrade.ts +++ b/apps/web/src/modules/create-proposal/hooks/useAvailableUpgrade.ts @@ -74,7 +74,10 @@ export const useAvailableUpgrade = ({ ...contract, functionName: 'contractVersion', }, - + { + ...contract, + functionName: 'getLatestVersions', + }, { ...contract, functionName: 'getDAOVersions', @@ -104,6 +107,7 @@ export const useAvailableUpgrade = ({ const [ paused, + managerVersion, latest, versions, tokenImpl, @@ -143,18 +147,28 @@ export const useAvailableUpgrade = ({ } const getUpgradesForVersion = ( - versions: DaoVersions, - version: string + daoVersions: DaoVersions, + givenVersion: DaoVersions ): Record => - pickBy(versions, (v) => isNil(v) || v === '' || lt(v, version)) + pickBy(daoVersions, (val, key) => { + return isNil(val) || val === '' || lt(val, givenVersion[key as keyof DaoVersions]) + }) - const givenVersion = contractVersion ? contractVersion : latest + const givenVersion: DaoVersions = contractVersion + ? { + token: contractVersion, + governor: contractVersion, + auction: contractVersion, + metadata: contractVersion, + treasury: contractVersion, + } + : latest const upgradesNeededForGivenVersion = getUpgradesForVersion(daoVersions, givenVersion) // meets the required given version, no upgrades needed if (Object.values(upgradesNeededForGivenVersion).length === 0) { return { - latest, + latest: managerVersion, currentVersions: daoVersions, shouldUpgrade: false, transaction: undefined, @@ -241,16 +255,16 @@ export const useAvailableUpgrade = ({ const upgrade = { type: TransactionType.UPGRADE, - summary: `Upgrade contracts to Nouns Builder v${latest}`, + summary: `Upgrade contracts to Nouns Builder v${managerVersion}`, transactions: withPauseUnpause(paused, upgradeTransactions), } return { - latest, + latest: managerVersion, shouldUpgrade: noActiveUpgradeProposal, currentVersions: daoVersions, - date: CONTRACT_VERSION_DETAILS?.[latest]['date'], - description: `This release upgrades the DAO to v${latest} to add several features, improvements and bug fixes.`, + date: CONTRACT_VERSION_DETAILS?.[managerVersion]['date'], + description: `This release upgrades the DAO to v${managerVersion} to add several features, improvements and bug fixes.`, totalContractUpgrades: upgradeTransactions.length, activeUpgradeProposalId: activeUpgradeProposal?.proposalId, transaction: upgrade, From e2bcae02e44c6e67ffdd318da935a65b4c7e7463 Mon Sep 17 00:00:00 2001 From: neokry Date: Mon, 29 Jan 2024 10:58:20 -0800 Subject: [PATCH 9/9] Add sepolia support --- apps/subgraph/config/base-sepolia.json | 7 + apps/subgraph/config/optimism-sepolia.json | 7 + apps/subgraph/config/sepolia.json | 7 + apps/subgraph/config/zora-sepolia.json | 7 + apps/subgraph/networks.json | 44 ------ apps/subgraph/package.json | 18 +-- apps/web/codegen.yml | 2 +- apps/web/next.config.js | 2 +- apps/web/src/constants/addresses.ts | 33 ++--- apps/web/src/constants/defaultChains.ts | 127 +++--------------- apps/web/src/constants/etherscan.ts | 8 +- apps/web/src/constants/featuredDaos.ts | 86 ++++++------ apps/web/src/constants/rpc.ts | 8 +- apps/web/src/constants/subgraph.ts | 16 +-- apps/web/src/data/contract/chains.ts | 15 ++- .../AllocationForm/AllocationForm.tsx | 4 +- .../AllocationForm/ContributionAllocation.tsx | 2 +- .../ReviewProposalForm/ReviewProposalForm.tsx | 8 +- .../src/pages/dao/[network]/[token]/index.tsx | 12 +- apps/web/src/services/abiService.ts | 8 +- apps/web/src/typings/index.tsx | 8 +- apps/web/src/utils/ens.ts | 2 +- 22 files changed, 171 insertions(+), 260 deletions(-) create mode 100644 apps/subgraph/config/base-sepolia.json create mode 100644 apps/subgraph/config/optimism-sepolia.json create mode 100644 apps/subgraph/config/sepolia.json create mode 100644 apps/subgraph/config/zora-sepolia.json delete mode 100644 apps/subgraph/networks.json diff --git a/apps/subgraph/config/base-sepolia.json b/apps/subgraph/config/base-sepolia.json new file mode 100644 index 000000000..0d57dff76 --- /dev/null +++ b/apps/subgraph/config/base-sepolia.json @@ -0,0 +1,7 @@ +{ + "network": "base-sepolia", + "manager": { + "address": "0x550c326d688fd51ae65ac6a2d48749e631023a03", + "startBlock": 4663760 + } +} diff --git a/apps/subgraph/config/optimism-sepolia.json b/apps/subgraph/config/optimism-sepolia.json new file mode 100644 index 000000000..542795ec4 --- /dev/null +++ b/apps/subgraph/config/optimism-sepolia.json @@ -0,0 +1,7 @@ +{ + "network": "optimism-sepolia", + "manager": { + "address": "0x1004e43b540af4dfde2737c29893716817b0a1d7", + "startBlock": 6646430 + } +} diff --git a/apps/subgraph/config/sepolia.json b/apps/subgraph/config/sepolia.json new file mode 100644 index 000000000..62c005534 --- /dev/null +++ b/apps/subgraph/config/sepolia.json @@ -0,0 +1,7 @@ +{ + "network": "sepolia", + "manager": { + "address": "0x0ca90a96ac58f19b1f69f67103245c9263bc4bfc", + "startBlock": 5074430 + } +} diff --git a/apps/subgraph/config/zora-sepolia.json b/apps/subgraph/config/zora-sepolia.json new file mode 100644 index 000000000..f32c552d3 --- /dev/null +++ b/apps/subgraph/config/zora-sepolia.json @@ -0,0 +1,7 @@ +{ + "network": "zora-sepolia", + "manager": { + "address": "0x550c326d688fd51ae65ac6a2d48749e631023a03", + "startBlock": 3508780 + } +} diff --git a/apps/subgraph/networks.json b/apps/subgraph/networks.json deleted file mode 100644 index 6380f85de..000000000 --- a/apps/subgraph/networks.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "mainnet": { - "Manager": { - "address": "0xd310a3041dfcf14def5ccbc508668974b5da7174", - "startBlock": 15799000 - } - }, - "optimism": { - "Manager": { - "address": "0x3ac0E64Fe2931f8e082C6Bb29283540DE9b5371C", - "startBlock": 107290000 - } - }, - "goerli": { - "Manager": { - "address": "0x0E9F3382Cf2508E3bc83248B5b4707FbA86D7Ee0", - "startBlock": 7810600 - } - }, - "optimism-goerli": { - "Manager": { - "address": "0x5f9c1e7E31875beAa6ba6B0AB573a4AbEcC95d67", - "startBlock": 11032400 - } - }, - "zora-testnet": { - "Manager": { - "address": "0xc521f85613985b7e417fccd5b348f64263d79397", - "startBlock": 597700 - } - }, - "base": { - "Manager": { - "address": "0x3ac0e64fe2931f8e082c6bb29283540de9b5371c", - "startBlock": 1991500 - } - }, - "base-testnet": { - "Manager": { - "address": "0x550c326d688fD51ae65AC6A2d48749E631023A03", - "startBlock": 6585050 - } - } -} diff --git a/apps/subgraph/package.json b/apps/subgraph/package.json index f26408603..d39121c4c 100644 --- a/apps/subgraph/package.json +++ b/apps/subgraph/package.json @@ -5,25 +5,25 @@ "clean": "rm -rf ./generated ./build subgraph.yaml", "local-node": "docker-compose up", "codegen": "graph codegen", - "prepare:goerli": "mustache config/goerli.json subgraph.yaml.mustache > subgraph.yaml", + "prepare:sepolia": "mustache config/sepolia.json subgraph.yaml.mustache > subgraph.yaml", "prepare:mainnet": "mustache config/mainnet.json subgraph.yaml.mustache > subgraph.yaml", "prepare:base": "mustache config/base.json subgraph.yaml.mustache > subgraph.yaml", - "prepare:base-goerli": "mustache config/base-goerli.json subgraph.yaml.mustache > subgraph.yaml", + "prepare:base-sepolia": "mustache config/base-sepolia.json subgraph.yaml.mustache > subgraph.yaml", "prepare:optimism": "mustache config/optimism.json subgraph.yaml.mustache > subgraph.yaml", - "prepare:optimism-goerli": "mustache config/optimism-goerli.json subgraph.yaml.mustache > subgraph.yaml", + "prepare:optimism-sepolia": "mustache config/optimism-sepolia.json subgraph.yaml.mustache > subgraph.yaml", "prepare:zora": "mustache config/zora.json subgraph.yaml.mustache > subgraph.yaml", - "prepare:zora-goerli": "mustache config/zora-goerli.json subgraph.yaml.mustache > subgraph.yaml", - "deploy:goerli": "pnpm clean && pnpm prepare:goerli && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-goerli-testnet/1.0.2", + "prepare:zora-sepolia": "mustache config/zora-sepolia.json subgraph.yaml.mustache > subgraph.yaml", + "deploy:sepolia": "pnpm clean && pnpm prepare:sepolia && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-sepolia-testnet/1.0.2", "deploy:mainnet": "pnpm clean && pnpm prepare:mainnet && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-ethereum-mainnet/1.0.2", "deploy:base": "pnpm clean && pnpm prepare:base && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-base-mainnet/1.0.2", - "deploy:base-goerli": "pnpm clean && pnpm prepare:base-goerli && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-base-testnet/1.0.2", + "deploy:base-sepolia": "pnpm clean && pnpm prepare:base-sepolia && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-base-sepolia/1.0.2", "deploy:optimism": "pnpm clean && pnpm prepare:optimism && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-optimism-mainnet/1.0.2", - "deploy:optimism-goerli": "pnpm clean && pnpm prepare:optimism-goerli && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-optimism-testnet/1.0.2", + "deploy:optimism-sepolia": "pnpm clean && pnpm prepare:optimism-sepolia && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-optimism-sepolia/1.0.2", "deploy:zora": "pnpm clean && pnpm prepare:zora && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-zora-mainnet/1.0.2", - "deploy:zora-goerli": "pnpm clean && pnpm prepare:zora-goerli && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-zora-testnet/1.0.2", + "deploy:zora-sepolia": "pnpm clean && pnpm prepare:zora-sepolia && pnpm codegen && graph build && goldsky subgraph deploy nouns-builder-zora-sepolia/1.0.2", "create:local": "graph create --node http://localhost:8020/ nouns-builder", "remove:local": "graph remove --node http://localhost:8020/ nouns-builder", - "deploy:local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 --network goerli nouns-builder" + "deploy:local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 --network sepolia nouns-builder" }, "dependencies": { "@graphprotocol/graph-cli": "0.50.1", diff --git a/apps/web/codegen.yml b/apps/web/codegen.yml index b91733aec..0adc84755 100644 --- a/apps/web/codegen.yml +++ b/apps/web/codegen.yml @@ -1,4 +1,4 @@ -schema: https://api.thegraph.com/subgraphs/name/neokry/nouns-builder-goerli +schema: https://api.thegraph.com/subgraphs/name/neokry/nouns-builder-sepolia documents: 'src/data/subgraph/**/*.graphql' generates: src/data/subgraph/sdk.generated.ts: diff --git a/apps/web/next.config.js b/apps/web/next.config.js index af16079cb..1158f3ad6 100644 --- a/apps/web/next.config.js +++ b/apps/web/next.config.js @@ -25,7 +25,7 @@ const nextConfig = { }, async redirects() { const network = - process.env.NEXT_PUBLIC_NETWORK_TYPE === 'testnet' ? 'goerli' : 'ethereum' + process.env.NEXT_PUBLIC_NETWORK_TYPE === 'testnet' ? 'sepolia' : 'ethereum' return [ { diff --git a/apps/web/src/constants/addresses.ts b/apps/web/src/constants/addresses.ts index 484487287..a86ba75d8 100644 --- a/apps/web/src/constants/addresses.ts +++ b/apps/web/src/constants/addresses.ts @@ -2,52 +2,53 @@ import { AddressType, CHAIN_ID } from 'src/typings' export type L2ChainType = | CHAIN_ID.OPTIMISM - | CHAIN_ID.OPTIMISM_GOERLI + | CHAIN_ID.OPTIMISM_SEPOLIA | CHAIN_ID.BASE - | CHAIN_ID.BASE_GOERLI + | CHAIN_ID.BASE_SEPOLIA | CHAIN_ID.ZORA - | CHAIN_ID.ZORA_GOERLI + | CHAIN_ID.ZORA_SEPOLIA export const PUBLIC_MANAGER_ADDRESS = { [CHAIN_ID.ETHEREUM]: '0xd310a3041dfcf14def5ccbc508668974b5da7174' as AddressType, [CHAIN_ID.OPTIMISM]: '0x3ac0E64Fe2931f8e082C6Bb29283540DE9b5371C' as AddressType, - [CHAIN_ID.GOERLI]: '0x0E9F3382Cf2508E3bc83248B5b4707FbA86D7Ee0' as AddressType, - [CHAIN_ID.OPTIMISM_GOERLI]: '0x5f9c1e7E31875beAa6ba6B0AB573a4AbEcC95d67' as AddressType, + [CHAIN_ID.SEPOLIA]: '0x0ca90a96ac58f19b1f69f67103245c9263bc4bfc' as AddressType, + [CHAIN_ID.OPTIMISM_SEPOLIA]: + '0x1004e43b540af4dfde2737c29893716817b0a1d7' as AddressType, [CHAIN_ID.BASE]: '0x3ac0e64fe2931f8e082c6bb29283540de9b5371c' as AddressType, - [CHAIN_ID.BASE_GOERLI]: '0x550c326d688fD51ae65AC6A2d48749E631023A03' as AddressType, + [CHAIN_ID.BASE_SEPOLIA]: '0x550c326d688fd51ae65ac6a2d48749e631023a03' as AddressType, [CHAIN_ID.ZORA]: '0x3ac0E64Fe2931f8e082C6Bb29283540DE9b5371C' as AddressType, - [CHAIN_ID.ZORA_GOERLI]: '0xc521f85613985b7e417fccd5b348f64263d79397' as AddressType, + [CHAIN_ID.ZORA_SEPOLIA]: '0x550c326d688fd51ae65ac6a2d48749e631023a03' as AddressType, [CHAIN_ID.FOUNDRY]: '0xd310a3041dfcf14def5ccbc508668974b5da7174' as AddressType, } export const PUBLIC_L1_BRIDGE_ADDRESS = { [CHAIN_ID.OPTIMISM]: '0xbEb5Fc579115071764c7423A4f12eDde41f106Ed' as AddressType, - [CHAIN_ID.OPTIMISM_GOERLI]: '0x5b47E1A08Ea6d985D6649300584e6722Ec4B1383' as AddressType, + [CHAIN_ID.OPTIMISM_SEPOLIA]: + '0x16Fc5058F25648194471939df75CF27A2fdC48BC' as AddressType, [CHAIN_ID.BASE]: '0x49048044D57e1C92A77f79988d21Fa8fAF74E97e' as AddressType, - [CHAIN_ID.BASE_GOERLI]: '0xe93c8cD0D409341205A592f8c4Ac1A5fe5585cfA' as AddressType, + [CHAIN_ID.BASE_SEPOLIA]: '0x49f53e41452C74589E85cA1677426Ba426459e85' as AddressType, [CHAIN_ID.ZORA]: '0x1a0ad011913A150f69f6A19DF447A0CfD9551054' as AddressType, - [CHAIN_ID.ZORA_GOERLI]: '0xDb9F51790365e7dc196e7D072728df39Be958ACe' as AddressType, + [CHAIN_ID.ZORA_SEPOLIA]: '0xeffE2C6cA9Ab797D418f0D91eA60807713f3536f' as AddressType, } export const PUBLIC_BUILDER_ADDRESS = { [CHAIN_ID.ETHEREUM]: '0xDC9b96Ea4966d063Dd5c8dbaf08fe59062091B6D' as AddressType, // builder treasury address - [CHAIN_ID.GOERLI]: '0xc2fff40D3e3468fD85dca6B09e41961edd9381cD' as AddressType, } export const PUBLIC_NOUNS_ADDRESS = { [CHAIN_ID.ETHEREUM]: '0x0BC3807Ec262cB779b38D65b38158acC3bfedE10' as AddressType, // nouns treasury address - [CHAIN_ID.GOERLI]: '0x0BC3807Ec262cB779b38D65b38158acC3bfedE10' as AddressType, } export const PUBLIC_ZORA_NFT_CREATOR = { [CHAIN_ID.ETHEREUM]: '0xF74B146ce44CC162b601deC3BE331784DB111DC1' as AddressType, [CHAIN_ID.OPTIMISM]: '0x7d1a46c6e614A0091c39E102F2798C27c1fA8892' as AddressType, - [CHAIN_ID.GOERLI]: '0xb9583D05Ba9ba8f7F14CCEe3Da10D2bc0A72f519' as AddressType, - [CHAIN_ID.OPTIMISM_GOERLI]: '0x3C1ebcF36Ca9DD9371c9aA99c274e4988906c6E3' as AddressType, + [CHAIN_ID.SEPOLIA]: '0x87cfd516c5ea86e50b950678CA970a8a28de27ac' as AddressType, + [CHAIN_ID.OPTIMISM_SEPOLIA]: + '0x0000000000000000000000000000000000000000' as AddressType, [CHAIN_ID.BASE]: '0x58C3ccB2dcb9384E5AB9111CD1a5DEA916B0f33c' as AddressType, - [CHAIN_ID.BASE_GOERLI]: '0x87cfd516c5ea86e50b950678CA970a8a28de27ac' as AddressType, + [CHAIN_ID.BASE_SEPOLIA]: '0x0000000000000000000000000000000000000000' as AddressType, [CHAIN_ID.ZORA]: '0xA2c2A96A232113Dd4993E8b048EEbc3371AE8d85' as AddressType, - [CHAIN_ID.ZORA_GOERLI]: '0xeB29A4e5b84fef428c072debA2444e93c080CE87' as AddressType, + [CHAIN_ID.ZORA_SEPOLIA]: '0x6b28d7C2F8b2C2189e95b89B67886eEb16489a97' as AddressType, [CHAIN_ID.FOUNDRY]: '0xF74B146ce44CC162b601deC3BE331784DB111DC1' as AddressType, } diff --git a/apps/web/src/constants/defaultChains.ts b/apps/web/src/constants/defaultChains.ts index 1cc8bec32..e33db1176 100644 --- a/apps/web/src/constants/defaultChains.ts +++ b/apps/web/src/constants/defaultChains.ts @@ -1,103 +1,16 @@ -import { baseGoerli, goerli, mainnet, optimism, optimismGoerli } from 'wagmi/chains' +import { + base, + baseSepolia, + mainnet, + optimism, + optimismSepolia, + sepolia, + zora, + zoraSepolia, +} from 'wagmi/chains' import { CHAIN_ID, Chain } from 'src/typings' -export const zora = { - id: 7777777, - name: 'Zora', - network: 'zora', - nativeCurrency: { - decimals: 18, - name: 'Ether', - symbol: 'ETH', - }, - rpcUrls: { - default: { - http: ['https://rpc.zora.energy'], - webSocket: ['wss://rpc.zora.energy'], - }, - public: { - http: ['https://rpc.zora.energy'], - webSocket: ['wss://rpc.zora.energy'], - }, - }, - blockExplorers: { - default: { name: 'Explorer', url: 'https://explorer.zora.energy' }, - }, - contracts: { - multicall3: { - address: '0xcA11bde05977b3631167028862bE2a173976CA11', - blockCreated: 5882, - }, - }, -} as const - -export const zoraGoerli = { - id: 999, - name: 'Zora Goerli', - network: 'zora-testnet', - nativeCurrency: { - decimals: 18, - name: 'Zora Goerli', - symbol: 'ETH', - }, - rpcUrls: { - default: { - http: ['https://testnet.rpc.zora.energy'], - webSocket: ['wss://testnet.rpc.zora.energy'], - }, - public: { - http: ['https://testnet.rpc.zora.energy'], - webSocket: ['wss://testnet.rpc.zora.energy'], - }, - }, - blockExplorers: { - default: { name: 'Explorer', url: 'https://testnet.explorer.zora.energy' }, - }, - contracts: { - multicall3: { - address: '0xcA11bde05977b3631167028862bE2a173976CA11', - blockCreated: 189123, - }, - }, - testnet: true, -} as const - -export const base = { - id: 8453, - network: 'base', - name: 'Base', - nativeCurrency: { name: 'Base', symbol: 'ETH', decimals: 18 }, - rpcUrls: { - default: { - http: ['https://developer-access-mainnet.base.org'], - }, - public: { - http: ['https://developer-access-mainnet.base.org'], - }, - }, - blockExplorers: { - blockscout: { - name: 'Basescout', - url: 'https://base.blockscout.com', - }, - default: { - name: 'Basescan', - url: 'https://basescan.org', - }, - etherscan: { - name: 'Basescan', - url: 'https://basescan.org', - }, - }, - contracts: { - multicall3: { - address: '0xca11bde05977b3631167028862be2a173976ca11', - blockCreated: 5022, - }, - }, -} as const - const MAINNET_CHAINS: Chain[] = [ { ...mainnet, id: CHAIN_ID.ETHEREUM, slug: 'ethereum', icon: '/chains/ethereum.svg' }, { ...zora, id: CHAIN_ID.ZORA, slug: 'zora', icon: '/chains/zora.png' }, @@ -111,23 +24,23 @@ const MAINNET_CHAINS: Chain[] = [ ] const TESTNET_CHAINS: Chain[] = [ - { ...goerli, id: CHAIN_ID.GOERLI, slug: 'goerli', icon: '/chains/ethereum.svg' }, + { ...sepolia, id: CHAIN_ID.SEPOLIA, slug: 'sepolia', icon: '/chains/ethereum.svg' }, { - ...optimismGoerli, - id: CHAIN_ID.OPTIMISM_GOERLI, - slug: 'op-goerli', + ...optimismSepolia, + id: CHAIN_ID.OPTIMISM_SEPOLIA, + slug: 'op-sepolia', icon: '/chains/optimism.svg', }, { - ...baseGoerli, - id: CHAIN_ID.BASE_GOERLI, - slug: 'base-goerli', + ...baseSepolia, + id: CHAIN_ID.BASE_SEPOLIA, + slug: 'base-sepolia', icon: '/chains/base.svg', }, { - ...zoraGoerli, - id: CHAIN_ID.ZORA_GOERLI, - slug: 'zora-goerli', + ...zoraSepolia, + id: CHAIN_ID.ZORA_SEPOLIA, + slug: 'zora-sepolia', icon: '/chains/zora.png', }, ] diff --git a/apps/web/src/constants/etherscan.ts b/apps/web/src/constants/etherscan.ts index a7497124d..92cb315fe 100644 --- a/apps/web/src/constants/etherscan.ts +++ b/apps/web/src/constants/etherscan.ts @@ -3,11 +3,11 @@ import { CHAIN_ID } from 'src/typings' export const ETHERSCAN_BASE_URL = { [CHAIN_ID.ETHEREUM]: 'https://etherscan.io', [CHAIN_ID.OPTIMISM]: 'https://optimistic.etherscan.io', - [CHAIN_ID.GOERLI]: 'https://goerli.etherscan.io', - [CHAIN_ID.OPTIMISM_GOERLI]: 'https://goerli-optimism.etherscan.io/', + [CHAIN_ID.SEPOLIA]: 'https://sepolia.etherscan.io', + [CHAIN_ID.OPTIMISM_SEPOLIA]: 'https://sepolia-optimism.etherscan.io/', [CHAIN_ID.BASE]: 'https://basescan.org/', - [CHAIN_ID.BASE_GOERLI]: 'https://goerli.basescan.org/', + [CHAIN_ID.BASE_SEPOLIA]: 'https://sepolia.basescan.org/', [CHAIN_ID.ZORA]: 'https://explorer.zora.energy/', - [CHAIN_ID.ZORA_GOERLI]: 'https://testnet.explorer.zora.energy/', + [CHAIN_ID.ZORA_SEPOLIA]: 'https://sepolia.explorer.zora.energy/', [CHAIN_ID.FOUNDRY]: '', } diff --git a/apps/web/src/constants/featuredDaos.ts b/apps/web/src/constants/featuredDaos.ts index 4e9fa8ae9..72c9a104a 100644 --- a/apps/web/src/constants/featuredDaos.ts +++ b/apps/web/src/constants/featuredDaos.ts @@ -1,74 +1,78 @@ import { CHAIN_ID } from 'src/typings' -export type TestnetChain = CHAIN_ID.GOERLI | CHAIN_ID.OPTIMISM_GOERLI +export type TestnetChain = + | CHAIN_ID.SEPOLIA + | CHAIN_ID.OPTIMISM_SEPOLIA + | CHAIN_ID.BASE_SEPOLIA + | CHAIN_ID.ZORA_SEPOLIA export const PUBLIC_FEATURED_DAOS = { - [CHAIN_ID.GOERLI]: [ + [CHAIN_ID.SEPOLIA]: [ { - auctionAddress: '0x8F1B054500ED7a2B06619CD2E5D70415Bc9d6b8a', - tokenAddress: '0x6e13ED8472fBBd384C260538323906fc1eCb0d7B', - name: 'MuseumDAO', + auctionAddress: '0x1fd8ab3d28589b7af58b0224c70ceb3e955c9882', + tokenAddress: '0x42D7665F431fceFC95a6fB550Bc2842beeDF3b37', + name: 'test', }, { - auctionAddress: '0x736EaF8C02dc093E392131068B7F17f34C4f7791', - tokenAddress: '0x7F29a9dfBFf0e6DB6c8a449Fee282F9B5f5fc99f', - name: 'RecordLabelDAO', + auctionAddress: '0x1fd8ab3d28589b7af58b0224c70ceb3e955c9882', + tokenAddress: '0x42D7665F431fceFC95a6fB550Bc2842beeDF3b37', + name: 'test', }, { - auctionAddress: '0xC4E181443EE3696cF19EB21578A6310BB75aA117', - tokenAddress: '0x579B2fF0F4bd719ad7628208606688a8Ac871644', - name: 'StartupDAO', + auctionAddress: '0x1fd8ab3d28589b7af58b0224c70ceb3e955c9882', + tokenAddress: '0x42D7665F431fceFC95a6fB550Bc2842beeDF3b37', + name: 'test', }, ], - [CHAIN_ID.OPTIMISM_GOERLI]: [ + [CHAIN_ID.OPTIMISM_SEPOLIA]: [ { - auctionAddress: '0x0Ba1D0999C4EeBd55671dfB0daE2aaE5C6652Da4', - tokenAddress: '0x29372170f43b13ca85eb0c17764f99e468739053', - name: 'Another Test', + auctionAddress: '0x4657444b584ad3a88c5f9daa446c6689b252793a', + tokenAddress: '0x33756a2B2F69B4B5D80E6474B35Bf3d65aA6C8Ab', + name: 'test', }, { - auctionAddress: '0x0Ba1D0999C4EeBd55671dfB0daE2aaE5C6652Da4', - tokenAddress: '0x29372170f43b13ca85eb0c17764f99e468739053', - name: 'Another Test', + auctionAddress: '0x4657444b584ad3a88c5f9daa446c6689b252793a', + tokenAddress: '0x33756a2B2F69B4B5D80E6474B35Bf3d65aA6C8Ab', + name: 'test', }, { - auctionAddress: '0xD471e841e0EA469c315fE237a83C5952fA078138', - tokenAddress: '0xc2047245f065ba2d4cc8276862723a159dd9d83b', - name: 'Test', + auctionAddress: '0x4657444b584ad3a88c5f9daa446c6689b252793a', + tokenAddress: '0x33756a2B2F69B4B5D80E6474B35Bf3d65aA6C8Ab', + name: 'test', }, ], - [CHAIN_ID.BASE_GOERLI]: [ + [CHAIN_ID.BASE_SEPOLIA]: [ { - auctionAddress: '0x03855976Fcb91bF23110E2C425dCfb1BA0635b79', - tokenAddress: '0x3b7626182aab7a70d4b2b254c4f19f5f48a7e6d8', - name: 'Test base DAO', + auctionAddress: '0x03855976fcb91bf23110e2c425dcfb1ba0635b79', + tokenAddress: '0x3b7626182aAB7a70D4B2B254C4F19f5f48A7E6D8', + name: 'test', }, { - auctionAddress: '0x03855976Fcb91bF23110E2C425dCfb1BA0635b79', - tokenAddress: '0x3b7626182aab7a70d4b2b254c4f19f5f48a7e6d8', - name: 'Test base DAO', + auctionAddress: '0x03855976fcb91bf23110e2c425dcfb1ba0635b79', + tokenAddress: '0x3b7626182aAB7a70D4B2B254C4F19f5f48A7E6D8', + name: 'test', }, { - auctionAddress: '0x03855976Fcb91bF23110E2C425dCfb1BA0635b79', - tokenAddress: '0x3b7626182aab7a70d4b2b254c4f19f5f48a7e6d8', - name: 'Test base DAO', + auctionAddress: '0x03855976fcb91bf23110e2c425dcfb1ba0635b79', + tokenAddress: '0x3b7626182aAB7a70D4B2B254C4F19f5f48A7E6D8', + name: 'test', }, ], - [CHAIN_ID.ZORA_GOERLI]: [ + [CHAIN_ID.ZORA_SEPOLIA]: [ { - auctionAddress: '0x8741AE7F44DFDEFaFC33b10D9FED9bd97ac8E972', - tokenAddress: '0x65737024daf0ed2e2d86d67cdc3bc92fb903bd93', - name: 'Test Zora', + auctionAddress: '0x03855976fcb91bf23110e2c425dcfb1ba0635b79', + tokenAddress: '0x3b7626182aAB7a70D4B2B254C4F19f5f48A7E6D8', + name: 'test', }, { - auctionAddress: '0x8741AE7F44DFDEFaFC33b10D9FED9bd97ac8E972', - tokenAddress: '0x65737024daf0ed2e2d86d67cdc3bc92fb903bd93', - name: 'Test Zora', + auctionAddress: '0x03855976fcb91bf23110e2c425dcfb1ba0635b79', + tokenAddress: '0x3b7626182aAB7a70D4B2B254C4F19f5f48A7E6D8', + name: 'test', }, { - auctionAddress: '0x8741AE7F44DFDEFaFC33b10D9FED9bd97ac8E972', - tokenAddress: '0x65737024daf0ed2e2d86d67cdc3bc92fb903bd93', - name: 'Test Zora', + auctionAddress: '0x03855976fcb91bf23110e2c425dcfb1ba0635b79', + tokenAddress: '0x3b7626182aAB7a70D4B2B254C4F19f5f48A7E6D8', + name: 'test', }, ], } diff --git a/apps/web/src/constants/rpc.ts b/apps/web/src/constants/rpc.ts index c3aa46b4b..9a652eb29 100644 --- a/apps/web/src/constants/rpc.ts +++ b/apps/web/src/constants/rpc.ts @@ -5,11 +5,11 @@ import { CHAIN_ID } from 'src/typings' export const RPC_URL = { [CHAIN_ID.ETHEREUM]: `https://eth-mainnet.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_ALCHEMY_ID}`, [CHAIN_ID.OPTIMISM]: `https://opt-mainnet.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_ALCHEMY_ID}`, - [CHAIN_ID.GOERLI]: `https://eth-goerli.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_ALCHEMY_ID}`, - [CHAIN_ID.OPTIMISM_GOERLI]: `https://opt-goerli.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_ALCHEMY_ID}`, + [CHAIN_ID.SEPOLIA]: `https://eth-sepolia.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_ALCHEMY_ID}`, + [CHAIN_ID.OPTIMISM_SEPOLIA]: `https://opt-sepolia.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_ALCHEMY_ID}`, [CHAIN_ID.BASE]: `https://hardworking-wild-arm.base-mainnet.discover.quiknode.pro/${process.env.NEXT_PUBLIC_QUICKNODE_ID}`, - [CHAIN_ID.BASE_GOERLI]: 'https://goerli.base.org', + [CHAIN_ID.BASE_SEPOLIA]: 'https://sepolia.base.org', [CHAIN_ID.ZORA]: 'https://rpc.zora.energy', - [CHAIN_ID.ZORA_GOERLI]: 'https://testnet.rpc.zora.energy', + [CHAIN_ID.ZORA_SEPOLIA]: 'https://sepolia.rpc.zora.energy', [CHAIN_ID.FOUNDRY]: foundry.rpcUrls.default.http[0], } diff --git a/apps/web/src/constants/subgraph.ts b/apps/web/src/constants/subgraph.ts index 4282f3406..fd6860dff 100644 --- a/apps/web/src/constants/subgraph.ts +++ b/apps/web/src/constants/subgraph.ts @@ -5,18 +5,18 @@ export const PUBLIC_SUBGRAPH_URL = { 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-ethereum-mainnet/stable/gn', [CHAIN_ID.OPTIMISM]: 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-optimism-mainnet/stable/gn', - [CHAIN_ID.GOERLI]: - 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-goerli-testnet/stable/gn', - [CHAIN_ID.OPTIMISM_GOERLI]: - 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-optimism-testnet/stable/gn', + [CHAIN_ID.SEPOLIA]: + 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-sepolia-testnet/stable/gn', + [CHAIN_ID.OPTIMISM_SEPOLIA]: + 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-optimism-sepolia/stable/gn', [CHAIN_ID.BASE]: 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-base-mainnet/stable/gn', - [CHAIN_ID.BASE_GOERLI]: - 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-base-testnet/stable/gn', + [CHAIN_ID.BASE_SEPOLIA]: + 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-base-sepolia/stable/gn', [CHAIN_ID.ZORA]: 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-zora-mainnet/stable/gn', - [CHAIN_ID.ZORA_GOERLI]: - 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-zora-testnet/stable/gn', + [CHAIN_ID.ZORA_SEPOLIA]: + 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-zora-sepolia/stable/gn', [CHAIN_ID.FOUNDRY]: 'https://api.thegraph.com/subgraphs/name/neokry/nouns-builder-mainnet', } diff --git a/apps/web/src/data/contract/chains.ts b/apps/web/src/data/contract/chains.ts index dd67cb23a..254c4929a 100644 --- a/apps/web/src/data/contract/chains.ts +++ b/apps/web/src/data/contract/chains.ts @@ -1,15 +1,24 @@ import { configureChains } from 'wagmi' -import { baseGoerli, goerli, mainnet, optimism, optimismGoerli } from 'wagmi/chains' +import { + base, + baseSepolia, + mainnet, + optimism, + optimismSepolia, + sepolia, + zora, + zoraSepolia, +} from 'wagmi/chains' import { alchemyProvider } from 'wagmi/providers/alchemy' import { jsonRpcProvider } from 'wagmi/providers/jsonRpc' -import { PUBLIC_IS_TESTNET, base, zora, zoraGoerli } from 'src/constants/defaultChains' +import { PUBLIC_IS_TESTNET } from 'src/constants/defaultChains' import { RPC_URL } from 'src/constants/rpc' import { CHAIN_ID } from 'src/typings' const MAINNET_CHAINS = [mainnet, zora, base, optimism] // Mainnet is required here due to hooks like useEnsData that only pull data from mainnet -const TESTNET_CHAINS = [mainnet, goerli, optimismGoerli, baseGoerli, zoraGoerli] +const TESTNET_CHAINS = [mainnet, sepolia, optimismSepolia, baseSepolia, zoraSepolia] const AVAILIBLE_CHAINS = PUBLIC_IS_TESTNET ? TESTNET_CHAINS : MAINNET_CHAINS diff --git a/apps/web/src/modules/create-dao/components/AllocationForm/AllocationForm.tsx b/apps/web/src/modules/create-dao/components/AllocationForm/AllocationForm.tsx index 6edf6b0e7..bf8490b41 100644 --- a/apps/web/src/modules/create-dao/components/AllocationForm/AllocationForm.tsx +++ b/apps/web/src/modules/create-dao/components/AllocationForm/AllocationForm.tsx @@ -156,9 +156,7 @@ export const AllocationForm: React.FC = ({ title }) => { )} - {(chain.id === CHAIN_ID.ETHEREUM || chain.id === CHAIN_ID.GOERLI) && ( - - )} + {chain.id === CHAIN_ID.ETHEREUM && } {allocationError && ( diff --git a/apps/web/src/modules/create-dao/components/AllocationForm/ContributionAllocation.tsx b/apps/web/src/modules/create-dao/components/AllocationForm/ContributionAllocation.tsx index 90ed37c8c..f96ce0877 100644 --- a/apps/web/src/modules/create-dao/components/AllocationForm/ContributionAllocation.tsx +++ b/apps/web/src/modules/create-dao/components/AllocationForm/ContributionAllocation.tsx @@ -16,7 +16,7 @@ import { } from './ContributionAllocationForm' import { DaoCopyAddress } from './DaoCopyAddress' -export type ContributionChain = 1 | 5 +export type ContributionChain = 1 export const ContributionAllocation = () => { const [open, setOpen] = useState(false) diff --git a/apps/web/src/modules/create-proposal/components/ReviewProposalForm/ReviewProposalForm.tsx b/apps/web/src/modules/create-proposal/components/ReviewProposalForm/ReviewProposalForm.tsx index 45fa1a45d..5e3a1b6c8 100644 --- a/apps/web/src/modules/create-proposal/components/ReviewProposalForm/ReviewProposalForm.tsx +++ b/apps/web/src/modules/create-proposal/components/ReviewProposalForm/ReviewProposalForm.tsx @@ -27,13 +27,13 @@ import { ERROR_CODE, FormValues, validationSchema } from './fields' const CHAINS_TO_SIMULATE = [ CHAIN_ID.ETHEREUM, - CHAIN_ID.GOERLI, + CHAIN_ID.SEPOLIA, CHAIN_ID.OPTIMISM, - CHAIN_ID.OPTIMISM_GOERLI, + CHAIN_ID.OPTIMISM_SEPOLIA, CHAIN_ID.BASE, - CHAIN_ID.BASE_GOERLI, + CHAIN_ID.BASE_SEPOLIA, CHAIN_ID.ZORA, - CHAIN_ID.ZORA_GOERLI, + CHAIN_ID.ZORA_SEPOLIA, ] interface ReviewProposalProps { diff --git a/apps/web/src/pages/dao/[network]/[token]/index.tsx b/apps/web/src/pages/dao/[network]/[token]/index.tsx index f0a8754e9..ecca0d6bb 100644 --- a/apps/web/src/pages/dao/[network]/[token]/index.tsx +++ b/apps/web/src/pages/dao/[network]/[token]/index.tsx @@ -23,26 +23,28 @@ import { useDaoStore, } from 'src/modules/dao' import { NextPageWithLayout } from 'src/pages/_app' -import { AddressType, Chain } from 'src/typings' +import { useChainStore } from 'src/stores/useChainStore' +import { AddressType, CHAIN_ID } from 'src/typings' import { unpackOptionalArray } from 'src/utils/helpers' interface DaoPageProps { - chain: Chain + chainId: CHAIN_ID addresses: DaoContractAddresses collectionAddress: AddressType } -const DaoPage: NextPageWithLayout = ({ chain, collectionAddress }) => { +const DaoPage: NextPageWithLayout = ({ chainId, collectionAddress }) => { const { query } = useRouter() const { address: signerAddress } = useAccount() const { addresses } = useDaoStore() + const chain = useChainStore((x) => x.chain) const { data: owner } = useContractRead({ abi: auctionAbi, address: addresses.auction, functionName: 'owner', - chainId: chain.id, + chainId: chainId, }) const sections = [ @@ -157,7 +159,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => { if (!initialized) { return { props: { - chain, + chainId: chain.id, addresses, collectionAddress, }, diff --git a/apps/web/src/services/abiService.ts b/apps/web/src/services/abiService.ts index c14dcb8b5..e0fd7196b 100644 --- a/apps/web/src/services/abiService.ts +++ b/apps/web/src/services/abiService.ts @@ -22,12 +22,12 @@ export type ContractABIResult = { const CHAIN_API_LOOKUP: Record = { [CHAIN_ID.ETHEREUM]: 'api.etherscan.io', [CHAIN_ID.OPTIMISM]: 'api-optimistic.etherscan.io', - [CHAIN_ID.GOERLI]: 'api-goerli.etherscan.io', - [CHAIN_ID.OPTIMISM_GOERLI]: 'api-goerli-optimistic.etherscan.io', + [CHAIN_ID.SEPOLIA]: 'api-sepolia.etherscan.io', + [CHAIN_ID.OPTIMISM_SEPOLIA]: 'api-sepolia-optimistic.etherscan.io', [CHAIN_ID.BASE]: 'api.basescan.org', - [CHAIN_ID.BASE_GOERLI]: 'api-goerli.basescan.org', + [CHAIN_ID.BASE_SEPOLIA]: 'api-sepolia.basescan.org', [CHAIN_ID.ZORA]: 'explorer.zora.energy', - [CHAIN_ID.ZORA_GOERLI]: 'testnet.explorer.zora.energy', + [CHAIN_ID.ZORA_SEPOLIA]: 'sepolia.explorer.zora.energy', [CHAIN_ID.FOUNDRY]: '', } diff --git a/apps/web/src/typings/index.tsx b/apps/web/src/typings/index.tsx index a54cbc75b..4e1ecef1c 100644 --- a/apps/web/src/typings/index.tsx +++ b/apps/web/src/typings/index.tsx @@ -9,13 +9,13 @@ export interface Duration { export const enum CHAIN_ID { ETHEREUM = 1, - GOERLI = 5, + SEPOLIA = 11155111, OPTIMISM = 10, - OPTIMISM_GOERLI = 420, + OPTIMISM_SEPOLIA = 11155420, BASE = 8453, - BASE_GOERLI = 84531, + BASE_SEPOLIA = 84532, ZORA = 7777777, - ZORA_GOERLI = 999, + ZORA_SEPOLIA = 999999999, FOUNDRY = 31337, } diff --git a/apps/web/src/utils/ens.ts b/apps/web/src/utils/ens.ts index e3f0f2968..66c4f11d9 100644 --- a/apps/web/src/utils/ens.ts +++ b/apps/web/src/utils/ens.ts @@ -25,7 +25,7 @@ export async function isValidAddress( let resolvedName: string | null - if (chainId === CHAIN_ID.ETHEREUM || chainId === CHAIN_ID.GOERLI) { + if (chainId === CHAIN_ID.ETHEREUM || chainId === CHAIN_ID.SEPOLIA) { resolvedName = await provider?.resolveName(address) } else { const [nameResponse, codeResponse] = await Promise.all([