mirror of
https://github.com/Instadapp/dsa-resolvers-deprecated.git
synced 2024-07-29 22:38:16 +00:00
Add the debt floor to collateral info
This commit is contained in:
parent
1228afdf97
commit
7bbf613c5f
|
@ -94,7 +94,8 @@ contract Helpers is DSMath {
|
||||||
uint borrowRate;
|
uint borrowRate;
|
||||||
uint price;
|
uint price;
|
||||||
uint liquidationRatio;
|
uint liquidationRatio;
|
||||||
uint debtCelling;
|
uint debtCeiling;
|
||||||
|
uint debtFloor;
|
||||||
uint totalDebt;
|
uint totalDebt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,10 +171,11 @@ contract Helpers is DSMath {
|
||||||
(, ratio,) = OracleRelayerLike(oracleRelayer).collateralTypes(collateralType);
|
(, ratio,) = OracleRelayerLike(oracleRelayer).collateralTypes(collateralType);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDebtCeiling(bytes32 collateralType) internal view returns (uint debtCeiling, uint totalDebt) {
|
function getDebtState(bytes32 collateralType) internal view returns (uint debtCeiling, uint debtFloor, uint totalDebt) {
|
||||||
address safeEngine = getReflexerAddresses().safeEngine;
|
address safeEngine = getReflexerAddresses().safeEngine;
|
||||||
(uint globalDebt,uint rate,,uint debtCeilingRad,) = SAFEEngineLike(safeEngine).collateralTypes(collateralType);
|
(uint globalDebt,uint rate,,uint debtCeilingRad, uint debtFloorRad) = SAFEEngineLike(safeEngine).collateralTypes(collateralType);
|
||||||
debtCeiling = debtCeilingRad / 10 ** 45;
|
debtCeiling = debtCeilingRad / 10 ** 45;
|
||||||
|
debtFloor = debtFloorRad / 10 ** 45;
|
||||||
totalDebt = rmul(globalDebt, rate);
|
totalDebt = rmul(globalDebt, rate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,12 +243,13 @@ contract SafeResolver is Helpers {
|
||||||
|
|
||||||
for (uint i = 0; i < name.length; i++) {
|
for (uint i = 0; i < name.length; i++) {
|
||||||
bytes32 collateralType = stringToBytes32(name[i]);
|
bytes32 collateralType = stringToBytes32(name[i]);
|
||||||
(uint debtCeiling, uint totalDebt) = getDebtCeiling(collateralType);
|
(uint debtCeiling, uint debtFloor, uint totalDebt) = getDebtState(collateralType);
|
||||||
colInfo[i] = ColInfo(
|
colInfo[i] = ColInfo(
|
||||||
getFee(collateralType),
|
getFee(collateralType),
|
||||||
getColPrice(collateralType),
|
getColPrice(collateralType),
|
||||||
getColRatio(collateralType),
|
getColRatio(collateralType),
|
||||||
debtCeiling,
|
debtCeiling,
|
||||||
|
debtFloor,
|
||||||
totalDebt
|
totalDebt
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user