Update proof function and TBTC minting
qualifyDeposit -> qualifyDepositTbtcWrapper
Function is now a unqualified deposit -> TBTC wrapper
dotToTbtc now mints full lot size
tbtcToDot now burns full lot size
Signer fees are provided during redemption.
@@ -21,8 +21,9 @@ contract VendingMachine {
depositOwnerToken = DepositOwnerToken(_depositOwnerToken);
}
- /// @notice Qualifies a deposit for minting TBTC.
- function qualifyDeposit(
+ /// @notice Qualifies a deposit and mints TBTC.
+ /// @dev User must allow VendingManchine to transfer DOT
+ function qualifyDepositTbtcWrapper(
address payable _depositAddress,
bytes4 _txVersion,
bytes memory _txInputVector,
@@ -47,7 +48,7 @@ contract VendingMachine {
),
"failed to provide funding proof");
// mint the signer fee to the Deposit
- tbtcToken.mint(_depositAddress, DepositUtils.signerFee());
+ dotToTbtc(uint256(_depositAddress));
}
/// @notice Determines whether a deposit is qualified for minting TBTC.
@@ -63,8 +64,8 @@ contract VendingMachine {
require(depositOwnerToken.exists(_dotId), "Deposit Owner Token does not exist");
require(isQualified(address(_dotId)), "Deposit must be qualified");
- require(tbtcToken.balanceOf(msg.sender) >= getDepositValueLessSignerFee(), "Not enough TBTC for DOT exchange");
- tbtcToken.burnFrom(msg.sender, getDepositValueLessSignerFee());
+ require(tbtcToken.balanceOf(msg.sender) >= getDepositValue(), "Not enough TBTC for DOT exchange");
+ tbtcToken.burnFrom(msg.sender, getDepositValue());
// TODO do we need the owner check below? transferFrom can be approved for a user, which might be an interesting use case.
require(depositOwnerToken.ownerOf(_dotId) == address(this), "Deposit is locked");
@@ -79,16 +80,15 @@ contract VendingMachine {
require(isQualified(address(_dotId)), "Deposit must be qualified");
depositOwnerToken.transferFrom(msg.sender, address(this), _dotId);
- tbtcToken.mint(msg.sender, getDepositValueLessSignerFee());
+ tbtcToken.mint(msg.sender, getDepositValue());
}
// TODO temporary helper function
/// @notice Gets the Deposit lot size less signer fees
/// @return amount in TBTC
- function getDepositValueLessSignerFee() internal returns (uint) {
+ function getDepositValue() internal returns (uint) {
uint256 _multiplier = TBTCConstants.getSatoshiMultiplier();
- uint256 _signerFee = DepositUtils.signerFee();
uint256 _totalValue = TBTCConstants.getLotSize().mul(_multiplier);
- return _totalValue.sub(_signerFee);
+ return _totalValue;
}
}
\ No newline at end of file
