This Subgraph sources events from the Beefy CLM contracts in different networks.
- Git: git-scm.com
- Node.js: nodejs.org, see version in .nvmrc
- Yarn: yarnpkg.com
- Docker: docker.com
- Docker Compose: docker.com
yarn install
yarn infra:start
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
yarn test # run all tests
yarn test:lint # run prettier linter
- Add the network configuration config/.json.
network
must match one of the networks in Goldsky's supported networks list.clockTickBlocks
is the number of blocks between each clock tick, aim for a clock tick every 5 minutes.- Price feed:
- Use chainlink
"priceOracleType" : "chainlink"
- Find the
<native>/USD
price feed contract address on chainlink's documentation. Verify that it's a ChainLinkAggregatorV3Interface
with thelatestRoundData()
method. Put the address inchainlinkNativePriceFeedAddress
. - Get the decimals of the price feed using the
decimals
field of the contract. Put the decimals inchainlinkNativePriceFeedDecimals
.
- Use pyth
"priceOracleType" : "pyth"
- Find the pyth contract address on pyth's documentation. Put the address in
pythPriceFeedAddress
. - Grab the
Crypto.<native>/USD
price feed ID on pyth's documentation. Put the ID inpythPriceFeedId
.
- Use chainlink
- Add dev RPCs in graph-node config docker/graph-node/config.toml.
- Add a new
prepare:<network>
script in package.json. - Add the chain name in the Release script in .github/workflows/Release.yml.
- Release the first version of the subgraph for the new network using the ./bin/release.sh script.
- Must be logged in to goldsky with the provided cli.
- Only used to deploy the first version, see below for updating a subgraph.
- Tag the new version on Goldsky's UI as "latest" to create a stable endpoint.
- Add the endpoint link to the README in alphabetical order.
- On github, create a new release with the new version number.
- The tag should be the version number, e.g.
1.0.0
. - This will trigger the Release workflow to deploy the subgraph to all networks.
- Wait for the workflow to finish, then check the Goldsky dashboard, the new subgraph version should be indexing on all chains.
- Run some manual tests on the subgraph endpoints using the
next
version tag to verify that the new version is working as expected. - If everything is working as expected, we need to move the goldsky tags to the new version. This process is manual as of now
- For each subgraph on Goldsky's UI
- Go to the new version and create the "latest" tag, this will in fact move the "latest" tag to the new version.
- Go back to the old version and delete the subgraph
- Create or update the schema.graphql file.
- See TheGraph docs for defining entities
- Run
yarn codegen
to generate the typescript types.
- See TheGraph docs for TypeScript code generation
- Update subgraph.template.yaml with the new entity bindings and/or data sources if needed.
- TheGraph docs for defining a call handler
- TheGraph docs for defining a block handler
- TheGraph docs for defining a data source template
- Update or create the mappings in the mappings folder to handle the new entity.
- TheGraph docs for defining mappings
- TheGraph AssemblyScript API
- Write tests for the new mappings in the tests folder.
- TheGraph docs for testing mappings
./bin/deploy.sh <network> goldsky
./bin/deploy.sh <network> 0xgraph
# or both
./bin/deploy.sh <network> goldsky 0xgraph
- classicVaultFactory: ProxyCreated(address)
- classicVault: strategy()
- classicVault: want()
- classicVault: balance()
- classicVault: totalSupply()
- classicVault: Transfer(indexed address,indexed address,uint256)
- classicVault: Initialized(uint8)
- classicVault: UpgradeStrat(address)
- classicVault: Transfer(indexed address,indexed address,uint256)
- classicStrategyFactory: ProxyCreated(address)
- classicStrategy.decimals()
- classicStrategy.name()
- classicStrategy.symbol()
- classicStrategy.vault()
- classicStrategy: Initialized(uint8)
- classicStrategy: Paused(address)
- classicStrategy: Unpaused(address)
- classicStrategy: StratHarvest(indexed address,uint256,uint256)
- classicBoostFactory: ProxyCreated(address)
- classicBoost: Initialized(uint8)
- classicBoost: Staked(indexed address,uint256)
- classicBoost: Withdrawn(indexed address,uint256)
- classicBoost: RewardPaid(indexed address,uint256)
- clmManagerFactory: ProxyCreated(address)
- clmManager.decimals()
- clmManager.name()
- clmManager.symbol()
- clmManager.balances()
- clmManager.totalSupply()
- clmManager.balanceOf()
- clmManager.strategy()
- clmManager.wants()
- clmManager: Initialized(uint8)
- clmManager: Transfer(indexed address,indexed address,uint256)
- clmStrategyFactory: GlobalPause(bool)
- clmStrategy.pool()
- clmStrategy.vault()
- clmStrategy.price()
- clmStrategy.range()
- clmStrategy.output() // optional
- clmStrategy.balanceOfPool()
- clmStrategy: Initialized(uint8)
- clmStrategy: Paused(address)
- clmStrategy: Unpaused(address)
- clmStrategy: Harvest(uint256,uint256)
- clmStrategy: HarvestRewards(uint256)
- clmStrategy: ClaimedFees(uint256,uint256,uint256,uint256)
- clmStrategy: ClaimedRewards(uint256)
- rewardPoolFactory: ProxyCreated(address)
- rewardPool.decimals()
- rewardPool.name()
- rewardPool.symbol()
- rewardPool.stakedToken()
- rewardPool.totalSupply()
- rewardPool: Initialized(uint8)
- rewardPool: Transfer(indexed address,indexed address,uint256)
- rewardPool: RewardPaid(indexed address,indexed address,uint256)
- rewardPool: AddReward(address)
- rewardPool: RemoveReward(address,address)
beefySwapper: getAmountOut(address,address,uint256)
beefyOracle: getFreshPrice(address)