This repository was archived by the owner on Feb 25, 2026. It is now read-only.
Mine for asset vanity address in encode function#101
Open
Conversation
This reverts commit 1fc9301.
z80dev
reviewed
Jul 9, 2025
Comment on lines
+593
to
+608
| let minedSalt = this.generateRandomSalt(userAddress); | ||
| for (let salt = BigInt(0); salt < BigInt(1_000_000); salt++) { | ||
| const saltBytes = `0x${salt.toString(16).padStart(64, "0")}` as Hash; | ||
|
|
||
| const token = this.computeCreate2Address( | ||
| saltBytes, | ||
| tokenInitHash, | ||
| tokenFactory | ||
| ); | ||
| if (token.toLowerCase().endsWith(VANITY_ADDRESS_ENDING)) { | ||
| console.log(token); | ||
| minedSalt = saltBytes; | ||
| break; | ||
| } | ||
| } | ||
|
|
Collaborator
There was a problem hiding this comment.
we should set a success boolean somewhere before the loop, set it to true if we find a valid salt, and then check it after the loop, and maybe throw an error if one isnt found, or just return a 0 val
otherwise if we dont find a valid salt in 1M generations this will just return the last salt it tried without telling the user anything
1M iterations is a lot so this may be extremely unlikely lol but it doesnt cost us much to add it
z80dev
reviewed
Jul 9, 2025
| export const MAX_TICK_SPACING = 30; | ||
| export const DEFAULT_PD_SLUGS = 5; | ||
| export const DAY_SECONDS = 24 * 60 * 60; | ||
| export const VANITY_ADDRESS_ENDING = "abcd"; |
Collaborator
There was a problem hiding this comment.
do we want this to be configurable by users?
Collaborator
Author
There was a problem hiding this comment.
No, this should be hardcoded
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.