|
|
@@ -51,6 +51,7 @@ interface RecordInfo {
|
|
|
pnlUsdPercent: string
|
|
|
PriceRange: string
|
|
|
totalDeposit: string
|
|
|
+ totalWithdraw: string
|
|
|
earnedUsd: string
|
|
|
earnedUsdPercent: string
|
|
|
allCopyAmount: string
|
|
|
@@ -72,6 +73,12 @@ interface RecordInfo {
|
|
|
fromCreatorPositionStatus: number
|
|
|
fromCreatorPosition: string
|
|
|
}
|
|
|
+ parentPositionInfo?: {
|
|
|
+ totalClaimedFeeAndReward: string
|
|
|
+ totalUnClaimedFeeAndReward: string
|
|
|
+ totalDeposit: string
|
|
|
+ totalWithdraw: string
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function MyLPPageContent() {
|
|
|
@@ -118,6 +125,7 @@ function MyLPPageContent() {
|
|
|
let isParentPositionClosed = false
|
|
|
let parentLiquidityUsd = 0
|
|
|
let childPositionList: RecordInfo[] = []
|
|
|
+ let parentPositionInfo: RecordInfo | null = null
|
|
|
|
|
|
if (bonusInfo?.fromCreatorPosition) {
|
|
|
const copyInfo = await Promise.all([
|
|
|
@@ -144,6 +152,7 @@ function MyLPPageContent() {
|
|
|
}
|
|
|
isParentPositionClosed = detailData.result.data.status === 1
|
|
|
parentLiquidityUsd = detailData.result.data.totalDeposit
|
|
|
+ parentPositionInfo = detailData.result.data
|
|
|
}
|
|
|
const newData = {
|
|
|
...data.result.data,
|
|
|
@@ -152,6 +161,7 @@ function MyLPPageContent() {
|
|
|
parentLiquidityUsd,
|
|
|
allCopyAmount,
|
|
|
allCopys,
|
|
|
+ parentPositionInfo,
|
|
|
}
|
|
|
return {
|
|
|
positionAddress: position.positionAddress,
|
|
|
@@ -612,6 +622,95 @@ function MyLPPageContent() {
|
|
|
</span>
|
|
|
),
|
|
|
},
|
|
|
+ {
|
|
|
+ title: (
|
|
|
+ <span>
|
|
|
+ 1U ROI{' '}
|
|
|
+ <Tooltip title="当前状态下,假设一开始复制金额为 1U 可获得的奖励">
|
|
|
+ <span style={{ cursor: 'help' }}>❓</span>
|
|
|
+ </Tooltip>
|
|
|
+ </span>
|
|
|
+ ),
|
|
|
+ key: 'oneURoi',
|
|
|
+ render: (_text: string, record: RecordInfo) => {
|
|
|
+ const claimed =
|
|
|
+ Number(record.parentPositionInfo?.totalClaimedFeeAndReward) || 0
|
|
|
+ const unclaimed =
|
|
|
+ Number(record.parentPositionInfo?.totalUnClaimedFeeAndReward) || 0
|
|
|
+ const parentFee = claimed + unclaimed
|
|
|
+ const totalCopyAmount = Number(record.allCopyAmount) || 0
|
|
|
+ const oneURoi =
|
|
|
+ totalCopyAmount > 0 ? (parentFee * 0.05) / totalCopyAmount : 0
|
|
|
+ return (
|
|
|
+ <span className="font-mono text-base font-bold">
|
|
|
+ {oneURoi.toFixed(4)}
|
|
|
+ </span>
|
|
|
+ )
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: (
|
|
|
+ <span>
|
|
|
+ 1U/Day 回报额{' '}
|
|
|
+ <Tooltip title="复制金额为 1U 时,每天可获得的奖励">
|
|
|
+ <span style={{ cursor: 'help' }}>❓</span>
|
|
|
+ </Tooltip>
|
|
|
+ </span>
|
|
|
+ ),
|
|
|
+ key: 'oneUPerDayRoi',
|
|
|
+ render: (_text: string, record: RecordInfo) => {
|
|
|
+ const claimed =
|
|
|
+ Number(record.parentPositionInfo?.totalClaimedFeeAndReward) || 0
|
|
|
+ const unclaimed =
|
|
|
+ Number(record.parentPositionInfo?.totalUnClaimedFeeAndReward) || 0
|
|
|
+ const parentFee = claimed + unclaimed
|
|
|
+ const totalCopyAmount = Number(record.allCopyAmount) || 0
|
|
|
+ const openTime = record.openTime || 0
|
|
|
+ const now = Date.now()
|
|
|
+ const days = (now - openTime) / (24 * 60 * 60 * 1000) || 1
|
|
|
+ const oneUPerDayRoi =
|
|
|
+ days > 0 && totalCopyAmount > 0
|
|
|
+ ? (parentFee * 0.05) / days / totalCopyAmount
|
|
|
+ : 0
|
|
|
+ return (
|
|
|
+ <span className="font-mono text-base font-bold">
|
|
|
+ {oneUPerDayRoi.toFixed(4)}
|
|
|
+ </span>
|
|
|
+ )
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: (
|
|
|
+ <span>
|
|
|
+ 当前日ROI{' '}
|
|
|
+ <Tooltip title="当前每天的 ROI 回报">
|
|
|
+ <span style={{ cursor: 'help' }}>❓</span>
|
|
|
+ </Tooltip>
|
|
|
+ </span>
|
|
|
+ ),
|
|
|
+ key: 'currentRoi',
|
|
|
+ render: (_text: string, record: RecordInfo) => {
|
|
|
+ const claimed =
|
|
|
+ Number(record.parentPositionInfo?.totalClaimedFeeAndReward) || 0
|
|
|
+ const unclaimed =
|
|
|
+ Number(record.parentPositionInfo?.totalUnClaimedFeeAndReward) || 0
|
|
|
+ const parentFee = claimed + unclaimed
|
|
|
+ const liquidityUsd = Number(record.liquidityUsd) || 0
|
|
|
+ const totalCopyAmount = Number(record.allCopyAmount) || 0
|
|
|
+ const openTime = record.openTime || 0
|
|
|
+ const now = Date.now()
|
|
|
+ const days = (now - openTime) / (24 * 60 * 60 * 1000) || 1
|
|
|
+ const currentRoi =
|
|
|
+ days > 0 && totalCopyAmount > 0
|
|
|
+ ? (((parentFee * 0.05) / days) * liquidityUsd) / totalCopyAmount
|
|
|
+ : 0
|
|
|
+ return (
|
|
|
+ <span className="font-mono text-base font-bold">
|
|
|
+ {currentRoi.toFixed(4)}
|
|
|
+ </span>
|
|
|
+ )
|
|
|
+ },
|
|
|
+ },
|
|
|
{
|
|
|
title: '总复制金额/复制数',
|
|
|
dataIndex: 'allCopyAmount',
|
|
|
@@ -627,11 +726,57 @@ function MyLPPageContent() {
|
|
|
title: '上级金额',
|
|
|
dataIndex: 'parentLiquidityUsd',
|
|
|
key: 'parentLiquidityUsd',
|
|
|
- render: (text: string) => (
|
|
|
- <span className="font-mono text-sm text-purple-500">
|
|
|
- ${Number(text).toFixed(2)}
|
|
|
- </span>
|
|
|
- ),
|
|
|
+ render: (_text: string, record: RecordInfo) => {
|
|
|
+ const parentDeposit =
|
|
|
+ Number(record.parentPositionInfo?.totalDeposit) || 0
|
|
|
+ const parentWithdraw =
|
|
|
+ Number(record.parentPositionInfo?.totalWithdraw) || 0
|
|
|
+ const parentAmount = parentDeposit - parentWithdraw
|
|
|
+ const displayAmount = parentAmount < 0 ? 0.01 : parentAmount
|
|
|
+ return (
|
|
|
+ <span className="font-mono text-sm text-purple-500">
|
|
|
+ ${displayAmount.toFixed(2)}
|
|
|
+ </span>
|
|
|
+ )
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '上级 fee',
|
|
|
+ key: 'parentFee',
|
|
|
+ render: (_text: string, record: RecordInfo) => {
|
|
|
+ const claimed =
|
|
|
+ Number(record.parentPositionInfo?.totalClaimedFeeAndReward) || 0
|
|
|
+ const unclaimed =
|
|
|
+ Number(record.parentPositionInfo?.totalUnClaimedFeeAndReward) || 0
|
|
|
+ const parentFee = claimed + unclaimed
|
|
|
+ return (
|
|
|
+ <span className="font-mono text-sm text-orange-500">
|
|
|
+ ${parentFee.toFixed(2)}
|
|
|
+ </span>
|
|
|
+ )
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '上级 fee/tvl',
|
|
|
+ key: 'parentFeeRatio',
|
|
|
+ render: (_text: string, record: RecordInfo) => {
|
|
|
+ const claimed =
|
|
|
+ Number(record.parentPositionInfo?.totalClaimedFeeAndReward) || 0
|
|
|
+ const unclaimed =
|
|
|
+ Number(record.parentPositionInfo?.totalUnClaimedFeeAndReward) || 0
|
|
|
+ const parentFee = claimed + unclaimed
|
|
|
+ const parentDeposit =
|
|
|
+ Number(record.parentPositionInfo?.totalDeposit) || 0
|
|
|
+ const parentWithdraw =
|
|
|
+ Number(record.parentPositionInfo?.totalWithdraw) || 0
|
|
|
+ const parentAmount = parentDeposit - parentWithdraw
|
|
|
+ const ratio = parentAmount > 0 ? (parentFee / parentAmount) * 100 : 0
|
|
|
+ return (
|
|
|
+ <span className="font-mono text-sm text-blue-500">
|
|
|
+ {ratio.toFixed(2)}%
|
|
|
+ </span>
|
|
|
+ )
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
title: '上级地址',
|