I'm really new to solidity and there is still alot I dont fully get. I have created this smart contract. I am getting an error while performing a test stating that the id to be set by the push cant be performed due to the following:
Error: Different number of components on the left hand side (1) than on the right hand side (0).
uint _id = arts.push(_art);//create ids
^------------------------^
I understand that the push receives only one atribute and should be able to stablish the index to the id variable. Nontheless this bugg occurs, I'm not sure if its the version or something else. I'm currently using truffle for the tests with version: "^0.6.0". I would really appreciate your help. Thanks in advance!
Here's my code:
pragma solidity >=0.4.21 <0.7.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract Art is ERC721{
string[] public arts;
mapping(string => bool) _artExists;//similar to json or hash
constructor() ERC721("Art", "DATA") public {
}
//E.G color = "#FFFFFF"
//create art restrict in the future to mentors
function mint(string memory _art) public{
//Require unique Art
require(!_artExists[_art]);
uint _id = arts.push(_art);//create ids
//address
_mint(msg.sender, _id);
_artExists[_art] = true;
//Art - track it & add it
//Call the mint function
//Art - track it
}
}
//mint function