I'm very new to truffle and solidity it might be a rookie mistake.
When typing truffle migrate --reset
, I've got the follow errors :
@openzeppelin/contracts/introspection/ERC165.sol:24:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
constructor () internal {
^ (Relevant source part starts here and spans across multiple lines).
,@openzeppelin/contracts/token/ERC721/ERC721.sol:93:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
constructor (string memory name_, string memory symbol_) public {
^ (Relevant source part starts here and spans across multiple lines)
> Artifacts written to C:\Users\greathawkeye\blockchain\abis
> Compiled successfully using:
- solc: 0.7.6+commit.7338295f.Emscripten.clang
It looks like this warning prevents me for compiling. Here are my token and my migration contracts :
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
contract MyToken is ERC721 {
constructor() ERC721('MyToken', 'MYT') {}
}
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.0 <0.8.0;
contract Migrations {
address public owner;
uint256 public last_completed_migration;
modifier restricted() {
if (msg.sender == owner) _;
}
constructor() {
owner = msg.sender;
}
function setCompleted(uint256 completed) public restricted {
last_completed_migration = completed;
}
function upgrade(address new_address) public restricted {
Migrations upgraded = Migrations(new_address);
upgraded.setCompleted(last_completed_migration);
}
}
truffle version
gives me this :
Truffle v5.1.62 (core: 5.1.62)
Solidity - >=0.6.0 <0.8.0 (solc-js)
Node v15.5.0
Web3.js v1.2.9
Here is my truffle-config.js
module.exports = {
compilers: {
solc: {
version: ">=0.6.0 <0.8.0",
optimizer: {
enabled: true,
runs: 200
}
}
},
networks: {
development: {
host: "127.0.0.1",
port: 7545,
network_id: "*" // Match any network id
}
}
};