Support for multiple proxy contracts

I am working on a large contract and the architecture that we have considered is to have multiple contracts to be called from a parent contract. To do this we are considering to use proxy pattern (upgradable contract for new versions of sub contract).

contract SubA {
    uint256 vara;
}
contract SubB {
    uint256 varb;
}
contract SubA_V1 is SubA {
    function getVar(){ return vara; }
}
contract SubB_V1 is SubB {
    function calculateVar(){ return varb * 10; }
}
contract ParentContract {
    function getVars(){
        SubA.getvar(); 
       SubB.calculateVar(); 
    }
}

Lots of other large ethereum projects (using proxy) seems to use single contract as proxy. is it possible to have multiple proxy contracts to use from single parent contract. And another important question is it preferable for large projects ?

You may want to take a look at BeaconProxy and UpgradeableBeacon contracts. They work together allowing multiple proxies forwarding calls to the same single implementation contract via a beacon. This sounds like what you are looking for.

Hey @sagarduwal, EIP-2535 Diamonds seems to be exactly what you are looking for. It is a smart contract standard for building modular smart contract systems that can be extended in production.

A diamond is a proxy contract with multiple facets (or implementation contracts). Check out this introduction: Introduction to the Diamond Standard, EIP-2535 Diamonds

2 Likes