hicommonwealth / commonwealth

A platform for decentralized communities
https://commonwealth.im
GNU General Public License v3.0
67 stars 44 forks source link

🟩 TokenTrades #9413

Open Rotorsoft opened 1 month ago

Rotorsoft commented 1 month ago

Description

Projects on-chain token buys and sales to off-chain Tokens projection

Stakeholders

Product Engineering
@sachben91 @timolegros

Model

See bucket #9393

Engineering Requirements

  1. Events
    • TokenBought, TokenSold ---- or TokenTraded -> consult with @ianrowan
  2. Schemas
    • See token model in Link command
  3. Business Rules Tagging @dillchen to answer caching off-chain
    • Do we keep track of token balance in projection? Our pattern is to fetch balances directly from the UI.
    • Do we keep track of off-chain audit trail or always query the contract?
  4. Persistence
    • See Link command
  5. Response
    • N/A

Unit Testing

Additional Context

timolegros commented 2 weeks ago

If supply (floating supply) in the launchpad Trade event is equal to the total supply then trigger transferring liquidity to Uniswap.

Total supply will be available in the Tokens model after: https://github.com/hicommonwealth/commonwealth/issues/9394#issuecomment-2429672355

Also, after transferring liquidity "lock" the token. The handler should be idempotent such that retries will "lock" a token even if the liquidity transfer was completed in a previous try.