Skip to content

Commit

Permalink
Merge branch 'mrtn-migration' into migration-proposal-template
Browse files Browse the repository at this point in the history
  • Loading branch information
neokry committed Jan 9, 2024
2 parents 6871ad9 + 0570d3d commit 50873ef
Show file tree
Hide file tree
Showing 52 changed files with 4,436 additions and 272 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
},
}

19 changes: 19 additions & 0 deletions apps/subgraph/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -73,6 +74,7 @@ type Proposal @entity {
snapshotBlockNumber: BigInt!
transactionHash: Bytes!
votes: [ProposalVote!]! @derivedFrom(field: "proposal")
executionHash: Bytes
}

enum ProposalVoteSupport {
Expand Down Expand Up @@ -120,3 +122,20 @@ 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!
}

type MetadataItem @entity {
id: ID!
property: MetadataProperty!
propertyId: BigInt!
name: String!
isNewProperty: Boolean!
}
1 change: 1 addition & 0 deletions apps/subgraph/src/governor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export function handleProposalExecuted(event: ProposalExecutedEvent): void {
let proposal = new Proposal(event.params.proposalId.toHexString())
proposal.executed = true
proposal.queued = false
proposal.executionHash = event.transaction.hash
proposal.save()
}

Expand Down
36 changes: 35 additions & 1 deletion apps/subgraph/src/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { DAO } from '../generated/schema'
import { DAO, MetadataItem, MetadataProperty } from '../generated/schema'
import {
AddPropertiesCall as AddPropertiesFunctionCall,
ContractImageUpdated as ContractImageUpdatedEvent,
DescriptionUpdated as DescriptionUpdatedEvent,
WebsiteURIUpdated as URIUpdatedEvent,
Expand All @@ -26,3 +27,36 @@ 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 + inputs._ipfsGroup.baseUri

let property = new MetadataProperty(id)
property.dao = dao.id
property.names = inputs._names
property.ipfsBaseUri = inputs._ipfsGroup.baseUri
property.ipfsExtension = inputs._ipfsGroup.extension

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()
}
3 changes: 3 additions & 0 deletions apps/subgraph/subgraph.yaml.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ templates:
handler: handleDescriptionUpdated
- event: WebsiteURIUpdated(string,string)
handler: handleWebsiteURIUpdated
callHandlers:
- function: addProperties(string[],(uint256,string,bool)[],(string,string))
handler: handleAddProperties
file: ./src/metadata.ts
- kind: ethereum
name: Auction
Expand Down
2 changes: 1 addition & 1 deletion apps/web/.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
NEXT_PUBLIC_UPLOAD_API=https://upload-api.zora.co
NEXT_PUBLIC_IPFS_GATEWAY=https://ipfs.decentralized-content.com
NEXT_PUBLIC_CHAIN_ID=5
NEXT_PUBLIC_NETWORK_TYPE=mainnet
NEXT_PUBLIC_NETWORK_TYPE=testnet
2 changes: 1 addition & 1 deletion apps/web/codegen.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
schema: https://api.thegraph.com/subgraphs/name/neokry/nouns-builder-goerli
schema: https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-goerli-testnet/1.1.0/gn
documents: 'src/data/subgraph/**/*.graphql'
generates:
src/data/subgraph/sdk.generated.ts:
Expand Down
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"ioredis": "^5.2.3",
"ipfs-http-client": "^59.0.0",
"ipfs-service": "workspace:*",
"lanyard": "^1.1.2",
"lodash": "^4.17.21",
"multiformats": "9.9.0",
"next": "^13.0.3",
Expand Down
23 changes: 22 additions & 1 deletion apps/web/src/constants/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const PUBLIC_MANAGER_ADDRESS = {
[CHAIN_ID.GOERLI]: '0x0E9F3382Cf2508E3bc83248B5b4707FbA86D7Ee0' as AddressType,
[CHAIN_ID.OPTIMISM_GOERLI]: '0x5f9c1e7E31875beAa6ba6B0AB573a4AbEcC95d67' as AddressType,
[CHAIN_ID.BASE]: '0x3ac0e64fe2931f8e082c6bb29283540de9b5371c' as AddressType,
[CHAIN_ID.BASE_GOERLI]: '0x550c326d688fD51ae65AC6A2d48749E631023A03' as AddressType,
[CHAIN_ID.BASE_GOERLI]: '0xcce64c2b4c51c2894fe5df0dda3e34e4d850b699' as AddressType,
[CHAIN_ID.ZORA]: '0x3ac0E64Fe2931f8e082C6Bb29283540DE9b5371C' as AddressType,
[CHAIN_ID.ZORA_GOERLI]: '0xc521f85613985b7e417fccd5b348f64263d79397' as AddressType,
[CHAIN_ID.FOUNDRY]: '0xd310a3041dfcf14def5ccbc508668974b5da7174' as AddressType,
Expand Down Expand Up @@ -52,3 +52,24 @@ export const PUBLIC_ZORA_NFT_CREATOR = {
}

export const NULL_ADDRESS = '0x0000000000000000000000000000000000000000' as AddressType

export const MERKLE_RESERVE_MINTER =
'0xa09790dba70fdad041c0901604c09a5c9efe2a9c' as AddressType

export const MERKLE_METADATA_RENDERER =
'0xc422f3f254a86ee369066007bb3c5751cc29c95c' as AddressType

export const L2_MIGRATION_DEPLOYER =
'0xed98171590dba48f6596f4743c2b7300a7091f9e' as AddressType

export const L1_MESSENGERS = {
[CHAIN_ID.ETHEREUM]: '0x0000000000000000000000000000000000000000' as AddressType,
[CHAIN_ID.GOERLI]: '0x0000000000000000000000000000000000000000' as AddressType,
[CHAIN_ID.BASE]: '0x866E82a600A1414e583f7F13623F1aC5d58b0Afa' as AddressType,
[CHAIN_ID.BASE_GOERLI]: '0x8e5693140eA606bcEB98761d9beB1BC87383706D' as AddressType,
[CHAIN_ID.OPTIMISM]: '0xDa2332D0a7608919Cd331B1304Cd179129a90495' as AddressType,
[CHAIN_ID.OPTIMISM_GOERLI]: '0xDa2332D0a7608919Cd331B1304Cd179129a90495' as AddressType,
[CHAIN_ID.ZORA]: '0x363B4B1ADa52E50353f746999bd9E94395190d2C' as AddressType,
[CHAIN_ID.ZORA_GOERLI]: '0x9779A9D2f3B66A4F4d27cB99Ab6cC1266b3Ca9af' as AddressType,
[CHAIN_ID.FOUNDRY]: '0x0000000000000000000000000000000000000000' as AddressType,
}
6 changes: 3 additions & 3 deletions apps/web/src/constants/subgraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import { CHAIN_ID } from 'src/typings'

export const PUBLIC_SUBGRAPH_URL = {
[CHAIN_ID.ETHEREUM]:
'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-ethereum-mainnet/stable/gn',
'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-ethereum-mainnet/1.1.0/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',
'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-goerli-testnet/1.1.0/gn',
[CHAIN_ID.OPTIMISM_GOERLI]:
'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-optimism-testnet/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',
'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-base-sandbox/1.1.0/gn',
[CHAIN_ID.ZORA]:
'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-zora-mainnet/stable/gn',
[CHAIN_ID.ZORA_GOERLI]:
Expand Down
4 changes: 4 additions & 0 deletions apps/web/src/constants/swrKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ const SWR_KEYS = {
MEMBERS: 'members',
TOKEN_IMAGE: 'token-image',
DASHBOARD: 'dashboard',
METADATA_ATTRIBUTES_MERKLE_ROOT: 'metadata-attributes-merkle-root',
TOKEN_HOLDERS_MERKLE_ROOT: 'token-holders-merkle-root',
ENCODED_DAO_METADATA: 'encoded-dao-metadata',
DAO_MIGRATED: 'dao-migrated',
DYNAMIC: {
MY_DAOS(str: string) {
return `my-daos-${str}`
Expand Down
Loading

0 comments on commit 50873ef

Please sign in to comment.