Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

# claude
.claude
8 changes: 8 additions & 0 deletions app/public/tokens/usdc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/public/tokens/usdt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/src/components/create-token/custom/authority.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function Authority({
initialData
}: AuthorityProps) {
const [formData, setFormData] = useState<AuthorityData>({
tokenUpdateAuthority: initialData?.tokenUpdateAuthority || "1",
tokenUpdateAuthority: initialData?.tokenUpdateAuthority || "0",
leftoverReceiver: initialData?.leftoverReceiver || "",
feeClaimer: initialData?.feeClaimer || "",
});
Expand Down
534 changes: 422 additions & 112 deletions app/src/components/create-token/custom/dbc-config.tsx

Large diffs are not rendered by default.

299 changes: 234 additions & 65 deletions app/src/components/create-token/custom/fee-config.tsx

Large diffs are not rendered by default.

120 changes: 114 additions & 6 deletions app/src/components/create-token/custom/liquidity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import React, { useState, useMemo, useCallback } from 'react';
import { Progress } from '@/components/ui/progress';
import { cn } from '@/lib/utils';
import { InfoTooltip, DBC_TOOLTIPS } from '@/components/ui/info-tooltip';

interface LiquidityProps {
onNext: (data: LiquidityData) => void;
Expand All @@ -18,6 +19,13 @@ export interface LiquidityData {
creatorLpPercentage: number;
partnerLockedLpPercentage: number;
creatorLockedLpPercentage: number;
creatorTradingFeePercentage: number;
leftover: number;
// Migration Fee (optional)
migrationFee?: {
feePercentage: number;
creatorFeePercentage: number;
};
}

export default function Liquidity({
Expand All @@ -33,6 +41,12 @@ export default function Liquidity({
creatorLpPercentage: initialData?.creatorLpPercentage || 50,
partnerLockedLpPercentage: initialData?.partnerLockedLpPercentage || 0,
creatorLockedLpPercentage: initialData?.creatorLockedLpPercentage || 0,
creatorTradingFeePercentage: initialData?.creatorTradingFeePercentage || 50,
leftover: initialData?.leftover || 0,
migrationFee: initialData?.migrationFee || {
feePercentage: 0,
creatorFeePercentage: 0,
},
});

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

const handleMigrationFeeChange = useCallback((field: 'feePercentage' | 'creatorFeePercentage', value: string) => {
const numValue = parseFloat(value) || 0;
setFormData(prev => ({
...prev,
migrationFee: {
...prev.migrationFee!,
[field]: numValue
}
}));
}, []);

const handleSubmit = useCallback((e: React.FormEvent) => {
e.preventDefault();
onNext(formData);
Expand Down Expand Up @@ -106,11 +131,12 @@ export default function Liquidity({
{/* LP Distribution */}
<div className="mb-6 sm:mb-8">
<h3 className="text-base sm:text-lg font-semibold text-black mb-3 sm:mb-4">LP Distribution</h3>

<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
<div>
<label className="block text-sm font-medium text-gray-700 mb-2">
<label className="block text-sm font-medium text-gray-700 mb-2 flex items-center">
Partner LP Percentage
<InfoTooltip content={DBC_TOOLTIPS.lpDistribution.partnerLpPercentage} />
</label>
<input
type="number"
Expand All @@ -123,8 +149,9 @@ export default function Liquidity({
/>
</div>
<div>
<label className="block text-sm font-medium text-gray-700 mb-2">
<label className="block text-sm font-medium text-gray-700 mb-2 flex items-center">
Creator LP Percentage
<InfoTooltip content={DBC_TOOLTIPS.lpDistribution.creatorLpPercentage} />
</label>
<input
type="number"
Expand Down Expand Up @@ -163,11 +190,12 @@ export default function Liquidity({
{/* LP Locking */}
<div className="mb-6 sm:mb-8">
<h3 className="text-base sm:text-lg font-semibold text-black mb-3 sm:mb-4">LP Locking</h3>

<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
<div>
<label className="block text-sm font-medium text-gray-700 mb-2">
<label className="block text-sm font-medium text-gray-700 mb-2 flex items-center">
Partner Locked LP Percentage
<InfoTooltip content={DBC_TOOLTIPS.lpDistribution.partnerLockedLpPercentage} />
</label>
<input
type="number"
Expand All @@ -180,8 +208,9 @@ export default function Liquidity({
/>
</div>
<div>
<label className="block text-sm font-medium text-gray-700 mb-2">
<label className="block text-sm font-medium text-gray-700 mb-2 flex items-center">
Creator Locked LP Percentage
<InfoTooltip content={DBC_TOOLTIPS.lpDistribution.creatorLockedLpPercentage} />
</label>
<input
type="number"
Expand All @@ -196,6 +225,85 @@ export default function Liquidity({
</div>
</div>

{/* Trading Fee & Leftover */}
<div className="mb-6 sm:mb-8">
<h3 className="text-base sm:text-lg font-semibold text-black mb-3 sm:mb-4">Trading Fee & Leftover</h3>

<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
<div>
<label className="block text-sm font-medium text-gray-700 mb-2 flex items-center">
Creator Trading Fee Percentage (%)
<InfoTooltip content={DBC_TOOLTIPS.lpDistribution.creatorTradingFeePercentage} />
</label>
<input
type="number"
placeholder="50"
value={formData.creatorTradingFeePercentage}
onChange={(e) => handleInputChange('creatorTradingFeePercentage', e.target.value)}
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"
min="0"
max="100"
/>
<p className="text-xs text-gray-500 mt-1">0% = all fees go to partner</p>
</div>
<div>
<label className="block text-sm font-medium text-gray-700 mb-2 flex items-center">
Leftover Amount
<InfoTooltip content={DBC_TOOLTIPS.lpDistribution.leftover} />
</label>
<input
type="number"
placeholder="0"
value={formData.leftover}
onChange={(e) => handleInputChange('leftover', e.target.value)}
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"
min="0"
/>
<p className="text-xs text-gray-500 mt-1">Claimable after pool migrates</p>
</div>
</div>
</div>

{/* Migration Fee */}
<div className="mb-6 sm:mb-8">
<h3 className="text-base sm:text-lg font-semibold text-black mb-3 sm:mb-4">Migration Fee (Optional)</h3>

<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
<div>
<label className="block text-sm font-medium text-gray-700 mb-2 flex items-center">
Migration Fee Percentage (%)
<InfoTooltip content={DBC_TOOLTIPS.migrationFee.feePercentage} />
</label>
<input
type="number"
placeholder="0"
value={formData.migrationFee?.feePercentage || 0}
onChange={(e) => handleMigrationFeeChange('feePercentage', e.target.value)}
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"
min="0"
max="50"
/>
<p className="text-xs text-gray-500 mt-1">Fee taken from migration threshold (0-50%)</p>
</div>
<div>
<label className="block text-sm font-medium text-gray-700 mb-2 flex items-center">
Creator Migration Fee Percentage (%)
<InfoTooltip content={DBC_TOOLTIPS.migrationFee.creatorFeePercentage} />
</label>
<input
type="number"
placeholder="0"
value={formData.migrationFee?.creatorFeePercentage || 0}
onChange={(e) => handleMigrationFeeChange('creatorFeePercentage', e.target.value)}
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"
min="0"
max="100"
/>
<p className="text-xs text-gray-500 mt-1">Creator's share of migration fee (0-100%)</p>
</div>
</div>
</div>

{/* LP Distribution Preview */}
<div className="bg-blue-50 p-6 rounded-lg mb-8">
<h3 className="font-semibold text-black mb-4">LP Distribution Preview</h3>
Expand Down
70 changes: 57 additions & 13 deletions app/src/components/create-token/custom/preview-deployment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import LoadingOverlay from "@/components/ui/loading-overlay";
import TokenCreationModal from "@/components/ui/token-creation-modal";
import TokenSuccessModal from "@/components/ui/token-success-modal";
import { BuyTokenModal } from "@/components/modal/BuyTokenModal";
import { NATIVE_MINT } from '@solana/spl-token';
import { getSOLNetwork } from '@/utils/sol';

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

return {
quoteMint: "So11111111111111111111111111111111111111112", // SOL
quoteMint: tokenInfo?.tokenQuoteAddress || NATIVE_MINT.toString(), // Use custom address or default to SOL
dbcConfig: {
buildCurveMode: parseInt(dbcConfig.buildCurveMode),
percentageSupplyOnMigration: dbcConfig.percentageSupplyOnMigration,
migrationQuoteThreshold: dbcConfig.migrationQuoteThreshold,
// Mode 0: Build Curve
...(parseInt(dbcConfig.buildCurveMode) === 0 && {
percentageSupplyOnMigration: dbcConfig.percentageSupplyOnMigration,
migrationQuoteThreshold: dbcConfig.migrationQuoteThreshold,
}),
// Mode 1: Market Cap Based
...(parseInt(dbcConfig.buildCurveMode) === 1 && {
initialMarketCap: dbcConfig.initialMarketCap,
migrationMarketCap: dbcConfig.migrationMarketCap,
}),
// Mode 2: Two Segments
...(parseInt(dbcConfig.buildCurveMode) === 2 && {
initialMarketCap: dbcConfig.initialMarketCap,
migrationMarketCap: dbcConfig.migrationMarketCap,
percentageSupplyOnMigration: dbcConfig.percentageSupplyOnMigration,
}),
// Mode 3: Liquidity Weights
...(parseInt(dbcConfig.buildCurveMode) === 3 && {
initialMarketCap: dbcConfig.initialMarketCap,
migrationMarketCap: dbcConfig.migrationMarketCap,
liquidityWeights: dbcConfig.liquidityWeights,
}),
totalTokenSupply: tokenInfo.totalTokenSupply,
migrationOption: parseInt(dbcConfig.migrationOption),
tokenBaseDecimal: tokenInfo.tokenBaseDecimal,
Expand All @@ -165,12 +187,21 @@ export default function PreviewDeployment({
},
baseFeeParams: {
baseFeeMode: parseInt(feeConfig.baseFeeMode),
feeSchedulerParam: {
startingFeeBps: feeConfig.feeSchedulerParam.startingFeeBps,
endingFeeBps: feeConfig.feeSchedulerParam.endingFeeBps,
numberOfPeriod: feeConfig.feeSchedulerParam.numberOfPeriod,
totalDuration: feeConfig.feeSchedulerParam.totalDuration
}
...(parseInt(feeConfig.baseFeeMode) === 2 ? {
rateLimiterParam: {
baseFeeBps: feeConfig.rateLimiterParam!.baseFeeBps,
feeIncrementBps: feeConfig.rateLimiterParam!.feeIncrementBps,
referenceAmount: feeConfig.rateLimiterParam!.referenceAmount,
maxLimiterDuration: feeConfig.rateLimiterParam!.maxLimiterDuration
}
} : {
feeSchedulerParam: {
startingFeeBps: feeConfig.feeSchedulerParam!.startingFeeBps,
endingFeeBps: feeConfig.feeSchedulerParam!.endingFeeBps,
numberOfPeriod: feeConfig.feeSchedulerParam!.numberOfPeriod,
totalDuration: feeConfig.feeSchedulerParam!.totalDuration
}
})
},
dynamicFeeEnabled: dbcConfig.dynamicFeeEnabled,
activationType: parseInt(dbcConfig.activationType),
Expand All @@ -181,13 +212,20 @@ export default function PreviewDeployment({
creatorLpPercentage: liquidityConfig.creatorLpPercentage,
partnerLockedLpPercentage: liquidityConfig.partnerLockedLpPercentage,
creatorLockedLpPercentage: liquidityConfig.creatorLockedLpPercentage,
creatorTradingFeePercentage: 50, // Default value
leftover: 0, // Default value
creatorTradingFeePercentage: liquidityConfig.creatorTradingFeePercentage,
leftover: liquidityConfig.leftover,
tokenUpdateAuthority: parseInt(authorityConfig.tokenUpdateAuthority),
migrationFee: {
migrationFee: liquidityConfig.migrationFee || {
feePercentage: 0,
creatorFeePercentage: 0
},
...(dbcConfig.migratedPoolFee && {
migratedPoolFee: {
collectFeeMode: parseInt(dbcConfig.migratedPoolFee.collectFeeMode),
dynamicFee: parseInt(dbcConfig.migratedPoolFee.dynamicFee),
poolFeeBps: dbcConfig.migratedPoolFee.poolFeeBps
}
}),
leftoverReceiver: authorityConfig.leftoverReceiver,
feeClaimer: authorityConfig.feeClaimer
},
Expand Down Expand Up @@ -755,6 +793,12 @@ export default function PreviewDeployment({
<span className="text-sm text-gray-600">Quote Decimal:</span>
<p className="font-medium">{formData.tokenInfo.tokenQuoteDecimal}</p>
</div>
{formData.tokenInfo.tokenQuoteAddress && (
<div className="sm:col-span-3">
<span className="text-sm text-gray-600">Token Quote Address:</span>
<p className="font-medium text-xs break-all">{formData.tokenInfo.tokenQuoteAddress}</p>
</div>
)}
</div>
</div>
</div>
Expand Down Expand Up @@ -843,7 +887,7 @@ export default function PreviewDeployment({
<div className="space-y-2">
<div className="flex justify-between text-sm">
<span className="text-gray-600">Network:</span>
<span className="font-medium">Solana Mainnet</span>
<span className="font-medium capitalize">{getSOLNetwork()}</span>
</div>
<div className="flex justify-between text-sm">
<span className="text-gray-600">RPC Endpoint:</span>
Expand Down
Loading
Loading