Skip to content

Commit

Permalink
fix: fix double accounting issue when updating transfers from borrowi…
Browse files Browse the repository at this point in the history
…ng activity
  • Loading branch information
coreyar committed Aug 4, 2023
1 parent a845999 commit aaa7281
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 23 deletions.
1 change: 0 additions & 1 deletion subgraphs/isolated-pools/src/mappings/vToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ export function handleTransfer(event: Transfer): void {
event.block.timestamp,
event.block.number,
event.logIndex,
event.params.amount,
);
}

Expand Down
6 changes: 0 additions & 6 deletions subgraphs/isolated-pools/src/operations/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ export const updateAccountVTokenTransferFrom = (
blockNumber,
logIndex,
);
accountVToken.accountSupplyBalanceMantissa =
accountVToken.accountSupplyBalanceMantissa.minus(amount);

accountVToken.totalUnderlyingRedeemedMantissa =
accountVToken.totalUnderlyingRedeemedMantissa.plus(amountUnderlyingMantissa);
Expand All @@ -142,7 +140,6 @@ export const updateAccountVTokenTransferTo = (
timestamp: BigInt,
blockNumber: BigInt,
logIndex: BigInt,
amount: BigInt,
): AccountVToken => {
const accountVToken = updateAccountVToken(
marketAddress,
Expand All @@ -154,9 +151,6 @@ export const updateAccountVTokenTransferTo = (
logIndex,
);

accountVToken.accountSupplyBalanceMantissa =
accountVToken.accountSupplyBalanceMantissa.plus(amount);

accountVToken.save();
return accountVToken as AccountVToken;
};
Expand Down
16 changes: 0 additions & 16 deletions subgraphs/isolated-pools/tests/VToken/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,6 @@ describe('VToken', () => {
const to = aaaTokenAddress;
const amount = BigInt.fromString('146205398726345');
const balanceOf = BigInt.fromString('262059874253345');
const expectedFinalBalanceMantissa = balanceOf.minus(amount);

/** Setup test */
const transferEvent = createTransferEvent(aaaTokenAddress, from, to, amount);
Expand Down Expand Up @@ -565,13 +564,6 @@ describe('VToken', () => {

assert.fieldEquals('AccountVToken', accountVTokenId, 'accountBorrowIndexMantissa', '0');

assert.fieldEquals(
'AccountVToken',
accountVTokenId,
'accountSupplyBalanceMantissa',
expectedFinalBalanceMantissa.toString(),
);

assert.fieldEquals(
'AccountVToken',
accountVTokenId,
Expand All @@ -586,7 +578,6 @@ describe('VToken', () => {
const from = aaaTokenAddress;
const to = user2Address;
const balanceOf = BigInt.fromString('262059874253345');
const expectedFinalBalanceMantissa = balanceOf.plus(amount);

/** Setup test */
const transferEvent = createTransferEvent(aaaTokenAddress, from, to, amount);
Expand Down Expand Up @@ -638,13 +629,6 @@ describe('VToken', () => {
);

assert.fieldEquals('AccountVToken', accountVTokenId, 'accountBorrowIndexMantissa', '0');

assert.fieldEquals(
'AccountVToken',
accountVTokenId,
'accountSupplyBalanceMantissa',
expectedFinalBalanceMantissa.toString(),
);
});

test('registers new interest rate model', () => {
Expand Down

0 comments on commit aaa7281

Please sign in to comment.