Skip to content
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

Common token prefix utility func #299

Merged
merged 3 commits into from
May 17, 2024

Conversation

mariusmihaic
Copy link
Contributor

No description provided.

@mariusmihaic mariusmihaic self-assigned this Apr 23, 2024
@mariusmihaic mariusmihaic changed the title FEAT: Common token prefix utility func Common token prefix utility func Apr 23, 2024
axenteoctavian
axenteoctavian previously approved these changes May 15, 2024
minLengthESDTPrefix = 1
)

func IsValidPrefixedToken(token string) (string, bool) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing comment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

// minLengthESDTPrefix represents the minimum number of characters a token's prefix can have
minLengthESDTPrefix = 1
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we have IsValidToken (as it was before) to understand prefixed tokens as well, not only non-prefixed ones ?

I think it should and it is possible.

It can be done with len of tokenSplit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In mx-chain-go we don't have any function which only does the validation for a simple token, we only have this func(which also does some validations):
ExtractTokenIDAndNonceFromTokenStorageKey.

However, that type of function is not being used in other places, so there was no need to create one and move it to core only to be used in the binary node.

@mariusmihaic mariusmihaic merged commit 7befa59 into rc/v1.7.next1 May 17, 2024
2 checks passed
@mariusmihaic mariusmihaic deleted the MX-15387-token-prefix-common branch May 17, 2024 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants