I am building the following smart contract on Remix and I'm currently receiving these errors when trying to call addBook("Goosebumps", "RL Stine", 1).
pragma solidity ^0.8;
contract Library {
struct Book {
uint256 id;
bytes32 title;
bytes32 author;
CoverType cover;
}
enum CoverType { HardCover, Paperback }
uint256 lastBookId;
mapping(uint256 => Book) books;
function addBook(bytes32 _title, bytes32 _author, CoverType _cover) public {
lastBookId++;
Book memory newBook;
newBook = Book(lastBookId, _title, _author, _cover);
}
}
From Tutorial Point they state
In Solidity we can assign String literal to a byte32 type variable easily. Solidity considers it as a byte32 literal.
contract SolidityTest { bytes32 data = "test"; }
Am I missing something? Here's the error that prints to the console.
transact to Library.addBook errored: Error encoding arguments: Error: invalid arrayify value (argument="value", value="Goosebumps", code=INVALID_ARGUMENT, version=bytes/5.5.0)