dev-protocol / community

🏕Community space for Dev Protocol
https://community.devprotocol.xyz/
MIT License
18 stars 7 forks source link

Create DApp "Cheer for you" #20

Open kazu80 opened 3 years ago

kazu80 commented 3 years ago

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
kazu80 commented 3 years ago

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

  1. We need to create a function to see if the MetaMask Chrome extension is installed
  2. If MetaMask is not installed we:
    1. Change our connectButton to Click here to install MetaMask
    2. When clicking that button it should take us to a page that will allow us to install the extension
    3. Disable the button
  3. If MetaMask is installed we:
    1. Change our connectButton to Connect
    2. When clicking that button it should allow us to connect to our MetaMask wallet
    3. Disable the button
kazu80 commented 3 years ago

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

kazu80 commented 3 years ago

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/

kazu80 commented 3 years ago

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

kazu80 commented 3 years ago

Send to smart contract

The parameters to be sent are as follows

  1. User's address
  2. Array of "address of property to be given and staking amount of it"
kazu80 commented 3 years ago

Tell the front side the completion

Use it because you can notify the completion after the block is imported by dev-kit-js.

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