I have a question about deploying a contract from a contract and size issues.
I have been trying to deploy contract B from contract A using B = new B (some params); but was breaking the size limit. My understanding is that when using “new” contract A will inline all of contract B’s code, so I modified this.
I moved contract B creation into a simple factory contract and passed the factory address into contract A, so I have BFactory bFactory = _bFactory; in the constructor of contract A and B = bFactory.createB (some params) in the code. Contract A was now under the limit (yay) but BFactory was over it. All BFactory does is declare a function "createB" which receives the params and then does: return new B (some params);
I’ve gone through contract B and reduced it from >20KB to c. 15KB but still BFactory is around 45KB even with runs at 1. Why is BFactory so large? Am I using the pattern wrong? Is there anything else I can do?