Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portfolio tracker with basic defi tools #29

Open
Keith-CY opened this issue Aug 8, 2022 · 2 comments
Open

Portfolio tracker with basic defi tools #29

Keith-CY opened this issue Aug 8, 2022 · 2 comments

Comments

@Keith-CY
Copy link
Member

Keith-CY commented Aug 8, 2022

Glossary:

  • Profile: similar to account of app, points to a group of information representing a user, in this case a profile consists of basic account info and wallets
  • Portfolio: a collection of tokens as the most basic unit in investment;
  • Layer 1: the layer provides security and decentralization, CKB in this case;
  • Layer 2: the layer provides scalability, Godwoken and Axon in this case;
  • HD Wallet: wallet can derive various addresses following BIP 32, BIP 39, BIP 44, Neuron in this case;
  • ETH Wallet: general eth wallet like MetaMask;
  • FT: Fungible tokens, ERC20 in evm ecosystem and SUDT in CKB ecosystem;
  • NFT: Non-fungible tokens, NRC721, NRC721A in evm ecosystem and M-NFT, CoTA, NRC721 in CKB ecosystem;
  • Protocol: Generally adopted rules in governance.
  • Bridge: a fundamental infra to transfer tokens between layer1 and layer2, godwoken bridge in this case.

Functionalities:

Profile Management:

Each profile consists of alias, avatar, wallets, wallets is a list of HD wallet and eth wallet;
Profiles are stored locally, in file or database of browser;

  • List: list all profile with alias, avatar and wallet ingredients
  • Create:
    • set alias(up to 200 chars)
    • set avatar(optional, only online image is supported)
    • add wallets
      • pick wallet type(hd wallet, eth wallet)
        • hd wallet: import from file(xpub)/request from neuron
        • eth wallet: paste eth address/request from metamask
      • if a hd wallet is imported, derive receive addresses and change addresses with the same rule in neuron. Besides, last batch derived addresses should be checked periodically if they have txns, if yes, next batch of addresses should be derived.
      • set wallet alias, if eth address has corresponding ens or bit, set by default and not allowed to be udpated, or set default value of wallet index
  • Edit
    • edit alias
    • edit avatar
    • add/remove wallet
    • derive addresses manually
  • Delete: delete the profile, double confirmation is required

Portfolio Dashboard

A dashoard to inspect portfolio of a specific profile from various perspectives

Functions:

  • Profile switch: pick which profile to inspect

  • Total value(in USD): aggregate asset value in USD, including total assets, total debts and net worth

    • Net worth
    • Total Assets
    • Total Debts: # todo
  • Portfolio Overview

    • FT Token List(sorted by name/value): show owned sudt/erc20 tokens in this portfolio

      • Token Name: a link to blockchain explorer
      • Balance
      • Price
      • Value
      • ckb/godwoken/axon
    • NFT Token List(sorted by name): show owned mnft, cota nft, nrc721, erc721 tokens in this portfolio

      • renderer
      • Token Name: a link to blockchain explorer
      • Token Id
      • ckb/godwoken/axon
    • Token Allocation

      • allocate token of layer 1 and layer 2 in value(USD): illustrate value percentage of each token
        • FT
          • General CKB
          • SUDT
          • ERC20
          • Deposited Nervos DAO
          • LP
        • NFT
      • allocate token of layer 1 in occupied CKBytes: illustrate capacity usage of each token
        • Unused
        • Nervos DAO
        • SUDT
        • NFT
  • Protocol selection: # skip because protocols are not too many for now

    • layer 1

      • Nervos DAO
      • Plain Cell
      • SUDT
      • MNFT
      • NRC 721
      • CoTA
    • layer 2

      • ERC20
      • ERC721
      • ERC1155
      • DEFI
        • Yokai LP
        • Yokai Monster
        • Stable KOI
  • History: basic functions similar to blockchain explorer

  • layer 1

    • transaction count
    • records
      • txns
        • tx hash
        • from
        • to
        • time
        • amount
        • fee
      • sudt transfer
        • tx hash
        • from
        • to
        • time
        • amount
        • fee
      • nervos dao deposit/withdrwal
        • tx hash
        • stage(deposit, withdrawing, unlock)
        • time
        • amount
        • fee
      • mnft mint/transfer/burn
        • tx hash
        • action(mint/transfer/burn)
        • token collection and id
        • time
        • fee
      • nrc721 mint/transfer/burn
        • tx hash
        • action(mint/transfer/burn)
        • token collection and id
        • time
        • fee
      • cota
        • tx hash
        • action(mint/transfer/burn)
        • token collection and id
        • time
        • fee
  • layer 2

    • transaction count
    • records
      • txn

        • tx hash
        • method
        • time
        • from
        • to
        • amount
        • gas price
        • gas fee
      • erc20 transfer

        • tx hash
        • time
        • from
        • to
        • amount(with token info)
        • gas price
        • gas fee
      • erc721 transfer

      • stake: # todo

-. Share # todo

Tools

