Help us understand the problem. What is going on with this article?

Library System: Smart Contract

More than 1 year has passed since last update.


pragma solidity ^0.4.25; //version


contract Library {

//This is the structure of the contract
  struct Book {
    string bookTitle;
    bool inTheShelf;
    address user;

//Declaration of two books
  Book book = Book("book1",true,address(0));
  Book book2 = Book("book2",true,address(0));

//This is an array container of the books
  Book[] books;

//calls first
//This is the constructor of the smart contract
  constructor() public {      

//This is the function for borrowBook
  function borrowBook(uint i) public {
    books[i].inTheShelf = false;
    books[i].user = msg.sender;

//This is the function for returnBook
  function returnBook(uint i) public {
    require(books[i].user == msg.sender);
    books[i].intheShelf = true;
    books[i].user = address(0);

こんにちは、JP です。現在奥多摩日本語学校の学生です。前職でQAテスターとして働いていました。私は学校のブランディングのためにデジタルマーケティング活動をしています。よろしくお願いします。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away