Unused function parameter

Hey whats up first time posting and I am new to the whole programing thing. I am trying to build an erc721 marketplace. I am running into issues migrating the sol files. I keep getting this error and cannot figure it out

    /C/Users/NEWMONEY/Desktop/PrntPlace-main/contracts/PrntNFT.sol:21:9: Warning: Unused function parameter. Remove or comment out the variable name to silence 
this warning.
        uint prntPrice
        ^------------^
,/C/Users/NEWMONEY/Desktop/PrntPlace-main/contracts/PrntNFT.sol:50:5: Warning: Function state mutability can be restricted to view
    function getNextPrntId() private returns (uint nextPrntId) {
    ^ (Relevant source part starts here and spans across multiple lines).
1 Like
pragma solidity >=0.5.0;


import { ERC721Full } from "@openzeppelin/contracts/token/ERC721/ERC721Full.sol";
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";


/**
 * @notice - This is the NFT contract for a prnt
 */
contract PrntNFT is ERC721Full {
    using SafeMath for uint256;

    uint256 public currentPrntId;
    
    constructor(
        address owner,  /// Initial owner (Seller)
        string memory _nftName, 
        string memory _nftSymbol,
        string memory _tokenURI,    /// [Note]: TokenURI is URL include ipfs hash
        uint prntPrice
    ) 
        public 
        ERC721Full(_nftName, _nftSymbol) 
    {
        mint(owner, _tokenURI);
    }

    /** 
     * @dev mint a prntNFT
     * @dev tokenURI - URL include ipfs hash
     */
    function mint(address to, string memory tokenURI) public returns (bool) {
        /// Mint a new PrntNFT
        uint newPrntId = getNextPrntId();
        currentPrntId++;
        _mint(to, newPrntId);
        _setTokenURI(newPrntId, tokenURI);
    }


    ///--------------------------------------
    /// Getter methods
    ///--------------------------------------


    ///--------------------------------------
    /// Private methods
    ///--------------------------------------
    function getNextPrntId() private returns (uint nextPrntId) {
        return currentPrntId.add(1);
    }
    

}
1 Like

Hi @420_tiesto,

Welcome to the community :wave:

The compiler is warning that you have an unused function parameter. Meaning you don’t use prntPrice in your function, so you could remove the parameter.

    constructor(
        address owner,  /// Initial owner (Seller)
        string memory _nftName, 
        string memory _nftSymbol,
        string memory _tokenURI,    /// [Note]: TokenURI is URL include ipfs hash
        uint prntPrice
    ) 
        public 
        ERC721Full(_nftName, _nftSymbol) 
    {
        mint(owner, _tokenURI);
    }

You may want to look at:


As an aside you can Format code in the forum

2 posts were split to a new topic: Can’t resolve ‘./contracts/SimpleStorage.json’

Did you mean to leave uint prntPrice in the constructors parameters?

function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {

How to remove bytes32 requestId?

Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.