Skip to content

Commit

Permalink
change name hash to bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey committed Mar 8, 2023
1 parent cc5a4d3 commit 3bee03a
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions packages/protocol/contracts/thirdparty/AddressManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ contract AddressManager is OwnableUpgradeable {
string memory name,
address newAddress
) external onlyOwner {
bytes32 nameHash;
assembly {
nameHash := keccak256(add(name, 32), mload(name))
}
bytes32 nameHash = keccak256(bytes(name));
address oldAddress = addresses[nameHash];
addresses[nameHash] = newAddress;
emit AddressSet(name, newAddress, oldAddress);
Expand All @@ -91,10 +88,7 @@ contract AddressManager is OwnableUpgradeable {
* @return Address associated with the given name.
*/
function getAddress(string memory name) external view returns (address) {
bytes32 nameHash;
assembly {
nameHash := keccak256(add(name, 32), mload(name))
}
bytes32 nameHash = keccak256(bytes(name));
return addresses[nameHash];
}
}

0 comments on commit 3bee03a

Please sign in to comment.