I have a Bakery.sol and Cookies.sol contract. Bakery has a function bakeCookie(). Since creation of contracts cost some ETH, how costly will it be to have new Cookie contracts being created very frequently? Is there a way to reduce the cost?

  • explain in detail, if its possible some eg Commented Feb 11, 2018 at 17:17
  • 2
    Check out clone factory github.com/yarrumretep/clone-factory Commented Feb 11, 2018 at 17:36
  • 2
    You should check if struct is a better choice for your requirement. It will be cheaper than deploying a contract.
    – ivicaa
    Commented Feb 11, 2018 at 20:52

1 Answer 1


Using the clone-factory module, your Bakery contract could inherit from CloneFactory and then bakeCookies() could clone a master Cookie.sol contract that gets deployed once. bakeCookies() would then initialize the new clone contract with whatever initialization data is necessary for that specific Cookie.

Check out the ThingFactory and Thing contracts at https://github.com/yarrumretep/clone-factory/tree/master/test

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.