BookLanding

UTILITYFINANCIALTOOLSDOCUMENTS

Contract purpose

This Smart Contract manages book lending. Anyone put their books forward for lending.

Exposed methods and variables

books returns the details about the book identified by the particular id

addBook called by anyone who wished to lend their book to someone

parameter nametypedetails
idintegerunique identifier of the book
ISBNstringISBN of the added book
titlestringbook title
authorNamestringthe name of the author
pubHousestringthe name of the publishing house
feeintegerthe sum that someone who wants to borrow the book must send to the contract first
timeintegerthe time until the book must be returned (in seconds)

borrowBook payable function called by someone who wants to borrow a particular book. The borrower has to send to the contract the fee set by the lender. In case he does not return the book in time, the fee is lost and transferred to the lender. It emits BookBorrowed event.

parameter nametypedetails
idintegerunique identifier of the book

whereIsMyBook called by the lender to check the address of the person who has his book and how much time is left until the book has to be returned. If the time has passed, he receives the fee.

parameter nametypedetails
idintegerunique identifier of the book

returnBook called by the one who borrowed the specified book. If the time has not passed, he received the fee back.

parameter nametypedetails
idintegerunique identifier of the book

Events

BookBorrowed

parameter nametypedetails
idintegerunique identifier of the book
addrethereum addressthe address of the borrower
Buy
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract