I am using Truffle v5.5.5
and solidity 0.8.0
.
I have the following constructor in my contract:
contract rNFT is ERC721Enumerable, Ownable {
using Strings for uint256;
string baseURI;
string public baseExtension = ".json";
uint256 public cost; // = 0.0 ether;
uint256 public maxSupply = 999999999999999999;
uint256 public maxMintAmount = 1;
bool public paused = false;
bool public revealed = true;
string public notRevealedUri;
constructor(
string memory _name,
string memory _symbol,
string memory _initBaseURI,
string memory _initNotRevealedUri,
uint256 _cost
) ERC721(_name, _symbol) {
setBaseURI(_initBaseURI);
setNotRevealedURI(_initNotRevealedUri);
setCost(_cost);
}
So basically the costs can also be set for the contract.
When deploying with truffle I use the following:
var rNFT = artifacts.require("../contracts/rNFT.sol");
module.exports = function(deployer) {
deployer.deploy(rNFT, "rNFT", "rNFT", "www._initBaseURI.com", "www._initNotRevealedUri.com", 0.12);
};
However, I get the following error:
Error: *** Deployment Failed ***
"rNFT" -- underflow (fault="underflow", operation="BigNumber.from", value=0.12, code=NUMERIC_FAULT, version=bignumber/5.0.8).
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.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:94: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: underflow (fault="underflow", operation="BigNumber.from", value=0.12, code=NUMERIC_FAULT, version=bignumber/5.0.8)
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.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:94: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) {
reason: 'underflow',
code: 'NUMERIC_FAULT',
fault: 'underflow',
operation: 'BigNumber.from',
value: 0.12,
hijackedStack: 'Error: underflow (fault="underflow", operation="BigNumber.from", value=0.12, code=NUMERIC_FAULT, version=bignumber/5.0.8)\n' +
' at lib_esm_Logger.makeError (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/@ethersproject/abi/node_modules/@ethersproject/logger/lib.esm/index.js:166:1)\n' +
' at lib_esm_Logger.throwError (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/@ethersproject/abi/node_modules/@ethersproject/logger/lib.esm/index.js:175:1)\n' +
' at throwFault (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/@ethersproject/abi/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js:273:18)\n' +
' at Function.from (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/@ethersproject/abi/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js:175:1)\n' +
' at NumberCoder.encode (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/@ethersproject/abi/lib.esm/coders/number.js:13:17)\n' +
' at /usr/local/lib/node_modules/truffle/build/webpack:/node_modules/@ethersproject/abi/lib.esm/coders/array.js:57:1\n' +
' at Array.forEach (<anonymous>)\n' +
' at pack (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/@ethersproject/abi/lib.esm/coders/array.js:43:1)\n' +
' at TupleCoder.encode (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/@ethersproject/abi/lib.esm/coders/tuple.js:19:16)\n' +
' at AbiCoder.encode (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/@ethersproject/abi/lib.esm/abi-coder.js:82:1)\n' +
' at ABICoder.encodeParameters (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-eth-abi/lib/index.js:120:1)\n' +
' at /usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-eth/node_modules/web3-eth-contract/lib/index.js:438:1\n' +
' at Array.map (<anonymous>)\n' +
' at Object._encodeMethodABI (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-eth/node_modules/web3-eth-contract/lib/index.js:437:6)\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)'
Any suggestions what I am doing wrong? I just want to set the costs for each NFT in the contract.
I appreciate your replies!
"rNFT" -- overflow (fault="overflow", operation="BigNumber.from", value=120000000000000000, code=NUMERIC_FAULT, version=bignumber/5.0.8).