Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
devchenyan committed Mar 3, 2024
1 parent 52a5546 commit 74337b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/neuron-ui/src/components/DepositDialog/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,17 +281,21 @@ export const useDepositRewards = ({
maxDepositValue,
disabled,
globalAPC,
isBalanceReserved,
}: {
depositValue: string
maxDepositValue: string | null
disabled: boolean
globalAPC: number
isBalanceReserved: boolean
}) => {
const [annualRewards, monthRewards] = useMemo(() => {
if (disabled) return ['0', '0']

const value = CKBToShannonFormatter(
(Number(maxDepositValue || depositValue) - MIN_DEPOSIT_AMOUNT).toFixed(MAX_DECIMAL_DIGITS).toString()
(Number(maxDepositValue || depositValue) - (isBalanceReserved ? MIN_DEPOSIT_AMOUNT : 0))
.toFixed(MAX_DECIMAL_DIGITS)
.toString()
)

const dpc = globalAPC / 365 / 100
Expand All @@ -301,7 +305,7 @@ export const useDepositRewards = ({
const rewerds = (Number(value) * dpc * 360).toFixed(0).toString()

return [rewerds, mRewards]
}, [depositValue, maxDepositValue, disabled, globalAPC])
}, [depositValue, maxDepositValue, disabled, globalAPC, isBalanceReserved])

return {
annualRewards,
Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/src/components/DepositDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const DepositDialog = ({
maxDepositValue,
disabled,
globalAPC,
isBalanceReserved,
})

const isChinese = language === 'zh' || language.startsWith('zh-')
Expand Down

0 comments on commit 74337b1

Please sign in to comment.