A subgraph for tracking BeraTrax protocol vaults.
This subgraph indexes various DeFi protocols and their vault contracts on the Berachain network, providing GraphQL APIs for querying vault activities, deposits, withdrawals, and transfers.
Follow these steps to add a new pool to an existing protocol:
📁 File: src/BurrbearVault.ts
Before:
let idArray = [22, 24];
let tokenNameArray = ["Nect-USDC-Honey", "wBERA-wgBERA"];
let vaultArray: Array<string> = [
"0xFD2dE4473577fd5a786E0DFaA611Bbd334fAc8eA",
"0x066Eb1D1e33027bc36FaF3055cf12C8F892408fA",
];Data to Add:
- Pool ID:
25 - Pool Name:
Nect-wgBERA - Pool Vault:
0x5490235e55E13CA58e821d873260f4979d650682
After:
let idArray = [22, 24, 25];
let tokenNameArray = ["Nect-USDC-Honey", "wBERA-wgBERA", "Nect-wgBERA"];
let vaultArray: Array<string> = [
"0xFD2dE4473577fd5a786E0DFaA611Bbd334fAc8eA",
"0x066Eb1D1e33027bc36FaF3055cf12C8F892408fA",
"0x5490235e55E13CA58e821d873260f4979d650682",
];📁 File: subgraph.yaml
Add the following entry under the dataSources section:
- kind: ethereum/contract
name: Nect-wgBERA-BurrbearVault
network: berachain-mainnet
source:
address: "0x5490235e55E13CA58e821d873260f4979d650682"
abi: BurrbearVault
startBlock: 2205365
mapping:
kind: ethereum/events
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- Approval
- Transfer
abis:
- name: BurrbearVault
file: ./abis/BurrbearVault.json
eventHandlers:
- event: Approval(indexed address,indexed address,uint256)
handler: handleApproval
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- event: Deposit(indexed address,indexed address,uint256,uint256)
handler: handleDeposit
- event: Withdraw(indexed address,indexed address,indexed address,uint256,uint256)
handler: handleWithdraw
file: ./src/BurrbearVault.tsExecute the following commands in order:
yarn codegenyarn buildgoldsky subgraph deploy beratrax-mainnet-subgraph/x.0.0 --path .By default, subgraph API endpoints are named after the subgraph name and version. When you update your subgraph to a new version, you'll need to update your frontend to point to the new endpoint.
Tags allow you to manage versions and seamlessly upgrade your subgraph without changing the URL.
Create a production tag:
goldsky subgraph tag create beratrax-mainnet-subgraph/x.0.0 --tag prodThis associates your subgraph version with a stable prod tag, enabling version updates without the need to update the URLs on frontend and backend.