Skip to content

Commit 23a9a62

Browse files
committed
add pricing strategy selector
1 parent 3117a3b commit 23a9a62

File tree

2 files changed

+83
-45
lines changed
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]

2 files changed

+83
-45
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/token/distribution/token-sale.tsx

Lines changed: 82 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,17 @@ import { defineChain } from "thirdweb";
88
import { isRouterEnabled } from "thirdweb/assets";
99
import { DistributionBarChart } from "@/components/blocks/distribution-chart";
1010
import { FormFieldSetup } from "@/components/blocks/FormFieldSetup";
11+
import { Badge } from "@/components/ui/badge";
1112
import { DynamicHeight } from "@/components/ui/DynamicHeight";
1213
import { DecimalInput } from "@/components/ui/decimal-input";
1314
import { Spinner } from "@/components/ui/Spinner/Spinner";
15+
import {
16+
Select,
17+
SelectContent,
18+
SelectItem,
19+
SelectTrigger,
20+
SelectValue,
21+
} from "@/components/ui/select";
1422
import { Switch } from "@/components/ui/switch";
1523
import { useAllChainsData } from "@/hooks/chains/allChains";
1624
import type { TokenDistributionForm } from "../_common/form";
@@ -198,55 +206,85 @@ function PoolConfig(props: {
198206
);
199207

200208
return (
201-
<div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
202-
{/* supply % */}
209+
<div className="grid grid-cols-1 gap-5">
210+
{/* Pricing Strategy */}
203211
<FormFieldSetup
204-
errorMessage={
205-
props.form.formState.errors.saleAllocationPercentage?.message
206-
}
207-
helperText={`${compactNumberFormatter.format(sellSupply)} tokens`}
208212
isRequired
209-
label="Sell % of Total Supply"
213+
label="Pricing Strategy"
214+
errorMessage={undefined}
215+
helperText="Bonding Curve pricing is a static formula for pricing tokens based on supply and demand"
210216
>
211-
<div className="relative">
212-
<DecimalInput
213-
maxValue={100}
214-
onChange={(value) => {
215-
props.form.setValue("saleAllocationPercentage", value, {
216-
shouldValidate: true,
217-
});
218-
}}
219-
value={props.form.watch("saleAllocationPercentage")}
220-
/>
221-
<span className="-translate-y-1/2 absolute top-1/2 right-3 text-sm text-muted-foreground">
222-
%
223-
</span>
224-
</div>
217+
<Select value="bonding-curve">
218+
<SelectTrigger>
219+
<SelectValue />
220+
</SelectTrigger>
221+
<SelectContent>
222+
<SelectItem value="bonding-curve">Bonding Curve</SelectItem>
223+
<SelectItem value="fixed-price" disabled>
224+
<span className="flex items-center gap-2">
225+
Dynamic Bonding Curve{" "}
226+
<Badge variant="secondary">Coming Soon</Badge>
227+
</span>
228+
</SelectItem>
229+
<SelectItem value="dutch-auction" disabled>
230+
<span className="flex items-center gap-2">
231+
Fixed Price <Badge variant="secondary">Coming Soon</Badge>
232+
</span>
233+
</SelectItem>
234+
</SelectContent>
235+
</Select>
225236
</FormFieldSetup>
226237

227-
{/* starting price */}
228-
<FormFieldSetup
229-
errorMessage={
230-
props.form.formState.errors.pool?.startingPricePerToken?.message
231-
}
232-
isRequired
233-
label="Starting price per token"
234-
>
235-
<div className="relative">
236-
<DecimalInput
237-
className="pr-10"
238-
onChange={(value) => {
239-
props.form.setValue("pool.startingPricePerToken", value, {
240-
shouldValidate: true,
241-
});
242-
}}
243-
value={props.form.watch("pool.startingPricePerToken")}
244-
/>
245-
<span className="-translate-y-1/2 absolute top-1/2 right-3 text-sm text-muted-foreground">
246-
{chainMeta?.nativeCurrency.symbol || "ETH"}
247-
</span>
248-
</div>
249-
</FormFieldSetup>
238+
<div className="grid grid-cols-1 lg:grid-cols-2 gap-5">
239+
{/* supply % */}
240+
<FormFieldSetup
241+
errorMessage={
242+
props.form.formState.errors.saleAllocationPercentage?.message
243+
}
244+
helperText={`${compactNumberFormatter.format(sellSupply)} tokens`}
245+
isRequired
246+
label="Sell % of Total Supply"
247+
>
248+
<div className="relative">
249+
<DecimalInput
250+
maxValue={100}
251+
onChange={(value) => {
252+
props.form.setValue("saleAllocationPercentage", value, {
253+
shouldValidate: true,
254+
});
255+
}}
256+
value={props.form.watch("saleAllocationPercentage")}
257+
/>
258+
<span className="-translate-y-1/2 absolute top-1/2 right-3 text-sm text-muted-foreground">
259+
%
260+
</span>
261+
</div>
262+
</FormFieldSetup>
263+
264+
{/* starting price */}
265+
<FormFieldSetup
266+
errorMessage={
267+
props.form.formState.errors.pool?.startingPricePerToken?.message
268+
}
269+
isRequired
270+
label="Starting price per token"
271+
>
272+
<div className="relative">
273+
<DecimalInput
274+
className="pr-10"
275+
onChange={(value) => {
276+
props.form.setValue("pool.startingPricePerToken", value, {
277+
shouldValidate: true,
278+
});
279+
}}
280+
value={props.form.watch("pool.startingPricePerToken")}
281+
/>
282+
<span className="-translate-y-1/2 absolute top-1/2 right-3 text-sm text-muted-foreground">
283+
{chainMeta?.nativeCurrency.symbol || "ETH"}
284+
</span>
285+
</div>
286+
</FormFieldSetup>
287+
</div>
250288
</div>
251289
);
252290
}

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/rewards/utils/unclaimed-fees.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { ThirdwebContract } from "thirdweb";
22
import { getContract, readContract } from "thirdweb";
33
import { symbol } from "thirdweb/extensions/common";
44

5-
export const maxUint128 = 2n ** 128n - 1n;
5+
const maxUint128 = 2n ** 128n - 1n;
66

77
export async function getUnclaimedFees(params: {
88
positionManager: ThirdwebContract;

0 commit comments

Comments
 (0)