Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/utils/Bytes32AddressLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ pragma solidity >=0.8.0;
/// @notice Library for converting between addresses and bytes32 values.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/Bytes32AddressLib.sol)
library Bytes32AddressLib {
/// @notice Converts a bytes32 value into an address.
/// @param bytesValue The bytes32 value to convert.
/// @return The resulting address.

function fromLast20Bytes(bytes32 bytesValue) internal pure returns (address) {
return address(uint160(uint256(bytesValue)));
}

/// @notice Converts an address to a bytes32 representation.
/// @param addressValue The address to convert.
/// @return The resulting bytes32 value.

function fillLast12Bytes(address addressValue) internal pure returns (bytes32) {
return bytes32(bytes20(addressValue));
}
Expand Down