Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ifo for solv #11116

Open
wants to merge 40 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
0d2422d
fix: 🐛 ifo listapie
chef-ryan Jan 7, 2025
645420f
fix: 🐛 update contract
chef-ryan Jan 7, 2025
303b84d
test listapie
chef-ryan Jan 7, 2025
9a2fc1b
fix tests
chef-ryan Jan 7, 2025
175b0a6
change params
chef-ryan Jan 7, 2025
e0aa398
save
chef-ryan Jan 7, 2025
c2afc6e
remove node config in web
chef-ryan Jan 7, 2025
107964f
adjust ifo paramters
chef-ryan Jan 8, 2025
4b6c77f
adjust params
chef-ryan Jan 8, 2025
ffe9cbb
adjust params
chef-ryan Jan 8, 2025
5d4c7b3
fix: 🐛 adjust params
chef-ryan Jan 8, 2025
8a012f1
feat: 🎸 Update icake contract
chef-ryan Jan 8, 2025
6a159c4
feat: 🎸 adjust ratio
chef-ryan Jan 8, 2025
8aaf60b
fix: 🐛 Fix bridge cake
chef-ryan Jan 8, 2025
a2ebb47
rebase
chef-ryan Jan 9, 2025
41f7e0b
chore: 🤖 update to new test contract
chef-ryan Jan 8, 2025
354cadc
fix: 🐛 build
chef-ryan Jan 8, 2025
a09e690
chore: 🤖 contract abi fix
chef-ryan Jan 8, 2025
97eec1d
fix: 🐛 fix vesting display
chef-ryan Jan 8, 2025
ee47a31
fix: 🐛 ifo
chef-ryan Jan 9, 2025
23db1ad
fix: 🐛 Do small refactor and fix vesting status display prolbem
chef-ryan Jan 9, 2025
45ab95c
save
chef-ryan Jan 9, 2025
a2987c6
claim usdt -> claim
chef-ryan Jan 10, 2025
b4850ef
feat: 🎸 Add override rate logic
chef-ryan Jan 10, 2025
c0fe4c5
fix: ratio display
chef-ryan Jan 10, 2025
6aabb7b
fix: 🐛 fix display bug
chef-ryan Jan 10, 2025
3bf5e8f
feat: 🎸 next round
chef-ryan Jan 10, 2025
a62fa36
fix: 🐛 Fix claimable issue
chef-ryan Jan 13, 2025
163c43e
fix
chef-ryan Jan 13, 2025
489304d
feat: 🎸 Add Solv Ifo
chef-ryan Jan 14, 2025
d7d0f0b
feat: 🎸 refactor
chef-ryan Jan 14, 2025
715e3b5
fix: 🐛 fix build errors
chef-ryan Jan 14, 2025
e3c7fbf
fix: 🐛 Fix data
chef-ryan Jan 14, 2025
239061d
update time
chef-ryan Jan 14, 2025
e80e4eb
fix text
chef-ryan Jan 14, 2025
89d130a
fix image
chef-ryan Jan 14, 2025
2a95b4c
fix svg
chef-ryan Jan 14, 2025
ea505a3
fix
chef-ryan Jan 14, 2025
e2fb541
fix: 🐛 fix claim button text
chef-ryan Jan 14, 2025
b2e5168
remove
chef-ryan Jan 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
"not op_mini all"
]
},
"engines": {
"node": ">=16.0.0"
},
"dependencies": {
"@binance/w3w-utils": "1.1.4",
"@binance/w3w-wagmi-connector-v2": "^1.2.3",
Expand Down
33 changes: 33 additions & 0 deletions apps/web/src/components/AdPanel/Ads/AdSolv.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { useTranslation } from '@pancakeswap/localization'
import { BodyText } from '../BodyText'
import { AdButton } from '../Button'
import { AdCard } from '../Card'
import { Countdown } from '../Countdown'
import { AdPlayerProps } from '../types'
import { getImageUrl } from '../utils'

export const AdSolv = (props: AdPlayerProps) => {
const { t } = useTranslation()

return (
<AdCard imageUrl={getImageUrl('solv')} {...props}>
<BodyText mb="8px">
{t('%token% IFO starts in', {
token: 'SOLV',
})}
</BodyText>

<Countdown
targetTime={new Date('2025-01-16T10:00:00Z').getTime() / 1000}
Copy link
Collaborator

Choose a reason for hiding this comment

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

plannedStartTime of the ifo can be used here

subtleColor="rgba(0,0,0,.6)"
background="linear-gradient(180deg, #FCC631 0%, #FF9D00 100%)"
color="black"
mb="8px"
/>

<AdButton variant="text" isExternalLink href="https://pancakeswap.finance/ifo">
{t('Get Started')}
</AdButton>
</AdCard>
)
}
27 changes: 4 additions & 23 deletions apps/web/src/components/AdPanel/config.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { useMatchBreakpoints } from '@pancakeswap/uikit'
import { useMemo } from 'react'
import { AdCakeStaking } from './Ads/AdCakeStaking'
import { AdOptionsTrading } from './Ads/AdOptionsTrading'
import { AdPCSX } from './Ads/AdPCSX'
import { AdRocker } from './Ads/AdRocker'
import { AdSolv } from './Ads/AdSolv'
import { AdSpringboard } from './Ads/AdSpringboard'
import { AdTradingCompetitionBfg, AdTradingCompetitionVinu } from './Ads/AdTradingCompetition'
import { AdTradingCompetitionVinu } from './Ads/AdTradingCompetition'
import { ExpandableAd } from './Expandable/ExpandableAd'
import { shouldRenderOnPages } from './renderConditions'

Expand Down Expand Up @@ -45,18 +44,9 @@ export const useAdConfig = () => {
component: <AdTradingCompetitionVinu />,
},
{
id: 'ad-bfg-tc',
component: <AdTradingCompetitionBfg />,
id: 'ad-ifo-solv',
component: <AdSolv />,
},

// {
// id: 'ad-mev',
// component: <AdMevProtection />,
// },
// {
// id: 'prediction-telegram-bot',
// component: <AdTelegramBot />,
// },
{
id: 'pcsx',
component: <AdPCSX />,
Expand All @@ -65,15 +55,6 @@ export const useAdConfig = () => {
id: 'cake-staking',
component: <AdCakeStaking />,
},
{
id: 'clamm-options-trading',
component: <AdOptionsTrading />,
},

{
id: 'rocker-meme-career',
component: <AdRocker />,
},
],
[shouldRenderOnPage],
)
Expand Down
62 changes: 62 additions & 0 deletions apps/web/src/components/PhishingWarningBanner/SolvStrip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { useTranslation } from '@pancakeswap/localization'
import { Box, Link, Text } from '@pancakeswap/uikit'
import { VerticalDivider } from '@pancakeswap/widgets-internal'

