Skip to content

Commit

Permalink
scaffold multiplier
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0neerpat committed Jul 1, 2024
1 parent a07bba3 commit 431c261
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 99 deletions.
7 changes: 3 additions & 4 deletions src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ const ETH: AddEthereumChainParameter['nativeCurrency'] = {
decimals: 18,
}

export const RPC_URL_ETHEREUM =
process.env.REACT_APP_RPC_URL_ETHEREUM && process.env.NODE_ENV !== 'development'
? process.env.REACT_APP_RPC_URL_ETHEREUM
: 'https://eth.llamarpc.com'
export const RPC_URL_ETHEREUM = process.env.REACT_APP_RPC_URL_ETHEREUM
? process.env.REACT_APP_RPC_URL_ETHEREUM
: 'https://eth.llamarpc.com'
export const RPC_URL_ARBITRUM = 'https://arbitrum.blockpi.network/v1/rpc/public'
export const RPC_URL_OPTIMISM = 'https://op-pokt.nodies.app'
export const RPC_URL_POLYGON = 'https://polygon-bor-rpc.publicnode.com'
Expand Down
8 changes: 4 additions & 4 deletions src/components/Bolts/AddressCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ import styled from 'styled-components'

interface AddressCellProps {
address: string
userFuulDataAddress: string
userBoltsDataAddress: string
data: LeaderboardUser[]
}

const AddressCell: React.FC<AddressCellProps> = ({ address, userFuulDataAddress, data }) => {
const AddressCell: React.FC<AddressCellProps> = ({ address, userBoltsDataAddress, data }) => {
const userInTop10 = useMemo(() => data.find((user) => user.rank <= 10 && user.address === address), [data, address])
// Skip ENS check for users not in the top 10
const resolvedAddress = useAddress(address, 0, !userInTop10)

return (
<Address>
{userFuulDataAddress === address && (
{userBoltsDataAddress === address && (
<Badge
style={{
backgroundColor: '#e2f1ff',
Expand All @@ -43,7 +43,7 @@ const AddressCell: React.FC<AddressCellProps> = ({ address, userFuulDataAddress,
export default React.memo(AddressCell, (prevProps, nextProps) => {
return (
prevProps.address === nextProps.address &&
prevProps.userFuulDataAddress === nextProps.userFuulDataAddress &&
prevProps.userBoltsDataAddress === nextProps.userBoltsDataAddress &&
prevProps.data === nextProps.data
)
})
Expand Down
22 changes: 11 additions & 11 deletions src/containers/Bolts/Leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { LeaderboardUser } from '~/model/boltsModel'
const columnHelper = createColumnHelper()

// @ts-ignore
const Table = ({ data, userFuulData }) => {
const Table = ({ data, userBoltsData }) => {
const [sorting, setSorting] = useState<SortingState>([])
const [globalFilter, setGlobalFilter] = useState<string>('')
const [isTableReady, setIsTableReady] = useState(false)
Expand All @@ -39,16 +39,16 @@ const Table = ({ data, userFuulData }) => {

const displayData = useMemo(() => {
let dataToDisplay = [...data.slice(0, 10)]
if (userFuulData.points) {
if (userBoltsData.bolts) {
const userInTop10 = data.find(
(user: LeaderboardUser) => user.address === userFuulData.address && user.rank <= 10
(user: LeaderboardUser) => user.address === userBoltsData.address && user.rank <= 10
)
if (!userInTop10) {
dataToDisplay.push(userFuulData)
dataToDisplay.push(userBoltsData)
}
}
return dataToDisplay
}, [data, userFuulData])
}, [data, userBoltsData])

const columns = [
columnHelper.accessor('rank', {
Expand All @@ -60,7 +60,7 @@ const Table = ({ data, userFuulData }) => {
if (rank <= 3) {
color = '#FFFFFF'
badge = <BadgeImage src={leaderboardLeadersBadge} alt="leaderboard-badge" />
} else if (rank === userFuulData.rank) {
} else if (rank === userBoltsData.rank) {
color = '#1A74EC'
}
return (
Expand All @@ -75,11 +75,11 @@ const Table = ({ data, userFuulData }) => {
header: 'Address',
cell: (info) => {
const address = info.getValue()
return <AddressCell address={address} userFuulDataAddress={userFuulData.address} data={data} />
return <AddressCell address={address} userBoltsDataAddress={userBoltsData.address} data={data} />
},
}),
columnHelper.accessor('points', {
header: 'Points',
columnHelper.accessor('bolts', {
header: 'Bolts',
// @ts-ignore
cell: (info) => <Points>{info.getValue().toLocaleString()}</Points>,
}),
Expand Down Expand Up @@ -144,7 +144,7 @@ const Table = ({ data, userFuulData }) => {
key={row.id}
style={
// @ts-ignore
row.original.address === userFuulData.address
row.original.address === userBoltsData.address
? { backgroundColor: '#8DB2FF99' }
: { backgroundColor: '#1A74EC' }
}
Expand All @@ -156,7 +156,7 @@ const Table = ({ data, userFuulData }) => {
else tdStyle = { paddingTop: '10px', color: '#eeeeee' }
if (index === 0) tdStyle.paddingBottom = '10px'
// @ts-ignore
if (row?.original.address === userFuulData.address) tdStyle.color = '#1A74EC'
if (row?.original.address === userBoltsData.address) tdStyle.color = '#1A74EC'

return (
<td key={cell.id} style={tdStyle}>
Expand Down
4 changes: 2 additions & 2 deletions src/containers/Bolts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useStoreState, useStoreActions } from '~/store'

const Bolts = () => {
const { account } = useActiveWeb3React()
const userFuulData = useStoreState((state) => state.boltsModel.userFuulData)
const userBoltsData = useStoreState((state) => state.boltsModel.userBoltsData)
const leaderboardData = useStoreState((state) => state.boltsModel.leaderboardData)
const boltsEarnedData = useStoreState((state) => state.boltsModel.boltsEarnedData)
const fetchData = useStoreActions((actions) => actions.boltsModel.fetchData)
Expand All @@ -28,7 +28,7 @@ const Bolts = () => {
</Section>
<Section>
<SectionHeader>Leaderboard</SectionHeader>
<Leaderboard data={leaderboardData} userFuulData={userFuulData} />
<Leaderboard data={leaderboardData} userBoltsData={userBoltsData} />
</Section>
<Section>
<MessageBox>
Expand Down
79 changes: 39 additions & 40 deletions src/containers/Bolts/quests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,31 +108,11 @@ export type BoltsEarnedData = {
[key: string]: string
}

export const MULTIPLIERS = (boltsEarnedData: BoltsEarnedData) => [
{
title: 'Invite a Friend',
text: (
<>
Create a referral link by signing a message with your wallet.
<Affiliate />
</>
),
button: '',
items: [
{
title: 'Source',
status: <OpenDollarLogo />,
},
{
title: 'Bolts',
status: '10% of referrals + friends receive 250 Bolts per ETH deposited for 30 days',
},
{
title: 'Earned',
status: boltsEarnedData['Invite a Friend'] || '-',
},
],
},
export type MultipliersData = {
[key: string]: string
}

export const MULTIPLIERS = (multipliersData: MultipliersData) => [
{
title: 'Genesis NFV User',
button: (
Expand All @@ -147,7 +127,7 @@ export const MULTIPLIERS = (boltsEarnedData: BoltsEarnedData) => [
status: <OpenDollarLogo />,
},
{ title: 'Bolts', status: '+10% to deposit/borrow' },
{ title: 'Holder', status: boltsEarnedData['GenesisNFV'] || '-' },
{ title: 'Holder', status: multipliersData['GENESIS_NFV'] || '-' },
],
},
{
Expand Down Expand Up @@ -180,7 +160,7 @@ export const MULTIPLIERS = (boltsEarnedData: BoltsEarnedData) => [
items: [
{ title: 'Source', status: 'Guild.xyz' },
{ title: 'Bolts', status: '+3% to all points' },
{ title: 'Holder', status: boltsEarnedData['OgNFT'] || '-' },
{ title: 'Holder', status: multipliersData['OG_NFT'] || '-' },
],
},
{
Expand Down Expand Up @@ -212,7 +192,7 @@ export const MULTIPLIERS = (boltsEarnedData: BoltsEarnedData) => [
items: [
{ title: 'Source', status: 'NFTs2Me' },
{ title: 'Bolts', status: '+7% to all points' },
{ title: 'Holder', status: boltsEarnedData['GenesisNFT'] || '-' },
{ title: 'Holder', status: multipliersData['GENESIS_NFT'] || '-' },
],
},
{
Expand All @@ -225,7 +205,7 @@ export const MULTIPLIERS = (boltsEarnedData: BoltsEarnedData) => [
status: <OpenDollarLogo />,
},
{ title: 'Bolts', status: '+30%' },
{ title: 'Earned', status: boltsEarnedData['Community Goal: 20K ETH TVL'] || '-' },
{ title: 'Earned', status: multipliersData['ETH_TVL_20K'] || '-' },
],
},
]
Expand All @@ -250,7 +230,7 @@ export const QUESTS = (boltsEarnedData: BoltsEarnedData) => [
status: <OpenDollarLogo />,
},
{ title: 'Bolts', status: '500 per ETH' },
{ title: 'Earned', status: boltsEarnedData[3] || '-' },
{ title: 'Earned', status: boltsEarnedData['COLLATERAL_DEPOSIT'] || '-' },
],
},
{
Expand All @@ -270,7 +250,7 @@ export const QUESTS = (boltsEarnedData: BoltsEarnedData) => [
status: <OpenDollarLogo />,
},
{ title: 'Bolts', status: '1,000 per ETH' },
{ title: 'Earned', status: boltsEarnedData[1] || '-' },
{ title: 'Earned', status: boltsEarnedData['DEBT_BORROW'] || '-' },
],
},
{
Expand All @@ -297,7 +277,7 @@ export const QUESTS = (boltsEarnedData: BoltsEarnedData) => [
items: [
{ title: 'Source', status: <CamelotLogo /> },
{ title: 'Bolts', status: '2,000 per ETH' },
{ title: 'Earned', status: boltsEarnedData[8] || '-' },
{ title: 'Earned', status: boltsEarnedData['ODG_ETH_LP'] || '-' },
],
},
{
Expand All @@ -324,34 +304,53 @@ export const QUESTS = (boltsEarnedData: BoltsEarnedData) => [
items: [
{ title: 'Source', status: <CamelotLogo /> },
{ title: 'Bolts', status: '3,000 per ETH' },
{ title: 'Earned', status: boltsEarnedData[7] || '-' },
{ title: 'Earned', status: boltsEarnedData['OD_ETH_LP'] || '-' },
],
},
{
title: 'Galxe and Zealy',
title: 'Galxe',
button: (
<>
<Button secondary onClick={() => onClick('https://galxe.com/opendollar')}>
Galxe <LinkIcon />
Go <LinkIcon />
</Button>
</>
),
text: 'Complete quests on Galxe.',
items: [
{
title: 'Source',
status: (
<>
<GalxeLogo />
</>
),
},
{ title: 'Bolts', status: '1 per Point' },
{ title: 'Earned', status: boltsEarnedData['GALXE'] || '-' },
],
},
{
title: 'Zealy',
button: (
<>
<Button secondary onClick={() => onClick('https://zealy.io/c/opendollar/questboard')}>
Zealy <LinkIcon />
Go <LinkIcon />
</Button>
</>
),
text: 'Complete tasks on Galxe and Zealy to earn Bolts.',
text: 'Complete quests on Zealy.',
items: [
{
title: 'Source',
status: (
<>
<GalxeLogo />
<ZealyLogo />
</>
),
},
{ title: 'Bolts', status: 'Varies' },
{ title: 'Earned', status: boltsEarnedData[6] || '-' },
{ title: 'Bolts', status: '1 per Point' },
{ title: 'Earned', status: boltsEarnedData['ZEALY'] || '-' },
],
},
]
Loading

0 comments on commit 431c261

Please sign in to comment.