Skip to content

Commit

Permalink
fix: paused state parsing issue (#1039)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmbronco authored Oct 8, 2024
1 parent 98de14f commit 92adb18
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
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

0 comments on commit 92adb18

Please sign in to comment.