Skip to content

Commit 693b743

Browse files
Update draft-InteroperableAddress.sol
1 parent 8631702 commit 693b743

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

contracts/utils/draft-InteroperableAddress.sol

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// SPDX-License-Identifier: MIT
2-
// OpenZeppelin Contracts (last updated v5.5.0) (utils/draft-InteroperableAddress.sol)
32

43
pragma solidity ^0.8.26;
54

@@ -46,23 +45,21 @@ library InteroperableAddress {
4645
* address (version 1) for a given chainid and ethereum address.
4746
*/
4847
function formatEvmV1(uint256 chainid, address addr) internal pure returns (bytes memory) {
49-
bytes memory chainReference = _toChainReference(chainid);
50-
return abi.encodePacked(bytes4(0x00010000), uint8(chainReference.length), chainReference, uint8(20), addr);
48+
return formatV1(0x0000, _toChainReference(chainid), abi.encodePacked(addr));
5149
}
5250

5351
/**
5452
* @dev Variant of {formatV1-bytes2-bytes-bytes-} that specifies an EVM chain without an address.
5553
*/
5654
function formatEvmV1(uint256 chainid) internal pure returns (bytes memory) {
57-
bytes memory chainReference = _toChainReference(chainid);
58-
return abi.encodePacked(bytes4(0x00010000), uint8(chainReference.length), chainReference, uint8(0));
55+
return formatV1(0x0000, _toChainReference(chainid), new bytes(0));
5956
}
6057

6158
/**
6259
* @dev Variant of {formatV1-bytes2-bytes-bytes-} that specifies an EVM address without a chain reference.
6360
*/
6461
function formatEvmV1(address addr) internal pure returns (bytes memory) {
65-
return abi.encodePacked(bytes6(0x000100000014), addr);
62+
return formatV1(0x0000, new bytes(0), abi.encodePacked(addr));
6663
}
6764

6865
/**

0 commit comments

Comments
 (0)