Skip to content

Commit

Permalink
changes to comply latest version of the Graph, sunrise upgrade (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashmi-278 authored Jun 10, 2024
1 parent 1bd1173 commit a6054a5
Show file tree
Hide file tree
Showing 8 changed files with 254 additions and 168 deletions.
Binary file not shown.
38 changes: 21 additions & 17 deletions Implementations/Subgraph/daostar/build/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
type RegistrationInstance @entity {
id: ID!
registrationAddress: Bytes!
daoAddress: Bytes!
daoURI: String! # string
daoName: String
registrationNetwork: RegistrationNetwork!
daoDescription: String
membersURI: String
issuersURI: String
proposalsURI: String
governanceURI: String
activityLogURI: String
managerAddress: String
contractsRegistryURI: String
id: ID!
daoAddress: Bytes!
registrationNetwork: RegistrationNetwork! @relation
registrationAddress: Bytes!
daoURI: String!
}

type DAOMetadata @entity {
id: ID!
daoName: String!
daoDescription: String!
membersURI: String!
issuersURI: String!
proposalsURI: String!
governanceURI: String!
activityLogURI: String!
contractsRegistryURI: String!
managerAddress: String!
}

type RegistrationNetwork @entity {
id: ID!
registrations: [RegistrationInstance!] @derivedFrom(field: "registrationNetwork")
chainId: String!
id: ID!
registrations: [RegistrationInstance!] @derivedFrom(field: "registrationNetwork")
chainId: String!
}
14 changes: 12 additions & 2 deletions Implementations/Subgraph/daostar/build/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ templates:
abi: EIP4824Registration
mapping:
kind: ethereum/events
apiVersion: 0.0.6
apiVersion: 0.0.7
language: wasm/assemblyscript
file: EIP4824Index/EIP4824Index.wasm
entities:
Expand All @@ -22,6 +22,16 @@ templates:
eventHandlers:
- event: DAOURIUpdate(address,string)
handler: handleNewURI
- name: DAOMetadataTemplate
kind: file/ipfs
mapping:
apiVersion: 0.0.7
language: wasm/assemblyscript
file: EIP4824Index/EIP4824Index.wasm
handler: handleDAOMetadata
entities:
- DAOMetadata
abis: []
dataSources:
- kind: ethereum
name: EIP4824Index
Expand All @@ -32,7 +42,7 @@ dataSources:
startBlock: 171329384
mapping:
kind: ethereum/events
apiVersion: 0.0.6
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- NewRegistration
Expand Down
180 changes: 93 additions & 87 deletions Implementations/Subgraph/daostar/generated/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,43 @@ export class RegistrationInstance extends Entity {
this.set("id", Value.fromString(value));
}

get registrationAddress(): Bytes {
let value = this.get("registrationAddress");
get daoAddress(): Bytes {
let value = this.get("daoAddress");
if (!value || value.kind == ValueKind.NULL) {
throw new Error("Cannot return null for a required field.");
} else {
return value.toBytes();
}
}

set registrationAddress(value: Bytes) {
this.set("registrationAddress", Value.fromBytes(value));
set daoAddress(value: Bytes) {
this.set("daoAddress", Value.fromBytes(value));
}

get daoAddress(): Bytes {
let value = this.get("daoAddress");
get registrationNetwork(): string {
let value = this.get("registrationNetwork");
if (!value || value.kind == ValueKind.NULL) {
throw new Error("Cannot return null for a required field.");
} else {
return value.toString();
}
}

set registrationNetwork(value: string) {
this.set("registrationNetwork", Value.fromString(value));
}

get registrationAddress(): Bytes {
let value = this.get("registrationAddress");
if (!value || value.kind == ValueKind.NULL) {
throw new Error("Cannot return null for a required field.");
} else {
return value.toBytes();
}
}

set daoAddress(value: Bytes) {
this.set("daoAddress", Value.fromBytes(value));
set registrationAddress(value: Bytes) {
this.set("registrationAddress", Value.fromBytes(value));
}

get daoURI(): string {
Expand All @@ -92,171 +105,164 @@ export class RegistrationInstance extends Entity {
set daoURI(value: string) {
this.set("daoURI", Value.fromString(value));
}
}

get daoName(): string | null {
let value = this.get("daoName");
export class DAOMetadata extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
}

save(): void {
let id = this.get("id");
assert(id != null, "Cannot save DAOMetadata entity without an ID");
if (id) {
assert(
id.kind == ValueKind.STRING,
`Entities of type DAOMetadata must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`,
);
store.set("DAOMetadata", id.toString(), this);
}
}

static loadInBlock(id: string): DAOMetadata | null {
return changetype<DAOMetadata | null>(
store.get_in_block("DAOMetadata", id),
);
}

static load(id: string): DAOMetadata | null {
return changetype<DAOMetadata | null>(store.get("DAOMetadata", id));
}

get id(): string {
let value = this.get("id");
if (!value || value.kind == ValueKind.NULL) {
return null;
throw new Error("Cannot return null for a required field.");
} else {
return value.toString();
}
}

set daoName(value: string | null) {
if (!value) {
this.unset("daoName");
} else {
this.set("daoName", Value.fromString(<string>value));
}
set id(value: string) {
this.set("id", Value.fromString(value));
}

get registrationNetwork(): string {
let value = this.get("registrationNetwork");
get daoName(): string {
let value = this.get("daoName");
if (!value || value.kind == ValueKind.NULL) {
throw new Error("Cannot return null for a required field.");
} else {
return value.toString();
}
}

set registrationNetwork(value: string) {
this.set("registrationNetwork", Value.fromString(value));
set daoName(value: string) {
this.set("daoName", Value.fromString(value));
}

get daoDescription(): string | null {
get daoDescription(): string {
let value = this.get("daoDescription");
if (!value || value.kind == ValueKind.NULL) {
return null;
throw new Error("Cannot return null for a required field.");
} else {
return value.toString();
}
}

set daoDescription(value: string | null) {
if (!value) {
this.unset("daoDescription");
} else {
this.set("daoDescription", Value.fromString(<string>value));
}
set daoDescription(value: string) {
this.set("daoDescription", Value.fromString(value));
}

get membersURI(): string | null {
get membersURI(): string {
let value = this.get("membersURI");
if (!value || value.kind == ValueKind.NULL) {
return null;
throw new Error("Cannot return null for a required field.");
} else {
return value.toString();
}
}

set membersURI(value: string | null) {
if (!value) {
this.unset("membersURI");
} else {
this.set("membersURI", Value.fromString(<string>value));
}
set membersURI(value: string) {
this.set("membersURI", Value.fromString(value));
}

get issuersURI(): string | null {
get issuersURI(): string {
let value = this.get("issuersURI");
if (!value || value.kind == ValueKind.NULL) {
return null;
throw new Error("Cannot return null for a required field.");
} else {
return value.toString();
}
}

set issuersURI(value: string | null) {
if (!value) {
this.unset("issuersURI");
} else {
this.set("issuersURI", Value.fromString(<string>value));
}
set issuersURI(value: string) {
this.set("issuersURI", Value.fromString(value));
}

get proposalsURI(): string | null {
get proposalsURI(): string {
let value = this.get("proposalsURI");
if (!value || value.kind == ValueKind.NULL) {
return null;
throw new Error("Cannot return null for a required field.");
} else {
return value.toString();
}
}

set proposalsURI(value: string | null) {
if (!value) {
this.unset("proposalsURI");
} else {
this.set("proposalsURI", Value.fromString(<string>value));
}
set proposalsURI(value: string) {
this.set("proposalsURI", Value.fromString(value));
}

get governanceURI(): string | null {
get governanceURI(): string {
let value = this.get("governanceURI");
if (!value || value.kind == ValueKind.NULL) {
return null;
throw new Error("Cannot return null for a required field.");
} else {
return value.toString();
}
}

set governanceURI(value: string | null) {
if (!value) {
this.unset("governanceURI");
} else {
this.set("governanceURI", Value.fromString(<string>value));
}
set governanceURI(value: string) {
this.set("governanceURI", Value.fromString(value));
}

get activityLogURI(): string | null {
get activityLogURI(): string {
let value = this.get("activityLogURI");
if (!value || value.kind == ValueKind.NULL) {
return null;
throw new Error("Cannot return null for a required field.");
} else {
return value.toString();
}
}

set activityLogURI(value: string | null) {
if (!value) {
this.unset("activityLogURI");
} else {
this.set("activityLogURI", Value.fromString(<string>value));
}
set activityLogURI(value: string) {
this.set("activityLogURI", Value.fromString(value));
}

get managerAddress(): string | null {
let value = this.get("managerAddress");
get contractsRegistryURI(): string {
let value = this.get("contractsRegistryURI");
if (!value || value.kind == ValueKind.NULL) {
return null;
throw new Error("Cannot return null for a required field.");
} else {
return value.toString();
}
}

set managerAddress(value: string | null) {
if (!value) {
this.unset("managerAddress");
} else {
this.set("managerAddress", Value.fromString(<string>value));
}
set contractsRegistryURI(value: string) {
this.set("contractsRegistryURI", Value.fromString(value));
}

get contractsRegistryURI(): string | null {
let value = this.get("contractsRegistryURI");
get managerAddress(): string {
let value = this.get("managerAddress");
if (!value || value.kind == ValueKind.NULL) {
return null;
throw new Error("Cannot return null for a required field.");
} else {
return value.toString();
}
}

set contractsRegistryURI(value: string | null) {
if (!value) {
this.unset("contractsRegistryURI");
} else {
this.set("contractsRegistryURI", Value.fromString(<string>value));
}
set managerAddress(value: string) {
this.set("managerAddress", Value.fromString(value));
}
}

Expand Down
10 changes: 10 additions & 0 deletions Implementations/Subgraph/daostar/generated/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,13 @@ export class EIP4824Registration extends DataSourceTemplate {
);
}
}

export class DAOMetadataTemplate extends DataSourceTemplate {
static create(cid: string): void {
DataSourceTemplate.create("DAOMetadataTemplate", [cid]);
}

static createWithContext(cid: string, context: DataSourceContext): void {
DataSourceTemplate.createWithContext("DAOMetadataTemplate", [cid], context);
}
}
Loading

0 comments on commit a6054a5

Please sign in to comment.