Skip to content

Commit 3cebbb4

Browse files
committed
marketplace deploy without extension
1 parent 72bc847 commit 3cebbb4

File tree

2 files changed

+77
-61
lines changed

2 files changed

+77
-61
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,7 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
473473
name: params.contractMetadata?.name || "",
474474
contractURI: _contractURI,
475475
defaultAdmin: params.deployParams._defaultAdmin as string,
476-
platformFeeBps: hasInbuiltDefaultFeeConfig
477-
? DEFAULT_FEE_BPS_NEW
478-
: DEFAULT_FEE_BPS,
476+
platformFeeBps: DEFAULT_FEE_BPS_NEW,
479477
platformFeeRecipient: DEFAULT_FEE_RECIPIENT,
480478
trustedForwarders: params.deployParams._trustedForwarders
481479
? JSON.parse(params.deployParams._trustedForwarders as string)

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

Lines changed: 76 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ import type { ClientAndChainAndAccount } from "../../utils/types.js";
1515
import { initialize as initMarketplace } from "./__generated__/Marketplace/write/initialize.js";
1616
import { generateExtensionFunctionsFromAbi } from "./get-required-transactions.js";
1717

18+
export type Extension = {
19+
metadata: {
20+
name: string;
21+
metadataURI: string;
22+
implementation: `0x${string}`;
23+
};
24+
functions: {
25+
functionSelector: string;
26+
functionSignature: string;
27+
}[];
28+
};
29+
1830
export type MarketplaceContractParams = {
1931
name: string;
2032
description?: string;
@@ -69,41 +81,72 @@ export async function deployMarketplaceContract(
6981
account,
7082
contractId: "WETH9",
7183
});
72-
const direct = await getOrDeployInfraForPublishedContract({
73-
chain,
74-
client,
75-
account,
76-
contractId: "DirectListingsLogic",
77-
constructorParams: { _nativeTokenWrapper: WETH.address },
78-
});
7984

80-
const english = await getOrDeployInfraForPublishedContract({
81-
chain,
82-
client,
83-
account,
84-
contractId: "EnglishAuctionsLogic",
85-
constructorParams: { _nativeTokenWrapper: WETH.address },
86-
});
85+
let extensions: Extension[] = [];
8786

88-
const offers = await getOrDeployInfraForPublishedContract({
89-
chain,
90-
client,
91-
account,
92-
contractId: "OffersLogic",
93-
});
87+
if (options.version !== "6.0.0") {
88+
const direct = await getOrDeployInfraForPublishedContract({
89+
chain,
90+
client,
91+
account,
92+
contractId: "DirectListingsLogic",
93+
constructorParams: { _nativeTokenWrapper: WETH.address },
94+
});
9495

95-
const [directFunctions, englishFunctions, offersFunctions] =
96-
await Promise.all([
97-
resolveContractAbi(direct.implementationContract).then(
98-
generateExtensionFunctionsFromAbi,
99-
),
100-
resolveContractAbi(english.implementationContract).then(
101-
generateExtensionFunctionsFromAbi,
102-
),
103-
resolveContractAbi(offers.implementationContract).then(
104-
generateExtensionFunctionsFromAbi,
105-
),
106-
]);
96+
const english = await getOrDeployInfraForPublishedContract({
97+
chain,
98+
client,
99+
account,
100+
contractId: "EnglishAuctionsLogic",
101+
constructorParams: { _nativeTokenWrapper: WETH.address },
102+
});
103+
104+
const offers = await getOrDeployInfraForPublishedContract({
105+
chain,
106+
client,
107+
account,
108+
contractId: "OffersLogic",
109+
});
110+
111+
const [directFunctions, englishFunctions, offersFunctions] =
112+
await Promise.all([
113+
resolveContractAbi(direct.implementationContract).then(
114+
generateExtensionFunctionsFromAbi,
115+
),
116+
resolveContractAbi(english.implementationContract).then(
117+
generateExtensionFunctionsFromAbi,
118+
),
119+
resolveContractAbi(offers.implementationContract).then(
120+
generateExtensionFunctionsFromAbi,
121+
),
122+
]);
123+
extensions = [
124+
{
125+
metadata: {
126+
name: "Direct Listings",
127+
metadataURI: "",
128+
implementation: direct.implementationContract.address,
129+
},
130+
functions: directFunctions,
131+
},
132+
{
133+
metadata: {
134+
name: "English Auctions",
135+
metadataURI: "",
136+
implementation: english.implementationContract.address,
137+
},
138+
functions: englishFunctions,
139+
},
140+
{
141+
metadata: {
142+
name: "Offers",
143+
metadataURI: "",
144+
implementation: offers.implementationContract.address,
145+
},
146+
functions: offersFunctions,
147+
},
148+
];
149+
}
107150

108151
const { cloneFactoryContract, implementationContract } =
109152
await getOrDeployInfraForPublishedContract({
@@ -113,32 +156,7 @@ export async function deployMarketplaceContract(
113156
contractId: "MarketplaceV3",
114157
constructorParams: {
115158
_marketplaceV3Params: {
116-
extensions: [
117-
{
118-
metadata: {
119-
name: "Direct Listings",
120-
metadataURI: "",
121-
implementation: direct.implementationContract.address,
122-
},
123-
functions: directFunctions,
124-
},
125-
{
126-
metadata: {
127-
name: "English Auctions",
128-
metadataURI: "",
129-
implementation: english.implementationContract.address,
130-
},
131-
functions: englishFunctions,
132-
},
133-
{
134-
metadata: {
135-
name: "Offers",
136-
metadataURI: "",
137-
implementation: offers.implementationContract.address,
138-
},
139-
functions: offersFunctions,
140-
},
141-
],
159+
extensions,
142160
royaltyEngineAddress: getRoyaltyEngineV1ByChainId(chain.id),
143161
nativeTokenWrapper: WETH.address,
144162
} as MarketplaceConstructorParams[number],

0 commit comments

Comments
 (0)