https://thegraph.com/studio/
npm install -g @graphprotocol/graph-cli
git clone https://github.com/dfx-finance/subgraph.git
yarn install
cd subgraph
yarn codegen
(This should be done every time the schema is changed)https://thegraph.com/studio/
under 'dfx-test'graph auth --studio
yarn deploy-test:mainnet
https://thegraph.com/studio/dfx-test
and you can start querying in the Playground
even before the subgraph has synced to 100%yarn prepare:mainnet
yarn codegen
yarn deploy-prod:mainnet
subgraph\src\helpers.ts
.fetchRewardsForDuration()
there is a function that makes calls to the staking contracts contract.getRewardForDuration()
in Ethereum it is just 1 BigDecimal but Polygon the number is inside an array so upon switching between the two there needs to be a small change of contract.getRewardForDuration()[0]
.graph-ts
module.error, warn, info, debug
They all follow the format of string
message followed by and string
array filled with your variables. They will show up after the subgraph is deployed.
For exampleNote:
Addresses and transaction hashes must be converted to Hexstrings in order to show up properly in the logging.