A DFO can have multiple external Smart Contracts that execute complex routines. In order to allow the modification of the configuration parameters of these SmartContracts, it is necessary that, during the deployment phase, the latter know the DoubleProxy of the DFO to which they refer:
contract DFODependantContract {//The DFO DoubleProxy address public doubleProxy; uint256 public mySpecificParameter;//Every configuration parameter must have a initial value in constructor and a setter callable by the DFO onlyconstructor(address _doubleProxy, uint256 _mySpecificParameterInitialValue) { doubleProxy = _doubleProxy; mySpecificParameter = _mySpecificParameterInitialValue; }//All the functions having this modifier can be called only by the DFO microservices and one-time proposals modifier byDFO() { require(IMVDFunctionalitiesManager(IMVDProxy(IDoubleProxy(_doubleProxy).proxy()).getMVDFunctionalitiesManagerAddress()).isAuthorizedFunctionality(msg.sender), "Unauthorized.");
_; }//E.g. mySpecificParameter can be changed only by proposalfunctionsetMySpecificParameter(uint256 _mySpecificParameter) publicbyDFO { mySpecificParameter = _mySpecificParameter; }//For security purposes, it is ALWAYS important to let a DFO vote to change the DoubleProxyfunctionsetDoubleProxy(address newDoubleProxy) publicbyDFO { doubleProxy = newDoubleProxy; }interfaceIDoubleProxy {functionproxy() externalviewreturns (address); }interfaceIMVDProxy {functiongetMVDFunctionalitiesManagerAddress() externalviewreturns(address);functiongetMVDWalletAddress() externalviewreturns (address);functiongetStateHolderAddress() externalviewreturns(address); function submit(string calldata codeName, bytes calldata data) external payable returns(bytes memory returnData);
}interfaceIMVDFunctionalitiesManager { function getFunctionalityData(string calldata codeName) external view returns(address, uint256, string memory, address, uint256);
functionisAuthorizedFunctionality(address functionality) externalviewreturns(bool); }interfaceIStateHolder {functiongetUint256(string calldata name) externalviewreturns(uint256);functiongetAddress(string calldata name) externalviewreturns(address);functionclear(string calldata varName) externalreturns(string memory oldDataType, bytes memory oldVal); }}