Commit b2ad9408 authored by Alina's avatar Alina Committed by GitHub

remove dupe toAddress (#107)

parent fe8dad0a
...@@ -4,6 +4,7 @@ pragma experimental ABIEncoderV2; ...@@ -4,6 +4,7 @@ pragma experimental ABIEncoderV2;
/* Library Imports */ /* Library Imports */
import { Lib_RLPWriter } from "../rlp/Lib_RLPWriter.sol"; import { Lib_RLPWriter } from "../rlp/Lib_RLPWriter.sol";
import { Lib_Bytes32Utils } from "./Lib_Bytes32Utils.sol";
/** /**
* @title Lib_EthUtils * @title Lib_EthUtils
...@@ -155,7 +156,7 @@ library Lib_EthUtils { ...@@ -155,7 +156,7 @@ library Lib_EthUtils {
encoded[1] = Lib_RLPWriter.writeUint(_nonce); encoded[1] = Lib_RLPWriter.writeUint(_nonce);
bytes memory encodedList = Lib_RLPWriter.writeList(encoded); bytes memory encodedList = Lib_RLPWriter.writeList(encoded);
return getAddressFromHash(keccak256(encodedList)); return Lib_Bytes32Utils.toAddress(keccak256(encodedList));
} }
/** /**
...@@ -181,30 +182,6 @@ library Lib_EthUtils { ...@@ -181,30 +182,6 @@ library Lib_EthUtils {
keccak256(_bytecode) keccak256(_bytecode)
)); ));
return getAddressFromHash(hashedData); return Lib_Bytes32Utils.toAddress(hashedData);
}
/****************************************
* Private Functions: Contract Creation *
****************************************/
/**
* Determines an address from a 32 byte hash. Since addresses are only
* 20 bytes, we need to retrieve the last 20 bytes from the original
* hash. Converting to uint256 and then uint160 gives us these bytes.
* @param _hash Hash to convert to an address.
* @return _address Hash converted to an address.
*/
function getAddressFromHash(
bytes32 _hash
)
private
pure
returns (
address _address
)
{
return address(bytes20(uint160(uint256(_hash))));
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment