Skip to content

Commit

Permalink
Merge pull request #305 from 00labs/update-redemption-content
Browse files Browse the repository at this point in the history
Update redemption content
  • Loading branch information
mliu authored Sep 14, 2024
2 parents 509780d + e0f8338 commit 64ba9d6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,18 @@ export function ChooseAmount({
lpConfig.withdrawalLockoutPeriodInDays * SECONDS_IN_A_DAY
if (nextEpochStartTime < lockupEndTime) {
const lockupEndTimeDayjs = dayjs.unix(lockupEndTime).date(1)
const withdrawTime = lockupEndTimeDayjs.add(1, 'month')
dispatch(setStep(WIDGET_STEP.Error))
dispatch(
setError({
errorReason: 'Redemption too soon',
errorMessage: `Your last deposit was on ${timestampToLL(
depositRecord!.lastDepositTime.toNumber(),
)}. You can redeem on ${timestampToLL(lockupEndTimeDayjs.unix())}.`,
)}. You can begin submitting redemption requests on ${timestampToLL(
lockupEndTimeDayjs.unix(),
)}, which can be redeemed starting ${timestampToLL(
withdrawTime.unix(),
)}.`,
}),
)
}
Expand Down
18 changes: 10 additions & 8 deletions packages/huma-widget/src/components/Lend/supplyV2/6-Success.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import {
import { sendTxAtom } from '@huma-finance/web-shared'
import { useWeb3React } from '@web3-react/core'
import { useAtom } from 'jotai'
import moment from 'moment'
import React, { useCallback, useEffect, useState } from 'react'
import { useDispatch } from 'react-redux'

import dayjs from 'dayjs'
import { Campaign } from '.'
import {
useDoesChainSupportNotifi,
Expand Down Expand Up @@ -90,14 +90,16 @@ export function Success({
]

const getSubContent = () => {
const currentTime = moment().add(
lpConfig.withdrawalLockoutPeriodInDays,
'days',
)
const redemptionTime = dayjs()
.add(lpConfig.withdrawalLockoutPeriodInDays, 'day')
.date(1)
const withdrawTime = redemptionTime.add(1, 'month')
return [
`First redemption date: ${timeUtil.timestampToLL(
currentTime.unix(),
)}. You can redeem end of each month after.`,
`You can begin submitting redemption requests on ${timeUtil.timestampToLL(
redemptionTime.unix(),
)}, which can be redeemed starting ${timeUtil.timestampToLL(
withdrawTime.unix(),
)}.`,
]
}

Expand Down

0 comments on commit 64ba9d6

Please sign in to comment.