sam rho
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # DApp project ## Topic * 복권 서비스(몰아주기) + 기능 추가(스테이킹) ## 모임 시간 - 10월 26일 오후 8시 ## 2022-10-26 ![](https://i.imgur.com/4hHGqnl.jpg) - 기능 정의 - 참여하기 - Smart Contract 에 참가비 전송
 - 취소하기 - 참가 취소 - 당첨 Rule ( 아래 중 1 택, 나머지 기능 추가, 룰은 변경 가능) - 당첨 시간 (30분, 1시간, 1일?) - 승자 독식 - ~~1, 2, 3순위, 랜덤~~ - 소액 투자, 무손실, 이자 공유 - 동일한 금액 참여 ~~vs 다른 금액 참여(가중평균)~~ - 참가 마감 - 마이닝 - 참여된 금액으로 마이닝 - 추가 채굴된 이더를 확인(모집금액, 이자 구분) - 홈화면 - 로그인(지갑) - ~~회원가입(?)~~ - 모집금액 조회 - 참여하기(금액 전송) - 전 회차 금액, 이자 - 당첨자 주소 - flow - 홈 - 모집금액 조회(회차정보, 이전회차 모집금액, 당첨주소) - 참여하기 - withdraw - 결과 조회 - 금액 / 주소 - Daemon? - 실시간 조회성 서비스? 30초 간격? - 수익 구조, 사업성 - 운용 보수(수수료) - 채굴된 이더를 적용? (전액 / 일부) - 해올 것 - 승남 - 각 page 나누기 - react-router-dom - login(지갑 연동) - smart contract와 통신 방법(web3.js) - ex ) [react-query](https://react-query-v3.tanstack.com/) - [alchemy](https://docs.alchemy.com/recipes) - 효근 - smart contract 기능별 구현 - Test CA address 생성 - 종승 - 결과 조회 화면 구현(승남 페이지 작업 후) - Smart Contract 이용하여 금액 및 주소 조회 ## 2022-10-25 tasks - [x] ⭐️ 프로젝트 주제 정하기 - [x] ⭐️ 프로젝트명 & 팀명 정하기 - [x] ⭐️ 역할(?) 분배 - [x] (노승남) 프로젝트 boilerplate setting - [x] convention 정하기 - [x] [github flow](https://www.gitkraken.com/learn/git/best-practices/git-branch-strategy#github-flow-branch-strategy) - [x] (bonus) issue template, PR template, labels ## 역할 * 노승남 - 프론트엔드 초기 세팅, 예시 찾기 * 윤종승 - 기능 * 박효근 - 기능 * 공통 - 솔리디티 문법 등 학습 ## 기능 * 핵심 기능 * 공모 기능 * 어떤 로직으로 랜덤하게 당첨자를 뽑을 건지 * 부가 기능 * 기존의 공모된 금액 마이닝 하게 되면 +가 됐을 텐데.. +된 금액을 어떻게 분배할 건지 * 1등이 1/3 2등이 1/x ... ## 내일까지 * 솔리디티 문법 등 학습 * 전반적인 플로우 고민 * [Github Flow](https://www.gitkraken.com/learn/git/best-practices/git-branch-strategy#github-flow-branch-strategy) ## Tech stack * [Truffle + react box](https://trufflesuite.com/boxes/) * Ganache ## Smart Contract - Lottery 기능 * 몇 명 모였는지 / 총 인원수 * Owner의 경우, 다음 라운드 인원수 변경 지원 * 게임참가자 수가 다 차면 게임을 자동으로 진행 * 얼마를 넣어야 하는지(균등) * Owner의 경우, 다음 라운드 참가비 변경 * 배팅하기 * 히스토리 조회 기능(회차별) * 중복 지원 가능 * 한계 * 마지막 참가자가 게임에 참가하는 경우 자동으로 게임 진행하게 됨으로 마지막 참가자에게 가스비가 추가 발생을 부담. * 해당 문제를 해결하기 위해 마지막 게임 진행은 Owner가 진행하고 대신 참가비 일부를 운영비로 받을 수 있도록 구현이 필요. ## Smart Contract - Lottery 메소드 설명 * constructor() * 첫 라운드 설정 - 게임 Fee와 참가 인원 수는 디폴트 값으로 설정됨 * Owner 권한 획득 * function getWinnerByLottery(uint lottery) public view returns (address payable) * 파라미터로 조회 회차를 입력받아 해당 회차 우승자 주소값을 리턴 * 파라미터 및 리턴 * unit lottery: 조회 회차 * returns(address payable): 조회 회차 주소값 * function getIDByLottery(uint lottery) public view returns (string memory) * 파라미터로 조회 회차를 입력받아 해당 회차 ID 값을 리턴 * 파라미터 및 리턴 * unit lottery: 조회 회차 * returns(address payable): 조회 회차 ID값 * function getAmountByLottery(uint lottery) public view returns (uint256) * 파라미터로 조회 회차를 입력받아 해당 회차 우승 상금 값을 리턴 * 파라미터 및 리턴 * unit lottery: 조회 회차 * returns(address payable): 조회 회차 우승 상금 값 * function getNumberOfPlayersByLottery(uint lottery) public view returns (uint256) * 파라미터로 조회 회차를 입력받아 해당 회차 플레이어 수를 리턴 * 파라미터 및 리턴 * unit lottery: 조회 회차 * returns(address payable): 조회 회차 플레이어 수 * function getBalance() public view returns (uint) * 현재 누적된 상금을 리턴 * 리턴 * returns (uint): 누적된 상금 값 * function getPlayers() public view returns (address payable[] memory) * 현재 참가중인 플레이어 주소값 배열을 리턴 * 리턴 * returns (address payable[] memory): 참가중인 플레이어 주소값 배열 * function getCurrentRound() public view returns (uint256) * 현재 회차 값을 리턴 * 리턴 * returns (uint256): 현재 회차 값 * function getCurrentNumberOfPlayers() public view returns (uint32) * 현재 참가 인원 수를 리턴 * 리턴 * returns (uint32): 현재 참가 인원 수 * function getMaxNumberOfPlayers() public view returns (uint32) * 최대 참가 인원 수를 리턴 * 리턴 * returns (uint32): 최대 참가 인원 수 * function enter() public payable * function enter(string memory id) public payable * 참가비 내고 게임에 참가. 파라미터로 id를 사용되며, 사용하지 않는 경우 현재 주소 값을 id로 사용 * 참가 인원이 최대 참가 인원 수와 동일한 경우, 게임이 진행되고 승자에게 상금이 지불됨 * 파라미터 * string memory id: 참가자 id * function setMaximumNumberOfPlayers(uint32 pNextRoundMaxNumOfPlayers) public onlyOwner * 다음 라운드 최대 참가 인원을 변경. (단, 게임참가자가 없는 경우 해당 라운드에 변경됨.) * Onwer만 변경 가능 * function setRoundFee(uint256 pNextRoundFee) public onlyOwner * 다음 라운드 참가비를 변경. (단, 게임참가자가 없는 경우 해당 라운드에 변경됨.) * Onwer만 변경 가능 ## 동작 화면 1. 메인 화면 ![](https://i.imgur.com/JucbrNz.png) 2. 참가하기 버튼 클릭 ![](https://i.imgur.com/671RqXi.png) 3. 닉네임 입력 후 베팅(트랜잭션 생성) ![](https://i.imgur.com/o3vXaJV.jpg) 4. 회차별 정보 조회 기능 ![](https://i.imgur.com/mjGb4CY.png)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully