I am using truffle 5.5.5 with Ganache as my dev blockchain.
When I run truffle migrate I get the following error:
> Compiled successfully using:
- solc: 0.8.13+commit.abaa5c0e.Emscripten.clang
Starting migrations...
> Network name: 'develop'
> Network id: 5777
> Block gas limit: 6721975 (0x6691b7)
1_initial_migration.js
Replacing 'NFTContract'
*** Deployment Failed ***
"NFTContract" -- Invalid number of parameters for "undefined". Got 3 expected 5!.
Exiting: Review successful transactions manually by checking the transaction hashes above on Etherscan.
Error: *** Deployment Failed ***
"NFTContract" -- Invalid number of parameters for "undefined". Got 3 expected 5!.
at /usr/local/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:379:1
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Migration._deploy (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:68:1)
at Migration._load (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:54:1)
at Migration.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:202:1)
at Object.runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:152:1)
at Object.runFrom (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:117:1)
at Object.runAll (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:121:1)
at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:86:1)
at runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate/run.js:78:1)
at Object.module.exports [as run] (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate/run.js:44:1)
at Command.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:189:1)
UnhandledRejections detected
Promise {
<rejected> Error: Invalid number of parameters for "undefined". Got 3 expected 5!
at /usr/local/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:348:1
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Migration._deploy (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:68:1)
at Migration._load (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:54:1)
at Migration.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:202:1)
at Object.runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:152:1)
at Object.runFrom (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:117:1)
at Object.runAll (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:121:1)
at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:86:1)
at runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate/run.js:78:1)
at Object.module.exports [as run] (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate/run.js:44:1)
at Command.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:189:1) {
hijackedStack: 'Error: Invalid number of parameters for "undefined". Got 3 expected 5!\n' +
' at Object.InvalidNumberOfParams (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-core-helpers/lib/errors.js:33:1)\n' +
' at Object._createTxObject (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-eth/node_modules/web3-eth-contract/lib/index.js:669:1)\n' +
' at Contract.deploy (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-eth/node_modules/web3-eth-contract/lib/index.js:501:1)\n' +
' at /usr/local/lib/node_modules/truffle/build/webpack:/packages/contract/lib/execute.js:275:1\n' +
' at processTicksAndRejections (node:internal/process/task_queues:96:5)'
},
_events: Events <[Object: null prototype] {}> {},
emit: [Function: emit],
on: [Function: on],
once: [Function: once],
off: [Function: removeListener],
listeners: [Function: listeners],
addListener: [Function: on],
removeListener: [Function: removeListener],
removeAllListeners: [Function: removeAllListeners],
_eventsCount: 0
} Error: Invalid number of parameters for "undefined". Got 3 expected 5!
at /usr/local/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:348:1
This is my contract:
pragma solidity >=0.7.0 <0.9.0;
import "./IERC165.sol";
import "./IERC721.sol";
import "./IERC721Enumerable.sol";
import "./ERC165.sol";
import "./Strings.sol";
import "./Address.sol";
import "./IERC721Metadata.sol";
import "./IERC721Receiver.sol";
import "./ERC721.sol";
import "./ERC721Enumerable.sol";
import "./Ownable.sol";
contract NFTContracts is ERC721Enumerable, Ownable {
using Strings for uint256;
string baseURI; //NFT json is saved
string linkURL;
string public baseExtension = ".json";
uint256 public cost; // = 0.0 ether;
uint256 public maxMintAmount = 1;
bool public isInVault = false;
constructor(
string memory _name,
string memory _symbol,
string memory _initBaseURI
) ERC721(_name, _symbol) {
setBaseURI(_initBaseURI);
}
// internal
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
Imports are all from openzeppelin.
My 1_initial_migration.js and 2_deploy_contracts.js look like the following:
1_initial_migration.js:
var NFTContract = artifacts.require("../contracts/NFTContract.sol");
// convert ether to wei - https://ethereum.stackexchange.com/questions/124350/how-to-fix-underflow/124354#124354
module.exports = function(deployer) {
deployer.deploy(NFTContract, "NFTContract", "NFTContract", "http://localhost:3000/");
};
2_deploy_contracts.js:
var NFTContract = artifacts.require("../contracts/NFTContract.sol");
module.exports = function(deployer) {
deployer.deploy(NFTContract, "NFTContract", "NFTContract", "http://localhost:3000/");
};
Any suggestions what I am doing wrong?
I appreciate your replies!
NFTContract.solorNFTContracts.sol? – Fatih Furkan Mar 26 '22 at 22:25NFTContract.sol– Carol.Kar Mar 27 '22 at 08:57build. You can delete it in the terminal withrm -rf ./buildor in file explorer by your hands. – Fatih Furkan Mar 27 '22 at 10:54