mirror of
https://github.com/Instadapp/smart-contract.git
synced 2024-07-29 22:08:07 +00:00
maxETH fixed
This commit is contained in:
parent
460d8bd74d
commit
af1e0760fa
|
@ -325,6 +325,13 @@ contract GetDetails is MakerHelpers {
|
||||||
uint maxDebtLimit = wdiv(colToUSD, 1500000000000000000) - 10;
|
uint maxDebtLimit = wdiv(colToUSD, 1500000000000000000) - 10;
|
||||||
maxDaiToDraw = sub(maxDebtLimit, daiDebt);
|
maxDaiToDraw = sub(maxDebtLimit, daiDebt);
|
||||||
ethInUSD = usdPerEth;
|
ethInUSD = usdPerEth;
|
||||||
|
|
||||||
|
(uint expectedRate,) = KyberInterface(getAddressKyber()).getExpectedRate(getAddressETH(), getAddressDAI(), maxColToFree);
|
||||||
|
uint expectedDai = wmul(maxColToFree, expectedRate);
|
||||||
|
if (expectedDai > maxDaiToDraw) {
|
||||||
|
maxColToFree = wmul(maxColToFree, wdiv(maxDaiToDraw, expectedDai));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSave(uint cdpID, uint ethToSwap) public view returns (uint finalEthCol, uint finalDaiDebt, uint finalColToUSD, bool canSave) {
|
function getSave(uint cdpID, uint ethToSwap) public view returns (uint finalEthCol, uint finalDaiDebt, uint finalColToUSD, bool canSave) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user