Skip to content

Commit

Permalink
fix: fix name discrepancy between abis
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Feb 5, 2024
1 parent 07187c0 commit e303008
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion subgraphs/venus/src/mappings/vToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
MintBehalf,
Redeem,
RepayBorrow,
} from '../../generated/templates/VTokenUpdatedEvents/VTokenUpdatedEvents';
} from '../../generated/templates/VTokenUpdatedEvents/VToken';
import { DUST_THRESHOLD, oneBigInt, zeroBigInt32 } from '../constants';
import {
createBorrowEvent,
Expand Down
4 changes: 2 additions & 2 deletions subgraphs/venus/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ templates:
kind: ethereum/contract
network: {{ network }}
source:
abi: VTokenUpdatedEvents
abi: VToken
mapping:
kind: ethereum/events
apiVersion: 0.0.5
Expand All @@ -140,7 +140,7 @@ templates:
- Market
- VTokenInfo
abis:
- name: VTokenUpdatedEvents
- name: VToken
file: ../../node_modules/@venusprotocol/venus-protocol/artifacts/contracts/Tokens/VTokens/VBep20.sol/VBep20.json
eventHandlers:
- event: Mint(address,uint256,uint256,uint256)
Expand Down
10 changes: 5 additions & 5 deletions subgraphs/venus/tests/VToken/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import {
NewMarketInterestRateModel as NewMarketInterestRateModelEvent,
NewReserveFactor as NewReserveFactorEvent,
Redeem as RedeemEventV1,
RepayBorrow as RepayBorrowEvent,
RepayBorrow as RepayBorrowEventV1,
Transfer as TransferEvent,
} from '../../generated/templates/VToken/VToken';
import {
MintBehalf as MintBehalfEvent,
Mint as MintEvent,
Redeem as RedeemEvent,
} from '../../generated/templates/VTokenUpdatedEvents/VTokenUpdatedEvents';
} from '../../generated/templates/VTokenUpdatedEvents/VToken';

export const createMarketListedEvent = (vTokenAddress: Address): MarketListedEvent => {
const event = changetype<MarketListedEvent>(newMockEvent());
Expand Down Expand Up @@ -143,15 +143,15 @@ export const createBorrowEvent = (
return event;
};

export const createRepayBorrowEvent = (
export const createRepayBorrowEventV1 = (
vTokenAddress: Address,
payerAddress: Address,
borrowerAddress: Address,
repayAmount: BigInt,
accountBorrows: BigInt,
totalBorrows: BigInt,
): RepayBorrowEvent => {
const event = changetype<RepayBorrowEvent>(newMockEvent());
): RepayBorrowEventV1 => {
const event = changetype<RepayBorrowEventV1>(newMockEvent());
event.address = vTokenAddress;
event.parameters = [];

Expand Down
20 changes: 10 additions & 10 deletions subgraphs/venus/tests/VToken/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
handleNewReserveFactor,
handleRedeem,
handleRedeemV1,
handleRepayBorrow,
handleRepayBorrowV1,
handleTransfer,
} from '../../src/mappings/vToken';
import { getMarket } from '../../src/operations/get';
Expand All @@ -43,7 +43,7 @@ import {
createNewReserveFactorEvent,
createRedeemEvent,
createRedeemEventV1,
createRepayBorrowEvent,
createRepayBorrowEventV1,
createTransferEvent,
} from './events';
import { createAccountVTokenBalanceOfMock } from './mocks';
Expand Down Expand Up @@ -205,7 +205,7 @@ describe('VToken', () => {
const balanceOf = BigInt.fromString('9937035970026454');

/** Setup test */
const repayBorrowEvent = createRepayBorrowEvent(
const repayBorrowEvent = createRepayBorrowEventV1(
aaaTokenAddress,
payer,
borrower,
Expand All @@ -228,7 +228,7 @@ describe('VToken', () => {
]);

/** Fire Event */
handleRepayBorrow(repayBorrowEvent);
handleRepayBorrowV1(repayBorrowEvent);

const accountVTokenId = getAccountVTokenId(aaaTokenAddress, borrower);
const market = getMarket(aaaTokenAddress);
Expand Down Expand Up @@ -579,7 +579,7 @@ describe('VToken', () => {
assert.fieldEquals('Market', aaaTokenAddress.toHex(), 'borrowerCount', '2');
assert.fieldEquals('Market', aaaTokenAddress.toHex(), 'borrowerCountAdjusted', '2');

let repayEvent = createRepayBorrowEvent(
let repayEvent = createRepayBorrowEventV1(
aaaTokenAddress,
borrower02,
borrower02,
Expand All @@ -588,11 +588,11 @@ describe('VToken', () => {
zeroBigInt32,
);

handleRepayBorrow(repayEvent);
handleRepayBorrowV1(repayEvent);
assert.fieldEquals('Market', aaaTokenAddress.toHex(), 'borrowerCount', '1');
assert.fieldEquals('Market', aaaTokenAddress.toHex(), 'borrowerCountAdjusted', '1');

repayEvent = createRepayBorrowEvent(
repayEvent = createRepayBorrowEventV1(
aaaTokenAddress,
borrower01,
borrower01,
Expand All @@ -601,11 +601,11 @@ describe('VToken', () => {
partialBorrowAmountWei,
);

handleRepayBorrow(repayEvent);
handleRepayBorrowV1(repayEvent);
assert.fieldEquals('Market', aaaTokenAddress.toHex(), 'borrowerCount', '1');
assert.fieldEquals('Market', aaaTokenAddress.toHex(), 'borrowerCountAdjusted', '1');

repayEvent = createRepayBorrowEvent(
repayEvent = createRepayBorrowEventV1(
aaaTokenAddress,
borrower01,
borrower01,
Expand All @@ -614,7 +614,7 @@ describe('VToken', () => {
partialBorrowAmountWei.minus(oneBigInt),
);

handleRepayBorrow(repayEvent);
handleRepayBorrowV1(repayEvent);
assert.fieldEquals('Market', aaaTokenAddress.toHex(), 'borrowerCount', '1');
assert.fieldEquals('Market', aaaTokenAddress.toHex(), 'borrowerCountAdjusted', '0');
});
Expand Down

0 comments on commit e303008

Please sign in to comment.