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

bytes32 instead of strings #129

Closed
Pfed-prog opened this issue Feb 18, 2023 · 3 comments
Closed

bytes32 instead of strings #129

Pfed-prog opened this issue Feb 18, 2023 · 3 comments

Comments

@Pfed-prog
Copy link

Article for reference: https://medium.com/@cryptopusco/bytes-and-strings-in-solidity-f2cd4e53f388

E.g.
contracts/tests/TalentLayerIDV2.sol Profile struct contains string handle attribute which can be changed to bytes32

The line in code
uint8 constant MAX_HANDLE_LENGTH = 31;
also satisfies this condition

@mattiapomelli
Copy link
Contributor

That's a good point. The problem is that we need the handle as a string for the token uri (see _buildTokenURI function), but it's quite tricky to convert a bytes32 to string without knowing the length of the string (and without adding extra zeros as padding)

So probably the change is not worth the extra complexity that it adds.

Thanks for the suggestions though, and would like to hear your thoughts on this. Maybe there's a solution that we are not thinking about.

@Pfed-prog
Copy link
Author

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

No branches or pull requests

3 participants