Skip to content

[TOOL-4689] Dashboard: Integrate ERC20Asset contract in token creation flow #7344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 26 commits into
base: yash/ocr-contracts-integration
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8702a49
[TOOL-4689] Dashboard: Integrate ERC20Asset contract in token creatio…
MananTank Jun 16, 2025
991051d
Merge branch 'yash/ocr-contracts-integration' into 06-16-_tool-4689_d…
MananTank Jul 1, 2025
2702e39
Merge branch 'yash/ocr-contracts-integration' into 06-16-_tool-4689_d…
MananTank Jul 1, 2025
4f457e9
add POST v1/tokens after coin creation
MananTank Jul 3, 2025
b6563b8
Fix createTokenOnUniversalBridge
MananTank Jul 3, 2025
5277e18
Merge branch 'yash/ocr-contracts-integration' into 06-16-_tool-4689_d…
MananTank Jul 7, 2025
7f7d97a
Fix lint
MananTank Jul 7, 2025
1aebfc8
set initialTick
MananTank Jul 9, 2025
1e8ca5a
Merge branch 'yash/ocr-contracts-integration' into 06-16-_tool-4689_d…
MananTank Jul 10, 2025
1d31fd0
Merge branch 'yash/ocr-contracts-integration' into 06-16-_tool-4689_d…
MananTank Jul 10, 2025
8a2e39c
update
MananTank Jul 10, 2025
f29a2c2
update tick calc
MananTank Jul 10, 2025
f61d0e0
Merge branch 'yash/ocr-contracts-integration' into 06-16-_tool-4689_d…
MananTank Jul 10, 2025
3e45e9d
remove unused stuff
MananTank Jul 10, 2025
ee8e2be
Merge branch 'yash/ocr-contracts-integration' into 06-16-_tool-4689_d…
MananTank Jul 15, 2025
3c745cc
Merge branch 'yash/ocr-contracts-integration' into 06-16-_tool-4689_d…
MananTank Jul 15, 2025
df8e5a4
add claim rewards page
MananTank Jul 15, 2025
6bfce15
load amounts
MananTank Jul 16, 2025
db396a7
update
MananTank Jul 16, 2025
e8e69ae
update UI
MananTank Jul 16, 2025
e946458
copy changes
MananTank Jul 16, 2025
e222e3d
Merge branch 'yash/ocr-contracts-integration' into 06-16-_tool-4689_d…
MananTank Jul 16, 2025
aabe00e
Merge branch 'yash/ocr-contracts-integration' into 06-16-_tool-4689_d…
MananTank Jul 17, 2025
2951738
update recent transfers table
MananTank Jul 17, 2025
1366058
update creation UI
MananTank Jul 17, 2025
9170c8f
Merge branch 'yash/ocr-contracts-integration' into 06-16-_tool-4689_d…
jakeloo Jul 18, 2025
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
20 changes: 16 additions & 4 deletions apps/dashboard/src/@/components/blocks/wallet-address.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import { CheckIcon, CopyIcon, XIcon } from "lucide-react";
import { CheckIcon, CircleSlashIcon, CopyIcon, XIcon } from "lucide-react";
import { useMemo } from "react";
import { isAddress, type ThirdwebClient, ZERO_ADDRESS } from "thirdweb";
import { Blobbie, type SocialProfile, useSocialProfiles } from "thirdweb/react";
Expand All @@ -24,6 +24,7 @@ export function WalletAddress(props: {
iconClassName?: string;
client: ThirdwebClient;
preventOpenOnFocus?: boolean;
fallbackIcon?: React.ReactNode;
}) {
// default back to zero address if no address provided
const address = useMemo(() => props.address || ZERO_ADDRESS, [props.address]);
Expand Down Expand Up @@ -60,9 +61,16 @@ export function WalletAddress(props: {
// special case for zero address
if (address === ZERO_ADDRESS) {
return (
<span className={cn("cursor-pointer font-mono", props.className)}>
{shortenedAddress}
</span>
<div className="flex items-center gap-2 py-2">
<CircleSlashIcon
className={cn("size-6 text-muted-foreground/70", props.iconClassName)}
/>
<span
className={cn("cursor-pointer font-mono text-sm", props.className)}
>
{shortenedAddress}
</span>
</div>
);
}

Expand All @@ -86,6 +94,7 @@ export function WalletAddress(props: {
iconClassName={props.iconClassName}
profiles={profiles.data || []}
thirdwebClient={props.client}
fallbackIcon={props.fallbackIcon}
/>
)}
<span className="cursor-pointer font-mono">
Expand Down Expand Up @@ -177,6 +186,7 @@ function WalletAvatar(props: {
profiles: SocialProfile[];
thirdwebClient: ThirdwebClient;
iconClassName?: string;
fallbackIcon?: React.ReactNode;
}) {
const avatar = useMemo(() => {
return props.profiles.find(
Expand All @@ -203,6 +213,8 @@ function WalletAvatar(props: {
className={cn("size-6 object-cover", props.iconClassName)}
src={resolvedAvatarSrc}
/>
) : props.fallbackIcon ? (
props.fallbackIcon
) : (
<Blobbie
address={props.address}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ const contractTypeToAssetTypeRecord: Record<string, string | undefined> = {
DropERC20: "Coin",
DropERC721: "NFT Collection",
DropERC1155: "NFT Collection",
ERC20Asset: "Coin",
};

const NetworkFilterCell = React.memo(function NetworkFilterCell({
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/src/@/components/ui/CopyAddressButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function CopyAddressButton(props: {
copyIconPosition={props.copyIconPosition}
textToCopy={props.address}
textToShow={shortenedAddress}
iconClassName={props.iconClassName}
tooltip={props.tooltip || "Copy Address"}
variant={props.variant}
/>
Expand Down
8 changes: 7 additions & 1 deletion apps/dashboard/src/@/components/ui/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export function TabButtons(props: {
shadowColor?: string;
tabIconClassName?: string;
hideBottomLine?: boolean;
bottomLineClassName?: string;
}) {
const { containerRef, lineRef, activeTabRef } =
useUnderline<HTMLButtonElement>();
Expand All @@ -106,7 +107,12 @@ export function TabButtons(props: {
<div className={cn("relative", props.containerClassName)}>
{/* Bottom line */}
{!props.hideBottomLine && (
<div className="absolute right-0 bottom-0 left-0 h-[1px] bg-border" />
<div
className={cn(
"absolute right-0 bottom-0 left-0 h-[1px] bg-border",
props.bottomLineClassName,
)}
/>
)}

<ScrollShadow
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/hooks/project-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function useAddContractToProject() {
contractAddress: string;
chainId: string;
deploymentType: "asset" | undefined;
contractType: "DropERC20" | "DropERC721" | "DropERC1155" | undefined;
contractType: "ERC20Asset" | "DropERC721" | "DropERC1155" | undefined;
}) => {
const res = await apiServerProxy({
body: JSON.stringify({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export type ContractPageMetadata = {
isAccount: boolean;
isAccountPermissionsSupported: boolean;
functionSelectors: string[];
showClaimRewards: boolean;
};

export async function getContractPageMetadata(contract: ThirdwebContract) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { ThirdwebContract } from "thirdweb";
import { getDeployedEntrypointERC20 } from "thirdweb/assets";
import { contractType as getContractType } from "thirdweb/extensions/thirdweb";
import { resolveFunctionSelectors } from "@/lib/selectors";
import { getValidReward } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/rewards/utils/rewards";
import {
isERC20ClaimConditionsSupported,
isERC721ClaimConditionsSupported,
Expand Down Expand Up @@ -43,6 +45,7 @@ type ContractPageMetadata = {
isAccount: boolean;
isAccountPermissionsSupported: boolean;
functionSelectors: string[];
showClaimRewards: boolean;
};

export async function getContractPageMetadataSetup(
Expand All @@ -53,10 +56,14 @@ export async function getContractPageMetadataSetup(
functionSelectorsResult,
isInsightSupportedResult,
contractTypeResult,
claimRewardResult,
] = await Promise.allSettled([
resolveFunctionSelectors(contract),
isAnalyticsSupportedFn(contract.chain.id),
getContractType({ contract }),
isClaimRewardsSupported({
assetContract: contract,
}),
]);

const functionSelectors =
Expand All @@ -72,6 +79,11 @@ export async function getContractPageMetadataSetup(
const contractType =
contractTypeResult.status === "fulfilled" ? contractTypeResult.value : null;

const showClaimRewards =
claimRewardResult.status === "fulfilled"
? !!claimRewardResult.value
: false;

return {
embedType: getEmbedTypeToShow(functionSelectors),
functionSelectors,
Expand All @@ -93,5 +105,30 @@ export async function getContractPageMetadataSetup(
isSplitSupported: contractType === "Split",
isVoteContract: contractType === "VoteERC20",
supportedERCs: supportedERCs(functionSelectors),
showClaimRewards,
};
}

async function isClaimRewardsSupported(params: {
assetContract: ThirdwebContract;
}): Promise<boolean> {
try {
const entrypointContract = await getDeployedEntrypointERC20({
chain: params.assetContract.chain,
client: params.assetContract.client,
});

if (!entrypointContract) {
return false;
}

const reward = await getValidReward({
assetContract: params.assetContract,
entrypointContract,
});

return !!reward;
} catch {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ export function getContractPageSidebarLinks(data: {
href: `${layoutPrefix}/permissions`,
label: "Permissions",
},
{
exactMatch: true,
hide: !data.metadata.showClaimRewards,
href: `${layoutPrefix}/rewards`,
label: "Rewards",
},
];

const extensionsToShow = extensionsLinks.filter((l) => !l.hide);
Expand Down
Loading
Loading