Skip to content

Commit

Permalink
Add beanstalk
Browse files Browse the repository at this point in the history
  • Loading branch information
soilking committed Jun 18, 2024
1 parent bce460c commit 95a1e62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion projects/subgraph-bean/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type Token @entity {
"Number of decimals"
decimals: BigInt!

"Last USD price calculated"
"Last USD price calculated. Isn't calculated for all tokens, in those cases will be zero."
lastPriceUSD: BigDecimal!
}

Expand All @@ -19,6 +19,9 @@ type Bean @entity {
"Which chain this Bean is from"
chain: String!

"Smart contract address of the Beanstalk this Bean is associated with"
beanstalk: String!

"Current supply"
supply: BigInt!

Expand Down
4 changes: 3 additions & 1 deletion projects/subgraph-bean/src/utils/Bean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
BEAN_WETH_V1,
BEAN_WETH_CP2_WELL,
BEAN_3CRV_V1,
BEAN_LUSD_V1
BEAN_LUSD_V1,
BEANSTALK
} from "../../../subgraph-core/utils/Constants";
import { dayFromTimestamp, hourFromTimestamp } from "../../../subgraph-core/utils/Dates";
import { ONE_BD, toDecimal, ZERO_BD, ZERO_BI } from "../../../subgraph-core/utils/Decimals";
Expand All @@ -21,6 +22,7 @@ export function loadBean(token: string): Bean {
if (bean == null) {
bean = new Bean(token);
bean.chain = "ethereum";
bean.beanstalk = BEANSTALK.toHexString();
bean.supply = ZERO_BI;
bean.marketCap = ZERO_BD;
bean.lockedBeans = ZERO_BI;
Expand Down

0 comments on commit 95a1e62

Please sign in to comment.