Skip to content

Commit 3d0ff27

Browse files
committed
fix weth
1 parent 5da4d21 commit 3d0ff27

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

packages/thirdweb/src/contract/deployment/utils/bootstrap.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import { isZkSyncChain } from "../../../utils/any-evm/zksync/isZkSyncChain.js";
77
import type { ClientAndChainAndAccount } from "../../../utils/types.js";
88
import { type ThirdwebContract, getContract } from "../../contract.js";
99
import { fetchPublishedContractMetadata } from "../publisher.js";
10-
import { ZKSYNC_IMPLEMENTATIONS } from "../zksync/implementations.js";
10+
import {
11+
ZKSYNC_IMPLEMENTATIONS,
12+
ZKSYNC_WETH,
13+
} from "../zksync/implementations.js";
1114
import { zkDeployCreate2Factory } from "../zksync/zkDeployCreate2Factory.js";
1215
import { zkDeployContractDeterministic } from "../zksync/zkDeployDeterministic.js";
1316
import { getDeployedCloneFactoryContract } from "./clone-factory.js";
@@ -200,6 +203,18 @@ export async function getOrDeployInfraContract(
200203
version?: string;
201204
},
202205
) {
206+
if (options.contractId === "WETH9" && (await isZkSyncChain(options.chain))) {
207+
const weth = ZKSYNC_WETH[options.chain.id];
208+
209+
if (weth) {
210+
return getContract({
211+
client: options.client,
212+
chain: options.chain,
213+
address: weth,
214+
});
215+
}
216+
}
217+
203218
const contractMetadata = await fetchPublishedContractMetadata({
204219
client: options.client,
205220
contractId: options.contractId,

packages/thirdweb/src/contract/deployment/zksync/implementations.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ export const ZKSYNC_IMPLEMENTATIONS: Record<number, Record<string, string>> = {
1212
MarketplaceV3: "0x2dA4Dd326A6482679547071be21f74685d730504",
1313
},
1414
};
15+
16+
export const ZKSYNC_WETH: Record<number, string> = {
17+
[300]: "0x0462C05457Fed440740Ff3696bDd2D0577411e34",
18+
[324]: "0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91",
19+
[11124]: "0x9EDCde0257F2386Ce177C3a7FCdd97787F0D841d",
20+
};

packages/thirdweb/src/extensions/prebuilts/get-required-transactions.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { ThirdwebClient } from "../../client/client.js";
33
import { getDeployedCreate2Factory } from "../../contract/deployment/utils/create-2-factory.js";
44
import { getDeployedInfraContract } from "../../contract/deployment/utils/infra.js";
55
import { getDeployedInfraContractFromMetadata } from "../../contract/deployment/utils/infra.js";
6+
import { ZKSYNC_WETH } from "../../contract/deployment/zksync/implementations.js";
67
import { computePublishedContractAddress } from "../../utils/any-evm/compute-published-contract-address.js";
78
import type { FetchDeployMetadataResult } from "../../utils/any-evm/deploy-metadata.js";
89
import { isZkSyncChain } from "../../utils/any-evm/zksync/isZkSyncChain.js";
@@ -227,8 +228,11 @@ export async function getAllDefaultConstructorParamsForImplementation(args: {
227228
const { chain, client } = args;
228229
const isZkSync = await isZkSyncChain(chain);
229230
if (isZkSync) {
230-
// zksync contracts dont need these implementation constructor params
231-
return {};
231+
const weth = ZKSYNC_WETH[chain.id];
232+
233+
return {
234+
nativeTokenWrapper: weth,
235+
};
232236
}
233237
const [forwarder, weth] = await Promise.all([
234238
computePublishedContractAddress({

0 commit comments

Comments
 (0)