Skip to content

Commit f7fe16b

Browse files
authored
Brian/module hook javadoc (#167)
Edited unupdated javadoc anf javadoc in _calculateAdjustedComponentIssuanceUnits.
1 parent 50caa3c commit f7fe16b

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

contracts/interfaces/IModuleIssuanceHookV2.sol

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,9 @@ interface IModuleIssuanceHookV2 {
6464

6565
/**
6666
* Adjustments should return the NET CHANGE in POSITION UNITS for each component in the SetToken's
67-
* components array. Each entry in the returned arrays should index to the same component in the
68-
* SetToken's components array (called using getComponents()). Directional adjustments should be made
69-
* according to the following table (i.e. returning a negative debt number means debt is reduced during
70-
* issue/redeem):
71-
* | ------------------------------------|
72-
* | Type | Positive | Negative |
73-
* | ----- |---------- | --------------|
74-
* | Equity | Add Equity| Equity Reduced|
75-
* | Debt | Add Debt | Debt Reduced |
76-
* | ------------------------------------|
67+
* components array (i.e. if debt is greater than current debt position unit return negative number).
68+
* Each entry in the returned arrays should index to the same component in the SetToken's components
69+
* array (called using getComponents()).
7770
*/
7871
function getRedemptionAdjustments(
7972
ISetToken _setToken,

contracts/protocol/modules/SlippageIssuanceModule.sol

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ contract SlippageIssuanceModule is DebtIssuanceModule {
305305
uint256[] memory totalDebtUnits = new uint256[](components.length);
306306
for (uint256 i = 0; i < components.length; i++) {
307307
// NOTE: If equityAdjustment is negative and exceeds equityUnits in absolute value this will revert
308+
// When adjusting units if we have MORE equity as a result of issuance (ie adjustment is positive) we want to add that
309+
// to the unadjusted equity units hence we use addition. Vice versa if we want to remove equity, the adjustment is negative
310+
// hence adding adjusts the units lower
308311
uint256 adjustedEquityUnits = equityUnits[i].toInt256().add(_equityAdjustments[i]).toUint256();
309312

310313
// Use preciseMulCeil to round up to ensure overcollateration when small issue quantities are provided
@@ -314,6 +317,9 @@ contract SlippageIssuanceModule is DebtIssuanceModule {
314317
adjustedEquityUnits.preciseMul(_quantity);
315318

316319
// NOTE: If debtAdjustment is negative and exceeds debtUnits in absolute value this will revert
320+
// When adjusting units if we have MORE debt as a result of issuance (ie adjustment is negative) we want to increase
321+
// the unadjusted debt units hence we subtract. Vice versa if we want to remove debt the adjustment is positive
322+
// hence subtracting adjusts the units lower.
317323
uint256 adjustedDebtUnits = debtUnits[i].toInt256().sub(_debtAdjustments[i]).toUint256();
318324

319325
// Use preciseMulCeil to round up to ensure overcollateration when small redeem quantities are provided

0 commit comments

Comments
 (0)