/DeMix_Subgraph

A decentralized protocol for indexing and querying data from DecentraMix's on chain contracts across all supported blockchains.

Primary LanguageJavaScript

DeMix Subgraph - by DecentraWorld

A decentralized protocol for indexing and querying data from DeMix contracts across all supported blockchains.

Supported Chains: 😁 BSC   |   😄 ETH   |   😃 FTM   |   😀 AVAX   |   😇 ARB   |   🙂 xDai   |   🙃 CRO   |   🤩 MATIC   |   😝 OPTIMISM   |   😗 Testnet   |   😙 Goerli

DeMix is a zero-knowledge DApp which allows a variety of Blockchain users to prove send & receive crypto currencies without revealing their original identity. At the same time, it allows users to collect their note without using a wallet with funds for gas (using relayers). It is designed to be a simple and useful privacy motivated DAPP for DecentraWorld's community and users. It's time to bring freedom to the people

⚠️ This repositories is still being worked on version/0.0.1. We will update this repo with the final versio as soon as DeMix is launched across all supported blockchains mentioned above, and we`re done testing & stressing the beta version of DeMix.

Requirements

  1. node v16.14.2(LTS)
  2. yarn 1.22.18
  3. npm install -g @graphprotocol/graph-cli@latest

Create a "Hosted-Service" For Each Subgraph

  1. Sign up with The Graph
  2. Add a subgraph under hosted service.
  3. The name of each subgraph needs to match the name on the script package.json.

Deploy DeMix's Subgraphs

  1. yarn install
  2. yarn run generate-<blockchain_name_here> E.g: yarn run generate-bsc
  3. replace $TOKEN (line 52 in package.json) with an access token
  4. yarn run deploy:demix-<blockchain_name_here> E.g: yarn run deploy:demix-bsc
    Or Deploy on all supported chains at the same time:
  5. yarn run deploy:all Optional: yarn run lint to fix code and implement prettier

Deployed subgraphs

The following is a list of our deployed subgraphs. Each subgraph.yaml file can be used with a thegraph.com hosted service. It helps our smart contracts to verify notes on the blockchain even when there is many transactions to look through.

Chain ID Subgraph Status
97 Testnet-DeMix-Subgraph Deployed
1 Mainnet-DeMix-Subgraph Undeployed
56 BSC-DeMix-Subgraph Undeployed
43114 Avalanche-DeMix-Subgraph Undeployed
250 Fantom-DeMix-Subgraph Undeployed
137 Matic-DeMix-Subgraph Undeployed
25 Cronos-DeMix-Subgraph Undeployed
42161 Arbitrum-DeMix-Subgraph Undeployed
10 Optimism-DeMix-Subgraph Undeployed
100 xDai-DeMix-Subgraph Undeployed
5 Goerli-DeMix-Subgraph Undeployed

...

How to adjust this subgraph to your needs

We encourage everyone to use subgraphs for complicated indexing on the blockchain. If you would like to use this repo for your own code, make sure to adjust the following files.

Example subgraph by The Graph: @graphprotocol/example-subgraph

  1. The schema file schema.graphql needs to match your contract`s query and indexing needs.
  2. Create a new subgraph.yaml file in the /subgraphs/subgraph.yaml folder, and name it as you wish. You can use existing .yaml files as a referance, or the create-yaml-file.js file as a .yaml generator script.
  3. Adjust mapping .ts files according to your needs, I'd suggest to follow TheGraph's documentation to learn how to initiate, build, and deploy your subgraphs properly. Always run the yarn deploy command above again to deploy the updated version of your subgraph. Mappings are AssemblyScript code called whenever the Graph Node finds an event or a call specified in the manifest.
  4. In the mustache folder you will find templates to DeMix's subgraph, as we use multiple blockchain this makes the deployment process of each subgraph much easier. You can adjust the templates according to your need. The yaml.mustache file contains the schema.graphql template, that will need to watch the indexing schema that you need.
  5. The abis folder contains abis of each contract that is needed for DeMix's indexing. Change the current files with the abi files of your contracts that will be indexed. These ABI files are being pulled by the subgraph.yaml file that is used to deploy your subgraph.
  6. The scripts in package.json are made to make the build & deployment process easy. Simply add/adjust the generate, yaml, codegen, build, and deploy scripts according to your new subgraph.yaml file name and other changes.