Skip to content

Commit 7d478dd

Browse files
committed
Update deploy config
1 parent 1a236fd commit 7d478dd

File tree

3 files changed

+87
-7
lines changed

3 files changed

+87
-7
lines changed

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

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
213213
defaultFeeRecipientFunction &&
214214
metadata.publisher === THIRDWEB_PUBLISHER_ADDRESS;
215215

216+
const isFeeExempt = walletChain?.id === 232 || walletChain?.id === 37111;
217+
216218
const [customFactoryNetwork, customFactoryAddress] = Object.entries(
217219
metadata?.factoryDeploymentData?.customFactoryInput
218220
?.customFactoryAddresses || {},
@@ -512,8 +514,12 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
512514
name: params.contractMetadata?.name || "",
513515
contractURI: _contractURI,
514516
defaultAdmin: params.deployParams._defaultAdmin as string,
515-
platformFeeBps: DEFAULT_FEE_BPS_NEW,
516-
platformFeeRecipient: DEFAULT_FEE_RECIPIENT,
517+
platformFeeBps: isFeeExempt
518+
? Number(params.deployParams._platformFeeBps)
519+
: DEFAULT_FEE_BPS_NEW,
520+
platformFeeRecipient: isFeeExempt
521+
? (params.deployParams._platformFeeRecipient as string)
522+
: DEFAULT_FEE_RECIPIENT,
517523
trustedForwarders: params.deployParams._trustedForwarders
518524
? JSON.parse(params.deployParams._trustedForwarders as string)
519525
: undefined,
@@ -530,8 +536,12 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
530536
_contractURI,
531537
platformFeeBps: hasInbuiltDefaultFeeConfig
532538
? DEFAULT_FEE_BPS_NEW
533-
: DEFAULT_FEE_BPS,
534-
platformFeeRecipient: DEFAULT_FEE_RECIPIENT,
539+
: isFeeExempt
540+
? Number(params.deployParams._platformFeeBps)
541+
: DEFAULT_FEE_BPS,
542+
platformFeeRecipient: isFeeExempt
543+
? (params.deployParams._platformFeeRecipient as string)
544+
: DEFAULT_FEE_RECIPIENT,
535545
};
536546

537547
const salt = params.deployDeterministic
@@ -765,8 +775,12 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
765775
/>
766776
)}
767777

768-
{hasPlatformFee && (
769-
<PlatformFeeFieldset isMarketplace={isMarketplace} />
778+
{hasPlatformFee && !isFeeExempt && (
779+
<PlatformFeeFieldset
780+
form={form}
781+
isMarketplace={isMarketplace}
782+
isFeeExempt={isFeeExempt}
783+
/>
770784
)}
771785

772786
{isSplit && <SplitFieldset form={form} />}

apps/dashboard/src/components/contract-components/contract-deploy-form/platform-fee-fieldset.tsx

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,79 @@
1+
import { FormFieldSetup } from "@/components/blocks/FormFieldSetup";
2+
import { BasisPointsInput } from "components/inputs/BasisPointsInput";
3+
import { SolidityInput } from "contract-ui/components/solidity-inputs";
14
import Link from "next/link";
25
import { Fieldset } from "./common";
6+
import type { CustomContractDeploymentForm } from "./custom-contract";
37

48
interface PlatformFeeFieldsetProps {
9+
form: CustomContractDeploymentForm;
510
isMarketplace: boolean;
11+
isFeeExempt: boolean;
612
}
713

814
export const PlatformFeeFieldset: React.FC<PlatformFeeFieldsetProps> = ({
15+
form,
916
isMarketplace,
17+
isFeeExempt,
1018
}) => {
1119
return (
1220
<Fieldset legend="Platform fees">
1321
<div className="flex flex-col gap-4 md:flex-row">
14-
{isMarketplace ? (
22+
{isFeeExempt ? (
23+
<>
24+
<FormFieldSetup
25+
className="grow"
26+
label="Recipient Address"
27+
isRequired
28+
errorMessage={
29+
form.getFieldState(
30+
"deployParams._platformFeeRecipient",
31+
form.formState,
32+
).error?.message
33+
}
34+
helperText={
35+
<>
36+
For contract with primary sales, get additional fees for all
37+
primary sales that happen on this contract. (This is useful if
38+
you are deploying this contract for a 3rd party and want to
39+
take fees for your service). <br /> If this contract is a
40+
marketplace, get a percentage of all the secondary sales that
41+
happen on your contract.
42+
</>
43+
}
44+
>
45+
<SolidityInput
46+
solidityType="address"
47+
{...form.register("deployParams._platformFeeRecipient")}
48+
/>
49+
</FormFieldSetup>
50+
51+
<FormFieldSetup
52+
label="Percentage"
53+
isRequired
54+
className="shrink-0 md:max-w-[150px]"
55+
errorMessage={
56+
form.getFieldState(
57+
"deployParams._platformFeeBps",
58+
form.formState,
59+
).error?.message
60+
}
61+
>
62+
<BasisPointsInput
63+
value={Number(form.watch("deployParams._platformFeeBps"))}
64+
onChange={(value) =>
65+
form.setValue(
66+
"deployParams._platformFeeBps",
67+
value.toString(),
68+
{
69+
shouldTouch: true,
70+
},
71+
)
72+
}
73+
/>
74+
</FormFieldSetup>
75+
</>
76+
) : isMarketplace ? (
1577
<p className="mb-3 pt-4 text-muted-foreground text-sm italic">
1678
A 2.5% platform fee is deducted from each sale to support ongoing
1779
platform operations and improvements.{" "}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,14 @@ export async function deployMarketplaceContract(
8585
let extensions: Extension[] = [];
8686

8787
if (options.version !== "6.0.0") {
88+
const isFeeExempt = chain.id === 232 || chain.id === 37111;
8889
const direct = await getOrDeployInfraForPublishedContract({
8990
chain,
9091
client,
9192
account,
9293
contractId: "DirectListingsLogic",
9394
constructorParams: { _nativeTokenWrapper: WETH.address },
95+
version: isFeeExempt ? "0.1.2" : "latest",
9496
});
9597

9698
const english = await getOrDeployInfraForPublishedContract({
@@ -99,13 +101,15 @@ export async function deployMarketplaceContract(
99101
account,
100102
contractId: "EnglishAuctionsLogic",
101103
constructorParams: { _nativeTokenWrapper: WETH.address },
104+
version: isFeeExempt ? "0.0.11" : "latest",
102105
});
103106

104107
const offers = await getOrDeployInfraForPublishedContract({
105108
chain,
106109
client,
107110
account,
108111
contractId: "OffersLogic",
112+
version: isFeeExempt ? "0.0.8" : "latest",
109113
});
110114

111115
const [directFunctions, englishFunctions, offersFunctions] =

0 commit comments

Comments
 (0)