Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Is this a good approach to reduce the bytecode of the B contract?
contract A {
uint256 value;
constructor(uint256 _value) public {
value = _value;
function getValue() external view returns(uint256) {
return value;
interface IA {
function getValue() external view returns(uint256);
contract FactoryA {
A[] private contractList;
function createContractA(uint256 _value) external {
A a = new A(_value);
function getContractListAddresses() external view returns (A[] memory) {
return contractList;
interface IFactoryA {
function createContractA(uint256 _value) external;
function getContractListAddresses() external view returns (A[] memory);
contract B {
event newContractACreated(uint256 _value);
IFactoryA factoryContract;
constructor(address _factoryContractAddress) public {
factoryContract = IFactoryA(_factoryContractAddress);
function createContractA(uint256 _value) public {
emit newContractACreated(_value);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.