Skip to content

Commit c0bbc21

Browse files
committed
Update deploy configs (#6299)
TOOL-3478 <!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on updating the platform fee configuration in the contract deployment process, introducing a new fee constant, and modifying the logic to handle different fee scenarios based on the publisher address. ### Detailed summary - Added `THIRDWEB_PUBLISHER_ADDRESS` constant in `addresses.ts`. - Introduced `DEFAULT_FEE_BPS_NEW` constant in `addresses.ts`. - Updated `PlatformFeeFieldset` to destructure `isMarketplace`. - Modified `CustomContractForm` to conditionally use `DEFAULT_FEE_BPS_NEW` based on the publisher address. - Adjusted imports in `custom-contract.tsx` to include new constants. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 9fcf1b8 commit c0bbc21

File tree

4 files changed

+29
-8
lines changed

4 files changed

+29
-8
lines changed

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

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ import { Flex, FormControl } from "@chakra-ui/react";
1414
import { useMutation, useQuery } from "@tanstack/react-query";
1515
import { verifyContract } from "app/(dashboard)/(chain)/[chain_id]/[contractAddress]/sources/ContractSourcesPage";
1616
import { NetworkSelectorButton } from "components/selects/NetworkSelectorButton";
17-
import { DEFAULT_FEE_BPS, DEFAULT_FEE_RECIPIENT } from "constants/addresses";
17+
import {
18+
DEFAULT_FEE_BPS,
19+
DEFAULT_FEE_BPS_NEW,
20+
DEFAULT_FEE_RECIPIENT,
21+
THIRDWEB_PUBLISHER_ADDRESS,
22+
} from "constants/addresses";
1823
import { SolidityInput } from "contract-ui/components/solidity-inputs";
1924
import { useTrack } from "hooks/analytics/useTrack";
2025
import { useTxNotifications } from "hooks/useTxNotifications";
@@ -161,6 +166,13 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
161166
const constructorParams =
162167
metadata.abi.find((a) => a.type === "constructor")?.inputs || [];
163168

169+
const defaultFeeRecipientFunction = metadata.abi.find(
170+
(a) => a.type === "function" && a.name === "DEFAULT_FEE_RECIPIENT",
171+
);
172+
const hasInbuiltDefaultFeeConfig =
173+
defaultFeeRecipientFunction &&
174+
metadata.publisher === THIRDWEB_PUBLISHER_ADDRESS;
175+
164176
const [customFactoryNetwork, customFactoryAddress] = Object.entries(
165177
metadata?.factoryDeploymentData?.customFactoryInput
166178
?.customFactoryAddresses || {},
@@ -457,7 +469,9 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
457469
name: params.contractMetadata?.name || "",
458470
contractURI: _contractURI,
459471
defaultAdmin: params.deployParams._defaultAdmin as string,
460-
platformFeeBps: DEFAULT_FEE_BPS,
472+
platformFeeBps: hasInbuiltDefaultFeeConfig
473+
? DEFAULT_FEE_BPS_NEW
474+
: DEFAULT_FEE_BPS,
461475
platformFeeRecipient: DEFAULT_FEE_RECIPIENT,
462476
trustedForwarders: params.deployParams._trustedForwarders
463477
? JSON.parse(params.deployParams._trustedForwarders as string)
@@ -473,8 +487,10 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
473487
payees,
474488
shares,
475489
_contractURI,
476-
_platformFeeBps: DEFAULT_FEE_BPS,
477-
_platformFeeRecipient: DEFAULT_FEE_RECIPIENT,
490+
platformFeeBps: hasInbuiltDefaultFeeConfig
491+
? DEFAULT_FEE_BPS_NEW
492+
: DEFAULT_FEE_BPS,
493+
platformFeeRecipient: DEFAULT_FEE_RECIPIENT,
478494
};
479495

480496
const salt = params.deployDeterministic

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ interface PlatformFeeFieldsetProps {
55
isMarketplace: boolean;
66
}
77

8-
export const PlatformFeeFieldset: React.FC<PlatformFeeFieldsetProps> = (
9-
props,
10-
) => {
8+
export const PlatformFeeFieldset: React.FC<PlatformFeeFieldsetProps> = ({
9+
isMarketplace,
10+
}) => {
1111
return (
1212
<Fieldset legend="Platform fees">
1313
<div className="flex flex-col gap-4 md:flex-row">
14-
{props.isMarketplace ? (
14+
{isMarketplace ? (
1515
<p className="mb-3 pt-4 text-muted-foreground text-sm italic">
1616
A 2.5% platform fee is deducted from each sale to support ongoing
1717
platform operations and improvements.{" "}

apps/dashboard/src/components/contract-functions/contract-function.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ export const ContractFunctionsPanel: React.FC<ContractFunctionsPanelProps> = ({
285285
twAccount,
286286
}) => {
287287
// TODO: clean this up
288+
288289
const functionsWithExtension = useMemo(() => {
289290
const allFunctions = fnsOrEvents.filter((f) => f.type === "function");
290291
const results: ExtensionFunctions[] = [];
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
export const THIRDWEB_DEPLOYER_ADDRESS =
22
"0xdd99b75f095d0c4d5112aCe938e4e6ed962fb024";
33

4+
export const THIRDWEB_PUBLISHER_ADDRESS =
5+
"0xdd99b75f095d0c4d5112aCe938e4e6ed962fb024";
6+
47
export const DEFAULT_FEE_RECIPIENT =
58
"0x1af20c6b23373350ad464700b5965ce4b0d2ad94";
69

710
export const DEFAULT_FEE_BPS = 250;
11+
export const DEFAULT_FEE_BPS_NEW = 150;

0 commit comments

Comments
 (0)