Skip to content

Commit 5ade632

Browse files
authored
Merge pull request #48 from PotLock/feat/testnet
fix: add tooltip and fix missing field custom token
2 parents 5d7d56d + 7d250d0 commit 5ade632

File tree

13 files changed

+1229
-235
lines changed

13 files changed

+1229
-235
lines changed

app/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ yarn-error.log*
4040
# typescript
4141
*.tsbuildinfo
4242
next-env.d.ts
43+
44+
# claude
45+
.claude

app/public/tokens/usdc.svg

Lines changed: 8 additions & 0 deletions
Loading

app/public/tokens/usdt.png

310 KB
Loading

app/src/components/create-token/custom/authority.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default function Authority({
4141
initialData
4242
}: AuthorityProps) {
4343
const [formData, setFormData] = useState<AuthorityData>({
44-
tokenUpdateAuthority: initialData?.tokenUpdateAuthority || "1",
44+
tokenUpdateAuthority: initialData?.tokenUpdateAuthority || "0",
4545
leftoverReceiver: initialData?.leftoverReceiver || "",
4646
feeClaimer: initialData?.feeClaimer || "",
4747
});

app/src/components/create-token/custom/dbc-config.tsx

Lines changed: 422 additions & 112 deletions
Large diffs are not rendered by default.

app/src/components/create-token/custom/fee-config.tsx

Lines changed: 234 additions & 65 deletions
Large diffs are not rendered by default.

app/src/components/create-token/custom/liquidity.tsx

Lines changed: 114 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import React, { useState, useMemo, useCallback } from 'react';
44
import { Progress } from '@/components/ui/progress';
55
import { cn } from '@/lib/utils';
6+
import { InfoTooltip, DBC_TOOLTIPS } from '@/components/ui/info-tooltip';
67

78
interface LiquidityProps {
89
onNext: (data: LiquidityData) => void;
@@ -18,6 +19,13 @@ export interface LiquidityData {
1819
creatorLpPercentage: number;
1920
partnerLockedLpPercentage: number;
2021
creatorLockedLpPercentage: number;
22+
creatorTradingFeePercentage: number;
23+
leftover: number;
24+
// Migration Fee (optional)
25+
migrationFee?: {
26+
feePercentage: number;
27+
creatorFeePercentage: number;
28+
};
2129
}
2230

2331
export default function Liquidity({
@@ -33,6 +41,12 @@ export default function Liquidity({
3341
creatorLpPercentage: initialData?.creatorLpPercentage || 50,
3442
partnerLockedLpPercentage: initialData?.partnerLockedLpPercentage || 0,
3543
creatorLockedLpPercentage: initialData?.creatorLockedLpPercentage || 0,
44+
creatorTradingFeePercentage: initialData?.creatorTradingFeePercentage || 50,
45+
leftover: initialData?.leftover || 0,
46+
migrationFee: initialData?.migrationFee || {
47+
feePercentage: 0,
48+
creatorFeePercentage: 0,
49+
},
3650
});
3751

3852
const progressPercentage = useMemo(() =>
@@ -45,6 +59,17 @@ export default function Liquidity({
4559
setFormData(prev => ({ ...prev, [field]: numValue }));
4660
}, []);
4761

62+
const handleMigrationFeeChange = useCallback((field: 'feePercentage' | 'creatorFeePercentage', value: string) => {
63+
const numValue = parseFloat(value) || 0;
64+
setFormData(prev => ({
65+
...prev,
66+
migrationFee: {
67+
...prev.migrationFee!,
68+
[field]: numValue
69+
}
70+
}));
71+
}, []);
72+
4873
const handleSubmit = useCallback((e: React.FormEvent) => {
4974
e.preventDefault();
5075
onNext(formData);
@@ -106,11 +131,12 @@ export default function Liquidity({
106131
{/* LP Distribution */}
107132
<div className="mb-6 sm:mb-8">
108133
<h3 className="text-base sm:text-lg font-semibold text-black mb-3 sm:mb-4">LP Distribution</h3>
109-
134+
110135
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
111136
<div>
112-
<label className="block text-sm font-medium text-gray-700 mb-2">
137+
<label className="block text-sm font-medium text-gray-700 mb-2 flex items-center">
113138
Partner LP Percentage
139+
<InfoTooltip content={DBC_TOOLTIPS.lpDistribution.partnerLpPercentage} />
114140
</label>
115141
<input
116142
type="number"
@@ -123,8 +149,9 @@ export default function Liquidity({
123149
/>
124150
</div>
125151
<div>
126-
<label className="block text-sm font-medium text-gray-700 mb-2">
152+
<label className="block text-sm font-medium text-gray-700 mb-2 flex items-center">
127153
Creator LP Percentage
154+
<InfoTooltip content={DBC_TOOLTIPS.lpDistribution.creatorLpPercentage} />
128155
</label>
129156
<input
130157
type="number"
@@ -163,11 +190,12 @@ export default function Liquidity({
163190
{/* LP Locking */}
164191
<div className="mb-6 sm:mb-8">
165192
<h3 className="text-base sm:text-lg font-semibold text-black mb-3 sm:mb-4">LP Locking</h3>
166-
193+
167194
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
168195
<div>
169-
<label className="block text-sm font-medium text-gray-700 mb-2">
196+
<label className="block text-sm font-medium text-gray-700 mb-2 flex items-center">
170197
Partner Locked LP Percentage
198+
<InfoTooltip content={DBC_TOOLTIPS.lpDistribution.partnerLockedLpPercentage} />
171199
</label>
172200
<input
173201
type="number"
@@ -180,8 +208,9 @@ export default function Liquidity({
180208
/>
181209
</div>
182210
<div>
183-
<label className="block text-sm font-medium text-gray-700 mb-2">
211+
<label className="block text-sm font-medium text-gray-700 mb-2 flex items-center">
184212
Creator Locked LP Percentage
213+
<InfoTooltip content={DBC_TOOLTIPS.lpDistribution.creatorLockedLpPercentage} />
185214
</label>
186215
<input
187216
type="number"
@@ -196,6 +225,85 @@ export default function Liquidity({
196225
</div>
197226
</div>
198227

228+
{/* Trading Fee & Leftover */}
229+
<div className="mb-6 sm:mb-8">
230+
<h3 className="text-base sm:text-lg font-semibold text-black mb-3 sm:mb-4">Trading Fee & Leftover</h3>
231+
232+
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
233+
<div>
234+
<label className="block text-sm font-medium text-gray-700 mb-2 flex items-center">
235+
Creator Trading Fee Percentage (%)
236+
<InfoTooltip content={DBC_TOOLTIPS.lpDistribution.creatorTradingFeePercentage} />
237+
</label>
238+
<input
239+
type="number"
240+
placeholder="50"
241+
value={formData.creatorTradingFeePercentage}
242+
onChange={(e) => handleInputChange('creatorTradingFeePercentage', e.target.value)}
243+
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-500 text-sm sm:text-base"
244+
min="0"
245+
max="100"
246+
/>
247+
<p className="text-xs text-gray-500 mt-1">0% = all fees go to partner</p>
248+
</div>
249+
<div>
250+
<label className="block text-sm font-medium text-gray-700 mb-2 flex items-center">
251+
Leftover Amount
252+
<InfoTooltip content={DBC_TOOLTIPS.lpDistribution.leftover} />
253+
</label>
254+
<input
255+
type="number"
256+
placeholder="0"
257+
value={formData.leftover}
258+
onChange={(e) => handleInputChange('leftover', e.target.value)}
259+
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-500 text-sm sm:text-base"
260+
min="0"
261+
/>
262+
<p className="text-xs text-gray-500 mt-1">Claimable after pool migrates</p>
263+
</div>
264+
</div>
265+
</div>
266+
267+
{/* Migration Fee */}
268+
<div className="mb-6 sm:mb-8">
269+
<h3 className="text-base sm:text-lg font-semibold text-black mb-3 sm:mb-4">Migration Fee (Optional)</h3>
270+
271+
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
272+
<div>
273+
<label className="block text-sm font-medium text-gray-700 mb-2 flex items-center">
274+
Migration Fee Percentage (%)
275+
<InfoTooltip content={DBC_TOOLTIPS.migrationFee.feePercentage} />
276+
</label>
277+
<input
278+
type="number"
279+
placeholder="0"
280+
value={formData.migrationFee?.feePercentage || 0}
281+
onChange={(e) => handleMigrationFeeChange('feePercentage', e.target.value)}
282+
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-500 text-sm sm:text-base"
283+
min="0"
284+
max="50"
285+
/>
286+
<p className="text-xs text-gray-500 mt-1">Fee taken from migration threshold (0-50%)</p>
287+
</div>
288+
<div>
289+
<label className="block text-sm font-medium text-gray-700 mb-2 flex items-center">
290+
Creator Migration Fee Percentage (%)
291+
<InfoTooltip content={DBC_TOOLTIPS.migrationFee.creatorFeePercentage} />
292+
</label>
293+
<input
294+
type="number"
295+
placeholder="0"
296+
value={formData.migrationFee?.creatorFeePercentage || 0}
297+
onChange={(e) => handleMigrationFeeChange('creatorFeePercentage', e.target.value)}
298+
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-500 text-sm sm:text-base"
299+
min="0"
300+
max="100"
301+
/>
302+
<p className="text-xs text-gray-500 mt-1">Creator's share of migration fee (0-100%)</p>
303+
</div>
304+
</div>
305+
</div>
306+
199307
{/* LP Distribution Preview */}
200308
<div className="bg-blue-50 p-6 rounded-lg mb-8">
201309
<h3 className="font-semibold text-black mb-4">LP Distribution Preview</h3>

app/src/components/create-token/custom/preview-deployment.tsx

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import LoadingOverlay from "@/components/ui/loading-overlay";
1414
import TokenCreationModal from "@/components/ui/token-creation-modal";
1515
import TokenSuccessModal from "@/components/ui/token-success-modal";
1616
import { BuyTokenModal } from "@/components/modal/BuyTokenModal";
17+
import { NATIVE_MINT } from '@solana/spl-token';
18+
import { getSOLNetwork } from '@/utils/sol';
1719

1820
interface PreviewDeploymentProps {
1921
onBack: () => void;
@@ -147,11 +149,31 @@ export default function PreviewDeployment({
147149
const authorityConfig = formData.authority;
148150

149151
return {
150-
quoteMint: "So11111111111111111111111111111111111111112", // SOL
152+
quoteMint: tokenInfo?.tokenQuoteAddress || NATIVE_MINT.toString(), // Use custom address or default to SOL
151153
dbcConfig: {
152154
buildCurveMode: parseInt(dbcConfig.buildCurveMode),
153-
percentageSupplyOnMigration: dbcConfig.percentageSupplyOnMigration,
154-
migrationQuoteThreshold: dbcConfig.migrationQuoteThreshold,
155+
// Mode 0: Build Curve
156+
...(parseInt(dbcConfig.buildCurveMode) === 0 && {
157+
percentageSupplyOnMigration: dbcConfig.percentageSupplyOnMigration,
158+
migrationQuoteThreshold: dbcConfig.migrationQuoteThreshold,
159+
}),
160+
// Mode 1: Market Cap Based
161+
...(parseInt(dbcConfig.buildCurveMode) === 1 && {
162+
initialMarketCap: dbcConfig.initialMarketCap,
163+
migrationMarketCap: dbcConfig.migrationMarketCap,
164+
}),
165+
// Mode 2: Two Segments
166+
...(parseInt(dbcConfig.buildCurveMode) === 2 && {
167+
initialMarketCap: dbcConfig.initialMarketCap,
168+
migrationMarketCap: dbcConfig.migrationMarketCap,
169+
percentageSupplyOnMigration: dbcConfig.percentageSupplyOnMigration,
170+
}),
171+
// Mode 3: Liquidity Weights
172+
...(parseInt(dbcConfig.buildCurveMode) === 3 && {
173+
initialMarketCap: dbcConfig.initialMarketCap,
174+
migrationMarketCap: dbcConfig.migrationMarketCap,
175+
liquidityWeights: dbcConfig.liquidityWeights,
176+
}),
155177
totalTokenSupply: tokenInfo.totalTokenSupply,
156178
migrationOption: parseInt(dbcConfig.migrationOption),
157179
tokenBaseDecimal: tokenInfo.tokenBaseDecimal,
@@ -165,12 +187,21 @@ export default function PreviewDeployment({
165187
},
166188
baseFeeParams: {
167189
baseFeeMode: parseInt(feeConfig.baseFeeMode),
168-
feeSchedulerParam: {
169-
startingFeeBps: feeConfig.feeSchedulerParam.startingFeeBps,
170-
endingFeeBps: feeConfig.feeSchedulerParam.endingFeeBps,
171-
numberOfPeriod: feeConfig.feeSchedulerParam.numberOfPeriod,
172-
totalDuration: feeConfig.feeSchedulerParam.totalDuration
173-
}
190+
...(parseInt(feeConfig.baseFeeMode) === 2 ? {
191+
rateLimiterParam: {
192+
baseFeeBps: feeConfig.rateLimiterParam!.baseFeeBps,
193+
feeIncrementBps: feeConfig.rateLimiterParam!.feeIncrementBps,
194+
referenceAmount: feeConfig.rateLimiterParam!.referenceAmount,
195+
maxLimiterDuration: feeConfig.rateLimiterParam!.maxLimiterDuration
196+
}
197+
} : {
198+
feeSchedulerParam: {
199+
startingFeeBps: feeConfig.feeSchedulerParam!.startingFeeBps,
200+
endingFeeBps: feeConfig.feeSchedulerParam!.endingFeeBps,
201+
numberOfPeriod: feeConfig.feeSchedulerParam!.numberOfPeriod,
202+
totalDuration: feeConfig.feeSchedulerParam!.totalDuration
203+
}
204+
})
174205
},
175206
dynamicFeeEnabled: dbcConfig.dynamicFeeEnabled,
176207
activationType: parseInt(dbcConfig.activationType),
@@ -181,13 +212,20 @@ export default function PreviewDeployment({
181212
creatorLpPercentage: liquidityConfig.creatorLpPercentage,
182213
partnerLockedLpPercentage: liquidityConfig.partnerLockedLpPercentage,
183214
creatorLockedLpPercentage: liquidityConfig.creatorLockedLpPercentage,
184-
creatorTradingFeePercentage: 50, // Default value
185-
leftover: 0, // Default value
215+
creatorTradingFeePercentage: liquidityConfig.creatorTradingFeePercentage,
216+
leftover: liquidityConfig.leftover,
186217
tokenUpdateAuthority: parseInt(authorityConfig.tokenUpdateAuthority),
187-
migrationFee: {
218+
migrationFee: liquidityConfig.migrationFee || {
188219
feePercentage: 0,
189220
creatorFeePercentage: 0
190221
},
222+
...(dbcConfig.migratedPoolFee && {
223+
migratedPoolFee: {
224+
collectFeeMode: parseInt(dbcConfig.migratedPoolFee.collectFeeMode),
225+
dynamicFee: parseInt(dbcConfig.migratedPoolFee.dynamicFee),
226+
poolFeeBps: dbcConfig.migratedPoolFee.poolFeeBps
227+
}
228+
}),
191229
leftoverReceiver: authorityConfig.leftoverReceiver,
192230
feeClaimer: authorityConfig.feeClaimer
193231
},
@@ -755,6 +793,12 @@ export default function PreviewDeployment({
755793
<span className="text-sm text-gray-600">Quote Decimal:</span>
756794
<p className="font-medium">{formData.tokenInfo.tokenQuoteDecimal}</p>
757795
</div>
796+
{formData.tokenInfo.tokenQuoteAddress && (
797+
<div className="sm:col-span-3">
798+
<span className="text-sm text-gray-600">Token Quote Address:</span>
799+
<p className="font-medium text-xs break-all">{formData.tokenInfo.tokenQuoteAddress}</p>
800+
</div>
801+
)}
758802
</div>
759803
</div>
760804
</div>
@@ -843,7 +887,7 @@ export default function PreviewDeployment({
843887
<div className="space-y-2">
844888
<div className="flex justify-between text-sm">
845889
<span className="text-gray-600">Network:</span>
846-
<span className="font-medium">Solana Mainnet</span>
890+
<span className="font-medium capitalize">{getSOLNetwork()}</span>
847891
</div>
848892
<div className="flex justify-between text-sm">
849893
<span className="text-gray-600">RPC Endpoint:</span>

0 commit comments

Comments
 (0)