Skip to content

Commit

Permalink
Update compound subgraph to v2 mainnet (#5)
Browse files Browse the repository at this point in the history
* Fix the price oracle usd bug (scope)

* Fix cETH to work with refactored contracts

* Refactor cETH.ts and cECR20.ts into one file

* Add eslint and prettier and apply

* Lint comments

* Add in market reserve factor

* add in realized and unrealized values

* Refactor creating CTokenInfo

* Update mappings to work with all new schema fields

* Reduce contract calls, mainly for balances

* Refactor user creation into a reusable function

* Refactor common CTokenstats updates into a reusable function

* Fix decimals bug, add in market as a ctoken relationship field

* Clean up schema comments

* Fix cTokenStats decimal bugs and calculation bugs

* Clean schema of js wrapper fields

* Refactor markets out of helpers.ts

* Fix market divide by decimals bugs

* Refactor to update all markets upon any event

* Rollback updating all markets at once. Add back all comptroller handlers

* Remove calculating any balances. All to be done by js wrapper

* Fix mappings to work with new graph-node verrsion

* Add in transfers to be handled. Remove unneccessary updateMarket() calls

* Fix transfer bug, and remove duplicate cTokenStats updates

* Clean up comments

* Change market updates to only run once per block

* Add interest rate address, pre-commit hook, and update rates to be yearly

* Fix negative cBalance bug. Fix cTokenContracts to not be users. Other small fixes

* Update schema to have comments show up in playground

* Rename many fields to be closer to the compound API naming

* Fix duplicate Mint and Redeeem calculation bugs. Fix storedBorrowBalance bug
  • Loading branch information
davekaj authored and jflatow committed Nov 5, 2019
1 parent a8e40ed commit 19f5d8c
Show file tree
Hide file tree
Showing 16 changed files with 2,926 additions and 1,330 deletions.
5 changes: 5 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": ["plugin:@typescript-eslint/recommended", "prettier", "prettier/@typescript-eslint"]
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ build/
node_modules/
src/types/
.DS_STORE
.idea/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
schema.graphql
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": false,
"trailingComma": "all",
"printWidth": 90,
"singleQuote": true
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ These contracts were left out:
- `StableCoinInterestRateModel.sol` - No data was chosen to be sourced from here
- `StandardInterestRateModel.sol` - No data was chosen to be sourced from here

### ABI

The ABI used is `ctoken.json`. It is a stripped down version of the full abi provided by compound, that satisfies the calls we need to make for both cETH and cERC20 contracts. This way we can use 1 ABI file, and one mapping for cETH and cERC20.

## Getting started with querying
Below are a few ways to show how to query the Compound V2 Subgraph for data. The queries show most of the information that is queryable, but there are many other filtering options that can be used, just check out the [querying api](https://github.com/graphprotocol/graph-node/blob/master/docs/graphql-api.md).
Expand Down
Loading

0 comments on commit 19f5d8c

Please sign in to comment.