Hello to everybody. I am new in all this Web3. As I plan to sell art NFTs on different market places (e.g. OpenSea, NFTify and Rarible) I like to have my own smart contract.
I followed on weekend the tutorial here on Quicknode, written shortly in August 2023 by Ferhat Kochan .
With lots of twerking as “newbe” (non coder) I manage it to come to the final step for doing a “Truffle Test”.
Both in the terminal I get the same negative result directly by Truffle, as same I did in Review.Etherum with the compiler test.
TypeError: No arguments passed to the base constructor. Specify the arguments or mark “ERC1155Token” as abstract.
→ Smart Contract (Polygon Testnet)/ERC1155Token.sol:11:1:
|
11 | contract ERC1155Token is ERC1155, Ownable {
| ^ (Relevant source part starts here and spans across multiple lines).
Note: Base constructor parameters:
→ @openzeppelin/contracts/access/Ownable.sol:38:16:
|
38 | constructor(address initialOwner) {
| ^^^^^^^^^^^^^^^^^^^^^^
Having asked A.I: I got following hint, but it doesnt really work.
The first two warnings in your Truffle compile output are telling you that the visibility of the constructors for your
MetaCoin
andMigrations
contracts is being ignored. This is because constructors in Solidity are always public, regardless of their visibility.To fix these warnings, you can either change the visibility of the constructors to
public
or mark the contracts asabstract
. Marking a contract asabstract
means that it cannot be deployed directly, but only inherited from.The third error in your Truffle compile output is telling you that you have not passed any arguments to the base constructor for your
ERC1155Token
contract. The base constructor for theERC1155
contract takes one argument, which is the initial owner of the contract.To fix this error, you need to pass the initial owner of the contract to the base constructor. You can do this by adding the following line to the constructor of your
ERC1155Token
contract:
*super(initialOwner);*
Here is an example of a corrected constructor for your
ERC1155Token
contract:
*contract ERC1155Token is ERC1155, Ownable {* *> constructor(address initialOwner) ERC1155(initialOwner) {}* *> }*
Has anybody a concrete hint ? And is it possible to send a direct message to the author Ferhat Kochan who wrote this tutorial ?