add a book
get book based on publisher -> id
//mycontract.sol
pragma solidity ^0.6.0;
contract MyContract {
mapping(address => mapping(uint => Book)) public myBooks;
struct Book{
string title;
string author;
}
function addMyBook(uint _id, string memory _title, string memory _author) public {
myBooks[msg.sender][_id] = Book(_title, _author);
}
}
reference:
No comments:
Post a Comment