Skip to content

Commit 04d2bc7

Browse files
authored
Update deploy config (#6643)
1 parent 1a236fd commit 04d2bc7

File tree

4 files changed

+98
-6
lines changed

4 files changed

+98
-6
lines changed

.changeset/chilly-bats-cheat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Deploy config

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

Lines changed: 26 additions & 5 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,14 @@ 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:
518+
metadata.version === "7.0.0" && isFeeExempt
519+
? Number(params.deployParams._platformFeeBps)
520+
: DEFAULT_FEE_BPS_NEW,
521+
platformFeeRecipient:
522+
metadata.version === "7.0.0" && isFeeExempt
523+
? (params.deployParams._platformFeeRecipient as string)
524+
: DEFAULT_FEE_RECIPIENT,
517525
trustedForwarders: params.deployParams._trustedForwarders
518526
? JSON.parse(params.deployParams._trustedForwarders as string)
519527
: undefined,
@@ -530,8 +538,13 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
530538
_contractURI,
531539
platformFeeBps: hasInbuiltDefaultFeeConfig
532540
? DEFAULT_FEE_BPS_NEW
533-
: DEFAULT_FEE_BPS,
534-
platformFeeRecipient: DEFAULT_FEE_RECIPIENT,
541+
: isFeeExempt
542+
? Number(params.deployParams._platformFeeBps)
543+
: DEFAULT_FEE_BPS,
544+
platformFeeRecipient:
545+
!hasInbuiltDefaultFeeConfig && isFeeExempt
546+
? (params.deployParams._platformFeeRecipient as string)
547+
: DEFAULT_FEE_RECIPIENT,
535548
};
536549

537550
const salt = params.deployDeterministic
@@ -766,7 +779,15 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
766779
)}
767780

768781
{hasPlatformFee && (
769-
<PlatformFeeFieldset isMarketplace={isMarketplace} />
782+
<PlatformFeeFieldset
783+
form={form}
784+
isMarketplace={isMarketplace}
785+
disabled={
786+
hasInbuiltDefaultFeeConfig ||
787+
(isMarketplace && metadata.version !== "7.0.0") ||
788+
!isFeeExempt
789+
}
790+
/>
770791
)}
771792

772793
{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+
disabled: boolean;
612
}
713

814
export const PlatformFeeFieldset: React.FC<PlatformFeeFieldsetProps> = ({
15+
form,
916
isMarketplace,
17+
disabled,
1018
}) => {
1119
return (
1220
<Fieldset legend="Platform fees">
1321
<div className="flex flex-col gap-4 md:flex-row">
14-
{isMarketplace ? (
22+
{!disabled ? (
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)