Skip to content

Commit

Permalink
chore: list bsc farms (#7439)
Browse files Browse the repository at this point in the history
<!--
Before opening a pull request, please read the [contributing
guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md)
first
-->

<!--
copilot:all
-->
### <samp>🤖 Generated by Copilot at 366d69b</samp>

### Summary
🌾,🍰,🔥,

<!--
1. 🌾, which represents the addition of new farms to the platform, as
farms are a common metaphor for liquidity pools that generate yield for
users.
2. 🍰, which represents the addition of new pools that involve CAKE, the
native token of the PancakeSwap platform, as cake is a symbol of reward
and sweetness.
3. 🔥, which represents the addition of SnBNB, a token that represents
staked BNB on the Synclub platform, as fire is a symbol of heat and
intensity, and staking BNB can generate high returns for users.
-->
This pull request adds support for SnBNB and HAY tokens and their
related farms and pools on the PancakeSwap platform. It updates the
`bscTokens`, `farmsV3`, and `pools` constants files with the necessary
information and configuration.

> _`farmsV3` expands_
> _New pairs for liquidity_
> _Harvest in autumn_

### Walkthrough
* Add four new farms for SnBNB and HAY pairs
([link](https://github.com/pancakeswap/pancake-frontend/pull/7439/files?diff=unified&w=0#diff-b68c662a4cbcb945733d7c43d7c670219954b0f8395016547312ad2d6ad6a066R46-R73))
* Add two new pools for staking CAKE to earn SnBNB and HAY
([link](https://github.com/pancakeswap/pancake-frontend/pull/7439/files?diff=unified&w=0#diff-21a68ca608a542b99be691600781000b07789bfe32d5765d6c2290c46107331bR17-R34))
* Add SnBNB token information to the bscTokens object
([link](https://github.com/pancakeswap/pancake-frontend/pull/7439/files?diff=unified&w=0#diff-71ff5223fbd0d4df9a3c1d29ff72168019f58785ec79d2fae29f002d095f3bf4R2669-R2676))
  • Loading branch information
Chef-Yogi authored Jul 28, 2023
1 parent 1e344de commit 6aafd10
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 25 deletions.
29 changes: 6 additions & 23 deletions apps/web/src/config/__tests__/farms.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SerializedFarm } from '@pancakeswap/farms'
import farms1 from '@pancakeswap/farms/constants/1'
import farms56 from '@pancakeswap/farms/constants/56'
import farms1101 from '@pancakeswap/farms/constants/1101'
import { Native } from '@pancakeswap/sdk'
import { getLpContract } from 'utils/contractHelpers'
import { describe, it } from 'vitest'
Expand All @@ -15,8 +14,6 @@ const farmsToTest: [number, SerializedFarm, number][] = farms56

const farms1ToTest: [number, SerializedFarm, number][] = farms1.slice(0, 10).map((farm) => [farm.pid, farm, 1])

const farms1101ToTest: [number, SerializedFarm, number][] = farms1101.slice(0, 10).map((farm) => [farm.pid, farm, 1101])

const getDuplicates = (key: 'pid' | 'lpAddress') => {
const farms = [...farms56, ...farms1]
const keys = farms.map((farm) => farm[key])
Expand All @@ -36,7 +33,7 @@ describe.concurrent(
expect(duplicates).toHaveLength(0)
})

it.each([...farmsToTest, ...farms1ToTest, ...farms1101ToTest])(
it.each([...farmsToTest, ...farms1ToTest])(
'Farm %d has the correct token addresses',
async (pid, farm, chainId) => {
const tokenAddress = farm.token.address
Expand All @@ -55,14 +52,11 @@ describe.concurrent(
},
)

it.each([...farmsToTest, ...farms1ToTest, ...farms1101ToTest])(
'Farm %d symbol should not be native symbol',
(_, farm, chainId) => {
const native = Native.onChain(chainId)
expect(farm.quoteToken.symbol).not.toEqual(native.symbol)
expect(farm.token.symbol).not.toEqual(native.symbol)
},
)
it.each([...farmsToTest, ...farms1ToTest])('Farm %d symbol should not be native symbol', (_, farm, chainId) => {
const native = Native.onChain(chainId)
expect(farm.quoteToken.symbol).not.toEqual(native.symbol)
expect(farm.token.symbol).not.toEqual(native.symbol)
})

// The first pid using the new factory
// BSC
Expand All @@ -86,17 +80,6 @@ describe.concurrent(
const factory = await lpContract.read.factory()
expect(factory.toLowerCase()).toEqual(ETH_FACTORY_ADDRESS)
})

// POLYGON_ZKEVM
const POLYGON_ZKEVM_START_PID = 1
const POLYGON_ZKEVM_FACTORY_ADDRESS = '0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E'
const polygonNewFarmsToTest = farms1101.filter((farmSet) => farmSet[0] >= POLYGON_ZKEVM_START_PID)

it.each(polygonNewFarmsToTest)('farm %d is using correct factory address', async (pid, farm) => {
const lpContract = getLpContract(farm.lpAddress, farm.token.chainId)
const factory = await lpContract.read.factory()
expect(factory.toLowerCase()).toEqual(POLYGON_ZKEVM_FACTORY_ADDRESS)
})
},
{ timeout: 50_000 },
)
2 changes: 1 addition & 1 deletion apps/web/src/views/Farms/FarmsV3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ const Farms: React.FC<React.PropsWithChildren> = ({ children }) => {
return farms
}
const sableFarm = farms.find((f) => f.version === 2 && f.pid === 167)
const v3TargetFarm = farms.find((f) => f.version === 3 && f.pid === 5)
const v3TargetFarm = farms.find((f) => f.version === 3 && f.pid === 60)
if (!sableFarm || !v3TargetFarm) {
return farms
}
Expand Down
28 changes: 28 additions & 0 deletions packages/farms/constants/56.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,34 @@ export const farmsV3 = defineFarmV3Configs([
feeAmount: FeeAmount.LOW,
},
// keep those farms on top
{
pid: 63,
token0: bscTokens.snbnb,
token1: bscTokens.wbnb,
lpAddress: '0x9474e972F49605315763c296B122CBB998b615Cf',
feeAmount: FeeAmount.LOW,
},
{
pid: 62,
token0: bscTokens.hay,
token1: bscTokens.eth,
lpAddress: '0xfdFCdE34d2038EBeDe62e95C65b1492C28c990C9',
feeAmount: FeeAmount.MEDIUM,
},
{
pid: 61,
token0: bscTokens.hay,
token1: bscTokens.btcb,
lpAddress: '0x06E2D4002a693812A6348c91A2bEccf4E926FF2f',
feeAmount: FeeAmount.MEDIUM,
},
{
pid: 60,
token0: bscTokens.hay,
token1: bscTokens.wbnb,
lpAddress: '0xBe43E64Cd61E0b9207A6beE93e2149317A604326',
feeAmount: FeeAmount.MEDIUM,
},
{
pid: 59,
token0: bscTokens.tusd,
Expand Down
6 changes: 5 additions & 1 deletion packages/farms/tests/v3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import { farmsV3ConfigChainMap } from '../constants/v3'
import { priceHelperTokens } from '../constants/common'
import { CommonPrice, getFarmsPrices } from '../src/fetchFarmsV3'

const mainnetFarms = [farmsV3ConfigChainMap[ChainId.BSC], farmsV3ConfigChainMap[ChainId.ETHEREUM]]
const mainnetFarms = [
farmsV3ConfigChainMap[ChainId.BSC],
farmsV3ConfigChainMap[ChainId.ETHEREUM],
farmsV3ConfigChainMap[ChainId.POLYGON_ZKEVM],
]

function hasDuplicates(array: any[]) {
return new Set(array).size !== array.length
Expand Down
18 changes: 18 additions & 0 deletions packages/pools/src/constants/pools/56.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@ export const livePools: SerializedPool[] = [
tokenPerBlock: '10',
isFinished: false,
},
{
sousId: 354,
stakingToken: bscTokens.cake,
earningToken: bscTokens.snbnb,
contractAddress: '0x854906693F7bAc4E4c8C31c001b6a42b3d93493E',
poolCategory: PoolCategory.CORE,
tokenPerBlock: '0.00004813',
version: 3,
},
{
sousId: 353,
stakingToken: bscTokens.cake,
earningToken: bscTokens.hay,
contractAddress: '0x8c41046b3C0D7b7C80316a57C39C74c9F5133852',
poolCategory: PoolCategory.CORE,
tokenPerBlock: '0.02314',
version: 3,
},
{
sousId: 352,
stakingToken: bscTokens.cake,
Expand Down
8 changes: 8 additions & 0 deletions packages/tokens/src/56.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2666,4 +2666,12 @@ export const bscTokens = {
'SABLE',
'https://sable.finance/',
),
snbnb: new ERC20Token(
ChainId.BSC,
'0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B',
18,
'SnBNB',
'Synclub Staked BNB',
'https://www.synclub.io/',
),
}

1 comment on commit 6aafd10

@vercel
Copy link

@vercel vercel bot commented on 6aafd10 Jul 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

uikit – ./packages/uikit

uikit-git-develop.pancake.run
uikit.pancake.run

Please sign in to comment.