Has there been any research into how a contract factory might be made in Michelson/Liquidity?
To elaborate, in Solidity a contract factory might look like:
pragma solidity ^0.4.8;
contract Bakery {
// index of created contracts
address[] public contracts;
// useful to know the row count in contracts index
function getContractCount()
public
constant
returns(uint contractCount)
{
return contracts.length;
}
// deploy a new contract
function newCookie()
public
returns(address newContract)
{
Cookie c = new Cookie();
contracts.push(c);
return c;
}
}
contract Cookie {
// suppose the deployed contract has a purpose
function getFlavor()
public
constant
returns (string flavor)
{
return "mmm ... chocolate chip";
}
}
(referenced from https://ethereum.stackexchange.com/questions/13415/deploy-contract-from-contract-in-solidity)
This is a powerful feature in DAPP development, as it allows you to build an object oriented structure for your DAPP where requests can create new contracts. It is a well established design pattern, so what would the equivalent be in the Tezos ecosystem?
CREATE_CONTRACT { storage 'g ; parameter 'p ; code ... }
would work, but this will bloat the size of a contract a bit, and it feels like there should be a way to handle this gracefully like in Solidity's Java style class instantiation. – Rob Mar 11 '19 at 23:54