Uniswap / v4-periphery

🦄 🦄 🦄 🦄 Peripheral smart contracts for interacting with Uniswap v4
https://blog.uniswap.org/uniswap-v4
GNU General Public License v2.0
684 stars 463 forks source link

Add param names to BaseHook #56

Closed naddison36 closed 4 days ago

naddison36 commented 1 year ago

Component

Pool Interaction, Hooks

Describe the suggested feature and problem it solves.

Please add the parameter names to the hook functions in the BaseHook contract.

Yes, the Solidity compiler will spit out warnings that these parameters are not used, but the purpose of BaseHook is to allow developers to extend it. Knowing what the parameters are without having to look at the IHook interface is very useful.

Describe the desired implementation.

Instead of

    function afterSwap(address, PoolKey calldata, IPoolManager.SwapParams calldata, BalanceDelta)
        external
        virtual
        returns (bytes4)
    {
        revert HookNotImplemented();
    }

Add the parameter names

    function afterSwap(
        address sender,
        PoolKey calldata key,
        IPoolManager.SwapParams calldata params,
        BalanceDelta delta)
        external
        virtual
        returns (bytes4 selector)
    {
        revert HookNotImplemented();
    }

Describe alternatives.

N/A

Additional context.

Contract and tx visualisation tools like sol2uml and tx2uml can also use the parameter names

naddison36 commented 1 year ago

Here's some example tx2uml call diagrams using Uniswap v4 hooks with parameter names https://github.com/naddison36/uniswap-v4-hooks/tree/main/docs#modify-liquidity

saucepoint commented 4 days ago

hey sorry for the slow response

the solidity compiler will throw warnings when variables are unused, so going to close this issue for now