Skip to content

Commit

Permalink
nit: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruv-chauhan committed Dec 19, 2023
1 parent 5b54c9f commit 8f63d29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
8 changes: 2 additions & 6 deletions subgraphs/abracadabra/src/common/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,27 +146,23 @@ export function updateUsageMetrics(
dailyActivity.save();
}

export function updateTVL(event: ethereum.Event): void {
export function updateTVL(): void {
// new user count handled in updateUsageMetrics
// totalBorrowUSD handled updateTotalBorrowUSD
const protocol = getOrCreateLendingProtocol();
log.warning(">> protocol.id: {}", [protocol.id.toHexString()]);
const bentoBoxContract = DegenBox.bind(Address.fromBytes(protocol.id));
const degenBoxContract = DegenBox.bind(
Address.fromString(getDegenBoxAddress(dataSource.network()))
);
const marketIDList = protocol.marketIDList;
let protocolTotalValueLockedUSD = BIGDECIMAL_ZERO;
for (let i: i32 = 0; i < marketIDList.length; i++) {
log.warning(">> marketIDList: {}", [marketIDList[i].toHexString()]);
const marketAddress = Address.fromBytes(marketIDList[i]);
const market = getMarket(marketAddress);
if (!market) {
return;
}
log.warning(">> market.inputToken: {}", [market.inputToken.toHexString()]);
const inputToken = getOrCreateToken(Address.fromBytes(market.inputToken));
log.warning(">> inputToken.id: {}", [inputToken.id.toHexString()]);
const bentoBoxCall: BigInt = readValue<BigInt>(
bentoBoxContract.try_balanceOf(
Address.fromBytes(inputToken.id),
Expand All @@ -193,7 +189,7 @@ export function updateTVL(event: ethereum.Event): void {
protocol.save();
}

export function updateTotalBorrows(event: ethereum.Event): void {
export function updateTotalBorrows(): void {
// new user count handled in updateUsageMetrics
const protocol = getOrCreateLendingProtocol();
const marketIDList = protocol.marketIDList;
Expand Down
10 changes: 5 additions & 5 deletions subgraphs/abracadabra/src/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export function handleLogAddCollateral(event: LogAddCollateral): void {
event.params.share,
event
);
updateTVL(event);
updateTVL();
updateUsageMetrics(event, event.params.from, event.params.to);
takeProtocolSnapshots(event);
takeMarketSnapshots(Address.fromBytes(market.id), event);
Expand Down Expand Up @@ -209,7 +209,7 @@ export function handleLogRemoveCollateral(event: LogRemoveCollateral): void {
event.params.share,
event
);
updateTVL(event);
updateTVL();
updateUsageMetrics(event, event.params.from, event.params.to);
takeProtocolSnapshots(event);
takeMarketSnapshots(Address.fromBytes(market.id), event);
Expand Down Expand Up @@ -263,7 +263,7 @@ export function handleLogBorrow(event: LogBorrow): void {
borrowEvent.save();

updateBorrowAmount(market);
updateTotalBorrows(event);
updateTotalBorrows();
updateMarketStats(
Address.fromBytes(market.id),
EventType.BORROW,
Expand Down Expand Up @@ -472,7 +472,7 @@ export function handleLogRepay(event: LogRepay): void {
repayEvent.save();

updateBorrowAmount(market);
updateTotalBorrows(event);
updateTotalBorrows();
updateMarketStats(
Address.fromBytes(market.id),
EventType.REPAY,
Expand All @@ -492,7 +492,7 @@ export function handleLogExchangeRate(event: LogExchangeRate): void {
}
const token = getOrCreateToken(Address.fromBytes(market.inputToken));
updateTokenPrice(event.params.rate, token, market, event.block.number);
updateTVL(event);
updateTVL();
takeProtocolSnapshots(event);
takeMarketSnapshots(Address.fromBytes(market.id), event);
}
Expand Down

0 comments on commit 8f63d29

Please sign in to comment.