https://github.com/graphprotocol/memefactory-subgraph
Memefactory subgraph for The Graph
https://github.com/graphprotocol/memefactory-subgraph
Last synced: 6 months ago
JSON representation
Memefactory subgraph for The Graph
- Host: GitHub
- URL: https://github.com/graphprotocol/memefactory-subgraph
- Owner: graphprotocol
- Created: 2018-06-27T20:10:52.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-03-23T00:15:41.000Z (almost 4 years ago)
- Last Synced: 2025-03-23T18:51:48.812Z (10 months ago)
- Language: TypeScript
- Homepage:
- Size: 3.28 MB
- Stars: 3
- Watchers: 10
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Meme Factory Subgraph
[Meme Factory](https://memefactory.io/) subgraph for [The Graph](https://thegraph.com).
## Getting started
Like other subgraphs, the Meme Factory subgraph is built with
```sh
# Once (installs dependencies)
yarn
# Each time you want to build
yarn build-ipfs [--verbosity debug]
```
However, in order to index the subgraph, [graph-node](https://github.com/graphprotocol/graph-node) needs to run against
a Ganache testnet rather than a real Ethereum node. This is because
the Meme Factory contracts have not been deployed to a public
Ethereum network yet and we need some test data and events to
index.
### Running the testnet
In order to bring up the Ganache testnet, run the following two
commands:
```sh
# Once
tar xf ganache-db.tar.bz2
# Each time
yarn testnet
```
This will run Ganache on `http://localhost:8546`, allowing to run
graph-node as follows:
```sh
graph-node \
... \
--ethereum-rpc http://localhost:8546 \
--subgraph IPFS_HASH
```
## TODO
1. Identify if there are other contracts/events we should watch
1. Identify how to handle remaining types and fields (see questions in GraphQL schema)
## Missing features already identified
- GraphQL interfaces
- `BigInt` math (required for adding votes for and votes against in challenges)
- Aggregation / counting
## Reference
This subgraph manifest is based on the following MemeFactory resources:
* [Contracts](https://github.com/district0x/memefactory/tree/master/resources/public/contracts/src)
* [GraphQL schema](https://github.com/district0x/memefactory/blob/master/src/memefactory/shared/graphql_schema.cljs)
* [Syncer with event processing](https://github.com/district0x/memefactory/blob/master/src/memefactory/server/syncer.cljs)
## Useful GraphQL queries
```graphql
{
users {
id
user_address
}
memes {
id
regEntry_address
regEntry_status
regEntry_version
regEntry_creator {
id
user_address
}
regEntry_deposit
regEntry_createdOn
regEntry_challengePeriodEnd
challenge_comment
challenge_votesFor
challenge_createdOn
challenge_challenger {
id
user_address
}
challenge_rewardPool
challenge_votesTotal
challenge_votesAgainst
challenge_commitPeriodEnd
challenge_claimedRewardOn
challenge_revealPeriodEnd
}
memeVotes {
id
vote_option
vote_amount
vote_createdOn
vote_secretHash
vote_revealedOn
vote_claimedRewardOn
vote_meme {
id
challenge_votes {
id
}
}
}
paramChanges {
id
regEntry_address
regEntry_status
regEntry_version
regEntry_creator {
id
user_address
}
regEntry_deposit
regEntry_createdOn
regEntry_challengePeriodEnd
challenge_comment
challenge_votesFor
challenge_createdOn
challenge_challenger {
id
user_address
}
challenge_rewardPool
challenge_votesTotal
challenge_votesAgainst
challenge_commitPeriodEnd
challenge_claimedRewardOn
challenge_revealPeriodEnd
}
users {
id
user_address
}
}
```