const TextHighlight = ({ text, highlights }: { text: string; highlights: string[] }) => {
const prts = text.split(new RegExp(`(${highlights.join('|')})`, 'g'))
return prts.map((prt, i) => {
const key = `${prt}-${i}`
if (highlights.includes(prt)) {
return (
<Text bold as="span" color="#FCC631" fontSize={['12px', '12px', '14px']} key={key}>
{prt}
</Text>
)
}
return (
<Text bold as="span" color="#FFFFFF" fontSize={['12px', '12px', '14px']} key={key}>
{prt}
</Text>
)
})
}
export const SolvStrip = () => {
const { t } = useTranslation()

return (
<Box mr={['6px']}>
<TextHighlight
text={t('Join the SOLV Token Launch (IFO) on BNB Chain PancakeSwap')}
highlights={['SOLV', 'PancakeSwap']}
/>{' '}
<Link
external
display="inline !important"
fontSize={['12px', '12px', '14px']}
href="https://pancakeswap.finance/ifo"
>
{t('Join Now')}
</Link>
<VerticalDivider
bg="#53DEE9"
style={{
display: 'inline-block',
verticalAlign: 'middle',
height: '18px',
opacity: 0.4,
width: '1px',
marginLeft: '0px',
marginRight: '8px',
}}
/>
<Link
external
display="inline !important"
fontSize={['12px', '12px', '14px']}
href="https://forum.pancakeswap.finance/t/solv-ifo-discussion-thread/993"
>
{t('Learn More')}
</Link>
</Box>
)
}
15 changes: 8 additions & 7 deletions apps/web/src/components/PhishingWarningBanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import 'swiper/css/effect-fade'
import { ASSET_CDN } from 'config/constants/endpoints'
import { Countdown } from './Countdown'

import { SolvStrip } from './SolvStrip'
import { Step1 } from './Step1'
import { Step2 } from './Step2'
import { Step3 } from './Step3'
import { TradingCompetitionBfg, TradingCompetitionVinu } from './TradingCompetition'
import { TradingCompetitionVinu } from './TradingCompetition'

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

