RedemptionManager
Write Methods
function redeemCollateral(
ITroveManager troveManager,
uint256 _debtAmount,
uint256 _firstRedemptionHint,
uint256 _upperPartialRedemptionHint,
uint256 _lowerPartialRedemptionHint,
uint256 _partialRedemptionHintNICR,
uint256 _maxIterations,
uint256 _maxFeePercentage
) external
Main redemption function: exchanges debt tokens for collateral while applying fees and managing Trove state updates.
Input Parameter
Type
Description
troveManager
ITroveManager
The TroveManager handling the redemption.
_debtAmount
uint256
The amount of debt tokens to redeem.
_firstRedemptionHint
uint256
Hint for the first Trove to redeem from (optimizes gas).
_upperPartialRedemptionHint
uint256
Upper hint for partial redemption (reinsertion).
_lowerPartialRedemptionHint
uint256
Lower hint for partial redemption (reinsertion).
_partialRedemptionHintNICR
uint256
Expected Nominal ICR after partial redemption.
_maxIterations
uint256
Max Troves to process (prevents OOG).
_maxFeePercentage
uint256
Maximum acceptable fee percentage (reverts if exceeded).
View Methods
function getRedemptionFeeWithDecay(
ITroveManager troveManager,
uint256 _collateralDrawn
) external view returns (uint256)
Returns the redemption fee for a given collateral amount, considering the decayed base rate.
Input Parameter
Type
Description
troveManager
ITroveManager
The TroveManager contract.
_collateralDrawn
uint256
The collateral amount being redeemed.
Returns:
Return Value
Type
Description
fee
uint256
The computed redemption fee.
function getRedemptionRateWithDecay(ITroveManager troveManager) public view returns (uint256)
Computes the current redemption rate with decayed base rate.
Input Parameter
Type
Description
troveManager
ITroveManager
The TroveManager contract.
Returns:
Return Value
Type
Description
rate
uint256
The decay-adjusted redemption rate.
function getRedemptionRate(ITroveManager troveManager) public view returns (uint256)
Computes the current redemption rate using the latest base rate (without decay).
Input Parameter
Type
Description
troveManager
ITroveManager
The TroveManager contract.
Returns:
Return Value
Type
Description
rate
uint256
The current redemption rate.
Structs
struct RedemptionTotals {
uint256 remainingDebt;
uint256 totalDebtToRedeem;
uint256 totalCollateralDrawn;
uint256 collateralFee;
uint256 collateralToSendToRedeemer;
uint256 decayedBaseRate;
uint256 price;
uint256 totalDebtSupplyAtStart;
}
struct SingleRedemptionValues {
uint256 debtLot;
uint256 collateralLot;
bool cancelledPartial;
}
Events
event Redemption(
uint256 _attemptedDebtAmount,
uint256 _actualDebtAmount,
uint256 _collateralSent,
uint256 _collateralFee
)
Last updated