Skip to content

Commit

Permalink
remove wrapped linear token propery (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
franzns authored Jan 16, 2024
1 parent d953103 commit 568181a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
10 changes: 8 additions & 2 deletions modules/content/github-content.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,24 @@ export class GithubContentService implements ContentService {
});
}

const linearPool = pools.find(
const wrappedLinearPoolToken = pools.find(
(pool) => pool.linearData && pool.tokens[pool.linearData.wrappedIndex]?.address === token.address,
);

if (linearPool && !tokenTypes.includes('LINEAR_WRAPPED_TOKEN')) {
if (wrappedLinearPoolToken && !tokenTypes.includes('LINEAR_WRAPPED_TOKEN')) {
types.push({
id: `${token.address}-linear-wrapped`,
chain: networkContext.chain,
type: 'LINEAR_WRAPPED_TOKEN',
tokenAddress: token.address,
});
}

if (!wrappedLinearPoolToken && tokenTypes.includes('LINEAR_WRAPPED_TOKEN')) {
prisma.prismaTokenType.delete({
where: { id_chain: { id: `${token.address}-linear-wrapped`, chain: networkContext.chain } },
});
}
}

await prisma.prismaTokenType.createMany({ skipDuplicates: true, data: types });
Expand Down
11 changes: 9 additions & 2 deletions modules/content/sanity-content.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import SanityClient from '@sanity/client';
import { env } from '../../app/env';
import { chainToIdMap } from '../network/network-config';
import { wrap } from 'module';

interface SanityToken {
name: string;
Expand Down Expand Up @@ -184,18 +185,24 @@ export class SanityContentService implements ContentService {
});
}

const linearPool = pools.find(
const wrappedLinearPoolToken = pools.find(
(pool) => pool.linearData && pool.tokens[pool.linearData.wrappedIndex].address === token.address,
);

if (linearPool && !tokenTypes.includes('LINEAR_WRAPPED_TOKEN')) {
if (wrappedLinearPoolToken && !tokenTypes.includes('LINEAR_WRAPPED_TOKEN')) {
types.push({
id: `${token.address}-linear-wrapped`,
chain: this.chain,
type: 'LINEAR_WRAPPED_TOKEN',
tokenAddress: token.address,
});
}

if (!wrappedLinearPoolToken && tokenTypes.includes('LINEAR_WRAPPED_TOKEN')) {
prisma.prismaTokenType.delete({
where: { id_chain: { id: `${token.address}-linear-wrapped`, chain: this.chain } },
});
}
}

await prisma.prismaTokenType.createMany({ skipDuplicates: true, data: types });
Expand Down

0 comments on commit 568181a

Please sign in to comment.