const CONFIG: BannerConfig[] = [
{
component: SolvStrip,
stripeImage: `${ASSET_CDN}/web/phishing-warning/solv.png?v=1`,
stripeImageWidth: '92px',
stripeImageAlt: 'SOLV IFO',
},
{
component: Step1,
stripeImage: `${ASSET_CDN}/web/phishing-warning/phishing-warning-bunny-1.png`,
Expand All @@ -117,12 +124,6 @@ const CONFIG: BannerConfig[] = [
stripeImageWidth: '92px',
stripeImageAlt: 'PCSX',
},
{
component: TradingCompetitionBfg,
stripeImage: `${ASSET_CDN}/web/promotions/bfg_competition.png`,
stripeImageWidth: '92px',
stripeImageAlt: 'bfg_competition',
},
{
component: TradingCompetitionVinu,
stripeImage: `${ASSET_CDN}/web/promotions/vinu_competition.png`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { CAKE } from '@pancakeswap/tokens'
import { Box, Flex, IfoSkeletonCardDetails, Skeleton, Text, TooltipText, useTooltip } from '@pancakeswap/uikit'
import { BIG_ONE_HUNDRED } from '@pancakeswap/utils/bigNumber'
import { formatNumber, getBalanceNumber } from '@pancakeswap/utils/formatBalance'
import { DAY_IN_SECONDS } from '@pancakeswap/utils/getTimePeriods'
import BigNumber from 'bignumber.js'
import { useStablecoinPrice } from 'hooks/useStablecoinPrice'
import { ReactNode, useMemo } from 'react'
Expand Down Expand Up @@ -141,6 +140,20 @@ const MaxTokenEntry = ({
)
}

function timeUntilDiffTime(diffTime: number): string {
if (diffTime <= 0) {
return 'The time has already passed.'
}

const diffInHours = Math.floor(diffTime / (60 * 60))
const diffInDays = Math.floor(diffInHours / 24)

if (diffInDays >= 1) {
return `${diffInDays} day(s)`
}
return `${diffInHours} hour(s)`
}

const IfoCardDetails: React.FC<React.PropsWithChildren<IfoCardDetailsProps>> = ({
isEligible,
poolId,
Expand Down Expand Up @@ -220,7 +233,8 @@ const IfoCardDetails: React.FC<React.PropsWithChildren<IfoCardDetailsProps>> = (
)

const durationInSeconds = ifo.version >= 3.2 ? poolCharacteristic?.vestingInformation?.duration ?? 0 : 0
const vestingDays = Math.ceil(durationInSeconds / DAY_IN_SECONDS)
// const vestingDays = Math.ceil(durationInSeconds / DAY_IN_SECONDS)
const vestingCountdown = timeUntilDiffTime(durationInSeconds)

/* Format end */
const renderBasedOnIfoStatus = () => {
Expand Down Expand Up @@ -276,9 +290,9 @@ const IfoCardDetails: React.FC<React.PropsWithChildren<IfoCardDetailsProps>> = (
/>
<FooterEntry
label={t('Vesting schedule:')}
value={`${vestingDays} days`}
tooltipContent={t('The vested tokens will be released linearly over a period of %days% days.', {
days: vestingDays,
value={vestingCountdown}
tooltipContent={t('The vested tokens will be released linearly over a period of %countdown%.', {
Copy link
Contributor

Choose a reason for hiding this comment

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

Tooltip content wouldn't look good when value of vestingCountdown is The time has already passed.

Copy link
Contributor Author

@chef-ryan chef-ryan Jan 14, 2025

Choose a reason for hiding this comment

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

vestingCountdown is in the format of {number} day(s) or hour(s)

countdown: vestingCountdown,
})}
/>
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Ifo, PoolIds, cakeBnbLpToken } from '@pancakeswap/ifos'
import { useTranslation } from '@pancakeswap/localization'
import { Token } from '@pancakeswap/sdk'
import { ChainId, Token } from '@pancakeswap/sdk'
import { bscTokens } from '@pancakeswap/tokens'
import {
AutoRenewIcon,
Expand Down Expand Up @@ -229,9 +229,9 @@ const IfoCardTokens: React.FC<React.PropsWithChildren<IfoCardTokensProps>> = ({
hasProfile
) {
// If Cross-Chain IFO
// if (ifo.chainId !== ChainId.BSC) {
message = <CrossChainVeCakeTips ifoChainId={ifo.chainId} />
// }
if (ifo.chainId !== ChainId.BSC) {
message = <CrossChainVeCakeTips ifoChainId={ifo.chainId} />
}
// Phase this out later, as it applies at the same time
// else message = <ICakeTips ifoId={ifo.id} ifoChainId={ifo.chainId} ifoAddress={ifo.address} />
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ interface Props {
claimableAmount: string
isVestingInitialized: boolean
fetchUserVestingData: () => void
enabled: boolean
}

const ClaimButton: React.FC<React.PropsWithChildren<Props>> = ({
Expand All @@ -25,6 +26,7 @@ const ClaimButton: React.FC<React.PropsWithChildren<Props>> = ({
claimableAmount,
isVestingInitialized,
fetchUserVestingData,
enabled,
}) => {
const { account, chain } = useWeb3React()
const { t } = useTranslation()
Expand Down Expand Up @@ -85,10 +87,10 @@ const ClaimButton: React.FC<React.PropsWithChildren<Props>> = ({
width="100%"
onClick={handleClaim}
isLoading={isPending}
disabled={isReady}
disabled={isReady && !enabled}
endIcon={isPending ? <AutoRenewIcon spin color="currentColor" /> : null}
>
{t('Claim %symbol%', { symbol: token.symbol })}
{t('Claim')}
</Button>
)
}
Expand Down
Loading
Loading