From 2827167f8bff2b6e7125e9bccbf9d03149e0d262 Mon Sep 17 00:00:00 2001 From: diana Date: Tue, 10 Dec 2024 14:51:44 -0500 Subject: [PATCH] make natspec consistent (#414) --- src/interfaces/IEIP712_v4.sol | 3 ++- src/interfaces/IERC721Permit_v4.sol | 4 ++-- src/interfaces/IImmutableState.sol | 3 ++- src/interfaces/IMulticall_v4.sol | 4 ++-- src/interfaces/INotifier.sol | 3 ++- src/interfaces/IPoolInitializer_v4.sol | 2 ++ src/interfaces/IPositionDescriptor.sol | 3 ++- src/interfaces/IStateView.sol | 5 ++--- src/interfaces/ISubscriber.sol | 1 + src/interfaces/IUniswapV4DeployerCompetition.sol | 4 ++-- src/interfaces/IUnorderedNonce.sol | 2 +- src/interfaces/IV4Quoter.sol | 7 ++----- src/interfaces/IV4Router.sol | 2 +- src/interfaces/external/IWETH9.sol | 2 +- src/lens/StateView.sol | 1 + src/lens/V4Quoter.sol | 5 +++++ 16 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/interfaces/IEIP712_v4.sol b/src/interfaces/IEIP712_v4.sol index 70c4faa5..8e78c586 100644 --- a/src/interfaces/IEIP712_v4.sol +++ b/src/interfaces/IEIP712_v4.sol @@ -1,7 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -/// @notice This interface is used for an EIP712 implementation +/// @title IEIP712_v4 +/// @notice Interface for the EIP712 contract interface IEIP712_v4 { /// @notice Returns the domain separator for the current chain. /// @return bytes32 The domain separator diff --git a/src/interfaces/IERC721Permit_v4.sol b/src/interfaces/IERC721Permit_v4.sol index e15e00bd..b45a7d81 100644 --- a/src/interfaces/IERC721Permit_v4.sol +++ b/src/interfaces/IERC721Permit_v4.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -/// @title ERC721 with permit -/// @notice Extension to ERC721 that includes a permit function for signature based approvals +/// @title IERC721Permit_v4 +/// @notice Interface for the ERC721Permit_v4 contract interface IERC721Permit_v4 { error SignatureDeadlineExpired(); error NoSelfPermit(); diff --git a/src/interfaces/IImmutableState.sol b/src/interfaces/IImmutableState.sol index 83f7cf03..4d265164 100644 --- a/src/interfaces/IImmutableState.sol +++ b/src/interfaces/IImmutableState.sol @@ -3,7 +3,8 @@ pragma solidity ^0.8.0; import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; -/// @title Interface for ImmutableState +/// @title IImmutableState +/// @notice Interface for the ImmutableState contract interface IImmutableState { /// @notice The Uniswap v4 PoolManager contract function poolManager() external view returns (IPoolManager); diff --git a/src/interfaces/IMulticall_v4.sol b/src/interfaces/IMulticall_v4.sol index 07c321b3..3caddb72 100644 --- a/src/interfaces/IMulticall_v4.sol +++ b/src/interfaces/IMulticall_v4.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -/// @title Multicall_v4 interface -/// @notice Enables calling multiple methods in a single call to the contract +/// @title IMulticall_v4 +/// @notice Interface for the Multicall_v4 contract interface IMulticall_v4 { /// @notice Call multiple functions in the current contract and return the data from all of them if they all succeed /// @dev The `msg.value` is passed onto all subcalls, even if a previous subcall has consumed the ether. diff --git a/src/interfaces/INotifier.sol b/src/interfaces/INotifier.sol index a415e27b..e7b61487 100644 --- a/src/interfaces/INotifier.sol +++ b/src/interfaces/INotifier.sol @@ -3,7 +3,8 @@ pragma solidity ^0.8.0; import {ISubscriber} from "./ISubscriber.sol"; -/// @notice This interface is used to opt in to sending updates to external contracts about position modifications or transfers +/// @title INotifier +/// @notice Interface for the Notifier contract interface INotifier { /// @notice Thrown when unsubscribing without a subscriber error NotSubscribed(); diff --git a/src/interfaces/IPoolInitializer_v4.sol b/src/interfaces/IPoolInitializer_v4.sol index 7a68678a..ad0e14b1 100644 --- a/src/interfaces/IPoolInitializer_v4.sol +++ b/src/interfaces/IPoolInitializer_v4.sol @@ -3,6 +3,8 @@ pragma solidity ^0.8.0; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; +/// @title IPoolInitializer_v4 +/// @notice Interface for the PoolInitializer_v4 contract interface IPoolInitializer_v4 { /// @notice Initialize a Uniswap v4 Pool /// @dev If the pool is already initialized, this function will not revert and just return type(int24).max diff --git a/src/interfaces/IPositionDescriptor.sol b/src/interfaces/IPositionDescriptor.sol index 70f8d3eb..92085217 100644 --- a/src/interfaces/IPositionDescriptor.sol +++ b/src/interfaces/IPositionDescriptor.sol @@ -4,7 +4,8 @@ pragma solidity ^0.8.24; import "./IPositionManager.sol"; import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; -/// @title Describes position NFT tokens via URI +/// @title IPositionDescriptor +/// @notice Interface for the PositionDescriptor contract interface IPositionDescriptor { error InvalidTokenId(uint256 tokenId); diff --git a/src/interfaces/IStateView.sol b/src/interfaces/IStateView.sol index 31f62b3a..8455fabc 100644 --- a/src/interfaces/IStateView.sol +++ b/src/interfaces/IStateView.sol @@ -7,9 +7,8 @@ import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; import {Position} from "@uniswap/v4-core/src/libraries/Position.sol"; import {IImmutableState} from "../interfaces/IImmutableState.sol"; -/// @title StateView Interface -/// @notice A view only contract wrapping the StateLibrary.sol library for reading storage in v4-core. -/// @dev The contract is intended for offchain clients. Use StateLibrary.sol directly if reading state onchain. +/// @title IStateView +/// @notice Interface for the StateView contract interface IStateView is IImmutableState { /// @notice Get Slot0 of the pool: sqrtPriceX96, tick, protocolFee, lpFee /// @dev Corresponds to pools[poolId].slot0 diff --git a/src/interfaces/ISubscriber.sol b/src/interfaces/ISubscriber.sol index 238c88f3..d98099e4 100644 --- a/src/interfaces/ISubscriber.sol +++ b/src/interfaces/ISubscriber.sol @@ -4,6 +4,7 @@ pragma solidity ^0.8.0; import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol"; import {PositionInfo} from "../libraries/PositionInfoLibrary.sol"; +/// @title ISubscriber /// @notice Interface that a Subscriber contract should implement to receive updates from the v4 position manager interface ISubscriber { /// @notice Called when a position subscribes to this subscriber contract diff --git a/src/interfaces/IUniswapV4DeployerCompetition.sol b/src/interfaces/IUniswapV4DeployerCompetition.sol index 5bb1a4be..7e3489b5 100644 --- a/src/interfaces/IUniswapV4DeployerCompetition.sol +++ b/src/interfaces/IUniswapV4DeployerCompetition.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.26; -/// @title UniswapV4DeployerCompetition -/// @notice A competition to deploy the UniswapV4 contract with the best address +/// @title IUniswapV4DeployerCompetition +/// @notice Interface for the UniswapV4DeployerCompetition contract interface IUniswapV4DeployerCompetition { event NewAddressFound(address indexed bestAddress, address indexed submitter, uint256 score); diff --git a/src/interfaces/IUnorderedNonce.sol b/src/interfaces/IUnorderedNonce.sol index 4e1866a6..022afb34 100644 --- a/src/interfaces/IUnorderedNonce.sol +++ b/src/interfaces/IUnorderedNonce.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -/// @title UnorderedNonce Interface +/// @title IUnorderedNonce /// @notice Interface for the UnorderedNonce contract interface IUnorderedNonce { error NonceAlreadyUsed(); diff --git a/src/interfaces/IV4Quoter.sol b/src/interfaces/IV4Quoter.sol index d51ddb3c..21b5fe48 100644 --- a/src/interfaces/IV4Quoter.sol +++ b/src/interfaces/IV4Quoter.sol @@ -6,11 +6,8 @@ import {Currency} from "@uniswap/v4-core/src/types/Currency.sol"; import {PathKey} from "../libraries/PathKey.sol"; import {IImmutableState} from "./IImmutableState.sol"; -/// @title V4 Quoter Interface -/// @notice Supports quoting the delta amounts for exact input or exact output swaps. -/// @notice For each pool also tells you the sqrt price of the pool after the swap. -/// @dev These functions are not marked view because they rely on calling non-view functions and reverting -/// to compute the result. They are also not gas efficient and should not be called on-chain. +/// @title IV4Quoter +/// @notice Interface for the V4Quoter contract interface IV4Quoter is IImmutableState { struct QuoteExactSingleParams { PoolKey poolKey; diff --git a/src/interfaces/IV4Router.sol b/src/interfaces/IV4Router.sol index f42715aa..6e3f5311 100644 --- a/src/interfaces/IV4Router.sol +++ b/src/interfaces/IV4Router.sol @@ -7,7 +7,7 @@ import {PathKey} from "../libraries/PathKey.sol"; import {IImmutableState} from "./IImmutableState.sol"; /// @title IV4Router -/// @notice Interface containing all the structs and errors for different v4 swap types +/// @notice Interface for the V4Router contract interface IV4Router is IImmutableState { /// @notice Emitted when an exactInput swap does not receive its minAmountOut error V4TooLittleReceived(uint256 minAmountOutReceived, uint256 amountReceived); diff --git a/src/interfaces/external/IWETH9.sol b/src/interfaces/external/IWETH9.sol index b8e68b36..f06b197b 100644 --- a/src/interfaces/external/IWETH9.sol +++ b/src/interfaces/external/IWETH9.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -/// @title Interface for WETH9 +/// @title IWETH9 interface IWETH9 is IERC20 { /// @notice Deposit ether to get wrapped ether function deposit() external payable; diff --git a/src/lens/StateView.sol b/src/lens/StateView.sol index e3894c19..deeab4b6 100644 --- a/src/lens/StateView.sol +++ b/src/lens/StateView.sol @@ -9,6 +9,7 @@ import {ImmutableState} from "../base/ImmutableState.sol"; import {IStateView} from "../interfaces/IStateView.sol"; /// @notice A view only contract wrapping the StateLibrary.sol library for reading storage in v4-core. +/// @dev The contract is intended for offchain clients. Use StateLibrary.sol directly if reading state onchain. contract StateView is ImmutableState, IStateView { using StateLibrary for IPoolManager; diff --git a/src/lens/V4Quoter.sol b/src/lens/V4Quoter.sol index 0f6b7864..9adc0bf3 100644 --- a/src/lens/V4Quoter.sol +++ b/src/lens/V4Quoter.sol @@ -11,6 +11,11 @@ import {PathKey, PathKeyLibrary} from "../libraries/PathKey.sol"; import {QuoterRevert} from "../libraries/QuoterRevert.sol"; import {BaseV4Quoter} from "../base/BaseV4Quoter.sol"; +/// @title V4Quoter +/// @notice Supports quoting the delta amounts for exact input or exact output swaps. +/// @notice For each pool also tells you the sqrt price of the pool after the swap. +/// @dev These functions are not marked view because they rely on calling non-view functions and reverting +/// to compute the result. They are also not gas efficient and should not be called on-chain. contract V4Quoter is IV4Quoter, BaseV4Quoter { using PathKeyLibrary for PathKey; using QuoterRevert for *;