Skip to content

Commit

Permalink
fix: v2 stake fetch allowance fail (#11206)
Browse files Browse the repository at this point in the history
- **fix: v2 miss stake button**
- **fix: v2 stake fetch allowance fail**

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the way the `bCakeWrapperAddress` is fetched in the
`getBCakeWrapperAddress` function by using a new key generation method
for the `fetchUniversalFarmsMap`. This change enhances the clarity and
consistency of how the farm configuration is accessed.

### Detailed summary
- Updated the key used to access `fetchUniversalFarmsMap` in the
`getBCakeWrapperAddress` function.
- Replaced the direct use of template literals with the
`getFarmConfigKey` function to generate the key.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
  • Loading branch information
chef-eric authored Feb 14, 2025
1 parent 8f63ef0 commit cbe496f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions apps/web/src/state/farmsV4/state/accountPositions/fetcher.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { BCakeWrapperFarmConfig, Protocol, fetchAllUniversalFarms, fetchAllUniversalFarmsMap } from '@pancakeswap/farms'
import {
BCakeWrapperFarmConfig,
Protocol,
fetchAllUniversalFarms,
fetchAllUniversalFarmsMap,
getFarmConfigKey,
} from '@pancakeswap/farms'
import { CurrencyAmount, ERC20Token, Pair, Token, pancakePairV2ABI } from '@pancakeswap/sdk'
import { LegacyStableSwapPair } from '@pancakeswap/smart-router/legacy-router'
import { deserializeToken } from '@pancakeswap/token-lists'
Expand Down Expand Up @@ -119,7 +125,7 @@ export const getTrackedV2LpTokens = memoize(
export const getBCakeWrapperAddress = async (lpAddress: Address, chainId: number) => {
const fetchUniversalFarmsMap = await fetchAllUniversalFarmsMap()

const f = fetchUniversalFarmsMap[`${chainId}:${lpAddress}`] as V2PoolInfo | StablePoolInfo | undefined
const f = fetchUniversalFarmsMap[getFarmConfigKey({ lpAddress, chainId })] as V2PoolInfo | StablePoolInfo | undefined

return f?.bCakeWrapperAddress ?? '0x'
}
Expand Down

0 comments on commit cbe496f

Please sign in to comment.