Mint the TDT before calling createNewDeposit
The TDT value is used to enfore the caller is a Deposit contract.
@@ -72,6 +72,8 @@ contract DepositFactory is CloneFactory, TBTCSystemAuthority{
function createDeposit (uint256 _lotSizeSatoshis) public payable returns(address) {
address cloneAddress = createClone(masterDepositAddress);
+ TBTCDepositToken(tbtcDepositToken).mint(msg.sender, uint256(cloneAddress));
+
Deposit deposit = Deposit(address(uint160(cloneAddress)));
deposit.initialize(address(this));
deposit.createNewDeposit.value(msg.value)(
@@ -85,8 +87,6 @@ contract DepositFactory is CloneFactory, TBTCSystemAuthority{
_lotSizeSatoshis
);
- TBTCDepositToken(tbtcDepositToken).mint(msg.sender, uint256(cloneAddress));
-
emit DepositCloneCreated(cloneAddress);
return cloneAddress;
