This subgraph tracks activity related to the Moonbase Alpha Bridge contract
- Deposits
- Proposals
- Votes
- Relayers
- Roles
- General & Daily Statistics
- node v16+
- yarn v1.22+
- The Graph Hosted Service
To lint the code with prettier
run:
yarn lint
- Set endpoints, and subgraph-name in
.env.local
(for deployment to local test graph-node) files. - Make sure
subgraph.yaml
refers to the same contracts and the same blockchain as.env.local
. Check themanifests
folder for templates. - Ensure that the startblocks are the creation blocks of the related contracts in
subgraph.yaml
- Set the correct chain in
src/config.ts
according to the blockchain you're intending to use by using comments.
Then run the following commands:
yarn
yarn codegen
yarn build
If you want to deploy to a local graph-node, you can do so by following the instructions here: https://github.com/graphprotocol/graph-node/blob/master/README.md.
Run the following commands to deploy the Moonbase Alpha Bridge subgraph to a local graph-node:
yarn create-local
yarn deploy-local
Run the following commands to deploy the Moonbase Alpha Bridge subgraph to a remote graph-node:
yarn run create
yarn run deploy
This example query fetches General
statistical data:
query General {
general(id: "1") {
totalDepositsCount
totalProposalsCount
totalVotesCount
totalRelayersCount
chainId
subgraphVersion
}
}
This example query fetches Deposits
data:
query Deposits {
userDeposits(first: 5) {
id
originChainId
destinationChainId
resourceId
nonce
createdTimestamp
createdBlockNumber
}
}
This example query fetches Proposals
data:
query Proposals {
proposals(first: 5) {
id
originChainId
destinationChainId
resourceId
status
dataHash
createdBy(first: 1) {
id
}
passedBy(first: 1) {
id
}
executedBy(first: 1) {
id
}
canceledBy(first: 1) {
id
}
createdTimestamp
createdBlockNumber
passedTimestamp
passedBlockNumber
executedTimestamp
executedBlockNumber
canceledTimestamp
canceledBlockNumber
}
}
This example query fetches Votes
data:
query Votes {
votes(first: 5) {
id
approved
votedTimestamp
votedBlockNumber
}
}
This example query fetches Relayers
data:
query Relayers {
relayers(first: 1) {
id
addedTimestamp
addedBlockNumber
removedTimestamp
removedBlockNumber
voteCount
threshold
createdProposals(first: 3) {
id
}
passedProposals(first: 3) {
id
}
executedProposals(first: 3) {
id
}
canceledProposals(first: 3) {
id
}
timestamp
blockNumber
}
}
This example query fetches Roles
data:
query Roles {
roles(first: 5) {
id
user {
id
}
role
sender
currentlyHeld
timestamp
blockNumber
}
}
This example query fetches DailyStatistics
data:
query DailyStatistics {
dailyStatistics(first: 5, orderBy: date, orderDirection: desc) {
id
date
depositsCount
proposalsCount
votesCount
relayersCount
}
}