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

Add support for FX pools #29

Merged
merged 23 commits into from
Jan 18, 2024
Merged
Changes from 1 commit
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
34 changes: 17 additions & 17 deletions modules/pool/subgraph-mapper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Chain, PrismaPoolType } from '@prisma/client';
import { BalancerPoolFragment } from '../subgraphs/balancer-subgraph/generated/balancer-subgraph-types';
import { AddressZero } from '@ethersproject/constants';
import * as dataMappers from './pool-data';
import { fx, gyro, linear, element, stableDynamic, linearDynamic } from './pool-data';

export const subgraphToPrismaCreate = (
pool: BalancerPoolFragment,
Expand Down Expand Up @@ -266,24 +266,24 @@ const mapPoolTypeVersion = (poolType: string, poolTypeVersion: number): number =
};

const dataMapper = {
ELEMENT: dataMappers.element,
FX: dataMappers.fx,
GYRO: dataMappers.gyro,
GYRO3: dataMappers.gyro,
GYROE: dataMappers.gyro,
LINEAR: dataMappers.linear,
ELEMENT: element,
FX: fx,
GYRO: gyro,
GYRO3: gyro,
GYROE: gyro,
LINEAR: linear,
};

const dynamicMapper = {
STABLE: dataMappers.stableDynamic,
COMPOSABLE_STABLE: dataMappers.stableDynamic,
META_STABLE: dataMappers.stableDynamic,
LINEAR: dataMappers.linearDynamic,
STABLE: stableDynamic,
COMPOSABLE_STABLE: stableDynamic,
META_STABLE: stableDynamic,
LINEAR: linearDynamic,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove this? it's unused afaik.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mapper is subgraph schema related, so more data we parse to DB schema the better. think about it as a layer. it makes it easy to compose what is needed for any pool syncing we would want to do.

we still read these data from subgraph in pool create jobs, once removed where would it go? just keep it blank until onchain calls fill it in?

};

export type FxData = ReturnType<typeof dataMappers['fx']>;
export type GyroData = ReturnType<typeof dataMappers['gyro']>;
export type LinearData = ReturnType<typeof dataMappers['linear']>;
export type ElementData = ReturnType<typeof dataMappers['element']>;
export type StableDynamicData = ReturnType<typeof dataMappers['stableDynamic']>;
export type LinearDynamicData = ReturnType<typeof dataMappers['linearDynamic']>;
export type FxData = ReturnType<typeof fx>;
export type GyroData = ReturnType<typeof gyro>;
export type LinearData = ReturnType<typeof linear>;
export type ElementData = ReturnType<typeof element>;
export type StableDynamicData = ReturnType<typeof stableDynamic>;
export type LinearDynamicData = ReturnType<typeof linearDynamic>;
Comment on lines +290 to +291
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove this? it's unused afaik.