Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix double accounting issue when updating transfers from borrowi when updating transfers from borrowing activity #104

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading