Initialize implementations for proxy contracts and protect initialization methods
It should be avoided that the implementation for proxy contracts can be initialized by third parties. This can be the case if the `initialize` function is unprotected. Since the implementation contract is not meant to be used directly without a proxy delegate-calling it is recommended to protect the initialization method of the implementation by initializing on deployment.\\nChanging the proxies implementation (upgradeTo()) to a version that does not protect the initialization method may allow someone to front-run and initialize the contract if it is not done within the same transaction.\\n`KeepVendor` delegates to `KeepVendorImplV1`. The implementations initialization method is unprotected.\\n```\\n/// @notice Initializes Keep Vendor contract implementation.\\n/// @param registryAddress Keep registry contract linked to this contract.\\nfunction initialize(\\n    address registryAddress\\n)\\n    public\\n{\\n    require(!initialized(), "Contract is already initialized.");\\n    \\_initialized["BondedECDSAKeepVendorImplV1"] = true;\\n    registry = Registry(registryAddress);\\n}\\n```\\n\\n`KeepRandomBeaconServiceImplV1` and `KeepRandomBeaconServiceUpgradeExample`\\n```\\nfunction initialize(\\n    uint256 priceFeedEstimate,\\n    uint256 fluctuationMargin,\\n    uint256 dkgContributionMargin,\\n    uint256 withdrawalDelay,\\n    address registry\\n)\\n    public\\n{\\n    require(!initialized(), "Contract is already initialized.");\\n    \\_initialized["KeepRandomBeaconServiceImplV1"] = true;\\n    \\_priceFeedEstimate = priceFeedEstimate;\\n    \\_fluctuationMargin = fluctuationMargin;\\n    \\_dkgContributionMargin = dkgContributionMargin;\\n    \\_withdrawalDelay = withdrawalDelay;\\n    \\_pendingWithdrawal = 0;\\n    \\_previousEntry = \\_beaconSeed;\\n    \\_registry = registry;\\n    \\_baseCallbackGas = 18845;\\n}\\n```\\n\\n`Deposit` is deployed via `cloneFactory` delegating to a `masterDepositAddress` in `DepositFactory`. The `masterDepositAddress` (Deposit) might be left uninitialized.\\n```\\ncontract DepositFactoryAuthority {\\n\\n    bool internal \\_initialized = false;\\n    address internal \\_depositFactory;\\n\\n    /// @notice Set the address of the System contract on contract initialization\\n    function initialize(address \\_factory) public {\\n        require(! \\_initialized, "Factory can only be initialized once.");\\n\\n        \\_depositFactory = \\_factory;\\n        \\_initialized = true;\\n    }\\n```\\n
Initialize unprotected implementation contracts in the implementation's constructor. Protect initialization methods from being called by unauthorized parties or ensure that deployment of the proxy and initialization is performed in the same transaction.
```\\n/// @notice Initializes Keep Vendor contract implementation.\\n/// @param registryAddress Keep registry contract linked to this contract.\\nfunction initialize(\\n    address registryAddress\\n)\\n    public\\n{\\n    require(!initialized(), "Contract is already initialized.");\\n    \\_initialized["BondedECDSAKeepVendorImplV1"] = true;\\n    registry = Registry(registryAddress);\\n}\\n```\\n