Skip to content
Open
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
4 changes: 2 additions & 2 deletions src/lib/bonding-curve/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export async function getTokenSellPrice(amount: string, currentSupply: string, c

export async function getTokenNextBuyPrice(currentSupply: string, curveState: CurveState) {
if (!curveState || !curveState.steps) return '0'
let currentSupplyBn = BigNumber(currentSupply)
let currentSupplyBn = BigNumber(currentSupply).multipliedBy(BigNumber(10).pow(BigNumber(curveState.repoToken.denomination)))
const maxSupplyBn = BigNumber(curveState.maxSupply)

// Get curve steps from state
Expand All @@ -141,7 +141,7 @@ export async function getTokenNextBuyPrice(currentSupply: string, curveState: Cu
}
}

return nextPrice.toString()
return nextPrice.toFixed()
}

export async function getCurrentStep(currentSupply: string, steps: CurveStep[]) {
Expand Down
31 changes: 17 additions & 14 deletions src/pages/repository/components/RepoHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,18 +198,21 @@ export default function RepoHeader({ repo, isLoading, owner, parentRepo }: Props
Tokenized
</span>
)}
{isDecentralized && repo.tokenType === 'BONDING_CURVE' && repo.token && repo.token.processId && (
<div className="flex items-center gap-2">
<div className="flex items-center">
<Button
className="!bg-[#26d9af] text-gray-200 !px-2 text-sm font-medium rounded-md h-full !py-[1px] justify-between gap-1"
variant="solid"
onClick={handleTradeClick}
>
<img src={imgUrlFormatter(repo.token.tokenImage)} className="w-4 h-4" />
Buy
</Button>
{/* {tokenBalLoading && <BeatLoader size={8} color="#56ADD9" />}
{isDecentralized &&
repo.token &&
(repo.tokenType ? repo.tokenType === 'BONDING_CURVE' : true) &&
repo.token.processId && (
<div className="flex items-center gap-2">
<div className="flex items-center">
<Button
className="!bg-[#26d9af] text-gray-200 !px-2 text-sm font-medium rounded-md h-full !py-[1px] justify-between gap-1"
variant="solid"
onClick={handleTradeClick}
>
<img src={imgUrlFormatter(repo.token.tokenImage)} className="w-4 h-4" />
Buy
</Button>
{/* {tokenBalLoading && <BeatLoader size={8} color="#56ADD9" />}
{!tokenBalLoading && (
<span
onClick={handleTokenBalClick}
Expand All @@ -225,9 +228,9 @@ export default function RepoHeader({ repo, isLoading, owner, parentRepo }: Props
onClick={fetchAndSetTokenBal}
className="w-5 h-5 cursor-pointer text-primary-600"
/> */}
</div>
</div>
</div>
)}
)}
{isDecentralized && repo.tokenType === 'IMPORT' && importedTokenDetails && (
<div className="flex items-center border-[1px] border-primary-600 gap-1 font-regular bg-primary-600 text-white rounded-full h-full text-sm px-2">
<img src={imgUrlFormatter(importedTokenDetails.tokenImage)} className="w-4 h-4" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@ import React from 'react'
import { formatNumberUsingNumeral } from '../../helpers/customFormatNumbers'

interface MarketStatsProps {
marketCapUSD: string
marketCap: string
volume: string
circulatingSupply: string
baseTokenTicker: string
}

const MarketStats: React.FC<MarketStatsProps> = ({ marketCap, volume, circulatingSupply }) => {
const MarketStats: React.FC<MarketStatsProps> = ({ marketCapUSD, marketCap, volume, circulatingSupply, baseTokenTicker }) => {
return (
<div className="bg-white shadow-md rounded-lg p-6 w-full">
<h2 className="text-lg font-semibold mb-4">Market Stats</h2>
<div className="grid grid-cols-3 gap-4">
<div className="grid grid-cols-4 gap-4">
<div className="flex flex-col">
<span className="text-gray-500 text-sm">Market Cap</span>
<span className="text-2xl font-bold">${marketCap}</span>
<span className="text-gray-500 text-sm">Market Cap (USD)</span>
<span className="text-2xl font-bold">${marketCapUSD}</span>
</div>
<div className="flex flex-col">
<span className="text-gray-500 text-sm">Market Cap ({baseTokenTicker})</span>
<span className="text-2xl font-bold">{marketCap}</span>
</div>
<div className="flex flex-col">
<span className="text-gray-500 text-sm">24h Volume</span>
Expand Down
Loading