unlock
unlock copied to clipboard
feat(smart-contracts): lower contract size for PublicLock v15
Description
This removes some code from PublicLock template so more features can be added without hitting the EVM contract size limit
Size: before : 23.956 / after: 22.636
Make some function private (avoid storing/copying full signature)
-
schemaVersion(-0.032) - set
updateSchemaVersioninternal (?)
Functions removed
-
addLockManager(duplicate ofhasRole(LOCK_MANAGER_ROLE, address)) andrenounceLockManager(duplicate ofrenounceRole(LOCK_MANAGER_ROLE)) (-0.220) - remove
isApprovedForAllandsetApprovalForAll(-0.477) - refactor hooks addresses getters into a single
hooksgetter (-0.061)
Other cleanup
- remove previous migration code (-0.188)
- refactor hooks addresses checks (-0.349)
NOT doing:
- ~~group fees into a single getter and a single setter (gas refund, transfer fee, cancel fee)~~ (+0.063)
- ~~refactor hooks addresses getters into a single hooks getter~~ (-0.061)
Potential candidates for deletion
- function where feature can be recreated with workarounds :
burn - 'nice to have' / sad to delete functions :
lendKey/unlendKey,mergeKeys
Issues
Fixes # Refs #
Checklist:
- [ ] 1 PR, 1 purpose: my Pull Request applies to a single purpose
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have updated the docs to reflect my changes if applicable
- [ ] I have added tests (and stories for frontend components) that prove my fix is effective or that my feature works
- [ ] I have performed a self-review of my own code
- [ ] If my code involves visual changes, I am adding applicable screenshots to this thread
Release Note Draft Snippet
contract size audit here https://observablehq.com/d/fcfc7fa77ef2dd13