I have a contract that doesn't appear to be too large (around 400 lines of code) but I am getting the error:
=> "Error: Transaction reverted: trying to deploy a contract whose code is too large"
Within my contract I am creating a new instance of a another contract with a call to a method like so:
contract SubContract {
// some contract code
}
// In a separate contract
function createContract() public {
SubContract ctr = new SubContract()
}
Which I believe is increasing the size of my contract dramatically. So my question is:
1.) Is my assumption correct (when I remove this code the error dissapears)
2.) If it is correct, would using the proxy pattern for the SubContract be the right approach?
3.) Is there another approach that would reduce the contract size?
Thanks!