Skip to content

Commit

Permalink
Merge pull request #272 from OlympusDAO/burnt-bonds
Browse files Browse the repository at this point in the history
[5.1]: Bond Manager OHM, Bond Depository, TRSRY v1.1
  • Loading branch information
0xJem authored Jan 29, 2024
2 parents 403e948 + 43e7e21 commit bbeba34
Show file tree
Hide file tree
Showing 14 changed files with 406 additions and 344 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/query.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "18"
cache: "yarn"
- name: Install
run: |
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "18"
cache: "yarn"
- name: Install
run: |
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "18"
cache: "yarn"
# Looks for an existing comment, so it can be updated
- name: Find Existing Comment
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"eslint.packageManager": "yarn",
"eslint.format.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"cSpell.words": [
"arbitrum",
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ Gathers data from bonds, liquidity and Olympus treasury.

Used in the [Olympus Treasury Dashboard](https://app.olympusdao.finance/).

Deployed at <https://thegraph.com/hosted-service/subgraph/olympusdao/olympus-protocol-metrics>
Deployed at:

- [Ethereum mainnet](https://thegraph.com/explorer/subgraphs/7jeChfyUTWRyp2JxPGuuzxvGt3fDKMkC9rLjm7sfLcNp?view=Overview&chain=arbitrum-one)
- [Polygon](https://thegraph.com/explorer/subgraphs/aF7zBXagiSjwwM1yAUiyrWFJDhh5RLpVn2nuvVbKwDw?view=Overview&chain=arbitrum-one)
- [Arbitrum](https://thegraph.com/explorer/subgraphs/8Zxb1kVv9ZBChHXEPSgtC5u5gjCijMn5k8ErpzRYWNgH?view=Overview&chain=arbitrum-one)
- [Fantom](https://thegraph.com/hosted-service/subgraph/olympusdao/protocol-metrics-polygon)

## Initial Setup

Expand Down
2 changes: 1 addition & 1 deletion bin/subgraph/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ program

console.info("*** Running graph test");
spawnProcess(
`yarn graph test --version 0.5.3 ${options.recompile == true ? "--recompile" : ""}`,
`yarn graph test --version 0.6.0 ${options.recompile == true ? "--recompile" : ""}`,
(testExitCode: number) => {
if (testExitCode > 0) {
process.exit(testExitCode);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"dependencies": {
"@apollo/client": "^3.8.4",
"@graphprotocol/graph-cli": "^0.57.0",
"@graphprotocol/graph-cli": "^0.67.0",
"@graphprotocol/graph-ts": "^0.31.0",
"assemblyscript-json": "^1.1.0",
"commander": "^9.4.0",
Expand Down Expand Up @@ -49,4 +49,4 @@
"ramda": "^0.27.2",
"yargs-parser": "^18.1.1"
}
}
}
7 changes: 7 additions & 0 deletions subgraphs/ethereum/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Subgraph Changelog

## 5.1.3 (2024-01-26)

- Adds TRSRY v1.1
- Adds support for recognising OHM burnt in the Bond Manager
- Removes the Bond Depository from protocol- and DAO-owned wallets going forward, as gOHM in the contract is considered user funds
- Grafted on top of 5.0.4

## 5.0.5 (2023-10-17)

- Improve indexing performance by using Bytes instead of String for entity ids
Expand Down
4 changes: 2 additions & 2 deletions subgraphs/ethereum/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "QmbucBqomBG2qDfizVV1cMGDudCLvW2h9KWHeD6YS6Bk7L",
"id": "Qmd7wgnNTijSpV1JDM3yUE8Exy4EGG1jw3yyQKdTKvYiig",
"org": "olympusdao",
"name": "olympus-protocol-metrics",
"version": "5.0.5"
"version": "5.1.3"
}
35 changes: 18 additions & 17 deletions subgraphs/ethereum/src/utils/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Address, BigDecimal, BigInt, log } from "@graphprotocol/graph-ts";

import { TokenCategoryPOL, TokenCategoryStable, TokenCategoryVolatile, TokenDefinition } from "../../../shared/src/contracts/TokenDefinition";
import { LendingMarketDeployment } from "../../../shared/src/utils/LendingMarketDeployment";
import { AAVE_ALLOCATOR, AAVE_ALLOCATOR_V2, AURA_ALLOCATOR, AURA_ALLOCATOR_V2, BALANCER_ALLOCATOR, BONDS_DEPOSIT, BONDS_INVERSE_DEPOSIT, CONVEX_ALLOCATOR1, CONVEX_ALLOCATOR2, CONVEX_ALLOCATOR3, CONVEX_CVX_ALLOCATOR, CONVEX_CVX_VL_ALLOCATOR, CONVEX_STAKING_PROXY_FRAXBP, CONVEX_STAKING_PROXY_OHM_FRAXBP, COOLER_LOANS_CLEARINGHOUSE_V1, COOLER_LOANS_CLEARINGHOUSE_V1_1, CROSS_CHAIN_ARBITRUM, CROSS_CHAIN_FANTOM, CROSS_CHAIN_POLYGON, DAO_WALLET, DAO_WORKING_CAPITAL, LUSD_ALLOCATOR, MAKER_DSR_ALLOCATOR, MAKER_DSR_ALLOCATOR_PROXY, MYSO_LENDING, OLYMPUS_ASSOCIATION_WALLET, OTC_ESCROW, RARI_ALLOCATOR, TREASURY_ADDRESS_V1, TREASURY_ADDRESS_V2, TREASURY_ADDRESS_V3, TRSRY, VEFXS_ALLOCATOR, VENDOR_LENDING } from "../../../shared/src/Wallets";
import { AAVE_ALLOCATOR, AAVE_ALLOCATOR_V2, AURA_ALLOCATOR, AURA_ALLOCATOR_V2, BALANCER_ALLOCATOR, BONDS_DEPOSIT, BONDS_INVERSE_DEPOSIT, CONVEX_ALLOCATOR1, CONVEX_ALLOCATOR2, CONVEX_ALLOCATOR3, CONVEX_CVX_ALLOCATOR, CONVEX_CVX_VL_ALLOCATOR, CONVEX_STAKING_PROXY_FRAXBP, CONVEX_STAKING_PROXY_OHM_FRAXBP, COOLER_LOANS_CLEARINGHOUSE_V1, COOLER_LOANS_CLEARINGHOUSE_V1_1, CROSS_CHAIN_ARBITRUM, CROSS_CHAIN_FANTOM, CROSS_CHAIN_POLYGON, DAO_WALLET, DAO_WORKING_CAPITAL, LUSD_ALLOCATOR, MAKER_DSR_ALLOCATOR, MAKER_DSR_ALLOCATOR_PROXY, MYSO_LENDING, OLYMPUS_ASSOCIATION_WALLET, OTC_ESCROW, RARI_ALLOCATOR, TREASURY_ADDRESS_V1, TREASURY_ADDRESS_V2, TREASURY_ADDRESS_V3, TRSRY, TRSRY_V1_1, VEFXS_ALLOCATOR, VENDOR_LENDING } from "../../../shared/src/Wallets";
import { PairHandler, PairHandlerTypes } from "./PairHandler";

export const BLOCKCHAIN = "Ethereum";
Expand All @@ -19,10 +19,10 @@ export const OHMETHLPBOND_TOKEN = "OHM-WETH";

/**
* Holds OHM V1, wsOHM (V1) and gOHM
*
*
* Any V1 assets in this contract were previously external to the protocol,
* and should NOT be counted as protocol assets.
*
*
* Any gOHM in this contract has been pre-minted
* for migration from V1 assets, and should NOT be counted as protocol assets.
*/
Expand Down Expand Up @@ -126,12 +126,12 @@ export const SILO_ADDRESS = "0xb2374f84b3cEeFF6492943Df613C9BcF45322a0c".toLower

/**
* Defines the contract addresses that belong to the protocol & DAO treasuries.
*
*
* This is normally deducted from total supply to determine circulating supply.
*
*
* The following are not included:
* - Myso and Vendor Finance: the deployed amounts are hard-coded.
* - Migration Contract: the migration offset is used to indicate the protocol-owned OHM.
* - Migration Contract: the migration offset is used to indicate the protocol-owned OHM.
* Additionally, the OHM and gOHM in the migration contract is pre-minted for v1 -> v2 migrations,
* and is not owned by the protocol or DAO.
* - Olympus Association: not considered part of the protocol or DAO treasuries.
Expand Down Expand Up @@ -311,15 +311,15 @@ export const ERC4626_SDAI = "0x83F20F44975D03b1b09e64809B757c47f942BEeA".toLower

/**
* Mapping between the contract address of an ERC4626 token and the TokenDefinition.
*
*
* A price lookup path must be defined for the underlying token within `LIQUIDITY_POOL_TOKEN_LOOKUP`.
*/
export const ERC4626_TOKENS = new Map<string, TokenDefinition>();
ERC4626_TOKENS.set(ERC4626_SDAI, new TokenDefinition(ERC4626_SDAI, TokenCategoryStable, true, false));

/**
* Mapping between the non-staked token and the token staked in Convex.
*
*
* The staked token should NOT be listed in {ERC20_TOKENS}.
*/
const CONVEX_STAKED_TOKENS = new Map<string, TokenDefinition>();
Expand Down Expand Up @@ -364,7 +364,7 @@ export const FRAX_LOCKING_CONTRACTS = [

/**
* Mapping between the non-staked token and the token staked in Frax.
*
*
* The staked token should NOT be listed in {ERC20_TOKENS}.
*/
const FRAX_STAKED_TOKENS = new Map<string, TokenDefinition>();
Expand Down Expand Up @@ -436,8 +436,8 @@ UNSTAKED_TOKEN_MAPPING.set(ERC20_FXS_VE, ERC20_FXS);
/**
* Often, staked/locked tokens have the same price as the original token. This
* provides the address of the unstaked token.
*
* @param contractAddress
*
* @param contractAddress
* @returns address of the unstaked token, or the original token address if not found
*/
export const getUnstakedToken = (contractAddress: string): string => {
Expand Down Expand Up @@ -774,10 +774,10 @@ VENDOR_DEPLOYMENTS.set(ERC20_DAI, [

/**
* Returns Vendor Finance deployments for the given contract address.
*
*
* The details of the deployment are manually recorded, as the deposited principal (e.g. DAI)
* is what is recognised until a default takes place - irrespective of the actual balance of
* DAI and gOHM in the contract.
* is what is recognised until a default takes place - irrespective of the actual balance of
* DAI and gOHM in the contract.
*/
export function getVendorDeployments(contractAddress: string): LendingMarketDeployment[] {
const contractAddressLower = contractAddress.toLowerCase();
Expand All @@ -795,10 +795,10 @@ MYSO_DEPLOYMENTS.set(ERC20_DAI.toLowerCase(), [

/**
* Returns Myso Finance deployments for the given contract address.
*
*
* The details of the deployment are manually recorded, as the deposited principal (e.g. DAI)
* is what is recognised until a default takes place - irrespective of the actual balance of
* DAI and gOHM in the contract.
* is what is recognised until a default takes place - irrespective of the actual balance of
* DAI and gOHM in the contract.
*/
export function getMysoDeployments(contractAddress: string): LendingMarketDeployment[] {
const contractAddressLower = contractAddress.toLowerCase();
Expand Down Expand Up @@ -1108,6 +1108,7 @@ CONTRACT_NAME_MAP.set(TREASURY_ADDRESS_V1, "Treasury Wallet V1");
CONTRACT_NAME_MAP.set(TREASURY_ADDRESS_V2, "Treasury Wallet V2");
CONTRACT_NAME_MAP.set(TREASURY_ADDRESS_V3, "Treasury Wallet V3");
CONTRACT_NAME_MAP.set(TRSRY, "Bophades Treasury");
CONTRACT_NAME_MAP.set(TRSRY_V1_1, "Bophades Treasury v1.1");
CONTRACT_NAME_MAP.set(VEFXS_ALLOCATOR, "VeFXS Allocator");
CONTRACT_NAME_MAP.set(VENDOR_LENDING, "Vendor Finance");

Expand Down
Loading

0 comments on commit bbeba34

Please sign in to comment.