Skip to content

Commit 8a2e39c

Browse files
committed
update
1 parent 1d31fd0 commit 8a2e39c

File tree

4 files changed

+35
-71
lines changed

4 files changed

+35
-71
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/token/_common/form.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export const tokenDistributionFormSchema = z.object({
5151

5252
return isValidTickValue(tick);
5353
}, "Invalid price"),
54-
tradingFees: z.enum(["0.01", "0.05", "0.3", "1"]),
5554
}),
5655
saleAllocationPercentage: z.string().refine(
5756
(value) => {

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ export function CreateTokenAssetPage(props: {
6262
);
6363

6464
try {
65-
const salePercent = Number(formValues.saleAllocationPercentage);
65+
const salePercent =
66+
formValues.saleMode === "pool"
67+
? Number(formValues.saleAllocationPercentage)
68+
: 0;
69+
6670
const saleAmount = Number(formValues.supply) * (salePercent / 100);
6771

6872
const contractAddress = await createToken({
@@ -75,12 +79,12 @@ export function CreateTokenAssetPage(props: {
7579
? {
7680
config: {
7781
amount: BigInt(saleAmount),
78-
fee: Number(formValues.pool.tradingFees) * 10000, // TODO - fix in SDK
7982
initialTick: getInitialTickValue({
8083
startingPricePerToken: Number(
8184
formValues.pool.startingPricePerToken,
8285
),
8386
}),
87+
referrerRewardBps: 5000, // 50%
8488
}, // public
8589
kind: "pool",
8690
}
@@ -93,6 +97,7 @@ export function CreateTokenAssetPage(props: {
9397
social_urls: socialUrls,
9498
symbol: formValues.symbol,
9599
},
100+
referrerAddress: "0x1Af20C6B23373350aD464700B5965CE4B0D2aD94",
96101
});
97102

98103
// add contract to project in background

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ export function CreateTokenAssetPageUI(props: {
8181
},
8282
pool: {
8383
startingPricePerToken: "0.01",
84-
tradingFees: "1",
8584
},
8685
// sale fieldset
8786
saleAllocationPercentage: "0",

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

Lines changed: 28 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,10 @@ import { FormFieldSetup } from "@/components/blocks/FormFieldSetup";
1010
import { TokenSelector } from "@/components/blocks/TokenSelector";
1111
import { DynamicHeight } from "@/components/ui/DynamicHeight";
1212
import { DecimalInput } from "@/components/ui/decimal-input";
13-
import {
14-
Select,
15-
SelectContent,
16-
SelectItem,
17-
SelectTrigger,
18-
SelectValue,
19-
} from "@/components/ui/select";
2013
import { Skeleton } from "@/components/ui/skeleton";
2114
import { Switch } from "@/components/ui/switch";
2215
import { useAllChainsData } from "@/hooks/chains/allChains";
23-
import type {
24-
TokenDistributionForm,
25-
TokenDistributionFormValues,
26-
} from "../_common/form";
16+
import type { TokenDistributionForm } from "../_common/form";
2717

2818
export function TokenSaleSection(props: {
2919
form: TokenDistributionForm;
@@ -84,7 +74,12 @@ export function TokenSaleSection(props: {
8474
"saleMode",
8575
checked ? "pool" : "disabled",
8676
);
87-
if (!checked) {
77+
78+
if (checked && !props.form.getValues("airdropEnabled")) {
79+
props.form.setValue("saleAllocationPercentage", "100", {
80+
shouldValidate: true,
81+
});
82+
} else {
8883
props.form.setValue("saleAllocationPercentage", "0", {
8984
shouldValidate: true,
9085
});
@@ -211,9 +206,6 @@ function PrimarySaleConfig(props: {
211206
);
212207
}
213208

214-
type TradingFees = TokenDistributionFormValues["pool"]["tradingFees"];
215-
const tradingFeesOptions: TradingFees[] = ["0.01", "0.05", "0.3", "1"];
216-
217209
function PoolConfig(props: {
218210
form: TokenDistributionForm;
219211
chainId: string;
@@ -228,7 +220,7 @@ function PoolConfig(props: {
228220
);
229221

230222
return (
231-
<div className="space-y-4">
223+
<div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
232224
{/* supply % */}
233225
<FormFieldSetup
234226
errorMessage={
@@ -254,60 +246,29 @@ function PoolConfig(props: {
254246
</div>
255247
</FormFieldSetup>
256248

257-
<div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
258-
{/* starting price */}
259-
<FormFieldSetup
260-
errorMessage={
261-
props.form.formState.errors.pool?.startingPricePerToken?.message
262-
}
263-
isRequired
264-
label="Starting price per token"
265-
>
266-
<div className="relative">
267-
<DecimalInput
268-
className="pr-10"
269-
onChange={(value) => {
270-
props.form.setValue("pool.startingPricePerToken", value, {
271-
shouldValidate: true,
272-
});
273-
}}
274-
value={props.form.watch("pool.startingPricePerToken")}
275-
/>
276-
<span className="-translate-y-1/2 absolute top-1/2 right-3 text-sm text-muted-foreground">
277-
{chainMeta?.nativeCurrency.symbol || "ETH"}
278-
</span>
279-
</div>
280-
</FormFieldSetup>
281-
282-
{/* trading fees */}
283-
<FormFieldSetup
284-
errorMessage={
285-
props.form.formState.errors.saleAllocationPercentage?.message
286-
}
287-
isRequired
288-
label="Trading Fees"
289-
>
290-
<Select
291-
onValueChange={(value) => {
292-
props.form.setValue("pool.tradingFees", value as TradingFees, {
249+
{/* starting price */}
250+
<FormFieldSetup
251+
errorMessage={
252+
props.form.formState.errors.pool?.startingPricePerToken?.message
253+
}
254+
isRequired
255+
label="Starting price per token"
256+
>
257+
<div className="relative">
258+
<DecimalInput
259+
className="pr-10"
260+
onChange={(value) => {
261+
props.form.setValue("pool.startingPricePerToken", value, {
293262
shouldValidate: true,
294263
});
295264
}}
296-
value={props.form.watch("pool.tradingFees")}
297-
>
298-
<SelectTrigger>
299-
<SelectValue placeholder="Select Fees" />
300-
</SelectTrigger>
301-
<SelectContent>
302-
{tradingFeesOptions.map((option) => (
303-
<SelectItem key={option} value={option}>
304-
{option}%
305-
</SelectItem>
306-
))}
307-
</SelectContent>
308-
</Select>
309-
</FormFieldSetup>
310-
</div>
265+
value={props.form.watch("pool.startingPricePerToken")}
266+
/>
267+
<span className="-translate-y-1/2 absolute top-1/2 right-3 text-sm text-muted-foreground">
268+
{chainMeta?.nativeCurrency.symbol || "ETH"}
269+
</span>
270+
</div>
271+
</FormFieldSetup>
311272
</div>
312273
);
313274
}

0 commit comments

Comments
 (0)