Skip to content

Commit 49fae2e

Browse files
committed
cleanup
1 parent aaacd68 commit 49fae2e

File tree

3 files changed

+10
-121
lines changed

3 files changed

+10
-121
lines changed

apps/dashboard/src/components/contract-components/contract-deploy-form/custom-contract.tsx

Lines changed: 10 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,16 @@ import {
2828
import Link from "next/link";
2929
import { useCallback, useMemo } from "react";
3030
import { FormProvider, type UseFormReturn, useForm } from "react-hook-form";
31-
import {
32-
ZERO_ADDRESS,
33-
eth_getTransactionCount,
34-
getContract,
35-
getRpcClient,
36-
sendTransaction,
37-
waitForReceipt,
38-
} from "thirdweb";
31+
import { ZERO_ADDRESS, getContract } from "thirdweb";
3932
import type { FetchDeployMetadataResult } from "thirdweb/contract";
4033
import {
4134
deployContractfromDeployMetadata,
4235
deployMarketplaceContract,
4336
getRequiredTransactions,
4437
} from "thirdweb/deploys";
45-
import { installPublishedModule } from "thirdweb/modules";
4638
import { useActiveAccount, useActiveWalletChain } from "thirdweb/react";
4739
import { upload } from "thirdweb/storage";
48-
import {
49-
type AbiFunction,
50-
concatHex,
51-
encodeAbiParameters,
52-
padHex,
53-
} from "thirdweb/utils";
40+
import {} from "thirdweb/utils";
5441
import { isZkSyncChain } from "thirdweb/utils";
5542
import { FormHelperText, FormLabel, Text } from "tw-components";
5643
import { useCustomFactoryAbi, useFunctionParamsFromABI } from "../hooks";
@@ -204,10 +191,6 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
204191
!isFactoryDeployment &&
205192
(metadata?.name.includes("AccountFactory") || false);
206193

207-
const isSuperchainInterop = !!modules?.find(
208-
(m) => m.name === "SuperChainInterop",
209-
);
210-
211194
const parsedDeployParams = useMemo(
212195
() => ({
213196
...deployParams.reduce(
@@ -482,20 +465,15 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
482465
_contractURI,
483466
};
484467

485-
const salt = isSuperchainInterop
486-
? concatHex(["0x0101", padHex("0x", { size: 30 })]).toString()
487-
: params.deployDeterministic
488-
? params.signerAsSalt
489-
? activeAccount.address.concat(params.saltForCreate2)
490-
: params.saltForCreate2
491-
: undefined;
468+
const salt = params.deployDeterministic
469+
? params.signerAsSalt
470+
? activeAccount.address.concat(params.saltForCreate2)
471+
: params.saltForCreate2
472+
: undefined;
492473

493474
const moduleDeployData = modules?.map((m) => ({
494475
deployMetadata: m,
495-
initializeParams:
496-
m.name === "SuperChainInterop"
497-
? { superchainBridge: "0x4200000000000000000000000000000000000028" }
498-
: params.moduleData[m.name],
476+
initializeParams: params.moduleData[m.name],
499477
}));
500478

501479
const coreContractAddress = await deployContractfromDeployMetadata({
@@ -506,69 +484,8 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
506484
initializeParams,
507485
implementationConstructorParams,
508486
salt,
509-
isSuperchainInterop,
510-
modules: isSuperchainInterop
511-
? // remove modules for superchain interop in order to deploy deterministically deploy just the core contract
512-
[]
513-
: moduleDeployData,
487+
modules: moduleDeployData,
514488
});
515-
const coreContract = getContract({
516-
client: thirdwebClient,
517-
address: coreContractAddress,
518-
chain: walletChain,
519-
});
520-
521-
if (isSuperchainInterop && moduleDeployData) {
522-
const rpcRequest = getRpcClient({
523-
client: thirdwebClient,
524-
chain: walletChain,
525-
});
526-
const currentNonce = await eth_getTransactionCount(rpcRequest, {
527-
address: activeAccount.address as `0x${string}`,
528-
});
529-
530-
for (const [i, m] of moduleDeployData.entries()) {
531-
let moduleData: `0x${string}` | undefined;
532-
533-
const moduleInstallParams = m.deployMetadata.abi.find(
534-
(abiType) =>
535-
(abiType as AbiFunction).name === "encodeBytesOnInstall",
536-
) as AbiFunction | undefined;
537-
538-
if (m.initializeParams && moduleInstallParams) {
539-
moduleData = encodeAbiParameters(
540-
(
541-
moduleInstallParams.inputs as { name: string; type: string }[]
542-
).map((p) => ({
543-
name: p.name,
544-
type: p.type,
545-
})),
546-
Object.values(m.initializeParams),
547-
);
548-
}
549-
550-
console.log("nonce used: ", currentNonce + i);
551-
552-
const installTransaction = installPublishedModule({
553-
contract: coreContract,
554-
account: activeAccount,
555-
moduleName: m.deployMetadata.name,
556-
publisher: m.deployMetadata.publisher,
557-
version: m.deployMetadata.version,
558-
moduleData,
559-
nonce: currentNonce + i,
560-
});
561-
562-
const txResult = await sendTransaction({
563-
transaction: installTransaction,
564-
account: activeAccount,
565-
});
566-
567-
await waitForReceipt(txResult);
568-
// can't handle parallel transactions, so wait a bit
569-
await new Promise((resolve) => setTimeout(resolve, 1000));
570-
}
571-
}
572489

573490
return coreContractAddress;
574491
},
@@ -899,10 +816,7 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
899816
{isModular && modules && modules.length > 0 && (
900817
<ModularContractDefaultModulesFieldset
901818
form={form}
902-
modules={modules.filter(
903-
// superchain interop will have a default value for it's install param
904-
(mod) => mod.name !== "SuperChainInterop",
905-
)}
819+
modules={modules}
906820
isTWPublisher={isTWPublisher}
907821
/>
908822
)}

apps/dashboard/src/data/explore.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -192,29 +192,6 @@ const MODULAR_CONTRACTS = {
192192
],
193193
} satisfies ExploreCategory;
194194

195-
const CROSS_CHAIN = {
196-
id: "cross-chain",
197-
name: "cross-chain",
198-
displayName: "Cross Chain",
199-
description:
200-
"Collection of contracts that are popular for building cross-chain applications.",
201-
contracts: [
202-
// erc20 drop
203-
[
204-
"deployer.thirdweb.eth/ERC20CoreInitializable", // TODO: replace this with the thirdweb published contract
205-
[
206-
"0xf2d22310905EaD92C19c7ef0003C1AD38e129cb1/SuperChainInterop", // TODO: replace this with the OP published contract
207-
"deployer.thirdweb.eth/ClaimableERC20",
208-
],
209-
{
210-
title: "OP Superchain Modular Token Drop",
211-
description:
212-
"ERC-20 Tokens crosschain compatible across OP Superchains",
213-
},
214-
],
215-
],
216-
} satisfies ExploreCategory;
217-
218195
const AIRDROP = {
219196
id: "airdrop",
220197
name: "Airdrop",
@@ -304,7 +281,6 @@ const SMART_WALLET = {
304281
const CATEGORIES: Record<string, ExploreCategory> = {
305282
[POPULAR.id]: POPULAR,
306283
[MODULAR_CONTRACTS.id]: MODULAR_CONTRACTS,
307-
[CROSS_CHAIN.id]: CROSS_CHAIN,
308284
[NFTS.id]: NFTS,
309285
[MARKETS.id]: MARKETS,
310286
[DROPS.id]: DROPS,

packages/thirdweb/src/extensions/prebuilts/deploy-published.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ export type DeployContractfromDeployMetadataOptions = {
127127
initializeParams?: Record<string, unknown>;
128128
initializeData?: `0x${string}`;
129129
implementationConstructorParams?: Record<string, unknown>;
130-
isSuperchainInterop?: boolean;
131130
isCrosschain?: boolean;
132131
modules?: {
133132
deployMetadata: FetchDeployMetadataResult;

0 commit comments

Comments
 (0)