Giter Site home page Giter Site logo

unused function parameter about evm HOT 5 CLOSED

rmrk-team avatar rmrk-team commented on June 16, 2024
unused function parameter

from evm.

Comments (5)

steven2308 avatar steven2308 commented on June 16, 2024 1

I recently tried adding uint256(tokenId), which fixes the issue and does not actually increase size. It is now released on 2.3.2

from evm.

ThunderDeliverer avatar ThunderDeliverer commented on June 16, 2024

I'm sorry to hear that.

We strive to have as thoroughly documented source code as possible, which is the result of it. We need to have all function inputs named if we wish to document them.

So I'm sorry to say we can't remove this without impacting the documentation's quality.

from evm.

xxxijustwei avatar xxxijustwei commented on June 16, 2024

Perhaps you can modify it like this, and then it won't prompt unused during compilation:

    /**
     * @notice Used to retrieve the information about who shall receive royalties of a sale of the specified token and
     *  how much they will be.
     * @param tokenId ID of the token for which the royalty info is being retrieved
     * @param salePrice Price of the token sale
     * @return receiver The beneficiary receiving royalties of the sale
     * @return royaltyAmount The value of the royalties recieved by the `receiver` from the sale
     */
    function royaltyInfo(
        uint256 tokenId,
        uint256 salePrice
    )
        external
        view
        virtual
        override
        returns (address receiver, uint256 royaltyAmount)
    {
        receiver = _royaltyRecipient;
        royaltyAmount = (salePrice * _royaltyPercentageBps) / 10000;

        tokenId;
    }

from evm.

ThunderDeliverer avatar ThunderDeliverer commented on June 16, 2024

This might remove the warning, but it increases contract size (which is limited) and increases gas consumption (because of the read operation). For these reasons, we can't implement this.

from evm.

steven2308 avatar steven2308 commented on June 16, 2024

I actually gave it a try yesterday with an idea I had for a while. I duplicated the IERC2981 definition from OZ into a local file and added the right doc string there. Then, on the implementation I simply used inheritdoc and did not set the name for the first parameter.
Surprisingly, the name tokenId disappeared from all docs, which is a bigger evil IMO.

from evm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.