Close keep at the end of redemption flow
We should signal the keep is no longer needed and the signing group can
disband.
@@ -40,6 +40,14 @@ library DepositRedemption {
_keep.distributeERC20ToMembers(_tbtcTokenAddress, _d.signerFee());
}
+ /// @notice Closes keep associated with the deposit.
+ /// @dev Should be called when the keep is no longer needed and the signing
+ /// group can disband.
+ function closeKeep(DepositUtils.Deposit storage _d) internal {
+ IBondedECDSAKeep _keep = IBondedECDSAKeep(_d.keepAddress);
+ _keep.closeKeep();
+ }
+
/// @notice Approves digest for signing by a keep.
/// @dev Calls given keep to sign the digest. Records a current timestamp
/// for given digest.
@@ -307,8 +315,9 @@ library DepositRedemption {
require((_d.utxoSize().sub(_fundingOutputValue)) <= _d.initialRedemptionFee.mul(5), "Fee unexpectedly very high");
- // Transfer TBTC to signers
+ // Transfer TBTC to signers and close the keep.
distributeSignerFee(_d);
+ closeKeep(_d);
_d.distributeFeeRebate();
