joshma91 / avocado

3 stars 0 forks source link

Student Flow #12

Open adrianmcli opened 6 years ago

adrianmcli commented 6 years ago

I was thinking through the user story for students in more detail. Hopefully this will help advise what components we need (smart contracts & frontend).

I am a student and I go to the website. I click "find a teacher".


Question 1: At which point do we require payment?

Question 2: How do the above steps map to specific contracts and method calls within those contracts?

Question 3: Do we require building anything other than our smart contract + frontend to support the above user flow?

joshma91 commented 6 years ago

Step 3. @kendricktan I think we would need a server for this - on the front end, it could be something as simple as a roomID comprising of the addresses of the teacher/student since these are readily known.

Steps 4/5. All of this will be on the front end

Step 6/Question1: In the user story, I proposed the student setting a max ETH spend. This needs to be implemented in a payable function, so I think that the student should trigger the creation of the meeting on the blockchain and lock up the x ETH in the contract. Doing so can set off a timer that calculates the amount that should be refunded. If the entire amount is used (i.e. time exceeds ETH contribution), just send all of the funds to the teacher.

We can easily obtain the stored teacher rate and student contribution, so this can be used to display the maximum amount of time on the front-end. Exceeding the time limit shouldn't stop the meeting imo - let people do what they want.

Step 7. Either the student or teacher can call for an end to the meeting - the contract should support this (i.e. completeMeeting function should contain modifier - require msg.sender isTeacher or isStudent)

Question 2: will update this as I write out test scripts

Question 3: I think we'll need a server lol.

kendricktan commented 6 years ago

@joshma91

Step 3: I don't think we need a server for this. We can create something like

struct Message {
    string message;
    bool read;
}

mapping (address => Message[]) privateMessages;

and limit it to 250 bytes (like a tweet) for them to initiate convo between one another.

Step 6/7: Looks good.