Update tbtc redemption requirements
Correctly handle cases where signer fee is not escrowed
@@ -56,13 +56,12 @@ library DepositRedemption {
/// @param _redeemer The assumed owner of the deposit's TDT
/// @return The amount in TBTC needed to redeem the deposit.
function getOwnerRedemptionTbtcRequirement(DepositUtils.Deposit storage _d, address _redeemer) public view returns(uint256) {
+ uint256 signerFee = _d.signerFee();
if(_d.remainingTerm() > 0){
if(_d.feeRebateTokenHolder() != _redeemer) {
return _d.signerFee();
}
- return 0;
}
- uint256 signerFee = _d.signerFee();
if(TBTCToken(_d.TBTCToken).balanceOf(address(this)) < signerFee) {
return signerFee;
}
@@ -74,6 +73,15 @@ library DepositRedemption {
/// @param _redeemer The deposit redeemer.
/// @return The amount in TBTC needed to redeem the deposit.
function getRedemptionTbtcRequirement(DepositUtils.Deposit storage _d, address _redeemer) internal view returns(uint256) {
+ // if(_d.depositOwner() == _redeemer){
+ // return getOwnerRedemptionTbtcRequirement(_d, _redeemer);
+ // }
+ // require(_d.remainingTerm() == 0, "Redemption can only be called by deposit owner.");
+ // return TBTCConstants.getLotSizeTbtc();
+
+
+
+
if(_d.remainingTerm() > 0){
require(
_d.depositOwner() == _redeemer,
@@ -82,7 +90,6 @@ library DepositRedemption {
if(_d.feeRebateTokenHolder() != _redeemer) {
return _d.signerFee();
}
- return 0;
}
if(_d.depositOwner() == _redeemer){
uint256 signerFee = _d.signerFee();
