Skip to content

Commit

Permalink
feat: don't initialize ethersProvider in module scope
Browse files Browse the repository at this point in the history
  • Loading branch information
gomesalexandre authored and woodenfurniture committed Feb 19, 2024
1 parent ba0f453 commit a85f27c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/state/slices/opportunitiesSlice/resolvers/uniV2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ import type {
} from '../types'
import { calculateAPRFromToken0 } from './utils'

const ethersProvider = getEthersProvider()

let _blockNumber: number | null = null
const getBlockNumber = async () => {
const ethersProvider = getEthersProvider()
if (_blockNumber) return _blockNumber
const blockNumber = await ethersProvider.getBlockNumber()
_blockNumber = blockNumber
Expand Down

0 comments on commit a85f27c

Please sign in to comment.