Adjust TBTCSystem initializer to make external calls at the end
This is ultimately a reentrancy guard; though the external calls are to
trusted contracts, following the best practice is still worth it.
@@ -133,6 +133,10 @@ contract TBTCSystem is Ownable, ITBTCSystem, DepositLog {
keepFactorySelection.initialize(_defaultKeepFactory);
keepThreshold = _keepThreshold;
keepSize = _keepSize;
+ initializedTimestamp = block.timestamp;
+ allowNewDeposits = true;
+
+ setTbtcDepositToken(_tbtcDepositToken);
_vendingMachine.setExternalAddresses(
_tbtcToken,
@@ -147,9 +151,6 @@ contract TBTCSystem is Ownable, ITBTCSystem, DepositLog {
_feeRebateToken,
address(_vendingMachine)
);
- setTbtcDepositToken(_tbtcDepositToken);
- initializedTimestamp = block.timestamp;
- allowNewDeposits = true;
}
/// @notice Returns whether new deposits should be allowed.
