citycoins/protocol

Remaining tasks for implementation

Closed this issue · 1 comments

This issue will be the main tracking point for tasks remaining before and after the testnet launch, and serve as a supplement to the original discussion in governance.

This also captures what is left following the merge of #19.

Individual items can be broken out into separate issues as needed.

Contract Code

  • ccd001: code complete!
  • ccd002: code complete!
  • ccd003: code complete!
  • ccd004: code complete!
  • ccd005: code complete!
  • ccd006: code complete!
  • ccd007: code complete!
  • ccd009: code complete!
  • ccd010: code complete!
  • ccd011: code complete!
  • ccip012-bootstrap: sets up the DAO, signers, signals, and delegates treasury contract
  • ccip013-migration: migrates MIA/NYC data to CCD005, creates shutdown job in auth
  • ccip013-activation: shuts down legacy protocol, activates cities in new protocol

General

  • #41
  • rename ccd006/ccd007 to be clearer
    • ccd006-city-mining -> ccd006-citycoin-mining
    • ccd007-city-stacking -> ccd007-citycoin-stacking
    • would reordering the extensions be a big ask?
  • reconsider default-to for read-only fns
    • could use unwrap! instead, still simplifies map-get
    • UIs can respond to null better than default values
    • default values can be applied where needed with option type

Testing

  • clear out all TODO comments
  • rename Clarinet.toml.XYZ to Clarinet.XYZ.toml
  • check that all errors are used in each contract
  • check that all errors are correctly defined in tests
  • check that all contract functions are covered for error then success paths
  • check that the min/mid/max is checked for any variable input
    • this is important for accurate cost testing
  • check that all test naming/printing is consistent
  • remove any remaining console logging at end
  • evaluate what a subsequent upgrade would look like
  • evaluate what launching a new city would look like

Transition

  • create basic outline of transition and next steps
  • review shutdown / status checks against DAO implementation

Costs

  • ccd006: consider #32
  • ccd005: condense naming for cost savings
    • coinbaseAmount1 -> amount1 -> cba1
    • coinbaseThreshold1 -> threshold1 -> cbt1
    • coinbaseBonusPeriod -> bonus
    • coinbaseEpochLength -> epoch
    • also reduces ccd006 and ccd008 costs
  • ccd005: consider combining CityTreasury* maps
    • var for nonce, one for id, name, address
    • single write, same key for all three
    • same for CityCoinbase* maps
    • thresholds, amounts, details
  • remove city- designation where possible
    • used in vars, maps, functions, etc
    • change targetCycle to cycleId
  • could condense calls between contracts
    • return multiple values like get-city-info and get-coinbase-info
    • individual calls are more expensive than one big call
    • remove separated functions where possible
      • e.g. if get-coinbase-info is used, remove other individual getters
  • test one big map versus a bunch of small ones
  • test combinining ccd-003 and ccd-004 as one registry

Future

  • stacking considerations
    • preparations for continuous stacking in 2.1
    • allow anyone to extend by 1 cycle
    • add flag to disable for draw-downs
  • ccd008: activate-city support for coinbase info
    • add function for TOKEN_EPOCH_LENGTH in old protocol
    • review setting for TOKEN_BONUS_PERIOD, combine with epoch?
    • set coinbase amounts and thresholds on success
  • ccd008: check for doubled guards based on ccd005
    • can eliminate if it's already protected
  • ccd008: leave in draft status
    • not required for setting up MIA/NYC
    • could review and update before next city launch

Closing this out as the mainnet deployment is already complete, future notes can be translated to separate issues as needed.