My contract size is too big. It's an erc20 token with RFI and a voting extension from Openzeppelin. ERC20 + RFI is fine. (21KB) ERC20 + Voting extension is fine too. (16KB) But ERC20 + RFI + Voting is > 24KB.

The contracts are already code and compiler optimised.

Any idea's how I could use both for my ERC20 token? I tried to create another contract for the voting extension and let the main contract (ERC20 + RFI) call it when needed, but it's too expensive.

Your insights would help a lot, Take it easy, Alex


1 Answer 1


Most likely there is some optimization you can do for your code, but it probably won't get you where you need to get.

There simply isn't any magic trick you could do. If the contract is too big, you just have to make it smaller.

One (a bit questionable) option is to import the used external contracts locally and go through their code to remove stuff you don't need. But that should be done with extreme caution, since you will lose some of the benefits of the template code (OpenZeppelin for example) if you mess around with the code - one wrong turn and you'll end up with a new vulnerability.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.