Expose External contract setter for DepositFactory
@@ -16,47 +16,64 @@ contract DepositFactory is CloneFactory{
// Holds the address of the deposit contract
// which will be used as a master contract for cloning.
address public masterDepositAddress;
+ address public tbtcSystem;
+ address public tbtcToken;
+ address public tbtcDepositToken;
+ address public feeRebateToken;
+ address public vendingMachine;
+ uint256 public keepThreshold;
+ uint256 public keepSize;
- event DepositCloneCreated(address depositCloneAddress);
-
- /// @dev Set the master deposit contract address
- /// on contract initialization
+ /// @dev Set the required external variables
/// @param _masterDepositAddress The address of the master deposit contract
- constructor(address _masterDepositAddress) public {
+ /// @param _tbtcSystem Address of system contract
+ /// @param _tbtcToken Address of TBTC token contract
+ /// @param _depositOwnerToken Address of the Deposit Owner Token contract
+ /// @param _feeRebateToken Address of the Fee Rebate Token contract
+ /// @param _vendingMachine Address of the Vending Machine contract
+ /// @param _keepThreshold Minimum number of honest keep members
+ /// @param _keepSize Number of all members in a keep
+ function setExternalDependencies(
+ address _masterDepositAddress,
+ address _tbtcSystem,
+ address _tbtcToken,
+ address _depositOwnerToken,
+ address _feeRebateToken,
+ address _vendingMachine,
+ uint256 _keepThreshold,
+ uint256 _keepSize
+ ) public {
masterDepositAddress = _masterDepositAddress;
+ tbtcSystem = _tbtcSystem;
+ tbtcToken = _tbtcToken;
+ tbtcDepositToken = _depositOwnerToken;
+ feeRebateToken = _feeRebateToken;
+ vendingMachine = _vendingMachine;
+ keepThreshold = _keepThreshold;
+ keepSize = _keepSize;
}
+ event DepositCloneCreated(address depositCloneAddress);
+
/// @notice Creates a new deposit instance
/// @dev Calls createNewDeposit from deposit contract as init method.
/// We don't offer pure createClone, meaning that the only way
/// to create a clone is by also calling createNewDeposit()
/// Deposits created this way will never pass by state 0 (START)
- /// @param _TBTCSystem Address of system contract
- /// @param _TBTCToken Address of TBTC token contract
- /// @param _keepThreshold Minimum number of honest keep members
- /// @param _keepSize Number of all members in a keep
/// @return True if successful, otherwise revert
- function createDeposit (
- address _TBTCSystem,
- address _TBTCToken,
- address _TBTCDepositToken,
- address _FeeRebateToken,
- address _VendingMachine,
- uint256 _keepThreshold,
- uint256 _keepSize
- ) public payable returns(address) {
+ function createDeposit () public payable returns(address) {
address cloneAddress = createClone(masterDepositAddress);
Deposit(address(uint160(cloneAddress))).createNewDeposit.value(msg.value)(
- _TBTCSystem,
- _TBTCToken,
- _TBTCDepositToken,
- _FeeRebateToken,
- _VendingMachine,
- _keepThreshold,
- _keepSize);
+ tbtcSystem,
+ tbtcToken,
+ tbtcDepositToken,
+ feeRebateToken,
+ vendingMachine,
+ keepThreshold,
+ keepSize);
- TBTCDepositToken(_TBTCDepositToken).mint(msg.sender, uint256(cloneAddress));
+ TBTCDepositToken(tbtcDepositToken).mint(msg.sender, uint256(cloneAddress));
emit DepositCloneCreated(cloneAddress);
