-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tangle-dapp): Implement stake & unstake liquifier functionality …
…for EVM-based liquid staking (#2500)
- Loading branch information
1 parent
37aafc3
commit de9b89f
Showing
87 changed files
with
3,687 additions
and
1,236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 0 additions & 59 deletions
59
apps/tangle-dapp/app/liquid-staking/[tokenSymbol]/page.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { Typography } from '@webb-tools/webb-ui-components'; | ||
import { FC } from 'react'; | ||
|
||
import { GlassCard } from '../../../components'; | ||
import LsOverviewItem from '../../../components/LiquidStaking/stakeAndUnstake/LsOverviewItem'; | ||
import StatItem from '../../../components/LiquidStaking/StatItem'; | ||
import { LS_PROTOCOLS } from '../../../constants/liquidStaking/constants'; | ||
import { LsProtocolId } from '../../../constants/liquidStaking/types'; | ||
|
||
const LiquidStakingPage: FC = () => { | ||
return ( | ||
<div className="flex flex-col gap-10"> | ||
<GlassCard className="flex flex-row items-center justify-between w-full overflow-x-auto"> | ||
<div className="flex flex-col gap-2"> | ||
<Typography variant="h5" fw="bold"> | ||
Tangle Liquid Staking | ||
</Typography> | ||
|
||
<Typography variant="body1" fw="normal"> | ||
Get Liquid Staking Tokens (LSTs) to earn & unleash restaking on | ||
Tangle Mainnet via delegation. | ||
</Typography> | ||
</div> | ||
|
||
<div className="flex gap-6 h-full"> | ||
<StatItem title="$123.01" subtitle="My Total Staking" /> | ||
</div> | ||
</GlassCard> | ||
|
||
<div className="flex flex-col gap-4"> | ||
<Typography variant="h4" fw="bold"> | ||
Liquid Staking Tokens | ||
</Typography> | ||
|
||
<GlassCard className="space-y-4"> | ||
<div className="overflow-x-auto"> | ||
<div className="flex flex-col gap-4 min-w-[750px]"> | ||
{LS_PROTOCOLS.map((protocol) => { | ||
return ( | ||
<LsOverviewItem | ||
key={protocol.id} | ||
title={`Tangle Liquid ${protocol.name}`} | ||
tokenSymbol={protocol.token} | ||
// TODO: Can't pass non-plain objects as props to Client components from Server components (this page). For now, passing in as a string then creating BN instance inside the component. | ||
totalStaked="100000000" | ||
totalValueStaked={220_000_123} | ||
hasLiquidIndicator={ | ||
protocol.id !== LsProtocolId.TANGLE_RESTAKING_PARACHAIN | ||
} | ||
/> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
</GlassCard> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default LiquidStakingPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,65 @@ | ||
import { Typography } from '@webb-tools/webb-ui-components'; | ||
'use client'; | ||
|
||
import { FC } from 'react'; | ||
|
||
import { GlassCard } from '../../components'; | ||
import LiquidStakingTokenItem from '../../components/LiquidStaking/stakeAndUnstake/LiquidStakingTokenItem'; | ||
import StatItem from '../../components/LiquidStaking/StatItem'; | ||
import { LIQUID_STAKING_CHAINS } from '../../constants/liquidStaking'; | ||
import { LiquidStakingSelectionTable } from '../../components/LiquidStaking/LiquidStakingSelectionTable'; | ||
import LiquidStakeCard from '../../components/LiquidStaking/stakeAndUnstake/LiquidStakeCard'; | ||
import LiquidUnstakeCard from '../../components/LiquidStaking/stakeAndUnstake/LiquidUnstakeCard'; | ||
import UnlockNftsTable from '../../components/LiquidStaking/unlockNftsTable/UnlockNftsTable'; | ||
import UnstakeRequestsTable from '../../components/LiquidStaking/unstakeRequestsTable/UnstakeRequestsTable'; | ||
import { LsSearchParamKey } from '../../constants/liquidStaking/types'; | ||
import { useLiquidStakingStore } from '../../data/liquidStaking/useLiquidStakingStore'; | ||
import useSearchParamState from '../../hooks/useSearchParamState'; | ||
import isLsParachainChainId from '../../utils/liquidStaking/isLsParachainChainId'; | ||
import TabListItem from '../restake/TabListItem'; | ||
import TabsList from '../restake/TabsList'; | ||
|
||
enum SearchParamAction { | ||
STAKE = 'stake', | ||
UNSTAKE = 'unstake', | ||
} | ||
|
||
const LiquidStakingTokenPage: FC = () => { | ||
const [isStaking, setIsStaking] = useSearchParamState({ | ||
defaultValue: true, | ||
key: LsSearchParamKey.ACTION, | ||
parser: (value) => value === SearchParamAction.STAKE, | ||
stringify: (value) => | ||
value ? SearchParamAction.STAKE : SearchParamAction.UNSTAKE, | ||
}); | ||
|
||
const { selectedProtocolId } = useLiquidStakingStore(); | ||
|
||
const LiquidStakingPage: FC = () => { | ||
return ( | ||
<div className="flex flex-col gap-10"> | ||
<GlassCard className="flex flex-row items-center justify-between w-full overflow-x-auto"> | ||
<div className="flex flex-col gap-2"> | ||
<Typography variant="h5" fw="bold"> | ||
Tangle Liquid Staking | ||
</Typography> | ||
|
||
<Typography variant="body1" fw="normal"> | ||
Get Liquid Staking Tokens (LSTs) to earn & unleash restaking on | ||
Tangle Mainnet via delegation. | ||
</Typography> | ||
</div> | ||
|
||
<div className="flex gap-6 h-full"> | ||
<StatItem title="$123.01" subtitle="My Total Staking" /> | ||
</div> | ||
</GlassCard> | ||
|
||
<div className="flex flex-col gap-4"> | ||
<Typography variant="h4" fw="bold"> | ||
Liquid Staking Tokens | ||
</Typography> | ||
|
||
<GlassCard className="space-y-4"> | ||
<div className="overflow-x-auto"> | ||
<div className="flex flex-col gap-4 min-w-[750px]"> | ||
{LIQUID_STAKING_CHAINS.map((chain) => { | ||
return ( | ||
<LiquidStakingTokenItem | ||
key={chain.id} | ||
title={`Tangle ${chain.name}`} | ||
tokenSymbol={chain.token} | ||
// TODO: Can't pass non-plain objects as props to Client components from Server components (this page). For now, passing in as a string then creating BN instance inside the component. | ||
totalStaked="100000000" | ||
totalValueStaked={220_000_123} | ||
/> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
</GlassCard> | ||
<div className="flex flex-wrap gap-12"> | ||
<div className="flex flex-col gap-4 w-full min-w-[450px] max-w-[600px]"> | ||
<TabsList className="w-full"> | ||
<TabListItem isActive={isStaking} onClick={() => setIsStaking(true)}> | ||
Stake | ||
</TabListItem> | ||
|
||
<TabListItem | ||
isActive={!isStaking} | ||
onClick={() => setIsStaking(false)} | ||
> | ||
Unstake | ||
</TabListItem> | ||
</TabsList> | ||
|
||
{isStaking ? <LiquidStakeCard /> : <LiquidUnstakeCard />} | ||
</div> | ||
|
||
<div className="flex flex-col flex-grow w-min gap-4 min-w-[370px]"> | ||
{isStaking ? ( | ||
<LiquidStakingSelectionTable /> | ||
) : isLsParachainChainId(selectedProtocolId) ? ( | ||
<UnstakeRequestsTable /> | ||
) : ( | ||
<UnlockNftsTable tokenId={selectedProtocolId} /> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default LiquidStakingPage; | ||
export default LiquidStakingTokenPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.