Skip to content

Commit 9fedac3

Browse files
committed
WIP: hardcoded modified version of TWCloneFactory to be used
1 parent c4acff6 commit 9fedac3

File tree

5 files changed

+17
-15
lines changed

5 files changed

+17
-15
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/cross-chain/data-table.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import { ZERO_ADDRESS, defineChain } from "thirdweb";
3636
import type { FetchDeployMetadataResult } from "thirdweb/contract";
3737
import { deployContractfromDeployMetadata } from "thirdweb/deploys";
3838
import { useActiveAccount, useSwitchActiveWalletChain } from "thirdweb/react";
39+
import { concatHex, padHex } from "thirdweb/utils";
3940

4041
export type CrossChain = {
4142
id: number;
@@ -170,7 +171,7 @@ export function DataTable({
170171

171172
const chain = defineChain(chainId);
172173
const client = getThirdwebClient();
173-
const salt = "thirdweb";
174+
const salt = concatHex(["0x0101", padHex("0x", { size: 30 })]).toString();
174175

175176
await switchChain(chain);
176177

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/cross-chain/page.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,6 @@ export default async function Page(props: {
5252
},
5353
);
5454

55-
const _topOPStackChainIds = [
56-
8453, // Base
57-
10, // OP Mainnet
58-
34443, // Mode Network
59-
7560, // Cyber
60-
7777777, // Zora
61-
];
62-
6355
const topOPStackTestnetChainIds = [
6456
84532, // Base
6557
11155420, // OP testnet

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
} from "thirdweb/deploys";
3636
import { useActiveAccount, useActiveWalletChain } from "thirdweb/react";
3737
import { upload } from "thirdweb/storage";
38+
import { concatHex, padHex } from "thirdweb/utils";
3839
import { FormHelperText, FormLabel, Heading, Text } from "tw-components";
3940
import { useCustomFactoryAbi, useFunctionParamsFromABI } from "../hooks";
4041
import { addContractToMultiChainRegistry } from "../utils";
@@ -436,7 +437,7 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
436437

437438
// TODO: discuss how to handle the salt properly for crosschain contracts
438439
const salt = isSuperchainInterop
439-
? "thirdweb"
440+
? concatHex(["0x0101", padHex("0x", { size: 30 })]).toString()
440441
: params.deployDeterministic
441442
? params.signerAsSalt
442443
? activeAccount.address.concat(params.saltForCreate2)

packages/thirdweb/src/contract/deployment/deploy-via-autofactory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { getRpcClient } from "../../rpc/rpc.js";
66
import { encode } from "../../transaction/actions/encode.js";
77
import { sendAndConfirmTransaction } from "../../transaction/actions/send-and-confirm-transaction.js";
88
import type { PreparedTransaction } from "../../transaction/prepare-transaction.js";
9-
import { keccakId } from "../../utils/any-evm/keccak-id.js";
109
import { isZkSyncChain } from "../../utils/any-evm/zksync/isZkSyncChain.js";
1110
import { toHex } from "../../utils/encoding/hex.js";
1211
import { resolvePromisedValue } from "../../utils/promise/resolve-promised-value.js";
@@ -35,7 +34,8 @@ export function prepareAutoFactoryDeployTransaction(
3534
});
3635
const blockNumber = await eth_blockNumber(rpcRequest);
3736
const salt = args.salt
38-
? keccakId(args.salt)
37+
? //? keccakId(args.salt)
38+
(args.salt as `0x${string}`)
3939
: toHex(blockNumber, {
4040
size: 32,
4141
});

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export async function deployContractfromDeployMetadata(
163163
import("../../contract/deployment/deploy-via-autofactory.js"),
164164
import("../../contract/deployment/utils/bootstrap.js"),
165165
]);
166-
const { cloneFactoryContract, implementationContract } =
166+
const { cloneFactoryContract: _, implementationContract } =
167167
await getOrDeployInfraForPublishedContract({
168168
chain,
169169
client,
@@ -181,18 +181,26 @@ export async function deployContractfromDeployMetadata(
181181
const initializeTransaction = await getInitializeTransaction({
182182
client,
183183
chain,
184-
deployMetadata: deployMetadata,
184+
deployMetadata,
185185
implementationContract,
186186
initializeParams,
187187
account,
188188
modules,
189189
});
190190

191+
// TODO: remove this once the modified version of TWCloneFactory
192+
// has been published under the thirdweb wallet
193+
const modifiedCloneFactoryContract = getContract({
194+
client,
195+
address: "0x7756D8a084e55d9872BD5bBDf6867543D15866A4", // only deployed on OP and zora testnets
196+
chain,
197+
});
198+
191199
return deployViaAutoFactory({
192200
client,
193201
chain,
194202
account,
195-
cloneFactoryContract,
203+
cloneFactoryContract: modifiedCloneFactoryContract,
196204
initializeTransaction,
197205
salt,
198206
});

0 commit comments

Comments
 (0)