Skip to content

Commit

Permalink
feat: As a user, I want the indexed objects to contain some "audit" data
Browse files Browse the repository at this point in the history
fix: All indexed objects should have lowercase IDs
  • Loading branch information
alainncls committed Apr 8, 2024
1 parent f2874e6 commit ccb3643
Show file tree
Hide file tree
Showing 23 changed files with 5,811 additions and 6,286 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ dist
.pnp.*
lcov.info
pnpm-lock.yaml
.latest.json
2 changes: 1 addition & 1 deletion explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"postcss": "^8.4.31",
"prettier": "^3.1.0",
"tailwindcss": "^3.3.5",
"typescript": "^5.2.2",
"typescript": "5.2.2",
"vite": "^4.5.3",
"vite-plugin-radar": "^0.9.1",
"vite-plugin-svgr": "^4.2.0"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"eslint": "^8.53.0",
"husky": "^8.0.3",
"prettier": "^2.8.8",
"typescript": "^5.2.2"
"typescript": "5.2.2"
},
"pnpm": {
"overrides": {
Expand Down
11,648 changes: 5,424 additions & 6,224 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions subgraph/.env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
DEPLOY_ENDPOINT_LINEA_GOERLI=
DEPLOY_ENDPOINT_LINEA_MAINNET=
DEPLOY_ENDPOINT_ARBITRUM_GOERLI=
DEPLOY_ENDPOINT_ARBITRUM_MAINNET=
DEPLOY_ENDPOINT_ARBITRUM_NOVA=
DEPLOY_ENDPOINT_ARBITRUM_SEPOLIA=
DEPLOY_ENDPOINT_LINEA_GOERLI=
DEPLOY_ENDPOINT_LINEA_MAINNET=

IPFS_ENDPOINT=
IPFS_IDENTIFIERS=
SUBGRAPH_NAME_ARBITRUM=

SUBGRAPH_NAME_ARBITRUM_GOERLI=
SUBGRAPH_NAME_ARBITRUM_MAINNET=
SUBGRAPH_NAME_ARBITRUM_NOVA=
SUBGRAPH_NAME_ARBITRUM_SEPOLIA=
SUBGRAPH_NAME_LINEA_GOERLI=
SUBGRAPH_NAME_LINEA_MAINNET=
9 changes: 6 additions & 3 deletions subgraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ This subgraph aims to index the data generated by the smart contracts of Verax.
Our subgraph is deployable on all the networks where Verax is deployed.
You can replace `XXX` by the name of the networks you want to work on in the commands below:

- `arbitrum-goerli`
- `arbitrum-mainnet`
- `arbitrum-nova`
- `arbitrum-sepolia`
- `linea-goerli`
- `linea-mainnet`
- `arbitrum-goerli`
- `arbitrum-one`

### 1. Add secrets

1. Copy the .env.example file to a .env file
2. Fill `DEPLOY_ENDPOINT_XXX` with the endpoint(s) dedicated to network(s) you want to work on
3. Fill `IPFS_ENDPOINT` with your IPFS endpoint (you can get one for free via Infura)
4. Fill `IPFS_IDENTIFIERS` with your IPFS identifiers (you can get them for free via Infura).
4. Fill `IPFS_IDENTIFIERS` with your IPFS identifiers (you can get them for free via Infura)
5. Fill `SUBGRAPH_NAME_XXX` with the name you want to give to the subgraph

Note: You need to encode your identifier and secret key to Base64, following this format: `IDENTIFIER:SECRET`.

Expand Down
26 changes: 26 additions & 0 deletions subgraph/abis/PortalRegistry.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,19 @@
"name": "PortalRegistered",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "portalAddress",
"type": "address"
}
],
"name": "PortalRevoked",
"type": "event"
},
{
"inputs": [
{
Expand Down Expand Up @@ -345,6 +358,19 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "id",
"type": "address"
}
],
"name": "revoke",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "router",
Expand Down
2 changes: 1 addition & 1 deletion subgraph/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"startBlock": 1454671
}
},
"linea-mainnet": {
"linea": {
"AttestationRegistry": {
"address": "0x3de3893aa4Cdea029e84e75223a152FD08315138",
"startBlock": 346695
Expand Down
24 changes: 11 additions & 13 deletions subgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"license": "MIT",
"author": "Consensys",
"scripts": {
"build:linea-mainnet": "cp subgraph.linea-mainnet.yaml subgraph.yaml && pnpm run codegen:linea-mainnet && graph build --network linea-mainnet",
"build:linea-mainnet": "cp subgraph.linea-mainnet.yaml subgraph.yaml && pnpm run codegen:linea-mainnet && graph build --network linea",
"build:linea-goerli": "cp subgraph.linea-goerli.yaml subgraph.yaml && pnpm run codegen:linea-goerli && graph build --network linea-goerli",
"build:arbitrum-goerli": "cp subgraph.arbitrum-goerli.yaml subgraph.yaml && pnpm run codegen:arbitrum-goerli && graph build --network arbitrum-goerli",
"build:arbitrum-sepolia": "cp subgraph.arbitrum-sepolia.yaml subgraph.yaml && pnpm run codegen:arbitrum-sepolia && graph build --network arbitrum-sepolia",
Expand All @@ -27,27 +27,25 @@
"codegen:arbitrum-sepolia": "cp subgraph.arbitrum-sepolia.yaml subgraph.yaml && graph codegen",
"codegen:arbitrum-mainnet": "cp subgraph.arbitrum-mainnet.yaml subgraph.yaml && graph codegen",
"codegen:arbitrum-nova": "cp subgraph.arbitrum-nova.yaml subgraph.yaml && graph codegen",
"create:linea-mainnet": "source .env && graph create --node $DEPLOY_ENDPOINT_LINEA_MAINNET Consensys/linea-attestation-registry",
"create:linea-goerli": "source .env && graph create --node $DEPLOY_ENDPOINT_LINEA_GOERLI Consensys/linea-attestation-registry",
"create:linea-mainnet": "source .env && graph create --node $DEPLOY_ENDPOINT_LINEA_MAINNET $SUBGRAPH_NAME_LINEA_MAINNET",
"create:linea-goerli": "source .env && graph create --node $DEPLOY_ENDPOINT_LINEA_GOERLI $SUBGRAPH_NAME_LINEA_GOERLI",
"create:arbitrum-goerli": "source .env && graph create --node $DEPLOY_ENDPOINT_ARBITRUM_GOERLI Consensys/verax-arbitrum-goerli",
"create:arbitrum-sepolia": "source .env && graph create --node $DEPLOY_ENDPOINT_ARBITRUM_SEPOLIA $SUBGRAPH_NAME_ARBITRUM_SEPOLIA",
"create:arbitrum-one": "source .env && graph create --node $DEPLOY_ENDPOINT_ARBITRUM_GOERLI Consensys/verax-arbitrum",
"deploy:linea-mainnet": "source .env && cp subgraph.linea-mainnet.yaml subgraph.yaml && pnpm run build:linea-mainnet && graph deploy --network linea-mainnet --node $DEPLOY_ENDPOINT_LINEA_MAINNET --headers \"{\\\"Authorization\\\": \\\"Basic $IPFS_IDENTIFIERS\\\"}\" --ipfs $IPFS_ENDPOINT --version-label v0.0.1 Consensys/linea-attestation-registry",
"deploy:linea-goerli": "source .env && cp subgraph.linea-goerli.yaml subgraph.yaml && pnpm run build:linea-goerli && graph deploy --network linea-goerli --node $DEPLOY_ENDPOINT_LINEA_GOERLI --headers \"{\\\"Authorization\\\": \\\"Basic $IPFS_IDENTIFIERS\\\"}\" --ipfs $IPFS_ENDPOINT --version-label v0.0.5 Consensys/linea-attestation-registry",
"deploy:arbitrum-goerli": "source .env && cp subgraph.arbitrum-goerli.yaml subgraph.yaml && pnpm run build:arbitrum-goerli && graph deploy --network arbitrum-goerli --node $DEPLOY_ENDPOINT_ARBITRUM_GOERLI --headers \"{\\\"Authorization\\\": \\\"Basic $IPFS_IDENTIFIERS\\\"}\" --ipfs $IPFS_ENDPOINT --version-label v0.0.5 Consensys/verax-arbitrum-goerli",
"deploy:linea-mainnet": "source .env && cp subgraph.linea-mainnet.yaml subgraph.yaml && graph deploy --studio $SUBGRAPH_NAME_LINEA_MAINNET",
"deploy:linea-goerli": "source .env && cp subgraph.linea-goerli.yaml subgraph.yaml && graph deploy --studio $SUBGRAPH_NAME_LINEA_GOERLI",
"deploy:arbitrum-goerli": "source .env && cp subgraph.arbitrum-goerli.yaml subgraph.yaml && graph deploy --network arbitrum-goerli --node $DEPLOY_ENDPOINT_ARBITRUM_GOERLI --headers \"{\\\"Authorization\\\": \\\"Basic $IPFS_IDENTIFIERS\\\"}\" --ipfs $IPFS_ENDPOINT --version-label v0.0.5 Consensys/verax-arbitrum-goerli",
"deploy:arbitrum-sepolia": "source .env && cp subgraph.arbitrum-sepolia.yaml subgraph.yaml && pnpm run build:arbitrum-sepolia && graph deploy --studio $SUBGRAPH_NAME_ARBITRUM_SEPOLIA",
"deploy:arbitrum-mainnet": "source .env && cp subgraph.arbitrum-mainnet.yaml subgraph.yaml && pnpm run build:arbitrum-mainnet && graph deploy --network arbitrum-mainnet --node $DEPLOY_ENDPOINT_ARBITRUM_MAINNET --headers \"{\\\"Authorization\\\": \\\"Basic $IPFS_IDENTIFIERS\\\"}\" --ipfs $IPFS_ENDPOINT --version-label v0.0.5 Consensys/verax-arbitrum",
"deploy:arbitrum-nova": "source .env && cp subgraph.arbitrum-nova.yaml subgraph.yaml && pnpm run build:arbitrum-nova && goldsky subgraph deploy 'verax-arbitrum-nova/0.0.5'",
"remove:linea-mainnet": "source .env && graph remove --node $DEPLOY_ENDPOINT_LINEA_MAINNET Consensys/linea-attestation-registry",
"remove:linea-goerli": "source .env && graph remove --node $DEPLOY_ENDPOINT_LINEA_GOERLI Consensys/linea-attestation-registry",
"test": "pnpm run codegen:linea-goerli && graph test",
"test:coverage": "graph test -c",
"test:docker": "graph test -d"
},
"devDependencies": {
"@graphprotocol/graph-cli": "0.68.5",
"@graphprotocol/graph-ts": "0.31.0",
"assemblyscript": "0.19.10",
"matchstick-as": "0.6.0"
"dependencies": {
"@graphprotocol/graph-cli": "^0.56.0",
"@graphprotocol/graph-ts": "^0.31.0",
"assemblyscript": "^0.19.23",
"matchstick-as": "^0.6.0-beta.2"
}
}
29 changes: 26 additions & 3 deletions subgraph/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
type Attestation @entity {
id: ID!
schemaId: Bytes!
schema: Schema!
replacedBy: Bytes!
attester: Bytes!
portal: Bytes!
portal: Portal!
attestedDate: BigInt!
expirationDate: BigInt!
revocationDate: BigInt!
Expand All @@ -12,15 +12,16 @@ type Attestation @entity {
subject: Bytes!
encodedSubject: Bytes!
attestationData: Bytes!
schemaString: String
decodedData: [String!]
auditInformation: AuditInformation!
}

type Module @entity {
id: ID!
moduleAddress: Bytes!
name: String!
description: String!
auditInformation: AuditInformation!
}

type Portal @entity {
Expand All @@ -32,6 +33,7 @@ type Portal @entity {
description: String!
ownerName: String!
attestationCounter: Int
auditInformation: AuditInformation!
}

type Schema @entity {
Expand All @@ -41,6 +43,7 @@ type Schema @entity {
context: String!
schema: String!
attestationCounter: Int
auditInformation: AuditInformation!
}

type Counter @entity {
Expand All @@ -53,10 +56,30 @@ type Counter @entity {

type Issuer @entity {
id: ID!
auditInformation: AuditInformation!
}

type RegistryVersion @entity {
id: ID!
versionNumber: Int
timestamp: BigInt
auditInformation: AuditInformation!
}

type AuditInformation @entity {
id: ID!
creation: Audit!
lastModification: Audit!
modifications: [Audit!]!
}

type Audit @entity {
id: ID!
blockNumber: BigInt!
transactionHash: Bytes!
transactionTimestamp: BigInt!
fromAddress: Bytes!
toAddress: Bytes
valueTransferred: BigInt
gasPrice: BigInt
}
Loading

0 comments on commit ccb3643

Please sign in to comment.