Create DApp "Cheer for you"
Title of DApp
Cheer for you
Description
"Cheer for you" is a DApp that can stake DEV to author
Glossary
| Word | Mean |
|---|---|
| Author | Property owner |
| Staking | Investing a DEV in a property |
How to create
The specifications when Stakes.social was created will be helpful.
| STEP | DESC | DETAIL |
|---|---|---|
| :heavy_check_mark: | Connect with the user's Metamask | https://github.com/dev-protocol/community/issues/20#issuecomment-764518429 |
| 2 | Get and display the user's DEV balance | |
| :heavy_check_mark: | Get a list of authors from GraphQL | https://github.com/dev-protocol/community/issues/20#issuecomment-764525945 |
| :heavy_check_mark: | Create a form to input the author and staking amount for the user to stake | |
| 5 | Confirm the user has a staking amount | |
| :heavy_check_mark: | Get a list of author properties | https://github.com/dev-protocol/community/issues/20#issuecomment-764531795 |
| :heavy_check_mark: | Calculate the staking amount per property | https://github.com/dev-protocol/community/issues/20#issuecomment-764534276 |
| 8 | Send to smart contract | https://github.com/dev-protocol/community/issues/20#issuecomment-764535925 |
| 9 | Develop smart contracts. Receive the properties submitted from step 8 | |
| 10 | Steak to the target property | |
| 11 | Tell the front side the completion | https://github.com/dev-protocol/community/issues/20#issuecomment-764555389 |
| 12 | Tell the user completion |
Points confused in developing
| Question | Answer |
|---|---|
| I don't understand the term (I don't know what to use) | Prepare a glossary as a document |
| I don't know how to get DEV | Document that the exchange can be returned from Eth and converted to DEV (note the content) |
| I don't understand the role and usage of the wallet | Prepare a document about the introduction and usage of the wallet |
| I don't know how to use DevProtocol | Prepare the document |
| How to prepare DEV in local environment | We recommend using Ropsten in the test environment |
| I don't know how to use dev-kit-js | Prepare the document |
Connect with the user's Metamask
Metamask official reference https://docs.metamask.io/guide/ethereum-provider.html#ethereum-request-args
Wallet connection request
ethereum.request({ method: 'eth_requestAccounts' })
非推奨: ethereum.enable()
STEP
- We need to create a function to see if the MetaMask Chrome extension is installed
- If MetaMask is not installed we:
- Change our connectButton to Click here to install MetaMask
- When clicking that button it should take us to a page that will allow us to install the extension
- Disable the button
- If MetaMask is installed we:
- Change our connectButton to Connect
- When clicking that button it should allow us to connect to our MetaMask wallet
- Disable the button
Get a list of authors from GraphQL
Devprotocol does not provide an interface to get a list of authors. It is prepared in GraphQL below, so use this https://explorer.graphql.devprotocol.xyz/
And, additional information (icons, etc.) is prepared below, so use it. https://github.com/dev-protocol/dev-for-apps
Get a list of author properties
Process on the front side to minimize contract processing
It is prepared in GraphQL below, so use this https://explorer.graphql.devprotocol.xyz/
Calculate the staking amount per property
Process on the front side to minimize contract processing
Staking Price / Total properties of designated Author = Staking amount per property
Give the remainder to the first property
Send to smart contract
The parameters to be sent are as follows
- User's address
- Array of "address of property to be given and staking amount of it"
Tell the front side the completion
Use it because you can notify the completion after the block is imported by dev-kit-js.
- Regardless of contract
You can find out dev-kit-js from the contract.ts below.
https://github.com/dev-protocol/dev-kit-js/blob/main/lib/contract.ts