Skip to content

Commit

Permalink
Merge branch 'marketplace' into mainnet/marketplace
Browse files Browse the repository at this point in the history
  • Loading branch information
RedBeardEth committed Jan 19, 2024
2 parents 93e3af8 + 3cd6f60 commit c2b8154
Show file tree
Hide file tree
Showing 7 changed files with 1,668 additions and 58 deletions.
24 changes: 19 additions & 5 deletions apps/nextjs/src/app/_components/staking/PaymentPoolV2.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
import { useAirdropClaim } from "@/hooks/useAirdropClaim";
import Lords from "@/icons/lords.svg";

import { Button } from "@realms-world/ui";

export const PaymentPoolV2 = () => {
const { dataLoading, numTokens, alreadyClaimed, claimAirdrop } =
const { numTokens, alreadyClaimed, claimAirdrop, balance } =
useAirdropClaim();

return (
<div className="flex-col pb-2 text-lg">
<div>
<Button onClick={claimAirdrop}>claim</Button>
</div>
<div className="flex-col border p-8 text-lg">
{numTokens > 0 && !balance ? (
<div>
<div className="mb-5 flex justify-center space-x-2 text-2xl ">
{numTokens ? numTokens.toLocaleString() : 0}{" "}
<Lords className="ml-2 h-5 w-5 self-center fill-current" />
</div>

{numTokens && (
<Button onClick={claimAirdrop}>
{alreadyClaimed ? "claimed" : "claim lords"}
</Button>
)}
</div>
) : (
"No tokens to claim"
)}
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export function ListModal({
value={price}
min={0}
onChange={(e) => {
setPrice(parseInt(e.target.value));
setPrice(parseInt(e.target.value || "0"));
}}
placeholder="Amount"
className={"h-12 w-full"}
Expand Down
3 changes: 2 additions & 1 deletion apps/nextjs/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const metadata: Metadata = {
},
twitter: {
card: "summary_large_image",
title: "Realms.World |" + title,
title: "Realms.World | " + title,
description: description,
siteId: "1467726470533754880",
creator: "@bibliothecadao",
Expand All @@ -106,6 +106,7 @@ export const metadata: Metadata = {
url: "/backgrounds/banner.png",
width: 800,
height: 600,
alt: "Realms Autonomous World",
},
{
url: "/backgrounds/banner.png",
Expand Down
129 changes: 125 additions & 4 deletions apps/nextjs/src/app/staking/StakingContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,131 @@ export const StakingContainer = () => {
)}
</div>
</div>
<h3 className="mt-10">Rewards</h3>
{/* <PaymentPoolV2 /> */}
<h3 className="mt-10">Galleon</h3>
<div className="flex-col pb-2 text-lg">
</div>
<h3 className="mt-10">Epoch 35-109 Rewards</h3>
<PaymentPoolV2 />
<h3 className="mt-10">Galleon</h3>
<div className="flex-col pb-2 text-lg">
<span className="bg-dark-green px-2 py-1">
Rewards: 49x $LORDS per epoch (a bonus of 12% over Carrack)
</span>
<br />
<span className="bg-dark-green px-2 py-1">
Redemption: Lords are locked until DAO approves the migration to
Starknet
</span>
</div>
<div className="grid grid-cols-2 gap-4 sm:gap-6">
<div className="flex flex-col justify-center rounded border bg-dark-green pb-8 pt-6">
{realmsDataIsLoading ? (
"Loading"
) : (
<>
<span className="text-2xl">
{realmsData?.wallet?.bridgedRealmsHeld || 0}
</span>
<span className="mb-4">Realms Staked</span>
<StakingModal
unstake
type="galleon"
realms={realmsData?.bridgedRealms}
/>
</>
)}
</div>
<div className="flex flex-col rounded border bg-dark-green pb-8 pt-6">
<span className="pb-4 text-lg">Lords Available</span>

{!isGalleonLordsLoading && typeof lordsAvailableData == "bigint" ? (
<div className="flex items-center justify-center">
<span className="mr-6 text-sm">Epoch 1-10:</span>
<span className="mr-3 flex">
<Lords className="mr-2 h-5 w-5 fill-current" />
{formatEther(lordsAvailableData)}
</span>
<Button
disabled={
lordsAvailableData == 0n ||
isGalleonClaimLoading ||
isCarrackClaimLoading
}
size={"sm"}
className="self-center"
variant={"outline"}
onClick={() =>
claimGalleonLords({
address: stakingAddresses[NETWORK_NAME]
.v1Galleon as `0x${string}`,
abi: GalleonStaking,
functionName: "claimLords",
})
}
>
{isGalleonClaimLoading || isCarrackClaimLoading ? (
<>
<Loader2 className="h-5 w-5 animate-spin" />
Claiming
</>
) : (
"Claim"
)}
</Button>
</div>
) : (
"Loading"
)}
{!poolWithdrawalsLoading ? (
<div className="mt-2 flex items-center justify-center">
<span className="mr-6 text-sm">Epoch 11-35:</span>
<span className="mr-3 flex">
<Lords className="mr-2 h-5 w-5 fill-current" />
{formatEther(poolClaimAmount ?? 0n).toLocaleString()} /{" "}
{formatEther(poolTotal ?? 0n).toLocaleString() ?? 0n}
</span>
<Button
disabled={
!poolClaimAmount ||
poolClaimAmount == 0n ||
isPoolClaimLoading
}
size={"sm"}
className="self-center"
variant={"outline"}
onClick={() =>
claimPoolLords({
address: stakingAddresses[NETWORK_NAME]
.paymentPool as `0x${string}`,
abi: paymentPoolAbi,
functionName: "withdraw",
args: [
parseEther(poolClaimAmount?.toString() ?? "0"),
hexProof as any,
],
})
}
>
{isPoolClaimLoading ? (
<>
<Loader2 className="h-5 w-5 animate-spin" />
Claiming
</>
) : (
"Claim"
)}
</Button>
</div>
) : (
"Loading"
)}
<span className="mt-3 text-sm">
Epoch 35+: <span className="ml-3">Future claim on Starknet</span>
</span>
</div>
</div>

<div className="mt-10 flex flex-col">
<h3>Carrack</h3>
<div className="pb-2 text-lg">
<span className="bg-dark-green px-2 py-1">
Rewards: 49x $LORDS per epoch (a bonus of 12% over Carrack)
</span>
Expand Down
Loading

0 comments on commit c2b8154

Please sign in to comment.