Skip to content

Commit

Permalink
chore: add subgraph availability manager contract
Browse files Browse the repository at this point in the history
  • Loading branch information
Maikol committed Jan 18, 2024
1 parent e53a031 commit d444049
Show file tree
Hide file tree
Showing 11 changed files with 4,409 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Ignore truffle stuff
build/

generated/
node_modules/
src/types/
src/mappings/helpers/metadata.ts
.DS_STORE
yarn-error.log
subgraph.yaml
config/addresses.ts
config/generatedAddresses.json
tests/.bin
.vscode
276 changes: 276 additions & 0 deletions abis/SubgraphAvailabilityManager.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,276 @@
[
{
"inputs": [
{ "internalType": "address", "name": "_governor", "type": "address" },
{
"internalType": "address",
"name": "_rewardsManager",
"type": "address"
},
{
"internalType": "uint256",
"name": "_executionThreshold",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_voteTimeLimit",
"type": "uint256"
},
{ "internalType": "address[5]", "name": "_oracles", "type": "address[5]" }
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
}
],
"name": "NewOwnership",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
}
],
"name": "NewPendingOwnership",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "index",
"type": "uint256"
},
{
"indexed": true,
"internalType": "address",
"name": "oracle",
"type": "address"
}
],
"name": "OracleSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "subgraphDeploymentID",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bool",
"name": "deny",
"type": "bool"
},
{
"indexed": true,
"internalType": "uint256",
"name": "oracleIndex",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
}
],
"name": "OracleVote",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "voteTimeLimit",
"type": "uint256"
}
],
"name": "VoteTimeLimitSet",
"type": "event"
},
{
"inputs": [],
"name": "NUM_ORACLES",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "acceptOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "_subgraphDeploymentID",
"type": "bytes32"
},
{ "internalType": "bool", "name": "_deny", "type": "bool" }
],
"name": "checkVotes",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "currentNonce",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "executionThreshold",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "governor",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "", "type": "uint256" },
{ "internalType": "bytes32", "name": "", "type": "bytes32" },
{ "internalType": "uint256", "name": "", "type": "uint256" }
],
"name": "lastAllowVote",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "", "type": "uint256" },
{ "internalType": "bytes32", "name": "", "type": "bytes32" },
{ "internalType": "uint256", "name": "", "type": "uint256" }
],
"name": "lastDenyVote",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"name": "oracles",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pendingGovernor",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "_index", "type": "uint256" },
{ "internalType": "address", "name": "_oracle", "type": "address" }
],
"name": "setOracle",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "_voteTimeLimit", "type": "uint256" }
],
"name": "setVoteTimeLimit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_newGovernor", "type": "address" }
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "_subgraphDeploymentID",
"type": "bytes32"
},
{ "internalType": "bool", "name": "_deny", "type": "bool" },
{ "internalType": "uint256", "name": "_oracleIndex", "type": "uint256" }
],
"name": "vote",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32[]",
"name": "_subgraphDeploymentID",
"type": "bytes32[]"
},
{ "internalType": "bool[]", "name": "_deny", "type": "bool[]" },
{ "internalType": "uint256", "name": "_oracleIndex", "type": "uint256" }
],
"name": "voteMany",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "voteTimeLimit",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
}
]
8 changes: 8 additions & 0 deletions networks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"sepolia": {
"SubgraphAvailabilityManager": {
"address": "0x0539C6995aC74eBCBa449D88fD947eeD2877bE34",
"startBlock": 5109718
}
}
}
18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "network-monitoring-subgraph",
"license": "UNLICENSED",
"scripts": {
"codegen": "graph codegen",
"build": "graph build",
"deploy": "graph deploy --node https://api.studio.thegraph.com/deploy/ network-monitoring-subgraph",
"create-local": "graph create --node http://localhost:8020/ network-monitoring-subgraph",
"remove-local": "graph remove --node http://localhost:8020/ network-monitoring-subgraph",
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 network-monitoring-subgraph",
"test": "graph test"
},
"dependencies": {
"@graphprotocol/graph-cli": "0.61.0",
"@graphprotocol/graph-ts": "0.30.0"
},
"devDependencies": { "matchstick-as": "0.5.0" }
}
45 changes: 45 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
type NewOwnership @entity(immutable: true) {
id: Bytes!
from: Bytes! # address
to: Bytes! # address
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type NewPendingOwnership @entity(immutable: true) {
id: Bytes!
from: Bytes! # address
to: Bytes! # address
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type OracleSet @entity(immutable: true) {
id: Bytes!
index: BigInt! # uint256
oracle: Bytes! # address
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type OracleVote @entity(immutable: true) {
id: Bytes!
subgraphDeploymentID: Bytes! # bytes32
deny: Boolean! # bool
oracleIndex: BigInt! # uint256
timestamp: BigInt! # uint256
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type VoteTimeLimitSet @entity(immutable: true) {
id: Bytes!
voteTimeLimit: BigInt! # uint256
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}
Loading

0 comments on commit d444049

Please sign in to comment.