beefyfinance / cowcentrated-subgraph

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Beefy CLM Subgraph

This Subgraph sources events from the Beefy CLM contracts in different networks.

Deployments

Goldsky.com

Latest endpoints

Historical endpoints

Contributing

Prerequisites

Setup the project

yarn install

Running a local instance of graph-node locally

yarn infra:strat

Deploying the subgraph locally

yarn remove-local # if you have already deployed the subgraph
yarn create-local # create the subgraph locally
yarn prepare:<network> # apply configuration for the network
yarn codegen # generate the typescript types
yarn build # build the subgraph code
yarn deploy-local # deploy the subgraph locally

Run tests

yarn test # run all tests
yarn test:graph # run only matchstick-as graph tests
yarn test:lint # run prettier linter

HOWTOs

How to add a new network

  1. Add the network configuration config/.json.
    • clockTickBlocks is the number of blocks between each clock tick, aim for a clock tick every 5 minutes.
    • Find the uniswap v3, QuoterV2 contract address on uniswap's documentation
    • Find the /USD price feed on chainlink's documentation. Verify that it's a ChainLink AggregatorV3Interface with the latestRoundData() method.
  2. Add dev RPCs in graph-node config docker/graph-node/config.toml.
  3. Add a new prepare:<network> script in package.json.
  4. Add a new deploy:<network>:<provider> script in package.json.

How to update the schema

  1. Create or update the schema.graphql file.
  1. Run yarn codegen to generate the typescript types.
  1. Update subgraph.template.yaml with the new entity bindings and/or data sources if needed.
  1. Update or create the mappings in the mappings folder to handle the new entity.
  1. Write tests for the new mappings in the tests folder.

Deploy the subgraph

./bin/deploy.sh <network> goldsky
./bin/deploy.sh <network> 0xgraph

# or both
./bin/deploy.sh <network> goldsky 0xgraph

Dependecies on the underlying contracts

- clManagerFactory: ProxyCreated(address)
- clManager.balances()
- clManager.totalSupply()
- clManager.balanceOf()
- clManager.strategy()
- clManager.wants()
- clManager: Initialized(uint8)
- clManager: Transfer(indexed address,indexed address,uint256)

- clStrategyFactory: GlobalPause(bool)
- clStrategy.pool()
- clStrategy.vault()
- clStrategy.output()
- clStrategy.price()
- clStrategy.range()
- clStrategy.balanceOfPool()
- clStrategy.lpToken1ToNativePrice()
- clStrategy.lpToken0ToNativePrice()
- clStrategy.ouptutToNativePrice()
- clStrategy: Initialized(uint8)
- clStrategy: Paused(address)
- clStrategy: Unpaused(address)
- clStrategy: Harvest(uint256,uint256)
- clStrategy: HarvestRewards(uint256)
- clStrategy: ClaimedFees(uint256,uint256,uint256,uint256)
- clStrategy: ClaimedRewards(uint256)

- rewardPoolFactory: ProxyCreated(address)
- rewardPool.stakedToken()
- rewardPool: Initialized(uint8)

About


Languages

Language:TypeScript 91.2%Language:Shell 8.5%Language:JavaScript 0.3%