I'm trying to assign an array to a struct item.creators.push(_creators[i]);, but it's not being assigned. I don't receive any error from the compile, but the only attribute that is created inside "Item" is id. What can I do?

 contract BitshoppTokens is Context, ERC1155Burnable, ERC1155Pausable, AccessControlEnumerable {

    using SafeMath for uint256;
    using Counters for Counters.Counter;
  Counters.Counter private _tokenIds;
    struct Item {
        uint256 id;
        LibPart.Part[] creators;
        LibPart.Part[] royalties;
    mapping(uint256 => Item) public Items;

    mapping(uint256 => uint256) private _totalSupply;

    function mintERC1155(address to, uint256 amount, LibPart.Part[] memory _creators, LibPart.Part[] memory _royalties, bytes memory data) public payable returns(uint256) {
        uint256 tokenId = incrementAndGet();
        _mint(to, tokenId, amount, data);
        uint256 total = 0;
        Item storage item = Items[tokenId];

        item.id = tokenId;

        for (uint256 i = 0; i < _creators.length; ++i){
            require(_creators[i].account != address(0x0), "Account should be present");
            require(_creators[i].value != 0, "Creator share should be positive");
            total = total.add(_creators[i].value);
        require(total == 10000, "total amount of creators share should be 10000");

        for (uint256 i = 0; i < _royalties.length; ++i){
        return tokenId;

For context, LibPart has the following struct:

struct Part {
        address payable account;
        uint96 value;
  • Could you explain the type of LibPart, which doesn't seem to be referenced in the code above?
    – Yakitori
    Aug 11, 2021 at 23:13
  • @Yakitori, I just edit the question with this info.
    – n3n3
    Aug 12, 2021 at 10:47

1 Answer 1


There may be a problem with your input data.

Indeed, if _creators.length is equal to 0, only Id will get filled. You can find how to do it here, for instance.

Another way of checking this is to add a line require(_creators.length > 0).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.