How can i pass/convert an address as bytes 32 in this constructor argument? #2386
-
I have a constructor here that takes an array of addresses but converted into bytes32 , and address contains 42 hex digits , but bytes32 contains 64. Im trying to find a way so i can convert the address's to bytes32 and pass them into this constructor.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
@ippy1997 You can add zeros after the address or you can convert it to bytes32 like this bytes32(abi.encodePacked(0x5B38Da6a701c568545dCfcB03FcB875f56beddC4)); |
Beta Was this translation helpful? Give feedback.
-
What do you want to do? Check @alymurtazamemon 's response for the conversion to bytes32. In the code snippet above--as I can comprehend--it maps the bytes32 key (i.e. at index i in callers[]) to the value true. |
Beta Was this translation helpful? Give feedback.
@ippy1997 You can add zeros after the address or you can convert it to bytes32 like this