# Omen Codebase Cleanup ## Strategy * Freeze codebase at stable state, after token launch * Start with low level and some high level changes * Later make high level and external changes alongside any ongoing feature development, e.g. guild ## Additional considerations ### UI/UX improvements * Should we use/wrap ERC-20 outcome tokens? * How is that managed with CPK & tight integration * What is the long term plan with CPK? * What is the long term plan with tight integration, considering possible deployment on many chains/L2s? * How much do we want to prioritize mobile optimization? * Improved market filters * Particularly: improve/replace 'ending soon' default filter in 'My Markets' ## Lower level changes ### Logic * Cleanup of math formulas * e.g. https://github.com/Polymarket/amm-maths * Better transaction state management * Transaction modal should be high up in the component tree so it doesn't always have to be imported into components (if possible) * `setTxHash` and `setTxState` should be included directly in the cpk constructor (as optional parameters) * CPK service should be simplified * Logic should not be reused * Compound logic should not be reused * Maybe worth considering removing altogether * Relay logic should not be reused * Add tests * (Ideally) all logic based functions should have tests ### Refactoring * Improved theme color structure * https://github.com/protofire/omen-exchange/issues/1996 * Improved styled component reuse * e.g. https://github.com/protofire/omen-exchange/issues/1997 * A strong way to manage component reuse is being strict with naming consistency between figma and the codebase. * Move all contexts we use inside contexts folder since we have most of them inside hooks folder * https://github.com/protofire/omen-exchange/issues/2000 * Separation of concerns with component structure * https://github.com/protofire/omen-exchange/issues/2002 * Scalar and categorical market components should share a parent * e.g. `market_buy` and `scalar_market_buy` should share `market_buy_container` where shared logic is not reused ## Higher level changes ### Housekeeping * Styled components should not be duplicated * Should be placed in a common styles file * Clean up `market_home` urls/filters * Enum types should be all caps * Better multi-network token mapping for token icons * Essentially a more maintainable version of `alternativeAddresses` ### Bug fixes * Likely many can be found in buried issues and from testing * Fix inconsistent liquidity values * `market_data` component uses different logic from `market_pool` * Fix svg console warnings ### Mobile * New components should be tested for basic mobile functionality * Navbar * When we include the governance page it will be extra important that we have some kind of proper mobile navbar. ![](https://firebasestorage.googleapis.com/v0/b/firescript-577a2.appspot.com/o/imgs%2Fapp%2Fkaden-notes%2FZejt805xaA.png?alt=media&token=dd369b21-60bc-471f-9b65-0607fe6c766a) * x-scrolling on market page ![](https://firebasestorage.googleapis.com/v0/b/firescript-577a2.appspot.com/o/imgs%2Fapp%2Fkaden-notes%2F1JdjojSTwR.png?alt=media&token=3357f3fc-985c-4b66-a1c1-db6e3452ec4c) ## External changes * Improved review process * Research good methods * Less reviewers, but deeper review * Integrate style guide(?) * Introduce new react development patterns * See Refactoring ### Subgraph improvements * Split up and refactor test suite * Separate utility functions * Use individual tests * Fix failing tests * Add tests for new/untested features * Fix `render-templates` * Should read from `/abis` and write to `/build`