Compound V3 Community Subgraphs are the most comprehensive data source for developers looking to integrate Compound v3 protocol data into their decentralized applications (dApps)
Blockchain Network | Deployment (The Graph Decentralized Network) |
---|---|
Ethereum mainnet | Subgraph |
Polygon | Subgraph |
Arbitrum | Subgraph |
Base | Subgraph |
Optimism | Subgraph |
Scroll | Subgraph |
Blockchain Network | Subgraph |
---|---|
Sepolia | Subgraph |
Base Sepolia | Subgraph |
We provide a decentralized network API key for the Compound Community, just ask for it in the Compound discord! Please don't abuse, otherwise we will have to revoke it.
- All percentages are represented as decimals in [0.0, 1.0]
- baseTransfer will not emit any events if all value changed is on the borrow side. For this reason, it it possible that positions that did baseTransfers may be out of date until interaction happens involving that position do another interaction with the market. There is an issue open in Compound's comet repo here to add this event: compound-finance/comet#816
- All interactions to the comet contract emit a specific event except for except for baseTransfer (see above^). Also, the
Transfer
event gets omitted anytime the cToken balances change, for this reason we update accounting on a Transfer event (which is generally redundant, except for the special case described above). For this reason, we don't explicitly track this interaction for usage as this would result in duplicate counting. - USD balances are as of the last time an entity got updated. If there are no entity updates for a long period the "current" values will not be very accurate and should be instead constructed using the token balance and the current token price pulled from elsewhere.
erDiagram
GOVERNOR_BRAVO ||--|| TIMELOCK : "ProposalCreated|VoteCase|ProposalCanceled|ProposalQueued|ProposalExecuted"
TIMELOCK ||--|| CONFIGURATOR_PROXY : "QueueTransaction|CancelTranscation|ExecuteTransaction"
CONFIGURATOR_PROXY ||--|| CONFIGURATOR : ""
CONFIGURATOR ||--o{ COMET_FACTORY : "SetFactory"
COMET_FACTORY ||--o{ COMET : ""
CONFIGURATOR ||--o{ COMET_PROXY : "CometDeployed|SetConfiguration|AddAsset|..."
COMET_REWARDS }|--|{ COMET_PROXY : ""
COMET_PROXY ||--|| COMET : ""
LENDER_OR_BORROWER }|--|{ COMET_PROXY : "Supply|Transfer|Withdraw|Approve"
LENDER_OR_BORROWER }|--|{ COMET_REWARDS : "RewardClaimed"
GOVERNANCE_PARTICIPANT }|--|| GOVERNOR_BRAVO : "Create|Vote|Cancel|Queue|Execute"
LIQUIDATOR }|--|{ COMET_PROXY : "Absorb|BuyCollatoral"
COMET }|--|{ PRICE_FEED : ""
In the below commands, replace with one of [mainnet, polygon, arbitrum-one, base, goerli]
Install dependencies:
yarn
Copy .env.example to .env and populate it
cp .env.example .env
Run code generation
yarn codegen
Build
yarn build:<network>
Deploy to the subgraph studio
yarn deploy-studio:<network>
Codegen, build and deploy in one command
yarn auto-deploy:<network> v<version (X.Y.Z)>
# Example
yarn auto-deploy:mainnet v0.0.1
Validation is summarized in this spreadsheet
Helpers used to derive the data for validation can be found in:
- Jupyter notebook query.ipynb: used to query subgraph and plot data
- The script directContract.ts: used to read comet contracts at specified blocks to compare with the subgraph
to run directContract.ts
cd validation
yarn install
ts-node directContract.ts