Skip to content

Commit

Permalink
fix(#patch); abracadabra; div by 0 error (#898)
Browse files Browse the repository at this point in the history
Co-authored-by: Vincent Wen <wensi.isnew@gmail.com>
  • Loading branch information
melotik and this-username-is-taken authored Aug 29, 2022
1 parent 3914e2c commit 6968fd8
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ This repo contains subgraphs defined using a set of standardized schemas. These
| [Venus Protocol](https://venus.io/) || 2.0.1 / 1.1.4 / 1.0.0 | [![Venus Protocol BSC](./docs/images/chains/bsc.png)](https://thegraph.com/hosted-service/subgraph/messari/venus-protocol-bsc) |
| [Yeti Finance](https://yeti.finance/) | 🔨 | | |
| **CDPs** | | |
| [Abracadabra](https://abracadabra.money/) | 🛠 | 2.0.1 / 1.2.6 / 1.0.0 | [![Abracadabra Money](./docs/images/chains/ethereum.png)](https://thegraph.com/hosted-service/subgraph/messari/abracadabra-money-ethereum) [![Abracadabra Money](./docs/images/chains/bsc.png)](https://thegraph.com/hosted-service/subgraph/messari/abracadabra-money-bsc) [![Abracadabra Money](./docs/images/chains/arbitrum.png)](https://thegraph.com/hosted-service/subgraph/messari/abracadabra-money-arbitrum) [![Abracadabra Money](./docs/images/chains/fantom.png)](https://thegraph.com/hosted-service/subgraph/messari/abracadabra-money-fantom) [![Abracadabra Money](./docs/images/chains/avalanche.png)](https://thegraph.com/hosted-service/subgraph/messari/abracadabra-money-avalanche) |
| [Abracadabra](https://abracadabra.money/) | 🛠 | 2.0.1 / 1.2.7 / 1.0.0 | [![Abracadabra Money](./docs/images/chains/ethereum.png)](https://thegraph.com/hosted-service/subgraph/messari/abracadabra-money-ethereum) [![Abracadabra Money](./docs/images/chains/bsc.png)](https://thegraph.com/hosted-service/subgraph/messari/abracadabra-money-bsc) [![Abracadabra Money](./docs/images/chains/arbitrum.png)](https://thegraph.com/hosted-service/subgraph/messari/abracadabra-money-arbitrum) [![Abracadabra Money](./docs/images/chains/fantom.png)](https://thegraph.com/hosted-service/subgraph/messari/abracadabra-money-fantom) [![Abracadabra Money](./docs/images/chains/avalanche.png)](https://thegraph.com/hosted-service/subgraph/messari/abracadabra-money-avalanche) |
| [Inverse Finance](https://www.inverse.finance/) | 🛠 | 1.3.0 / 1.2.2 / 1.0.0 | [![Inverse Finance Ethereum](./docs/images/chains/ethereum.png)](https://thegraph.com/hosted-service/subgraph/messari/inverse-finance-ethereum) |
| [Liquity](https://www.liquity.org/) || 1.3.0 / 1.1.4 / 1.0.1 | [![Liquity Ethereum](./docs/images/chains/ethereum.png)](https://thegraph.com/hosted-service/subgraph/messari/liquity-ethereum) |
| [MakerDAO](https://makerdao.com/en/) | 🛠 | 1.3.0 / 1.2.0 / 1.0.1 | [![MakerDAO Ethereum](./docs/images/chains/ethereum.png)](https://thegraph.com/hosted-service/subgraph/messari/makerdao-ethereum) |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@
"SpellStartBlock": "821891",
"OffchainAggregatorEnabled": true,
"OffchainAggregatorAddress": "0x87121f6c9a9f6e90e59591e4cf4804873f54a95b",
"OffchainAggregatorStartBlock": "2370257"
"OffchainAggregatorStartBlock": "2370257",
"graftEnabled": true,
"subgraphId": "QmRA311PK6ZPevsPDMxohJkeQ5M4vNaq8mfVT8tTug2h7h",
"graftStartBlock": 21896462
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@
"SpellEnabled": true,
"SpellAddress": "0xCE1bFFBD5374Dac86a2893119683F4911a2F7814",
"SpellStartBlock": "4041085",
"OffchainAggregatorEnabled": false
"OffchainAggregatorEnabled": false,
"graftEnabled": true,
"subgraphId": "QmcDpsUjwb6pVWq4XTgqTKraithR5CR1N3dXHDB7zAAqW8",
"graftStartBlock": 8283543
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"SpellEnabled": false,
"OffchainAggregatorEnabled": true,
"OffchainAggregatorAddress": "0x87a69a2988b33ea745008A47486890232630AABf",
"OffchainAggregatorStartBlock": "12743820"
"OffchainAggregatorStartBlock": "12743820",
"graftEnabled": true,
"subgraphId": "QmTFXTyX2AWfTmBjg84H4gzhoFBfin3bugP9YWL6Jnc8PD",
"graftStartBlock": 20874790
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"SpellStartBlock": "12454535",
"OffchainAggregatorEnabled": true,
"OffchainAggregatorAddress": "0x18f0112E30769961AF90FDEe0D1c6B27E6d72D92",
"OffchainAggregatorStartBlock": "12505995"
"OffchainAggregatorStartBlock": "12505995",
"graftEnabled": true,
"subgraphId": "QmQZX9TNpPWguYZBEF9Zq4SPrcn8iMRotMp8FGwgrV5N2W",
"graftStartBlock": 15436152
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@
"SpellEnabled": true,
"SpellAddress": "0x468003B688943977e6130F4F68F23aad939a1040",
"SpellStartBlock": "16717812",
"OffchainAggregatorEnabled": false
"OffchainAggregatorEnabled": false,
"graftEnabled": true,
"subgraphId": "QmQvRHHY4sPMXsrMZmePXH3R6VCjK3CS6qK6dednurCZNU",
"graftStartBlock": 28576808
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
specVersion: 0.0.4
schema:
file: ./schema.graphql
{{#graftEnabled}}
description: ...
features:
- grafting
graft:
base: {{subgraphId}} # Subgraph ID of base subgraph
block: {{graftStartBlock}} # Block number
{{/graftEnabled}}
dataSources:
- kind: ethereum
name: BentoBox
Expand Down
2 changes: 1 addition & 1 deletion subgraphs/abracadabra/src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,5 @@ export const BSC_NETWORK = "bsc";
export const AVALANCHE_NETWORK = "avalanche";

export const schemaVersion = "2.0.1";
export const subgraphVersion = "1.2.6";
export const subgraphVersion = "1.2.7";
export const methodologyVersion = "1.0.0";
5 changes: 4 additions & 1 deletion subgraphs/abracadabra/src/common/setters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,10 @@ export function createLiquidateEvent(event: LogRemoveCollateral): void {
// Update token price using the exchange rate
// update on the market and token
export function updateTokenPrice(rate: BigInt, token: Token, market: Market, blockNumber: BigInt): void {
let priceUSD = BIGDECIMAL_ONE.div(bigIntToBigDecimal(rate, token.decimals));
let priceUSD = BIGDECIMAL_ZERO;
if (rate != BIGINT_ZERO) {
priceUSD = BIGDECIMAL_ONE.div(bigIntToBigDecimal(rate, token.decimals));
}

// update market
market.inputTokenPriceUSD = priceUSD;
Expand Down
2 changes: 0 additions & 2 deletions subgraphs/abracadabra/src/positions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ export function addAccountToProtocol(eventType: string, account: Account, event:
dailySnapshot.cumulativeUniqueLiquidators = protocol.cumulativeUniqueLiquidators;
}
if (!activeEvent) {
log.warning("REACHED: {}", [activeEventId])
activeEvent = new ActiveEventAccount(activeEventId);
dailySnapshot.dailyActiveLiquidators += 1;
}
Expand All @@ -168,7 +167,6 @@ export function addAccountToProtocol(eventType: string, account: Account, event:
}
if (!activeEvent) {
activeEvent = new ActiveEventAccount(activeEventId);
log.warning("REACHED: {}", [activeEventId])
dailySnapshot.dailyActiveLiquidatees += 1;
}
dailySnapshot.save();
Expand Down

0 comments on commit 6968fd8

Please sign in to comment.