Some tools for daily usage

  • Bridge(between layer 1 and layer 2)

    • Deposit CKB/SUDT from ckb to godwoken with Neuron/MetaMask

      • interface

        • display sender selector(checkout one from wallets in the profile)
        • display CKB amount field: set how many CKB to deposit, 400 CKB at least
        • display SUDT amount field: set which and how many SUDT to deposit along with CKB, optional
        • display receiver address field, free to input, but also support picking one of eth wallets in the profile
        • display bridge history
          • layer 1 tx hash
          • layer 2 status (received or not)
          • from wallet
          • receive address(show wallet alias if possible)
          • ckb amount and sudt amount
          • confirmations
      • workflow

        • select one from current wallets as sender
        • set X CKB to deposit
        • select SUDT and set Y to deposit(optional)
        • set receiver address
        • confirm with estimated, received amount and fee
        • show pending transaction in history
    • Withdraw CKB/SUDT from godwoken to ckb with MetaMask

      • interface

        • display sender selector(only eth wallets are available)
        • display CKB amount field: set how many CKB to withdraw, 400 CKB at least
        • display SUDT amount field: set which and how many SUDT to withdraw, optional
        • display receiver address field: free to input, and can pick one from wallets in the profile
        • display confirm dialog
          • withdrawing X sudt along with Y CKB
          • 100b locks to wait
          • estiamted time
          • caveat: Layer 2 assets will be locked in Withdrawal Request, and available to withdraw to Layer 1 after maturity.
        • display transaction history
          • layer 1 tx hash
          • layer 2 block
          • from wallet
          • receiver address(show wallet alias if possible)
          • ckb amount and sudt amount
          • confirmations
      • workflow

        • same as deposit
  • PoolTogether(demo)

    Only one pool of YOK asset

    • Rules

      • Govern team deploys a contract as a fund pool and triggers distribution for each round
      • User deposits YOKs into the fund pool while the pool mints tickets as sharing to the user
      • Fund pool stakes deposited YOKs into the auto yok pool to earn interest
      • Fund pool pays every week as govern team triggers the contract
      • On payday, the fund pool fetch the amount of interest and accumulate tickets to the winner of this round;
      • After the pay, if there're withdrawal requests from users, the fund pool withdraws from the auto yok pool, and sends back to user's wallet with burning corresponding tickets.
      • Shares won't be effective until the next round is finished, namely shares will be locked more than 1 round, less than 2 rounds without profit. This could avoid a trick that a user deposits at the moment of rolling a winner and withdraws them after the round.
    • interface

      • deposit

        • display the prize pool of current round, show how many YOKs as prize in the pool for participants
        • display a countdown of current round
        • display sender selector
          • select layer: select from which layer to deposit assets, CKB or godwoken
          • select wallet: Neuron wallets and eth wallets are available if layer1 is selected, or only MetaMask is available
        • display receiver selector as the participant in the round
          • select eth wallet: eth wallet selected as depositor will be filled in automatically
        • display YOK amount: set how many YOKs to deposit
        • display Estimated APR, fee: not necessary for now
        • display estimated time if the asset is bridged from layer 1 into the pool
      • withdraw

        • display amount of deposited YOK (including actively deposited and passive earned prize)
        • display receiver select: participant is filled automatically
          • select layer: CKB or godwoken
          • select wallet: Neuron wallets and eth wallets are available if layer1 is selected, or only eth wallets are available
        • CKB amount: set how many YOKs to withdraw
        • display estimated time if the asset is bridged back to layer 1
    • workflow

      • deposit

        • select wallet to send deposit asset
          • select layer: ckb or godwoken
          • select wallet: neuron wallet or eth wallet
        • set depositor to participate in the game
        • set YOK amount to deposit
        • click the deposit button and sign a transaction
          • neuron wallet: call neuron signing function
          • eth wallet: call MetaMask signing function
        • pool receives the deposit, mint corresponding shares to the participant and stake YOK in yok pool
      • roll a winner

        • on payday, govern team calls the award method to increase sharing of the winner
      • withdraw

        • select wallet to receive deposited asset
          • select layer: ckb or godwoken
          • select wallet: neuron wallet or eth wallet
        • set CKB amount to withdraw
        • click withdraw button and sign a transaction with eth wallet connected to participant's address
  • DApp Radar: use strapi

    • List available protocols and dapps
      • logo
      • name
      • type(defi/nft/social/game/other)
      • website

Settings

  • Currency
    • USD
  • Language
    • EN
  • Chain
    • Mainnet
    • Testnet

Search # todo

Other

Footer

  • GitHub
  • Discord
  • CKB Explorer
  • GwScan
  • API Documentation
  • Careers

Ref:

@Keith-CY
Copy link
Member Author

By 08/19

@Keith-CY
Copy link
Member Author

Keith-CY commented Oct 9, 2022

MetaMask starts to provide portfolio service
Ref: https://portfolio.metamask.io/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Todo
Development

No branches or pull requests

1 participant