-
Notifications
You must be signed in to change notification settings - Fork 574
[MNY-11] Dashboard: Add ERC20 token selector for starting price in token creation flow #7933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
graphite-app
merged 1 commit into
main
from
08-28-_mny-11_dashboard_add_erc20_token_selector_for_starting_price_in_token_creation_flow
Aug 28, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ import { pollWithTimeout } from "@/utils/pollWithTimeout"; | |
import { createTokenOnUniversalBridge } from "../_apis/create-token-on-bridge"; | ||
import type { CreateAssetFormValues } from "./_common/form"; | ||
import { CreateTokenAssetPageUI } from "./create-token-page.client"; | ||
import { getInitialTickValue } from "./utils/calculate-tick"; | ||
import { getInitialTickValue, isValidTickValue } from "./utils/calculate-tick"; | ||
|
||
export function CreateTokenAssetPage(props: { | ||
accountAddress: string; | ||
|
@@ -113,6 +113,25 @@ export function CreateTokenAssetPage(props: { | |
|
||
const chain = getChain(Number(params.values.chain)); | ||
|
||
let initialTick: number | undefined; | ||
|
||
if (params.values.saleEnabled && saleAmount !== 0) { | ||
initialTick = await getInitialTickValue({ | ||
startingPricePerToken: Number( | ||
params.values.erc20Asset_poolMode.startingPricePerToken, | ||
), | ||
tokenAddress: params.values.erc20Asset_poolMode.tokenAddress, | ||
chain, | ||
client: props.client, | ||
}); | ||
|
||
if (!isValidTickValue(initialTick)) { | ||
throw new Error( | ||
"Invalid starting price per token. Change price and try again", | ||
); | ||
} | ||
} | ||
|
||
const contractAddress = await createToken({ | ||
account, | ||
chain: chain, | ||
|
@@ -123,12 +142,13 @@ export function CreateTokenAssetPage(props: { | |
kind: "pool", | ||
config: { | ||
amount: BigInt(saleAmount), | ||
initialTick: getInitialTickValue({ | ||
startingPricePerToken: Number( | ||
params.values.erc20Asset_poolMode.startingPricePerToken, | ||
), | ||
}), | ||
initialTick: initialTick, | ||
developerRewardBps: 1250, // 12.5% | ||
currency: | ||
getAddress(params.values.erc20Asset_poolMode.tokenAddress) === | ||
getAddress(NATIVE_TOKEN_ADDRESS) | ||
? undefined | ||
: params.values.erc20Asset_poolMode.tokenAddress, | ||
}, | ||
} | ||
: undefined, | ||
|
@@ -442,14 +462,23 @@ export function CreateTokenAssetPage(props: { | |
setClaimConditions: DropERC20_setClaimConditions, | ||
}, | ||
}} | ||
onLaunchSuccess={(params) => { | ||
createTokenOnUniversalBridge({ | ||
chainId: params.chainId, | ||
client: props.client, | ||
tokenAddress: params.contractAddress, | ||
// TODO: UPDATE THIS WHEN WE ALLOW CUSTOM CURRENCY PAIRING | ||
pairedTokenAddress: NATIVE_TOKEN_ADDRESS, | ||
}); | ||
onLaunchSuccess={(values, contractAddress) => { | ||
if (values.saleMode === "erc20-asset:pool") { | ||
MananTank marked this conversation as resolved.
Show resolved
Hide resolved
|
||
createTokenOnUniversalBridge({ | ||
chainId: Number(values.chain), | ||
client: props.client, | ||
tokenAddress: contractAddress, | ||
pairedTokenAddress: values.erc20Asset_poolMode.tokenAddress, | ||
}); | ||
} else if (values.saleMode === "drop-erc20:token-drop") { | ||
Comment on lines
+465
to
+473
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainDouble-check callers updated to new onLaunchSuccess signature Guard against any remaining old call sites. 🏁 Script executed: #!/bin/bash
# Find old-style signatures/usages
rg -nP -C2 --type=ts --type=tsx '\bonLaunchSuccess\s*:\s*\(\s*params\s*:' | sed -n '1,120p'
rg -nP -C2 --type=ts --type=tsx 'onLaunchSuccess\(\s*\{' | sed -n '1,120p' Length of output: 222 🏁 Script executed: #!/bin/bash
# Search for all call sites and prop definitions of onLaunchSuccess
rg -n -C2 'onLaunchSuccess\s*=' -g '*.ts' -g '*.tsx'
rg -n -C2 'onLaunchSuccess\s*:' -g '*.ts' -g '*.tsx' Length of output: 8467 Update all onLaunchSuccess call sites to new signature
🤖 Prompt for AI Agents
|
||
createTokenOnUniversalBridge({ | ||
chainId: Number(values.chain), | ||
client: props.client, | ||
tokenAddress: contractAddress, | ||
pairedTokenAddress: undefined, | ||
}); | ||
} | ||
|
||
revalidatePathAction( | ||
`/team/${props.teamSlug}/project/${props.projectId}/tokens`, | ||
"page", | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 28 additions & 3 deletions
31
...pp)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/token/utils/calculate-tick.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.