Skip to content

Commit

Permalink
Merge pull request #65 from nachomazzara/feat/optimize-gas-usage
Browse files Browse the repository at this point in the history
feat: reduce gas cost by prevent reading again from storage
  • Loading branch information
itzmeanjan authored Feb 24, 2021
2 parents 9277e74 + 938fb01 commit 962da54
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions contracts/root/RootChainManager/RootChainManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,13 @@ contract RootChainManager is
address rootToken,
bytes memory depositData
) private {
bytes32 tokenType = tokenToType[rootToken];
require(
rootToChildToken[rootToken] != address(0x0) &&
tokenToType[rootToken] != 0,
tokenType != 0,
"RootChainManager: TOKEN_NOT_MAPPED"
);
address predicateAddress = typeToPredicate[tokenToType[rootToken]];
address predicateAddress = typeToPredicate[tokenType];
require(
predicateAddress != address(0),
"RootChainManager: INVALID_TOKEN_TYPE"
Expand Down Expand Up @@ -407,7 +408,7 @@ contract RootChainManager is

ITokenPredicate(predicateAddress).exitTokens(
_msgSender(),
childToRootToken[childToken],
rootToken,
logRLP.toRlpBytes()
);
}
Expand Down

0 comments on commit 962da54

Please sign in to comment.