Skip to content

Commit

Permalink
OZ L-11 (#311)
Browse files Browse the repository at this point in the history
* OZ L-11

* fix natspec

* some more
  • Loading branch information
dianakocsis authored Aug 29, 2024
1 parent e2c3d0b commit 3c626c2
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/PositionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ contract PositionManager is
using SlippageCheckLibrary for BalanceDelta;
using PositionConfigIdLibrary for PositionConfigId;

/// @inheritdoc IPositionManager
/// @dev The ID of the next token that will be minted. Skips 0
uint256 public nextTokenId = 1;

Expand Down Expand Up @@ -174,6 +175,7 @@ contract PositionManager is
_executeActionsWithoutUnlock(actions, params);
}

/// @inheritdoc BaseActionsRouter
function msgSender() public view override returns (address) {
return _getLocker();
}
Expand Down
4 changes: 2 additions & 2 deletions src/base/EIP712_v4.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ contract EIP712_v4 is IEIP712_v4 {
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator();
}

/// @notice Returns the domain separator for the current chain.
/// @dev Uses cached version if chainid is unchanged from construction.
/// @inheritdoc IEIP712_v4
function DOMAIN_SEPARATOR() public view override returns (bytes32) {
// uses cached version if chainid is unchanged from construction
return block.chainid == _CACHED_CHAIN_ID ? _CACHED_DOMAIN_SEPARATOR : _buildDomainSeparator();
}

Expand Down
1 change: 1 addition & 0 deletions src/base/Notifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ abstract contract Notifier is INotifier {
// at 30M gas, the limit is 300K
uint256 private constant BLOCK_LIMIT_BPS = 100;

/// @inheritdoc INotifier
mapping(uint256 tokenId => ISubscriber subscriber) public subscriber;

modifier onlyIfApproved(address caller, uint256 tokenId) virtual;
Expand Down
3 changes: 3 additions & 0 deletions src/interfaces/IEIP712_v4.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @notice This interface is used for an EIP712 implementation
interface IEIP712_v4 {
/// @notice Returns the domain separator for the current chain.
/// @return bytes32 The domain separator
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
1 change: 1 addition & 0 deletions src/interfaces/IERC721Permit_v4.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface IERC721Permit_v4 {
/// @param operator The address that will be set as an operator for the owner
/// @param approved The permission to set on the operator
/// @param deadline The deadline timestamp by which the call must be mined for the approve to work
/// @param nonce The nonce of the owner's permit
/// @param signature Concatenated data from a valid secp256k1 signature from the holder, i.e. abi.encodePacked(r, s, v)
/// @dev payable so it can be multicalled with NATIVE related actions
function permitForAll(
Expand Down
12 changes: 9 additions & 3 deletions src/interfaces/INotifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity ^0.8.24;

import {PositionConfig} from "../libraries/PositionConfig.sol";
import {ISubscriber} from "./ISubscriber.sol";

/// @notice This interface is used to opt in to sending updates to external contracts about position modifications or transfers
interface INotifier {
Expand All @@ -12,14 +13,19 @@ interface INotifier {
/// @notice Wraps the revert message of the subscriber contract on a reverting transfer notification
error Wrap__TransferNotificationReverted(address subscriber, bytes reason);

/// @notice Returns the subscriber for a respective position
/// @param tokenId the ERC721 tokenId
/// @return subscriber the subscriber contract
function subscriber(uint256 tokenId) external view returns (ISubscriber subscriber);

/// @notice Enables the subscriber to receive notifications for a respective position
/// @param tokenId the ERC721 tokenId
/// @param config the corresponding PositionConfig for the tokenId
/// @param subscriber the address to notify
/// @param newSubscriber the address of the subscriber contract
/// @param data caller-provided data that's forwarded to the subscriber contract
/// @dev Calling subscribe when a position is already subscribed will revert
/// @dev payable so it can be multicalled with NATIVE related actions
function subscribe(uint256 tokenId, PositionConfig calldata config, address subscriber, bytes calldata data)
function subscribe(uint256 tokenId, PositionConfig calldata config, address newSubscriber, bytes calldata data)
external
payable;

Expand All @@ -31,7 +37,7 @@ interface INotifier {
/// @dev Must always allow a user to unsubscribe. In the case of a malicious subscriber, a user can always unsubscribe safely, ensuring liquidity is always modifiable.
function unsubscribe(uint256 tokenId, PositionConfig calldata config, bytes calldata data) external payable;

/// @notice Returns whether a a position should call out to notify a subscribing contract on modification or transfer
/// @notice Returns whether a position should call out to notify a subscribing contract on modification or transfer
/// @param tokenId the ERC721 tokenId
/// @return bool whether or not the position has a subscriber
function hasSubscriber(uint256 tokenId) external view returns (bool);
Expand Down
8 changes: 4 additions & 4 deletions src/interfaces/IPositionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ interface IPositionManager is INotifier {

/// @notice Unlocks Uniswap v4 PoolManager and batches actions for modifying liquidity
/// @dev This is the standard entrypoint for the PositionManager
/// @param payload is an encoding of actions, and parameters for those actions
/// @param unlockData is an encoding of actions, and parameters for those actions
/// @param deadline is the deadline for the batched actions to be executed
function modifyLiquidities(bytes calldata payload, uint256 deadline) external payable;
function modifyLiquidities(bytes calldata unlockData, uint256 deadline) external payable;

/// @notice Batches actions for modifying liquidity without unlocking v4 PoolManager
/// @dev This must be called by a contract that has already unlocked the v4 PoolManager
Expand All @@ -29,9 +29,9 @@ interface IPositionManager is INotifier {
function nextTokenId() external view returns (uint256);

/// @param tokenId the ERC721 tokenId
/// @return configId a truncated hash of the position's poolkey, tickLower, and tickUpper
/// @return bytes32 a truncated hash of the position's poolkey, tickLower, and tickUpper
/// @dev truncates the least significant bit of the hash
function getPositionConfigId(uint256 tokenId) external view returns (bytes32 configId);
function getPositionConfigId(uint256 tokenId) external view returns (bytes32);

/// @param tokenId the ERC721 tokenId
/// @param config the corresponding PositionConfig for the tokenId
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/IQuoter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ interface IQuoter {
/// @return deltaAmounts Delta amounts resulted from the swap
/// @return sqrtPriceX96After The sqrt price of the pool after the swap
/// @return initializedTicksLoaded The number of initialized ticks that the swap loaded
function quoteExactInputSingle(QuoteExactSingleParams calldata params)
function quoteExactInputSingle(QuoteExactSingleParams memory params)
external
returns (int128[] memory deltaAmounts, uint160 sqrtPriceX96After, uint32 initializedTicksLoaded);

Expand Down Expand Up @@ -77,7 +77,7 @@ interface IQuoter {
/// @return deltaAmounts Delta amounts resulted from the swap
/// @return sqrtPriceX96After The sqrt price of the pool after the swap
/// @return initializedTicksLoaded The number of initialized ticks that the swap loaded
function quoteExactOutputSingle(QuoteExactSingleParams calldata params)
function quoteExactOutputSingle(QuoteExactSingleParams memory params)
external
returns (int128[] memory deltaAmounts, uint160 sqrtPriceX96After, uint32 initializedTicksLoaded);

Expand Down

0 comments on commit 3c626c2

Please sign in to comment.