Hey everyone, I recently came across this error "Contract code size exceeds 24576 bytes ". I googled and read a few things. There are 2 solutions that I get.
Using a truffle plugin.
Refactor code to be modular.
I can't do the first one as I am using Hardhat. And secondly, I can't really refactor much here. What I have here is a governance contract that I made from reading the openzeppelin blog. I am going to make this upgradable and add features late..... I can see how to make the modular but what I have so far is just very basic/necessary. I have just imported contracts and overridden functions. That's it,there isn't really much to refactor.
I have added config to help me but nothing was affected.
Generally try to remove functions you/your contract won't ever use.
When copy and pasting contract code from somewhere else, you often introduce functions that never will be used.
I have future plans to modify this, and I can see how I will refactor them, but here I am just importing, setting up required, and overriding required functions. I have seen a common suggestion of using a truffle tool, but I am on hardhat.
I am still struggling to figure out what I did wrong from the article.