Skip to content

Commit

Permalink
refactor: correct vtoken mapping file capitalization
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Sep 4, 2023
1 parent 2891bac commit 30f1a26
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -362,9 +362,7 @@ export const handleTransfer = (event: Transfer): void => {
market = updateMarket(event.address, event.block.number.toI32(), event.block.timestamp.toI32());
}
let vTokenDecimals = market.vTokenDecimals;
let amountUnderlying = market.exchangeRateMantissa.times(
event.params.amount,
);
let amountUnderlying = market.exchangeRateMantissa.times(event.params.amount);
// const exchangeRateBigDecimal = getExchangeRateBigDecimal(exchangeRate, underlyingDecimals);
// const amountUnderlyingMantissa = exchangeRateBigDecimal
// .times(exponentToBigDecimal(underlyingDecimals))
@@ -392,7 +390,10 @@ export const handleTransfer = (event: Transfer): void => {
);

vTokenStatsFrom.vTokenBalance = vTokenStatsFrom.vTokenBalance.minus(
event.params.amount.toBigDecimal().div(exponentToBigDecimal(vTokenDecimals)).truncate(vTokenDecimals),
event.params.amount
.toBigDecimal()
.div(exponentToBigDecimal(vTokenDecimals))
.truncate(vTokenDecimals),
);

vTokenStatsFrom.totalUnderlyingRedeemedMantissa =
@@ -424,7 +425,10 @@ export const handleTransfer = (event: Transfer): void => {
);

vTokenStatsTo.vTokenBalance = vTokenStatsTo.vTokenBalance.plus(
event.params.amount.toBigDecimal().div(exponentToBigDecimal(vTokenDecimals)).truncate(vTokenDecimals),
event.params.amount
.toBigDecimal()
.div(exponentToBigDecimal(vTokenDecimals))
.truncate(vTokenDecimals),
);

vTokenStatsTo.totalUnderlyingSuppliedMantissa =
2 changes: 1 addition & 1 deletion subgraphs/venus/template.yaml
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ templates:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/vtoken.ts
file: ./src/mappings/vToken.ts
entities:
- User
- Market
2 changes: 1 addition & 1 deletion subgraphs/venus/tests/VToken/index.test.ts
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ import {
handleRedeem,
handleRepayBorrow,
handleTransfer,
} from '../../src/mappings/vtoken';
} from '../../src/mappings/vToken';
import { getMarket } from '../../src/operations/get';
import { getAccountVTokenId } from '../../src/utilities/ids';
import {

0 comments on commit 30f1a26

Please sign in to comment.