---
# System prepended metadata

title: Code Review (CCO)

---

# Code Review (CCO)

### utils/cco.js

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/utils/cco.js#L97
- Nested ternary. 

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/utils/cco.js#L104
- This is looks like a side effect. Would probably be best to find overTime separately without reassigning. 

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/utils/cco.js#L111
- I'm seeing ``total / 10 ** Number(args.round.ccoToken.decimals)`` repeated a lot through this doc. I think there's a utility for this somewhere in general.js. If not, or you need a CCO specific fn, would probably be good to make one. 

### pages/DaosquareCco.jsx
https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/pages/DaosquareCco.jsx#L8
- It's contexts before components, right? 

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/pages/DaosquareCco.jsx#L52
- Is there a way to do this in the context? Would probably be better not to run sort for every render. 

### components/daosquareCcoOverall.jsx 

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/components/daosquareCcoOverall.jsx#L2
- Spacing for imports

### components/ccoCard.jsx

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/components/ccoCard.jsx#L7

- Spacing between components/utils


### contexts/DaosquareCcoContext.jsx 
https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/contexts/DaosquareCcoContext.jsx#L2
- import spacing 


### pages/CcoContribution.jsx 

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/pages/CcoContribution.jsx#L4

- Some imports out of place here. 

### components/ccoElibility.jsx

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/components/ccoElibility.jsx#L6

- Same here. 

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/components/ccoElibility.jsx#L130

- Unary

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/components/ccoElibility.jsx#L86

- Nested ternary. Should probably refactor some of these to small stateless components.  

### components/ccoContributeCard.jsx

- Imports 

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/components/ccoContributeCard.jsx#L80

- Curious about hard-coding the proposal id to 157 here. There's probably a reason, but I'm just making sure nothing got left out.

    - needs update


- see nan in display
http://localhost:3000/dao/0x64/0x815aa1d90bcf6535bba894db67c49cd34f5cfc66/cco


### forms/ccoLootGrab.jsx

- Imports

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/forms/ccoLootGrab.jsx#L200

- A pretty readable nested ternary, but still a nested ternary

### forms/ccoTributeInput.jsx

- Imports

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/forms/ccoTributeInput.jsx#L21

- State/hooks are out of order. 

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/forms/ccoTributeInput.jsx#L42

- Should use spread instead of unshift (ex. [token, ...tokenArray]) to prevent obj mutations. 


https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/forms/ccoTributeInput.jsx#L178

- Number() instead of '+' for type coercion 

### components/ccoClaimCard.jsx 

- Imports 

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/components/ccoClaimCard.jsx#L21

- This is a good use case for useMemo

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/components/ccoClaimCard.jsx#L76

- Unary

### forms/ccoClaim.jsx
- Imports
- State/hook order 

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/forms/ccoClaim.jsx#L44
- Include daoMember in deps array
- Check daoMember exists. Currently we're setting can rage to true even if daoMember is undefined. 

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/forms/ccoClaim.jsx#L100

- constants go above fns now, right? 

### components/ccoResources.jsx

- Imports

### pages/CcoAdmin.jsx 
https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/pages/CcoAdmin.jsx#L21
- No try/catch here on fetchTransmutation. Graphquery has one though. Might be good to have one in fetchTransmutation?

### forms/ccoConfig.jsx

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/forms/ccoConfig.jsx#L168

- don't need to use anon callback here. Can stash 'cco' or 'daosquarecco' in button value attribute and get in the fn with e.target.value


### forms/ccoWhitelist.jsx 

- State/hooks order

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/forms/ccoWhitelist.jsx#L126

- No need for anon callback fn. onChange={handleFileSet} works the same. 

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/forms/ccoWhitelist.jsx#L112

- Same here. 


### forms/ccoActivate.jsx

- state/hooks order


### components/ccoTransmutation.jsx
- imports order
- state/hooks order

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/components/ccoTransmutation.jsx#L17

- This only selects the first vanilla minion. Would we want to be able to select a particular minion. 


https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/components/ccoTransmutation.jsx#L49
- Nested ternary (readable, but probably good to change to keep code consistent)

### forms/newTransmutation.jsx
- Imports order
- state/hooks order

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/forms/newTransmutation.jsx#L41

- Doesn't need to be async

https://github.com/HausDAO/pokemol-web/blob/0f910d4ff56b16c767679319821092c6afb9f127/src/forms/newTransmutation.jsx#L226
- Should be unary
- same for other steps. 

