Skip to content

Commit

Permalink
New tokenomics (#681)
Browse files Browse the repository at this point in the history
* initial swap page implementation

* cleanup

* New Stake Page

* debug convert
  • Loading branch information
muhammedea committed Mar 15, 2024
1 parent a9abfe8 commit 4d72122
Show file tree
Hide file tree
Showing 19 changed files with 24,471 additions and 452 deletions.
22,530 changes: 22,530 additions & 0 deletions public/data/whitelist.json

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions src/components/Header/UbeBalanceContent.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useCelo } from '@celo/react-celo'
import { ChainId as UbeswapChainId, TokenAmount } from '@ubeswap/sdk'
import Loader from 'components/Loader'
import { useToken } from 'hooks/Tokens'
import React from 'react'
import { X } from 'react-feather'
import { useTranslation } from 'react-i18next'
Expand Down Expand Up @@ -51,6 +52,9 @@ export default function UbeBalanceContent({ setShowUbeBalanceModal }: { setShowU
const ubeBalance: TokenAmount | undefined = useTokenBalance(account ?? undefined, ube)
const ubeToClaim: TokenAmount | undefined = useTotalUbeEarned()

const oldUbeToken = useToken('0x00Be915B9dCf56a3CBE739D9B9c202ca692409EC')
const oldUbeBalance = useTokenBalance(account ?? undefined, oldUbeToken ?? undefined)

const totalSupply: TokenAmount | undefined = useTotalSupply(ube)
const ubePrice = useCUSDPrice(ube)
const circulation = useCirculatingSupply()
Expand Down Expand Up @@ -82,6 +86,17 @@ export default function UbeBalanceContent({ setShowUbeBalanceModal }: { setShowU
<TYPE.white color="white">{t('Balance')}:</TYPE.white>
<TYPE.white color="white">{ubeBalance?.toFixed(2, { groupSeparator: ',' })}</TYPE.white>
</RowBetween>
<RowBetween>
<TYPE.white color="white">Old Ube Balance:</TYPE.white>
<TYPE.white color="white">
{oldUbeBalance?.toFixed(2, { groupSeparator: ',' })}
{oldUbeBalance && oldUbeBalance.greaterThan('0') && (
<StyledInternalLink onClick={() => setShowUbeBalanceModal(false)} to="/claim-new-ube">
Convert
</StyledInternalLink>
)}
</TYPE.white>
</RowBetween>
<RowBetween>
<TYPE.white color="white">{t('Unclaimed')}:</TYPE.white>
<TYPE.white color="white">
Expand Down
34 changes: 25 additions & 9 deletions src/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { CELO, ChainId as UbeswapChainId, TokenAmount } from '@ubeswap/sdk'
import { CardNoise } from 'components/earn/styled'
import Modal from 'components/Modal'
import Hamburger from 'hamburger-react'
import { useToken } from 'hooks/Tokens'
import usePrevious from 'hooks/usePrevious'
import { darken } from 'polished'
import Drawer from 'rc-drawer'
Expand All @@ -17,7 +18,6 @@ import { useAggregateUbeBalance, useTokenBalance } from 'state/wallet/hooks'
import styled from 'styled-components'
import { TYPE } from 'theme'
import { ExternalLink } from 'theme/components'
import { CountUp } from 'use-count-up'
import { relevantDigits } from 'utils/relevantDigits'

import Icon from '../../assets/svg/icon-ube.svg'
Expand Down Expand Up @@ -368,6 +368,10 @@ export default function Header() {
const countUpValue = relevantDigits(aggregateBalance)
const countUpValuePrevious = usePrevious(countUpValue) ?? '0'

Check warning on line 369 in src/components/Header/index.tsx

View workflow job for this annotation

GitHub Actions / Run linters

'countUpValuePrevious' is assigned a value but never used

const oldUbeToken = useToken('0x00Be915B9dCf56a3CBE739D9B9c202ca692409EC')
const oldUbeBalance = useTokenBalance(account ?? undefined, oldUbeToken ?? undefined)
const oldUbeBalanceFormatted = relevantDigits(oldUbeBalance)

const [drawerVisible, setDrawerVisible] = useState<boolean>(false)

const onDrawerClose = () => {
Expand Down Expand Up @@ -418,6 +422,9 @@ export default function Header() {
{t('stake')}
</StyledNavLinkExtraSmall>
<ChartsMenuGroup />
<StyledNavLink id={`convert-nav-link`} to={'/claim-new-ube'}>
Convert UBE
</StyledNavLink>
</HeaderLinks>
<BurgerElement>
<Hamburger size={18} hideOutline={false} label="show menu" toggled={drawerVisible} onToggle={onToggle} />
Expand Down Expand Up @@ -512,20 +519,27 @@ export default function Header() {
paddingRight: '.4rem',
}}
>
<CountUp
key={countUpValue}
isCounting
start={parseFloat(countUpValuePrevious)}
end={parseFloat(countUpValue)}
thousandsSeparator={','}
duration={1}
/>
{countUpValue}
</TYPE.white>
</HideSmall>
)}
UBE
</UBEAmount>
<CardNoise />
<HideSmall>
<UBEAmount active={!!account} style={{ pointerEvents: 'auto' }}>
{account && (
<TYPE.white
style={{
paddingRight: '.4rem',
}}
>
{oldUbeBalanceFormatted}
</TYPE.white>
)}
old-UBE
</UBEAmount>
</HideSmall>
</UBEWrapper>
)}

Expand Down Expand Up @@ -560,6 +574,8 @@ const UBEAmount = styled(AccountElement)`

const UBEWrapper = styled.span`
width: fit-content;
display: flex;
gap: 2px;
position: relative;
cursor: pointer;
:hover {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Stake/Proposals/ProposalCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const SECONDS_PER_BLOCK = 5

const ube = new WrappedTokenInfo(
{
address: '0x00be915b9dcf56a3cbe739d9b9c202ca692409ec',
address: '0x71e26d0E519D14591b9dE9a0fE9513A398101490',
name: 'Ubeswap Governance Token',
symbol: 'UBE',
chainId: 42220,
Expand Down

0 comments on commit 4d72122

Please sign in to comment.