Timeline for Using a string's hash as a mapping key
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 23, 2021 at 0:59 | vote | accept | GGizmos | ||
Aug 10, 2021 at 20:19 | comment | added | GGizmos | It may not be necessary to make the conversion internally (could be built with mapping of (bytes32=>string), but I think byte32 is quite a pain for app devs who may want to use my contracts. I was able to achieve something close to what I think will be easier on the user side, with the answer below, although I am not really sure if the conversion of byte32 to unit is totally legit. But it seems to work. | |
Aug 10, 2021 at 20:17 | answer | added | GGizmos | timeline score: 0 | |
Aug 10, 2021 at 18:51 | comment | added | Ahmed Ihsan Tawfeeq |
I've looked up most available answers for converting a bytes32 type into string , and all seem to fail with the latest version of Solidity. I'm sure there is a solution that would work, but I don't possibly see any reason why you would make that conversion in the first place. You could simply key the mapping by the bytes32 representation of the hash. It would be easier to convert a string input into bytes32 type on the user side via Web3JS as in: ethereum.stackexchange.com/questions/23058/….
|
|
Aug 10, 2021 at 17:36 | history | undeleted | GGizmos | ||
Aug 10, 2021 at 17:35 | history | deleted | GGizmos | via Vote | |
Aug 10, 2021 at 17:31 | history | asked | GGizmos | CC BY-SA 4.0 |