Skip to content

Commit 58ab27c

Browse files
authored
feat: add ifo for solv (#11116)
<!-- Before opening a pull request, please read the [contributing guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md) first --> <!-- start pr-codex --> --- ## PR-Codex overview This PR primarily focuses on adding support for the `SOLV` token launch (IFO) on PancakeSwap, including updates to configuration, new components, and enhancements in the vesting logic. ### Detailed summary - Added `SOLV` token launch configuration in `packages/ifos/src/constants/ifos/bsc.ts`. - Introduced `AdSolv` component for promotional ads. - Updated `Claim` component to include vesting status. - Enhanced vesting logic to track user claimable amounts. - Modified various hooks and components to integrate `SOLV` IFO data. - Updated localization strings for `SOLV` IFO. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent b9d7bf0 commit 58ab27c

File tree

27 files changed

+756
-398
lines changed

27 files changed

+756
-398
lines changed

apps/web/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
"not op_mini all"
3232
]
3333
},
34-
"engines": {
35-
"node": ">=16.0.0"
36-
},
3734
"dependencies": {
3835
"@binance/w3w-utils": "1.1.4",
3936
"@binance/w3w-wagmi-connector-v2": "^1.2.3",
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { useTranslation } from '@pancakeswap/localization'
2+
import { BodyText } from '../BodyText'
3+
import { AdButton } from '../Button'
4+
import { AdCard } from '../Card'
5+
import { Countdown } from '../Countdown'
6+
import { AdPlayerProps } from '../types'
7+
import { getImageUrl } from '../utils'
8+
9+
export const AdSolv = (props: AdPlayerProps) => {
10+
const { t } = useTranslation()
11+
12+
return (
13+
<AdCard imageUrl={getImageUrl('solv')} {...props}>
14+
<BodyText mb="8px">
15+
{t('%token% IFO starts in', {
16+
token: 'SOLV',
17+
})}
18+
</BodyText>
19+
20+
<Countdown
21+
targetTime={new Date('2025-01-16T10:00:00Z').getTime() / 1000}
22+
subtleColor="rgba(0,0,0,.6)"
23+
background="linear-gradient(180deg, #FCC631 0%, #FF9D00 100%)"
24+
color="black"
25+
mb="8px"
26+
/>
27+
28+
<AdButton variant="text" isExternalLink href="https://pancakeswap.finance/ifo">
29+
{t('Get Started')}
30+
</AdButton>
31+
</AdCard>
32+
)
33+
}

apps/web/src/components/AdPanel/config.tsx

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { useMatchBreakpoints } from '@pancakeswap/uikit'
22
import { useMemo } from 'react'
33
import { AdCakeStaking } from './Ads/AdCakeStaking'
4-
import { AdOptionsTrading } from './Ads/AdOptionsTrading'
54
import { AdPCSX } from './Ads/AdPCSX'
6-
import { AdRocker } from './Ads/AdRocker'
5+
import { AdSolv } from './Ads/AdSolv'
76
import { AdSpringboard } from './Ads/AdSpringboard'
8-
import { AdTradingCompetitionBfg, AdTradingCompetitionVinu } from './Ads/AdTradingCompetition'
7+
import { AdTradingCompetitionVinu } from './Ads/AdTradingCompetition'
98
import { ExpandableAd } from './Expandable/ExpandableAd'
109
import { shouldRenderOnPages } from './renderConditions'
1110

@@ -45,18 +44,9 @@ export const useAdConfig = () => {
4544
component: <AdTradingCompetitionVinu />,
4645
},
4746
{
48-
id: 'ad-bfg-tc',
49-
component: <AdTradingCompetitionBfg />,
47+
id: 'ad-ifo-solv',
48+
component: <AdSolv />,
5049
},
51-
52-
// {
53-
// id: 'ad-mev',
54-
// component: <AdMevProtection />,
55-
// },
56-
// {
57-
// id: 'prediction-telegram-bot',
58-
// component: <AdTelegramBot />,
59-
// },
6050
{
6151
id: 'pcsx',
6252
component: <AdPCSX />,
@@ -65,15 +55,6 @@ export const useAdConfig = () => {
6555
id: 'cake-staking',
6656
component: <AdCakeStaking />,
6757
},
68-
{
69-
id: 'clamm-options-trading',
70-
component: <AdOptionsTrading />,
71-
},
72-
73-
{
74-
id: 'rocker-meme-career',
75-
component: <AdRocker />,
76-
},
7758
],
7859
[shouldRenderOnPage],
7960
)

apps/web/src/components/Menu/config/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ const config: (
164164
],
165165
items: [
166166
{
167-
status: { text: t('New'), color: 'success' },
168167
label: t('Springboard'),
169168
href: 'https://springboard.pancakeswap.finance',
170169
type: DropdownMenuItemType.EXTERNAL_LINK,
@@ -201,6 +200,7 @@ const config: (
201200
label: t('IFO'),
202201
href: '/ifo',
203202
image: '/images/ifos/ifo-bunny.png',
203+
status: { text: t('SOON'), color: 'warning' },
204204
overrideSubNavItems: [
205205
{
206206
label: t('Latest'),
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import { useTranslation } from '@pancakeswap/localization'
2+
import { Box, Link, Text } from '@pancakeswap/uikit'
3+
import { VerticalDivider } from '@pancakeswap/widgets-internal'
4+
5+
const TextHighlight = ({ text, highlights }: { text: string; highlights: string[] }) => {
6+
const prts = text.split(new RegExp(`(${highlights.join('|')})`, 'g'))
7+
return prts.map((prt, i) => {
8+
const key = `${prt}-${i}`
9+
if (highlights.includes(prt)) {
10+
return (
11+
<Text bold as="span" color="#FCC631" fontSize={['12px', '12px', '14px']} key={key}>
12+
{prt}
13+
</Text>
14+
)
15+
}
16+
return (
17+
<Text bold as="span" color="#FFFFFF" fontSize={['12px', '12px', '14px']} key={key}>
18+
{prt}
19+
</Text>
20+
)
21+
})
22+
}
23+
export const SolvStrip = () => {
24+
const { t } = useTranslation()
25+
26+
return (
27+
<Box mr={['6px']}>
28+
<TextHighlight
29+
text={t('Join the SOLV Token Launch (IFO) on BNB Chain PancakeSwap')}
30+
highlights={['SOLV', 'PancakeSwap']}
31+
/>{' '}
32+
<Link
33+
external
34+
display="inline !important"
35+
fontSize={['12px', '12px', '14px']}
36+
href="https://pancakeswap.finance/ifo"
37+
>
38+
{t('Join Now')}
39+
</Link>
40+
<VerticalDivider
41+
bg="#53DEE9"
42+
style={{
43+
display: 'inline-block',
44+
verticalAlign: 'middle',
45+
height: '18px',
46+
opacity: 0.4,
47+
width: '1px',
48+
marginLeft: '0px',
49+
marginRight: '8px',
50+
}}
51+
/>
52+
<Link
53+
external
54+
display="inline !important"
55+
fontSize={['12px', '12px', '14px']}
56+
href="https://forum.pancakeswap.finance/t/solv-ifo-discussion-thread/993"
57+
>
58+
{t('Learn More')}
59+
</Link>
60+
</Box>
61+
)
62+
}

apps/web/src/components/PhishingWarningBanner/index.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import 'swiper/css/effect-fade'
88
import { ASSET_CDN } from 'config/constants/endpoints'
99
import { Countdown } from './Countdown'
1010

11+
import { SolvStrip } from './SolvStrip'
1112
import { Step1 } from './Step1'
1213
import { Step2 } from './Step2'
1314
import { Step3 } from './Step3'
14-
import { TradingCompetitionBfg, TradingCompetitionVinu } from './TradingCompetition'
15+
import { TradingCompetitionVinu } from './TradingCompetition'
1516

1617
const Container = styled(Flex).withConfig({ shouldForwardProp: (prop) => !['$background'].includes(prop) })<{
1718
$background?: string
@@ -99,6 +100,12 @@ type BannerConfig = {
99100
}
100101

101102
const CONFIG: BannerConfig[] = [
103+
{
104+
component: SolvStrip,
105+
stripeImage: `${ASSET_CDN}/web/phishing-warning/solv.png?v=1`,
106+
stripeImageWidth: '92px',
107+
stripeImageAlt: 'SOLV IFO',
108+
},
102109
{
103110
component: Step1,
104111
stripeImage: `${ASSET_CDN}/web/phishing-warning/phishing-warning-bunny-1.png`,
@@ -117,12 +124,6 @@ const CONFIG: BannerConfig[] = [
117124
stripeImageWidth: '92px',
118125
stripeImageAlt: 'PCSX',
119126
},
120-
{
121-
component: TradingCompetitionBfg,
122-
stripeImage: `${ASSET_CDN}/web/promotions/bfg_competition.png`,
123-
stripeImageWidth: '92px',
124-
stripeImageAlt: 'bfg_competition',
125-
},
126127
{
127128
component: TradingCompetitionVinu,
128129
stripeImage: `${ASSET_CDN}/web/promotions/vinu_competition.png`,

apps/web/src/views/Ifos/components/IfoFoldableCard/IfoPoolCard/IfoCardDetails.tsx

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { CAKE } from '@pancakeswap/tokens'
44
import { Box, Flex, IfoSkeletonCardDetails, Skeleton, Text, TooltipText, useTooltip } from '@pancakeswap/uikit'
55
import { BIG_ONE_HUNDRED } from '@pancakeswap/utils/bigNumber'
66
import { formatNumber, getBalanceNumber } from '@pancakeswap/utils/formatBalance'
7-
import { DAY_IN_SECONDS } from '@pancakeswap/utils/getTimePeriods'
87
import BigNumber from 'bignumber.js'
98
import { useStablecoinPrice } from 'hooks/useStablecoinPrice'
109
import { ReactNode, useMemo } from 'react'
@@ -141,6 +140,23 @@ const MaxTokenEntry = ({
141140
)
142141
}
143142

143+
const useTimeUntilDiffTime = (diffTime: number): string => {
144+
const { t } = useTranslation()
145+
if (diffTime <= 0) {
146+
return t('The time has already passed.')
147+
}
148+
149+
const diffInHours = Math.floor(diffTime / (60 * 60))
150+
const diffInDays = Math.floor(diffInHours / 24)
151+
const unitDay = t('day(s)')
152+
const unitHour = t('hour(s)')
153+
154+
if (diffInDays >= 1) {
155+
return `${diffInDays} ${unitDay}`
156+
}
157+
return `${diffInHours} ${unitHour}`
158+
}
159+
144160
const IfoCardDetails: React.FC<React.PropsWithChildren<IfoCardDetailsProps>> = ({
145161
isEligible,
146162
poolId,
@@ -220,7 +236,8 @@ const IfoCardDetails: React.FC<React.PropsWithChildren<IfoCardDetailsProps>> = (
220236
)
221237

222238
const durationInSeconds = ifo.version >= 3.2 ? poolCharacteristic?.vestingInformation?.duration ?? 0 : 0
223-
const vestingDays = Math.ceil(durationInSeconds / DAY_IN_SECONDS)
239+
// const vestingDays = Math.ceil(durationInSeconds / DAY_IN_SECONDS)
240+
const vestingCountdown = useTimeUntilDiffTime(durationInSeconds)
224241

225242
/* Format end */
226243
const renderBasedOnIfoStatus = () => {
@@ -276,9 +293,9 @@ const IfoCardDetails: React.FC<React.PropsWithChildren<IfoCardDetailsProps>> = (
276293
/>
277294
<FooterEntry
278295
label={t('Vesting schedule:')}
279-
value={`${vestingDays} days`}
280-
tooltipContent={t('The vested tokens will be released linearly over a period of %days% days.', {
281-
days: vestingDays,
296+
value={vestingCountdown}
297+
tooltipContent={t('The vested tokens will be released linearly over a period of %countdown%.', {
298+
countdown: vestingCountdown,
282299
})}
283300
/>
284301
</>

apps/web/src/views/Ifos/components/IfoFoldableCard/IfoPoolCard/IfoCardTokens.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Ifo, PoolIds, cakeBnbLpToken } from '@pancakeswap/ifos'
22
import { useTranslation } from '@pancakeswap/localization'
3-
import { Token } from '@pancakeswap/sdk'
3+
import { ChainId, Token } from '@pancakeswap/sdk'
44
import { bscTokens } from '@pancakeswap/tokens'
55
import {
66
AutoRenewIcon,
@@ -229,9 +229,9 @@ const IfoCardTokens: React.FC<React.PropsWithChildren<IfoCardTokensProps>> = ({
229229
hasProfile
230230
) {
231231
// If Cross-Chain IFO
232-
// if (ifo.chainId !== ChainId.BSC) {
233-
message = <CrossChainVeCakeTips ifoChainId={ifo.chainId} />
234-
// }
232+
if (ifo.chainId !== ChainId.BSC) {
233+
message = <CrossChainVeCakeTips ifoChainId={ifo.chainId} />
234+
}
235235
// Phase this out later, as it applies at the same time
236236
// else message = <ICakeTips ifoId={ifo.id} ifoChainId={ifo.chainId} ifoAddress={ifo.address} />
237237
}

apps/web/src/views/Ifos/components/IfoVesting/VestingPeriod/Claim.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ interface Props {
1717
claimableAmount: string
1818
isVestingInitialized: boolean
1919
fetchUserVestingData: () => void
20+
enabled: boolean
2021
}
2122

2223
const ClaimButton: React.FC<React.PropsWithChildren<Props>> = ({
@@ -25,6 +26,7 @@ const ClaimButton: React.FC<React.PropsWithChildren<Props>> = ({
2526
claimableAmount,
2627
isVestingInitialized,
2728
fetchUserVestingData,
29+
enabled,
2830
}) => {
2931
const { account, chain } = useWeb3React()
3032
const { t } = useTranslation()
@@ -85,10 +87,10 @@ const ClaimButton: React.FC<React.PropsWithChildren<Props>> = ({
8587
width="100%"
8688
onClick={handleClaim}
8789
isLoading={isPending}
88-
disabled={isReady}
90+
disabled={isReady && !enabled}
8991
endIcon={isPending ? <AutoRenewIcon spin color="currentColor" /> : null}
9092
>
91-
{t('Claim %symbol%', { symbol: token.symbol })}
93+
{t('Claim')}
9294
</Button>
9395
)
9496
}

0 commit comments

Comments
 (0)