I do need to deploy a lot of similar smart contracts. With Solidity it's quite easy, but expensive :(
I'm doing:
contract One {
...
}
contract Builder {
function create(uint8 amount) public returns (address[]) {
uint8 i = 0;
address[] contracts;
while (i++ < amount) {
address[i] = new One();
}
return contracts;
}
}
This approach works, but costs almost same amount of gas as it would creating via separate transactions. It looks like that EVM is just cloning code into new place in storage and we have anyway pay for gas for such duplicated code.
Is there any way to have pointers in new accounts into place in storage where code is stored instead of duplicating same bytecode into own storage?