Discover more of XDCScan Block Explorer's tools and services in one place.
Contract Source Code:
File 1 of 1 : AddressUtilsExternal.sol
/* * Copyright 2024 Circle Internet Group, Inc. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity 0.7.6; /** * @title AddressUtilsExternal Library * @notice Helper functions for converting addresses to and from bytes **/ library AddressUtilsExternal { /** * @notice converts address to bytes32 (alignment preserving cast.) * @param addr the address to convert to bytes32 */ function addressToBytes32(address addr) external pure returns (bytes32) { return bytes32(uint256(uint160(addr))); } /** * @notice converts bytes32 to address (alignment preserving cast.) * @dev Warning: it is possible to have different input values _buf map to the same address. * For use cases where this is not acceptable, validate that the first 12 bytes of _buf are zero-padding. * @param _buf the bytes32 to convert to address */ function bytes32ToAddress(bytes32 _buf) external pure returns (address) { return address(uint160(uint256(_buf))); } }
Please enter a contract address above to load the contract details and source code.
Please DO NOT store any passwords or private keys here. A private note (up to 100 characters) can be saved and is useful for transaction tracking.
My Name Tag:
Private Note:
This website uses cookies to improve your experience. By continuing to use this website, you agree to its Terms and Privacy Policy.