Skip to content

Commit

Permalink
refactor: skip recording vbifi positions
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Dec 18, 2024
1 parent a9ba84e commit c104299
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
20 changes: 12 additions & 8 deletions subgraphs/isolated-pools/src/operations/updateOrCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Actions } from '../constants';
import Box from '../utilities/box';
import { getMarketActionId } from '../utilities/ids';
import { getOrCreateMarketPosition } from './getOrCreate';
import { vBifiAddress } from '../constants/addresses';

export const updateOrCreateMarketPosition = (
accountAddress: Address,
Expand Down Expand Up @@ -36,12 +37,15 @@ export const updateOrCreateMarketAction = (
vTokenAddress: Address,
action: i32,
pauseState: boolean,
): MarketAction => {
const id = getMarketActionId(vTokenAddress, action);
const marketAction = new MarketAction(id);
marketAction.market = vTokenAddress;
marketAction.action = Actions[action];
marketAction.pauseState = pauseState;
marketAction.save();
return marketAction;
): MarketAction | null => {
if (vTokenAddress.notEqual(vBifiAddress)) {
const id = getMarketActionId(vTokenAddress, action);
const marketAction = new MarketAction(id);
marketAction.market = vTokenAddress;
marketAction.action = Actions[action];
marketAction.pauseState = pauseState;
marketAction.save();
return marketAction;
}
return null;
};
6 changes: 5 additions & 1 deletion subgraphs/venus/src/operations/getOrCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { getMarketPositionId, getTokenId } from '../utilities/ids';
import { getMarket } from './get';
import { updateMarketCashMantissa } from './updateMarketCashMantissa';
import { updateMarketRates } from './updateMarketRates';
import { vBifiAddress } from '../constants/addresses';

export function getOrCreateMarket(marketAddress: Address, event: ethereum.Event): Market {
let market = getMarket(marketAddress);
Expand Down Expand Up @@ -134,7 +135,10 @@ export class GetOrCreateMarketPositionReturn {
export function getOrCreateMarketPosition(
accountId: Address,
marketId: Address,
): GetOrCreateMarketPositionReturn {
): GetOrCreateMarketPositionReturn | null {
if (marketId.equals(vBifiAddress)) {
return null;
}
const marketPositionId = getMarketPositionId(accountId, marketId);
let marketPosition = MarketPosition.load(marketPositionId);
let created = false;
Expand Down

0 comments on commit c104299

Please sign in to comment.