Problem with current proxy
Course: Upgradable contracts - chapter 12
Ref - https://blog.openzeppelin.com/the-transparent-proxy-pattern
Problem with the current proxy implementation
Section titled “Problem with the current proxy implementation”You have to specify all functions upfront when the Proxy contract is being deployed.
contract StorageProxy is Ownable { uint public num; address implementation;
constructor(address _implementation) Ownable(msg.sender) { num = 0; implementation = _implementation; }
function setNum(uint _num) public { (bool success, ) = implementation.delegatecall( abi.encodeWithSignature("setNum(uint256)", _num) ); require(success, "Error while delegating call"); }
function setImplementation(address _implementation) public onlyOwner { implementation = _implementation; }
}Once this contract is deployed, there is no way for me to add a new getNum function in there.