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: paused state parsing issue #1039

Merged
merged 1 commit into from
Oct 8, 2024
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
5 changes: 5 additions & 0 deletions .changeset/six-peas-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'backend': patch
---

fix paused state parsing issue
9 changes: 3 additions & 6 deletions modules/pool/lib/pool-onchain-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Multicaller3Viem } from '../../web3/multicaller-viem';
import { PrismaPoolType } from '@prisma/client';
import abi from '../abi/WeightedPoolV2.json';
import { Chain } from '@prisma/client';
import { Multicaller3 } from '../../web3/multicaller3';

interface PoolInput {
id: string;
Expand All @@ -13,14 +12,12 @@ interface PoolInput {
}

interface OnchainState {
pausedState?: {
paused: boolean;
};
pausedState?: [boolean, bigint, bigint];
inRecoveryMode?: boolean;
}

const parse = (result: OnchainState) => ({
isPaused: result.pausedState?.paused ? result.pausedState.paused : false,
isPaused: result.pausedState ? result.pausedState[0] : false,
isInRecoveryMode: result.inRecoveryMode ? result.inRecoveryMode : false,
});

Expand All @@ -29,7 +26,7 @@ export const fetchOnChainPoolState = async (pools: PoolInput[], batchSize = 1024
return {};
}

const multicaller = new Multicaller3(abi, batchSize);
const multicaller = new Multicaller3Viem(pools[0].chain, abi, batchSize);

pools.forEach(({ id, type, address }) => {
// filter certain pool types that don't have pausedState or recovery mode
Expand Down
Loading