Skip to content

Commit

Permalink
perf(pool): replace modifier with function
Browse files Browse the repository at this point in the history
  • Loading branch information
gakonst committed May 25, 2021
1 parent 570faf2 commit b1b1ecd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions contracts/UniswapV3Pool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ contract UniswapV3Pool is IUniswapV3Pool, NoDelegateCall {
}

/// @dev Prevents calling a function from anyone except the address returned by IUniswapV3Factory#owner()
modifier onlyFactoryOwner() {
function onlyFactoryOwner() private view {
require(msg.sender == IUniswapV3Factory(factory).owner());
_;
}

constructor() {
Expand Down Expand Up @@ -819,7 +818,8 @@ contract UniswapV3Pool is IUniswapV3Pool, NoDelegateCall {
}

/// @inheritdoc IUniswapV3PoolOwnerActions
function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external override lock onlyFactoryOwner {
function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external override lock {
onlyFactoryOwner();
require(
(feeProtocol0 == 0 || (feeProtocol0 >= 4 && feeProtocol0 <= 10)) &&
(feeProtocol1 == 0 || (feeProtocol1 >= 4 && feeProtocol1 <= 10))
Expand All @@ -834,7 +834,8 @@ contract UniswapV3Pool is IUniswapV3Pool, NoDelegateCall {
address recipient,
uint128 amount0Requested,
uint128 amount1Requested
) external override lock onlyFactoryOwner returns (uint128 amount0, uint128 amount1) {
) external override lock returns (uint128 amount0, uint128 amount1) {
onlyFactoryOwner();
amount0 = amount0Requested > protocolFees.token0 ? protocolFees.token0 : amount0Requested;
amount1 = amount1Requested > protocolFees.token1 ? protocolFees.token1 : amount1Requested;

Expand Down

0 comments on commit b1b1ecd

Please sign in to comment.