Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
b2ad9408
Commit
b2ad9408
authored
Dec 08, 2020
by
Alina
Committed by
GitHub
Dec 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove dupe toAddress (#107)
parent
fe8dad0a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
26 deletions
+3
-26
Lib_EthUtils.sol
...acts/optimistic-ethereum/libraries/utils/Lib_EthUtils.sol
+3
-26
No files found.
packages/contracts/contracts/optimistic-ethereum/libraries/utils/Lib_EthUtils.sol
View file @
b2ad9408
...
...
@@ -4,6 +4,7 @@ pragma experimental ABIEncoderV2;
/* Library Imports */
import { Lib_RLPWriter } from "../rlp/Lib_RLPWriter.sol";
import { Lib_Bytes32Utils } from "./Lib_Bytes32Utils.sol";
/**
* @title Lib_EthUtils
...
...
@@ -155,7 +156,7 @@ library Lib_EthUtils {
encoded[1] = Lib_RLPWriter.writeUint(_nonce);
bytes memory encodedList = Lib_RLPWriter.writeList(encoded);
return
getAddressFromHash
(keccak256(encodedList));
return
Lib_Bytes32Utils.toAddress
(keccak256(encodedList));
}
/**
...
...
@@ -181,30 +182,6 @@ library Lib_EthUtils {
keccak256(_bytecode)
));
return getAddressFromHash(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))));
return Lib_Bytes32Utils.toAddress(hashedData);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment