# DeFiWiki userflow, UI, Dataflow
## Short
1. *maintainer* uploads new content to the page => it uploads it to IPFS. When it is finished it notifies him, that "content is uploaded, ready to publish"
2. user presses "publish" button => creates tx serves it to metamask, it contains the new content hash on IPFS
## Long
1. user opens up the wikipage.
2. he picks a section that needs updating
3. he presses "update" button. UI shows him message box: "please connect wallet first"
2. Once his wallet is connected, it checks if he is *maintainer* for the section.
- **IF he is NOT a *maintainer***
1. user is shown:
*you are not a maintainer for current section do you want to become you one? For this you will need to deposit 100 WIK tokens. Do you wish to stake your tokens?*
2. user presses "became maintaner" button
- FE generates approve + transferFrom TX to transfer his stake, there are 2 more steps here for the user "approve" + "transfer"
3. user is shown "congrat! you have become a maintainer!"
- FE recognizes user is now maintaner and continues from step 5
- **IF he is *maintainer***
5. he presses "update" button again. It shows him popup box where he can paste in the new content.
- file starts uploading to IPFS.
5. user is showm *file is uploading* message, the button text changes to "uploading"
- FE waits for IPFS hash, once it has it, updates FE for the user.
6. user is showm *uploaded!* "publish" which is next to upload button stops being seethrough and available, user presses this, it generates TX with the new IPFS hash.
7. user confirms the transaction.
8. user is showm *publishing*
- UI waits ofr TX is go get to blockchain
- Once it goes through it transacts *small amount* of WIK tokens
9. user is showm *Thank you! your content has been published*, we have send you som WIK tokens to thank you for your work!
## Dataflow
### Actions
#### Editing content
1. user adds text to the text field and uploads it to IPFS
2. FE shows him uploaded content + content hash
3. FE Generates tx with the hash, user is will be able to successfully publish it only if he is a maintainer.
### Glossary
- *staking amount* - amount of WIK tokens that is necessary to stake, to raise a challenge or become an *editor*. Different sections can have different *staking amounts* associated with them. However, *staking amount* for a specific section is the same for all wiki pages. (e.g. abstract section has staking amount of 100 WIK accross all wiki pages)
- *dispute period* - time period in which *maintainer* can dispute a *challenge*. Could be different for different sections.
** Actors in the system: **
- ***editors*** - edit and update content. Anybody can become an *editor*, they lock WIK tokens.
- ***maintainer*** - *editor* who is currently responsible for correctness of specific section.
- *challenger* - *editor* who challenges current *maintainer*
- ***voters*** - ensure that conflict between *editors* regarding correct content are resolved