Added debt ceiling in maker resolver

This commit is contained in:
Thrilok Kumar 2020-07-24 22:11:57 +05:30
parent a4c7e94fcd
commit 68e3f380f4

View File

@ -110,6 +110,8 @@ contract Helpers is DSMath {
uint borrowRate; uint borrowRate;
uint price; uint price;
uint liquidationRatio; uint liquidationRatio;
uint debtCelling;
uint totalDebt;
} }
/** /**
@ -162,6 +164,13 @@ contract Helpers is DSMath {
address spot = InstaMcdAddress(getMcdAddresses()).spot(); address spot = InstaMcdAddress(getMcdAddresses()).spot();
(, ratio) = SpotLike(spot).ilks(ilk); (, ratio) = SpotLike(spot).ilks(ilk);
} }
function getDebtCeiling(bytes32 ilk) internal view returns (uint debtCeiling, uint totalDebt) {
address vat = InstaMcdAddress(getMcdAddresses()).vat();
(uint totalArt,uint rate,,uint debtCeilingRad,) = VatLike(vat).ilks(ilk);
debtCeiling = debtCeilingRad / 10 ** 45;
totalDebt = rmul(totalArt, rate);
}
} }
@ -236,10 +245,13 @@ contract VaultResolver is Helpers {
for (uint i = 0; i < name.length; i++) { for (uint i = 0; i < name.length; i++) {
bytes32 ilk = stringToBytes32(name[i]); bytes32 ilk = stringToBytes32(name[i]);
(uint debtCeiling, uint totalDebt) = getDebtCeiling(ilk);
colInfo[i] = ColInfo( colInfo[i] = ColInfo(
getFee(ilk), getFee(ilk),
getColPrice(ilk), getColPrice(ilk),
getColRatio(ilk) getColRatio(ilk),
debtCeiling,
totalDebt
); );
} }
return colInfo; return colInfo;
@ -265,5 +277,5 @@ contract DSRResolver is VaultResolver {
contract InstaMakerResolver is DSRResolver { contract InstaMakerResolver is DSRResolver {
string public constant name = "Maker-Resolver-v1"; string public constant name = "Maker-Resolver-v1.1";
} }