Skip to content

Commit

Permalink
refactor: gas optimization on set limits
Browse files Browse the repository at this point in the history
  • Loading branch information
hexshire authored May 1, 2024
1 parent ca446b8 commit a8410c1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion solidity/contracts/XERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ contract XERC20 is ERC20, Ownable, IXERC20, ERC20Permit {
* @param _bridge The address of the bridge we are setting the limits too
*/
function setLimits(address _bridge, uint256 _mintingLimit, uint256 _burningLimit) external onlyOwner {
if (_mintingLimit > (type(uint256).max / 2) || _burningLimit > (type(uint256).max / 2)) {
if (_mintingLimit > (type(uint256).max >> 1) || _burningLimit > (type(uint256).max >> 1)) {
revert IXERC20_LimitsTooHigh();
}

Expand Down

0 comments on commit a8410c1

Please sign in to comment.