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/remove ve #2038

Merged
merged 3 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion content/site.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"link": "/profile"
}
],
"announcement": "[Lock your OCEAN](https://df.oceandao.org/) to get veOCEAN, earn rewards and curate data.",
"announcement": "",
"warning": {
"ctd": "Please note that Compute-to-Data is still in alpha phase."
}
Expand Down
177 changes: 0 additions & 177 deletions src/@utils/veAllocation.ts

This file was deleted.

12 changes: 0 additions & 12 deletions src/components/@shared/AssetTeaser/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,6 @@ export default function AssetTeaser({
)}
</div>
<footer className={styles.footer}>
{allocated && allocated > 0 ? (
<span className={styles.typeLabel}>
{allocated < 0 ? (
''
) : (
<>
<strong>{formatNumber(allocated, locale, '0')}</strong>{' '}
veOCEAN
</>
)}
</span>
) : null}
{orders && orders > 0 ? (
<span className={styles.typeLabel}>
{orders < 0 ? (
Expand Down
41 changes: 1 addition & 40 deletions src/components/Asset/AssetActions/AssetStats/index.tsx
Original file line number Diff line number Diff line change
@@ -1,43 +1,12 @@
import { useAsset } from '@context/Asset'
import { useUserPreferences } from '@context/UserPreferences'
import Tooltip from '@shared/atoms/Tooltip'
import { formatNumber } from '@utils/numbers'
import { getNftOwnAllocation } from '@utils/veAllocation'
import React, { useEffect, useState } from 'react'
import { useAccount } from 'wagmi'
import React from 'react'
import styles from './index.module.css'

export default function AssetStats() {
const { locale } = useUserPreferences()
const { asset } = useAsset()
const { address: accountId } = useAccount()

const [ownAllocation, setOwnAllocation] = useState(0)

useEffect(() => {
if (!asset || !accountId) return

async function init() {
const allocation = await getNftOwnAllocation(
accountId,
asset.nftAddress,
asset.chainId
)
setOwnAllocation(allocation / 100)
}
init()
}, [accountId, asset])

return (
<footer className={styles.stats}>
{asset?.stats?.allocated && asset?.stats?.allocated > 0 ? (
<span className={styles.stat}>
<span className={styles.number}>
{formatNumber(asset.stats.allocated, locale, '0')}
</span>{' '}
veOCEAN
</span>
) : null}
{!asset?.stats || asset?.stats?.orders < 0 ? (
<span className={styles.stat}>N/A</span>
) : asset?.stats?.orders === 0 ? (
Expand All @@ -48,14 +17,6 @@ export default function AssetStats() {
{asset.stats.orders === 1 ? '' : 's'}
</span>
)}
{ownAllocation && ownAllocation > 0 ? (
<span className={styles.stat}>
<span className={styles.number}>{ownAllocation}</span>% allocated
<Tooltip
content={`You have ${ownAllocation}% of your total veOCEAN allocated to this asset.`}
/>
</span>
) : null}
</footer>
)
}
2 changes: 0 additions & 2 deletions src/components/Footer/MarketStats/_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@ export interface StatsTotal {
nfts: number
datatokens: number
orders: number
veAllocated: number
veLocked: number
}
31 changes: 2 additions & 29 deletions src/components/Footer/MarketStats/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@ import { useMarketMetadata } from '@context/MarketMetadata'
import Tooltip from '@shared/atoms/Tooltip'
import Markdown from '@shared/Markdown'
import content from '../../../../content/footer.json'
import { getTotalAllocatedAndLocked } from '@utils/veAllocation'
import PriceUnit from '@shared/Price/PriceUnit'
import Loader from '@components/@shared/atoms/Loader'

const initialTotal: StatsTotal = {
nfts: 0,
datatokens: 0,
orders: 0,
veAllocated: 0,
veLocked: 0
orders: 0
}

function LoaderArea() {
Expand Down Expand Up @@ -85,13 +81,6 @@ export default function MarketStats(): ReactElement {
setData(newData)
}, [mainChainIds])

async function addVeTotals(partialTotals: StatsTotal) {
const total: StatsTotal = { ...partialTotals }
const veTotals = await getTotalAllocatedAndLocked()
total.veAllocated = veTotals.totalAllocated
total.veLocked = veTotals.totalLocked
return total
}
//
// 1. Fetch Data
//
Expand Down Expand Up @@ -121,7 +110,7 @@ export default function MarketStats(): ReactElement {
}
}
async function setTotalAllocatedAndLocked() {
setTotal(await addVeTotals(newTotal))
setTotal(newTotal)
setLoading(false)
}
setTotalAllocatedAndLocked()
Expand All @@ -140,22 +129,6 @@ export default function MarketStats(): ReactElement {
}
/>
</div>
<div>
<PriceUnit
decimals="0"
price={total.veLocked}
symbol="OCEAN"
size="small"
/>{' '}
locked.{' '}
<PriceUnit
decimals="0"
price={total.veAllocated}
symbol="veOCEAN"
size="small"
/>{' '}
allocated.
</div>
</div>
)
}
47 changes: 0 additions & 47 deletions src/components/Home/Allocations/AssetListTable.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions src/components/Home/Allocations/index.module.css

This file was deleted.

Loading
Loading