Base constructor arguments given twice when using ERC1155 Preset

Hello, Im having a problem when compiling my smart contracts.
After the constructor, where it is suposed to be the ERC1155(uri) the compiler return me this error Base constructor arguments given twice.
Here the contract

pragma solidity >=0.4.22 <0.8.0;

import "@openzeppelin/contracts/presets/ERC1155PresetMinterPauser.sol";

abstract contract PruebasToken is  ERC1155PresetMinterPauser {
    uint256 public constant xx = 0;
    uint256 public constant yy = 0;
    uint256 public constant zz = 0;

  constructor()  ERC1155(uri) {
    _mint(msg.sender, xx, 10 ** 10, "");
    _mint(msg.sender, yy,10 ** 10, "");
    _mint(msg.sender, zz,10 ** 10, "");
1 Like

Hi @Tomas_Velasquez,

Welcome to the community :wave:

I recommend having a look at: Create an ERC1155.

As you are extending ERC1155PresetMinterPauser you should call the constructor of ERC1155PresetMinterPauser rather than the ERC1155 constructor.

uri isn’t defined in your contract. You could pass a value in using your constructor or set a value in a constant.

I wasn’t sure why you set your contract to be abstract. Unless you wanted to create an ERC1155 which inherits from this contract.

You have a wide pragma, >=0.4.22 <0.8.0, when you may be better to stick to a similar pragma to the contract you are extending.

Your contract could look something like the following:

// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.4.22 <0.8.0;

import "@openzeppelin/contracts/presets/ERC1155PresetMinterPauser.sol";

contract PruebasToken is ERC1155PresetMinterPauser {
    uint256 public constant xx = 1;
    uint256 public constant yy = 2;
    uint256 public constant zz = 3;

    constructor(string memory uri) public ERC1155PresetMinterPauser(uri) {
        _mint(msg.sender, xx, 10**10, "");
        _mint(msg.sender, yy, 10**10, "");
        _mint(msg.sender, zz, 10**10, "");

Hi @Tomas_Velasquez,

I just wanted to check that you resolved your issue?

Hi @abcoathup I resolved the issue.

1 Like