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
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { getValidatorDashboardValidatorUrl } from "@/utils/validatorDashboardUti
import { getExplorerTxUrl, getExplorerAddressUrl } from "@/utils/explorerUtils"
import { useSequencerStatus, SequencerStatus } from "@/hooks/rollup/useSequencerStatus"
import { useStakeHealth } from "@/hooks/rollup/useStakeHealth"
import { useIsRewardsClaimable } from "@/hooks/rollup/useIsRewardsClaimable"
import { useGovernanceConfig } from "@/hooks/governance"
import { useClaimAllContext } from "@/contexts/ClaimAllContext"
import { WithdrawalActions } from "./WithdrawalActions"
Expand Down Expand Up @@ -58,8 +57,6 @@ export const ATPDetailsDelegationItem = ({
const { symbol, decimals } = useStakingAssetTokenDetails()
const { date, time } = formatBlockTimestamp(delegation.timestamp)
const { getSplitStatus, claimAllHook } = useClaimAllContext()
const { isRewardsClaimable } = useIsRewardsClaimable()

const { status, statusLabel, isLoading: isLoadingStatus, canFinalize, actualUnlockTime, refetch: refetchStatus } = useSequencerStatus(delegation.operatorAddress as Address)
const { withdrawalDelayDays } = useGovernanceConfig()

Expand Down Expand Up @@ -445,16 +442,14 @@ export const ATPDetailsDelegationItem = ({
providerTakeRate: delegation.providerTakeRate,
providerRewardsRecipient: delegation.providerRewardsRecipient
})}
disabled={delegationRewards.userRewards === 0n || isInBatch || isRewardsClaimable === false}
disabled={delegationRewards.userRewards === 0n || isInBatch}
className="px-3 py-1.5 border font-oracle-standard text-xs font-bold uppercase tracking-wide whitespace-nowrap transition-colors disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-parchment/10 disabled:border-parchment/30 disabled:text-parchment/60 border-chartreuse bg-chartreuse text-ink hover:bg-chartreuse/90"
title={
isRewardsClaimable === false
? "Rewards are currently locked by the network protocol"
: delegationRewards.userRewards === 0n
? "No rewards to claim"
: isInBatch
? "Processing in batch"
: "Claim delegation rewards"
delegationRewards.userRewards === 0n
? "No rewards to claim"
: isInBatch
? "Processing in batch"
: "Claim delegation rewards"
}
>
{isProcessingInBatch ? (
Expand All @@ -466,13 +461,9 @@ export const ATPDetailsDelegationItem = ({
'Claim Rewards'
)}
</button>
{(delegationRewards.userRewards === 0n || isRewardsClaimable === false) && (
{delegationRewards.userRewards === 0n && (
<TooltipIcon
content={
isRewardsClaimable === false
? "All rewards are currently locked by the network protocol. Claiming will be enabled once the protocol unlocks rewards."
: "No rewards available to claim yet. Rewards will accumulate as your delegated sequencer validates blocks."
}
content="No rewards available to claim yet. Rewards will accumulate as your delegated sequencer validates blocks."
size="sm"
maxWidth="max-w-xs"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { getValidatorDashboardValidatorUrl } from "@/utils/validatorDashboardUti
import { getExplorerTxUrl } from "@/utils/explorerUtils"
import { useSequencerStatus, SequencerStatus } from "@/hooks/rollup/useSequencerStatus"
import { useStakeHealth } from "@/hooks/rollup/useStakeHealth"
import { useIsRewardsClaimable } from "@/hooks/rollup/useIsRewardsClaimable"
import { useGovernanceConfig } from "@/hooks/governance"
import { ClaimSelfStakeRewardsModal } from "@/components/ClaimSelfStakeRewardsModal"
import { WithdrawalActions } from "./WithdrawalActions"
Expand Down Expand Up @@ -41,8 +40,6 @@ export const ATPDetailsDirectStakeItem = ({ stake, stakerAddress, rollupVersion,
const [isClaimModalOpen, setIsClaimModalOpen] = useState(false)
const { symbol, decimals } = useStakingAssetTokenDetails()
const { date, time } = formatBlockTimestamp(stake.timestamp)
const { isRewardsClaimable } = useIsRewardsClaimable()

const { status, statusLabel, isLoading: isLoadingStatus, canFinalize, actualUnlockTime, refetch: refetchStatus } = useSequencerStatus(stake.attesterAddress as Address)
const { withdrawalDelayDays } = useGovernanceConfig()

Expand Down Expand Up @@ -366,19 +363,11 @@ export const ATPDetailsDirectStakeItem = ({ stake, stakerAddress, rollupVersion,
<div className="flex items-center gap-2">
<button
onClick={() => setIsClaimModalOpen(true)}
disabled={isRewardsClaimable === false}
className="px-3 py-1.5 border font-oracle-standard text-xs font-bold uppercase tracking-wide whitespace-nowrap transition-colors disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-parchment/10 disabled:border-parchment/30 disabled:text-parchment/60 border-chartreuse bg-chartreuse text-ink hover:bg-chartreuse/90"
title={isRewardsClaimable === false ? "Rewards are currently locked by the network protocol" : "Claim self-stake rewards"}
className="px-3 py-1.5 border font-oracle-standard text-xs font-bold uppercase tracking-wide whitespace-nowrap transition-colors border-chartreuse bg-chartreuse text-ink hover:bg-chartreuse/90"
title="Claim self-stake rewards"
>
Claim Rewards
</button>
{isRewardsClaimable === false && (
<TooltipIcon
content="All rewards are currently locked by the network protocol. Claiming will be enabled once the protocol unlocks rewards."
size="sm"
maxWidth="max-w-xs"
/>
)}
</div>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useState, useEffect, useRef } from "react"
import { useAggregatedStakingData } from "@/hooks/atp/useAggregatedStakingData"
import { useMultipleStakeableAmounts } from "@/hooks/atp/useMultipleStakeableAmounts"
import { useStakingAssetTokenDetails } from "@/hooks/stakingRegistry"
import { useIsRewardsClaimable } from "@/hooks/rollup/useIsRewardsClaimable"
import { useCoinbaseAddresses, useMultipleCoinbaseRewards } from "@/hooks/rewards"
import { ATPDetailsModal } from "@/components/ATPDetailsModal"
import { ATPStakingOverviewSkeleton } from "./ATPStakingOverviewSkeleton"
Expand Down Expand Up @@ -58,9 +57,6 @@ export const ATPStakingOverview = ({ atpData, walletBalance = 0n }: ATPStakingOv
isLoading: isLoadingStakeable,
} = useMultipleStakeableAmounts(atpData)

// Check if rewards are claimable
const { isRewardsClaimable } = useIsRewardsClaimable()

// Get coinbase addresses and their rewards for self-stake tracking
const { coinbaseAddresses } = useCoinbaseAddresses()
const { totalCoinbaseRewards, coinbaseBreakdown, refetch: refetchCoinbaseRewards } = useMultipleCoinbaseRewards(coinbaseAddresses as Address[])
Expand Down Expand Up @@ -179,7 +175,6 @@ export const ATPStakingOverview = ({ atpData, walletBalance = 0n }: ATPStakingOv
totalRewards={totalRewards}
selfStakeRewards={totalCoinbaseRewards}
pendingWarehouseWithdrawal={pendingWarehouseWithdrawal}
isRewardsClaimable={isRewardsClaimable}
isExpanded={isTotalRewardsExpanded}
onToggle={() => setIsTotalRewardsExpanded(!isTotalRewardsExpanded)}
decimals={decimals}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ interface ATPStakingOverviewClaimableRewardsProps {
totalRewards: bigint
selfStakeRewards?: bigint
pendingWarehouseWithdrawal?: bigint
isRewardsClaimable?: boolean
isExpanded: boolean
onToggle: () => void
decimals: number
Expand All @@ -25,7 +24,7 @@ interface ATPStakingOverviewClaimableRewardsProps {
* Displays claimable delegation rewards and self-stake rewards
*/
export const ATPStakingOverviewClaimableRewards = forwardRef<HTMLDivElement, ATPStakingOverviewClaimableRewardsProps>(
({ totalRewards, selfStakeRewards = 0n, pendingWarehouseWithdrawal = 0n, isRewardsClaimable = true, isExpanded, onToggle, decimals, symbol, delegationBreakdown = [], coinbaseBreakdown = [], onClaimSuccess }, ref) => {
({ totalRewards, selfStakeRewards = 0n, pendingWarehouseWithdrawal = 0n, isExpanded, onToggle, decimals, symbol, delegationBreakdown = [], coinbaseBreakdown = [], onClaimSuccess }, ref) => {
const [isManageModalOpen, setIsManageModalOpen] = useState(false)
const [isClaimAllModalOpen, setIsClaimAllModalOpen] = useState(false)

Expand Down Expand Up @@ -85,18 +84,6 @@ export const ATPStakingOverviewClaimableRewards = forwardRef<HTMLDivElement, ATP
</div>
</div>

{/* Rewards Locked Warning */}
{!isRewardsClaimable && (
<div className="mt-4 pt-4 border-t border-parchment/10">
<div className="flex items-center gap-2 bg-amber-500/10 border border-amber-500/30 p-2">
<Icon name="lock" size="sm" className="text-amber-500 flex-shrink-0" />
<span className="text-xs text-amber-200">
Rewards are currently locked
</span>
</div>
</div>
)}

{/* Info message when no rewards */}
{combinedTotalRewards === 0n && (
<div className="mt-4 pt-4 border-t border-parchment/10">
Expand All @@ -117,7 +104,7 @@ export const ATPStakingOverviewClaimableRewards = forwardRef<HTMLDivElement, ATP
e.stopPropagation()
setIsClaimAllModalOpen(true)
}}
disabled={!isRewardsClaimable || combinedTotalRewards === 0n}
disabled={combinedTotalRewards === 0n}
className="w-full py-2 bg-chartreuse text-ink text-sm font-bold uppercase tracking-wide hover:bg-chartreuse/90 transition-colors flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed"
>
<Icon name="gift" size="sm" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Icon } from "@/components/Icon"
import { formatTokenAmount } from "@/utils/atpFormatters"
import { getValidatorDashboardValidatorUrl } from "@/utils/validatorDashboardUtils"
import { getExplorerTxUrl } from "@/utils/explorerUtils"
import { useIsRewardsClaimable } from "@/hooks/rollup/useIsRewardsClaimable"
import { useClaimAllContext } from "@/contexts/ClaimAllContext"
import type { ATPData } from "@/hooks/atp"
import type { DelegationBreakdown, Erc20DelegationBreakdown } from "@/hooks/atp/useAggregatedStakingData"
Expand Down Expand Up @@ -35,7 +34,6 @@ export const ATPStakingOverviewDelegationItem = ({
onClaimClick
}: ATPStakingOverviewDelegationItemProps) => {
const { getSplitStatus, claimAllHook } = useClaimAllContext()
const { isRewardsClaimable } = useIsRewardsClaimable()
const isWallet = variant === 'wallet'

const splitStatus = getSplitStatus(delegation.splitContract as Address)
Expand Down Expand Up @@ -152,12 +150,10 @@ export const ATPStakingOverviewDelegationItem = ({
</div>
<button
onClick={() => onClaimClick(delegation)}
disabled={delegation.rewards === 0n || isInBatch || isRewardsClaimable === false}
disabled={delegation.rewards === 0n || isInBatch}
className="px-2 py-0.5 border font-oracle-standard text-xs font-bold uppercase tracking-wide whitespace-nowrap transition-colors disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-parchment/10 disabled:border-parchment/30 disabled:text-parchment/60 border-chartreuse bg-chartreuse text-ink hover:bg-chartreuse/90"
title={
isRewardsClaimable === false
? "Rewards are currently locked by the network protocol"
: delegation.rewards === 0n
delegation.rewards === 0n
? "No rewards to claim"
: isInBatch
? "Processing in batch"
Expand All @@ -173,13 +169,6 @@ export const ATPStakingOverviewDelegationItem = ({
'Claim'
)}
</button>
{isRewardsClaimable === false && (
<TooltipIcon
content="All rewards are currently locked by the network protocol. Claiming will be enabled once the protocol unlocks rewards."
size="sm"
maxWidth="max-w-xs"
/>
)}
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Icon } from "@/components/Icon"
import { formatTokenAmount } from "@/utils/atpFormatters"
import { getValidatorDashboardValidatorUrl } from "@/utils/validatorDashboardUtils"
import { getExplorerTxUrl } from "@/utils/explorerUtils"
import { useIsRewardsClaimable } from "@/hooks/rollup/useIsRewardsClaimable"
import type { ATPData } from "@/hooks/atp"
import type { DirectStakeBreakdown, Erc20DirectStakeBreakdown } from "@/hooks/atp/useAggregatedStakingData"

Expand Down Expand Up @@ -32,7 +31,6 @@ export const ATPStakingOverviewDirectStakeItem = ({
onWalletClick,
onClaimClick
}: ATPStakingOverviewDirectStakeItemProps) => {
const { isRewardsClaimable } = useIsRewardsClaimable()
const isWallet = variant === 'wallet'

return (
Expand Down Expand Up @@ -119,19 +117,11 @@ export const ATPStakingOverviewDirectStakeItem = ({
<div className="flex items-center gap-1">
<button
onClick={() => onClaimClick?.(stake as DirectStakeBreakdown, atp)}
disabled={isRewardsClaimable === false}
className="px-2 py-0.5 border font-oracle-standard text-xs font-bold uppercase tracking-wide whitespace-nowrap transition-colors disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-parchment/10 disabled:border-parchment/30 disabled:text-parchment/60 border-chartreuse bg-chartreuse text-ink hover:bg-chartreuse/90"
title={isRewardsClaimable === false ? "Rewards are currently locked by the network protocol" : "Claim self-stake rewards"}
className="px-2 py-0.5 border font-oracle-standard text-xs font-bold uppercase tracking-wide whitespace-nowrap transition-colors border-chartreuse bg-chartreuse text-ink hover:bg-chartreuse/90"
title="Claim self-stake rewards"
>
Claim
</button>
{isRewardsClaimable === false && (
<TooltipIcon
content="All rewards are currently locked by the network protocol. Claiming will be enabled once the protocol unlocks rewards."
size="sm"
maxWidth="max-w-xs"
/>
)}
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useEffect, useMemo } from "react"
import { useAccount } from "wagmi"
import { useStakingAssetTokenDetails } from "@/hooks/stakingRegistry"
import { useIsRewardsClaimable } from "@/hooks/rollup/useIsRewardsClaimable"
import { useClaimAllContext } from "@/contexts/ClaimAllContext"
import { useAlert } from "@/contexts/AlertContext"
import type { Address } from "viem"
Expand All @@ -28,7 +27,6 @@ export const ClaimAllDelegationRewardsButton = ({
}: ClaimAllDelegationRewardsButtonProps) => {
const { address: beneficiary } = useAccount() // TODO : should get the address from atp.beneficiary to handle the condition where the connected address is operator
const { stakingAssetAddress: tokenAddress } = useStakingAssetTokenDetails()
const { isRewardsClaimable } = useIsRewardsClaimable()
const { claimAllHook } = useClaimAllContext()
const { showAlert } = useAlert()

Expand Down Expand Up @@ -81,7 +79,7 @@ export const ClaimAllDelegationRewardsButton = ({
claimAllHook.claimAll(tasks)
}

if (delegationsWithRewards.length === 0 || isRewardsClaimable === false) {
if (delegationsWithRewards.length === 0) {
return null
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { createPortal } from "react-dom"
import { Icon } from "@/components/Icon"
import { useClaimAllRewards } from "@/hooks/rewards"
import { useStakingAssetTokenDetails } from "@/hooks/stakingRegistry"
import { useIsRewardsClaimable } from "@/hooks/rollup/useIsRewardsClaimable"
import { ClaimAllRewardsSummary } from "./ClaimAllRewardsSummary"
import { ClaimAllRewardsProgress } from "./ClaimAllRewardsProgress"
import { ClaimAllRewardsSuccess } from "./ClaimAllRewardsSuccess"
Expand Down Expand Up @@ -38,9 +37,6 @@ export const ClaimAllRewardsModal = ({
// Token details
const { symbol, decimals } = useStakingAssetTokenDetails()

// Check if rewards are claimable
const { isRewardsClaimable } = useIsRewardsClaimable()

// Claim hook
const claimAllRewards = useClaimAllRewards()

Expand Down Expand Up @@ -154,7 +150,6 @@ export const ClaimAllRewardsModal = ({
pendingWarehouseWithdrawal={pendingWarehouseWithdrawal}
decimals={decimals ?? 18}
symbol={symbol ?? ""}
isRewardsClaimable={isRewardsClaimable ?? false}
onStartClaiming={handleStartClaiming}
isDisabled={false}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ interface ClaimAllRewardsSummaryProps {
pendingWarehouseWithdrawal?: bigint
decimals: number
symbol: string
isRewardsClaimable: boolean
onStartClaiming: () => void
isDisabled: boolean
}
Expand All @@ -23,7 +22,6 @@ export const ClaimAllRewardsSummary = ({
pendingWarehouseWithdrawal = 0n,
decimals,
symbol,
isRewardsClaimable,
onStartClaiming,
isDisabled
}: ClaimAllRewardsSummaryProps) => {
Expand All @@ -41,21 +39,6 @@ export const ClaimAllRewardsSummary = ({

return (
<div className="space-y-6">
{/* Rewards Locked Warning */}
{!isRewardsClaimable && (
<div className="bg-amber-500/10 border border-amber-500/30 p-4">
<div className="flex items-start gap-3">
<Icon name="warning" size="md" className="text-amber-500 flex-shrink-0 mt-0.5" />
<div>
<p className="text-amber-500 font-bold text-sm">Rewards Locked</p>
<p className="text-parchment/60 text-xs mt-1">
Rewards are currently locked and cannot be claimed. Check back later.
</p>
</div>
</div>
</div>
)}

{/* Total */}
<div className="bg-chartreuse/10 border border-chartreuse/30 p-4">
<div className="text-xs text-parchment/60 uppercase tracking-wide mb-1">
Expand Down Expand Up @@ -187,18 +170,14 @@ export const ClaimAllRewardsSummary = ({
{/* Claim Button */}
<button
onClick={onStartClaiming}
disabled={isDisabled || !hasRewards || !isRewardsClaimable}
disabled={isDisabled || !hasRewards}
className="w-full py-4 bg-chartreuse text-ink font-oracle-standard font-bold text-sm uppercase tracking-wider hover:bg-chartreuse/90 transition-all disabled:opacity-50 disabled:cursor-not-allowed"
>
{!isRewardsClaimable
? "Rewards Locked"
: !hasRewards
? "No Rewards to Claim"
: "Claim All Rewards"}
{!hasRewards ? "No Rewards to Claim" : "Claim All Rewards"}
</button>

{/* Transaction Info */}
{hasRewards && isRewardsClaimable && (
{hasRewards && (
<p className="text-xs text-parchment/40 text-center">
This will require multiple transactions. Each claim will prompt for approval.
</p>
Expand Down
Loading