Skip to content

Commit 63940eb

Browse files
committed
Add tokendrop as fallback
1 parent ee0dee1 commit 63940eb

File tree

15 files changed

+878
-377
lines changed

15 files changed

+878
-377
lines changed

apps/dashboard/src/@/analytics/report.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,11 @@ export function reportChainConfigurationAdded(properties: {
224224
// ASSETS
225225
// ----------------------------
226226

227-
type AssetContractType = "DropERC20" | "DropERC1155" | "DropERC721";
227+
type AssetContractType =
228+
| "DropERC20"
229+
| "DropERC1155"
230+
| "DropERC721"
231+
| "ERC20Asset";
228232

229233
/**
230234
* ### Why do we need to report this event?
@@ -334,6 +338,15 @@ export function reportAssetCreationSuccessful(properties: {
334338
});
335339
}
336340

341+
type CoinCreationStep =
342+
| "erc20-asset:deploy-contract"
343+
| "erc20-asset:airdrop-tokens"
344+
| "erc20-asset:approve-airdrop-tokens"
345+
| "drop-erc20:deploy-contract"
346+
| "drop-erc20:set-claim-conditions"
347+
| "drop-erc20:mint-tokens"
348+
| "drop-erc20:airdrop-tokens";
349+
337350
/**
338351
* ### Why do we need to report this event?
339352
* - To track number of failed asset creations
@@ -355,12 +368,7 @@ export function reportAssetCreationFailed(
355368
}
356369
| {
357370
assetType: "coin";
358-
step:
359-
| "deploy-contract"
360-
| "set-claim-conditions"
361-
| "mint-tokens"
362-
| "airdrop-tokens"
363-
| "approve-airdrop-tokens";
371+
step: CoinCreationStep;
364372
}
365373
),
366374
) {

apps/dashboard/src/@/components/blocks/TokenSelector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export function TokenSelector(props: {
204204
searchPlaceholder="Search by name or symbol"
205205
showCheck={props.showCheck}
206206
side={props.side}
207-
value={selectedValue}
207+
value={tokensQuery.isPending ? undefined : selectedValue}
208208
/>
209209
);
210210
}

apps/dashboard/src/@/hooks/project-contracts.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ export function useAddContractToProject() {
1111
contractAddress: string;
1212
chainId: string;
1313
deploymentType: "asset" | undefined;
14-
contractType: "ERC20Asset" | "DropERC721" | "DropERC1155" | undefined;
14+
contractType:
15+
| "ERC20Asset"
16+
| "DropERC721"
17+
| "DropERC1155"
18+
| "DropERC20"
19+
| undefined;
1520
}) => {
1621
const res = await apiServerProxy({
1722
body: JSON.stringify({

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

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,21 @@ const priceAmountSchema = z.string().refine(
2222
return !Number.isNaN(number) && number >= 0;
2323
},
2424
{
25-
message: "Must be number larger than or equal to 0",
25+
message: "Amount must be number larger than or equal to 0",
2626
},
2727
);
2828

2929
export const tokenDistributionFormSchema = z.object({
30+
// airdrop
3031
airdropAddresses: z.array(
3132
z.object({
3233
address: addressSchema,
3334
quantity: z.string(),
3435
}),
3536
),
36-
// UI states
3737
airdropEnabled: z.boolean(),
38-
pool: z.object({
38+
// sales ---
39+
erc20Asset_poolMode: z.object({
3940
startingPricePerToken: priceAmountSchema.refine((value) => {
4041
const numValue = Number(value);
4142
if (numValue === 0) {
@@ -47,21 +48,37 @@ export const tokenDistributionFormSchema = z.object({
4748

4849
return isValidTickValue(tick);
4950
}, "Invalid price"),
51+
saleAllocationPercentage: z.string().refine(
52+
(value) => {
53+
const number = Number(value);
54+
if (Number.isNaN(number)) {
55+
return false;
56+
}
57+
return number >= 0 && number <= 100;
58+
},
59+
{
60+
message: "Must be a number between 0 and 100",
61+
},
62+
),
5063
}),
51-
saleAllocationPercentage: z.string().refine(
52-
(value) => {
53-
const number = Number(value);
54-
if (Number.isNaN(number)) {
55-
return false;
56-
}
57-
return number >= 0 && number <= 100;
58-
},
59-
{
60-
message: "Must be a number between 0 and 100",
61-
},
62-
),
63-
64-
saleMode: z.enum(["pool", "disabled"]),
64+
dropERC20Mode: z.object({
65+
pricePerToken: priceAmountSchema,
66+
saleTokenAddress: addressSchema,
67+
saleAllocationPercentage: z.string().refine(
68+
(value) => {
69+
const number = Number(value);
70+
if (Number.isNaN(number)) {
71+
return false;
72+
}
73+
return number >= 0 && number <= 100;
74+
},
75+
{
76+
message: "Must be a number between 0 and 100",
77+
},
78+
),
79+
}),
80+
saleEnabled: z.boolean(),
81+
saleMode: z.enum(["erc20-asset:pool", "drop-erc20:token-drop"]),
6582
supply: z.string().min(1, "Supply is required"),
6683
});
6784

0 commit comments

Comments
 (0)