Skip to content

Commit

Permalink
Add Qidao Base (#2530)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Steege <[email protected]>
Co-authored-by: Chris Steege <[email protected]>
  • Loading branch information
3 people authored Jul 3, 2024
1 parent 8abbdf9 commit 93ca744
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 23 deletions.
26 changes: 26 additions & 0 deletions deployment/deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -5087,6 +5087,32 @@
}
}
},
"qidao-base": {
"network": "base",
"status": "prod",
"versions": {
"schema": "1.3.0",
"subgraph": "1.0.2",
"methodology": "1.0.1"
},
"files": {
"template": "qidao.template.yaml"
},
"options": {
"prepare:yaml": true,
"prepare:constants": false
},
"services": {
"hosted-service": {
"slug": "qidao-base",
"query-id": "qidao-base"
},
"decentralized-network": {
"slug": "qidao-base",
"query-id": "TODO"
}
}
},
"qidao-bsc": {
"network": "bsc",
"status": "prod",
Expand Down
6 changes: 2 additions & 4 deletions subgraphs/qidao/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ Polygon Treasury [0xc63c477465a792537d291adb32ed15c0095e106b](https://debank.com

The total revenue can be calculated by summing the


1. Yield from LP Pools
2. Interaction fees (repay, swap, lp deposit, liquidations)

Expand All @@ -67,11 +66,10 @@ or `Total Revenue (USD) = Supply Side Revenue (USD) + Protocol Revenue (USD)`

**Supply Side Revenue USD**

Supply side revenue can be determined by omitting the interaction fees that go to the protocol.
Supply side revenue can be determined by omitting the interaction fees that go to the protocol.

`Supply Side Revenue (USD) = supply side Interaction fees + supply side Pool Yield`


**Protocol Revenue USD**

How does QiDAO make revenue?
Expand All @@ -96,7 +94,7 @@ Substituting in fee breakdown, we can rearrange to

where percentage multipliers, and staking reward LP pool share are subject to change with DAO policy.

Rewards are currently calculated offchain.
Rewards are currently calculated offchain.

## Pool-Level Metrics

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"chain": "base",
"erc20Vaults": [
{
"name": "CBSTEMVT",
"address": "0x7333fd58d8d73a8e5fc1a16c8037ada4f580fa2b",
"startBlock": 2572101
},
{
"name": "ETBMVT",
"address": "0x8D6CeBD76f18E1558D4DB88138e2DeFB3909fAD6",
"startBlock": 2571852
},
{
"name": "WLSSTEMVT",
"address": "0x654a31Ba7D714cfCab19b17D0066171c1A292349",
"startBlock": 6541087
},
{
"name": "ABMVT",
"address": "0x20658fDaBD4C79F1B3666E5bcCAeF78b5059B109",
"startBlock": 13050803
}
]
}
1 change: 1 addition & 0 deletions subgraphs/qidao/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ enum Network {
OSMOSIS
MATIC # aka Polygon
GNOSIS
BASE
}

enum ProtocolType {
Expand Down
43 changes: 24 additions & 19 deletions subgraphs/qidao/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export namespace Network {
export const OSMOSIS = "OSMOSIS";
export const MATIC = "MATIC"; // aka Polygon
export const GNOSIS = "GNOSIS"; // aka Gnosis Chain
export const BASE = "BASE";
}

export namespace ProtocolType {
Expand Down Expand Up @@ -112,10 +113,10 @@ export const DAI_WETH_PAIR = "0xa478c2975ab1ea89e8196811f51a7b7ade33eb11"; // cr
export const USDT_WETH_PAIR = "0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852"; // created block 10093341

export const STAKEDAO_STETH_VAULT = Address.fromHexString(
"0xcc61Ee649A95F2E2f0830838681f839BDb7CB823"
"0xcc61Ee649A95F2E2f0830838681f839BDb7CB823",
);
export const YEARN_STETH_VAULT = Address.fromHexString(
"0x82e90eb7034c1df646bd06afb9e67281aab5ed28"
"0x82e90eb7034c1df646bd06afb9e67281aab5ed28",
);

////////////////////////
Expand All @@ -136,7 +137,7 @@ export const BIGINT_THOUSAND = BigInt.fromI32(1000);
export const BIGINT_TEN_THOUSAND = BigInt.fromI32(10000);
export const BIGINT_TEN_TO_EIGHTEENTH = BigInt.fromString("10").pow(18);
export const BIGINT_MAX = BigInt.fromString(
"115792089237316195423570985008687907853269984665640564039457584007913129639935"
"115792089237316195423570985008687907853269984665640564039457584007913129639935",
);

export const INT_NEGATIVE_ONE = -1 as i32;
Expand All @@ -162,7 +163,7 @@ export const SECONDS_PER_HOUR = 60 * 60; // 3600
export const MS_PER_DAY = new BigDecimal(BigInt.fromI32(24 * 60 * 60 * 1000));
export const DAYS_PER_YEAR = new BigDecimal(BigInt.fromI32(365));
export const MS_PER_YEAR = DAYS_PER_YEAR.times(
new BigDecimal(BigInt.fromI32(24 * 60 * 60 * 1000))
new BigDecimal(BigInt.fromI32(24 * 60 * 60 * 1000)),
);

////////////////
Expand All @@ -177,68 +178,72 @@ export const ETH_NAME = "Ether";
/////////////////////////////

export const MATIC_ADDRESS = Address.fromString(
"0x0000000000000000000000000000000000001010"
"0x0000000000000000000000000000000000001010",
);

export const MATIC_MAXIMUM_LTV = BIGDECIMAL_ONE.div(
BigDecimal.fromString("1.5")
BigDecimal.fromString("1.5"),
).times(BIGDECIMAL_HUNDRED);

export const MAI_TOKEN_ADDRESS = new Map<string, string>();
MAI_TOKEN_ADDRESS.set(
Network.MATIC,
"0xa3fa99a148fa48d14ed51d610c367c61876997f1"
"0xa3fa99a148fa48d14ed51d610c367c61876997f1",
);
MAI_TOKEN_ADDRESS.set(
Network.FANTOM,
"0xfb98b335551a418cd0737375a2ea0ded62ea213b"
"0xfb98b335551a418cd0737375a2ea0ded62ea213b",
);
MAI_TOKEN_ADDRESS.set(
Network.AVALANCHE,
"0x5c49b268c9841aff1cc3b0a418ff5c3442ee3f3b"
"0x5c49b268c9841aff1cc3b0a418ff5c3442ee3f3b",
);
MAI_TOKEN_ADDRESS.set(
Network.MOONRIVER,
"0xfb2019dfd635a03cfff624d210aee6af2b00fc2c"
"0xfb2019dfd635a03cfff624d210aee6af2b00fc2c",
);
MAI_TOKEN_ADDRESS.set(
Network.ARBITRUM_ONE,
"0x3f56e0c36d275367b8c502090edf38289b3dea0d"
"0x3f56e0c36d275367b8c502090edf38289b3dea0d",
);
MAI_TOKEN_ADDRESS.set(
Network.GNOSIS,
"0x3f56e0c36d275367b8c502090edf38289b3dea0d"
"0x3f56e0c36d275367b8c502090edf38289b3dea0d",
);
MAI_TOKEN_ADDRESS.set(
Network.BSC,
"0x3f56e0c36d275367b8c502090edf38289b3dea0d"
"0x3f56e0c36d275367b8c502090edf38289b3dea0d",
);
MAI_TOKEN_ADDRESS.set(
Network.OPTIMISM,
"0xdfa46478f9e5ea86d57387849598dbfb2e964b02"
"0xdfa46478f9e5ea86d57387849598dbfb2e964b02",
);
MAI_TOKEN_ADDRESS.set(
Network.MAINNET,
"0x8D6CeBD76f18E1558D4DB88138e2DeFB3909fAD6"
"0x8D6CeBD76f18E1558D4DB88138e2DeFB3909fAD6",
);
MAI_TOKEN_ADDRESS.set(
Network.HARMONY,
"0x3F56e0c36d275367b8C502090EDF38289b3dEa0d"
"0x3F56e0c36d275367b8C502090EDF38289b3dEa0d",
);
MAI_TOKEN_ADDRESS.set(
Network.BASE,
"0xbf1aea8670d2528e08334083616dd9c5f3b087ae",
);

export const COLLATERAL_PRICE_DECIMALS = new Map<string, i32>();
// MATIC
COLLATERAL_PRICE_DECIMALS.set(
prefixID(Network.MATIC, "0xa3fa99a148fa48d14ed51d610c367c61876997f1"),
8
8,
);
// camWMATIC
COLLATERAL_PRICE_DECIMALS.set(
prefixID(Network.MATIC, "0x88d84a85a87ed12b8f098e8953b322ff789fcd1a"),
8
8,
);
// camWBTC
COLLATERAL_PRICE_DECIMALS.set(
prefixID(Network.MATIC, "0x7dda5e1a389e0c1892caf55940f5fce6588a9ae0"),
8
8,
);

0 comments on commit 93ca744

Please sign in to comment.