Skip to content

Commit

Permalink
fix: Merkl link for pools with reward on different chain
Browse files Browse the repository at this point in the history
  • Loading branch information
memoyil committed Dec 26, 2024
1 parent e00ae25 commit 86d21b3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/updateMerkl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ const fetchAllMerklConfig = async (): Promise<MerklConfigResponse> => {
return response.json() as Promise<MerklConfigResponse>
}

const parseMerklConfig = (merklConfig: MerklConfig[]): MerklConfigPool[] => {
const pools = merklConfig.reduce((acc, config) => {
const _pools = Object.values(config.pools).filter(
(pool) => Object.keys(pool.aprs).length > 1 && pool.ammName.toLowerCase().startsWith('pancakeswap'),
)
const parseMerklConfig = (merklConfigResponse: MerklConfigResponse): MerklConfigPool[] => {
const pools = Object.entries(merklConfigResponse).reduce((acc, [chainId, config]) => {
const _pools = Object.values(config.pools)
.filter((pool) => Object.keys(pool.aprs).length > 1 && pool.ammName.toLowerCase().startsWith('pancakeswap'))
.map((pool) => ({ ...pool, chainId: Number(chainId) }))
return [...acc, ..._pools]
}, [] as MerklPool[])

Expand All @@ -72,7 +72,7 @@ const run = async () => {
const merklConfig = await fetchAllMerklConfig()
console.info('Fetched merkl config!', Object.keys(merklConfig).length)
console.info('Parsing merkl config...')
const merklPools = parseMerklConfig(Object.values(merklConfig))
const merklPools = parseMerklConfig(merklConfig)
console.info('Writing merkl config...')

fs.writeFile(`apps/web/src/config/constants/merklPools.json`, JSON.stringify(merklPools, null, 2) + os.EOL, (err) => {
Expand Down

0 comments on commit 86d21b3

Please sign in to comment.