I’m inheriting ERC721PresetMinterPauserAutoId.sol in my contract and trying to compile, I’m getting the following:
Contract “Test” should be marked as abstract.
contract Test is ERC721PresetMinterPauserAutoId {
^ (Relevant source part starts here and spans across multiple lines). @openzeppelin/contracts/presets/ERC721PresetMinterPauserAutoId.sol:40:5: Missing implementation:
constructor(string memory name, string memory symbol, string memory baseURI) public ERC721(name, symbol) {
^ (Relevant source part starts here and spans across multiple lines). Environment
I would like to know how and where initialise name, symbol and baseURI, cause the docs indicates that should be done inside the constructor parameter but I’m getting errors like expeting “,”
Also, when trying adding a constructor, when compiling I’m asked to mark the contract abstract Code to reproduce
pragma solidity 0.6.6;
import "@openzeppelin/contracts/presets/ERC721PresetMinterPauserAutoId.sol";
contract Test is ERC721PresetMinterPauserAutoId {
}
$ npx oz deploy
No contracts found to compile.
? Choose the kind of deployment regular
? Pick a network development
? Pick a contract to deploy ERC721PresetMinterPauserAutoId
? name: string: My Token
? symbol: string: MYT
? baseURI: string: https://example.com/token/
✓ Deployed instance of ERC721PresetMinterPauserAutoId
0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab
Alternatively, if you want to build on top of the ERC721 preset you can inherit as you have done.
MyToken.sol
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/presets/ERC721PresetMinterPauserAutoId.sol";
contract MyToken is ERC721PresetMinterPauserAutoId {
constructor() public ERC721PresetMinterPauserAutoId("My Token", "MYT", "https://example.com/token/") {
}
}