Skip to content

Read manager

viestursr edited this page Dec 22, 2017 · 2 revisions

Read manager is responsible for direct blockchain interaction with the Read (Book) contract.

The source of the contract that was used during development is located in:
contracts/ReadToken.sol - This contract is exactly the same as the live one
build/contracts/ReadToken.json - Compiled JSON version of the contract


constructor(address)

Constructor expects to get Read (book) contract address that you want to interact with.

address - Read (book) contract address that you want to interact with


getInstance()

Method will return or assign instance of a contract based on provided address in constructor


createInstance(owner, author, description, title, price, totalTokens, saleEndDate)

Method will create a new instance of the contract and deploy it to blockchain network

owner - wallet address of the user who will be contract owner

author - name/surname of the author of the book

description - short description of the book

title - title of the book

price - price of the book

totalTokens - total amount of tokens being sold

saleEndDate - unix timestamp for the sale end date


buy(payer)

Method will trigger buy function on the contract

payer - wallet address of the user who will be buying the Read (book) tokens