mirror of
https://github.com/Instadapp/smart-contract.git
synced 2024-07-29 22:08:07 +00:00
save error solved
This commit is contained in:
parent
b796e5bd78
commit
016ecd3020
|
@ -282,7 +282,8 @@ contract MakerHelpers is Helpers {
|
||||||
(bytes32 val, bool ok) = tub.pep().peek();
|
(bytes32 val, bool ok) = tub.pep().peek();
|
||||||
|
|
||||||
// tub.rap(cup) = stability fee in $, tub.tab(cup) = total DAI debt
|
// tub.rap(cup) = stability fee in $, tub.tab(cup) = total DAI debt
|
||||||
uint mkrFee = wdiv(rmul(_wad, rdiv(tub.rap(cup), add(tub.rap(cup), tub.tab(cup)))), uint(val));
|
uint mkrFee = wdiv(rmul(_wad, rdiv(tub.rap(cup), tub.tab(cup))), uint(val));
|
||||||
|
// uint mkrFee = wdiv(rmul(_wad, rdiv(tub.rap(cup), add(tub.rap(cup), tub.tab(cup)))), uint(val));
|
||||||
|
|
||||||
uint daiFeeAmt = daiEx.getTokenToEthOutputPrice(mkrEx.getEthToTokenOutputPrice(mkrFee));
|
uint daiFeeAmt = daiEx.getTokenToEthOutputPrice(mkrEx.getEthToTokenOutputPrice(mkrFee));
|
||||||
uint daiAmt = sub(_wad, daiFeeAmt);
|
uint daiAmt = sub(_wad, daiFeeAmt);
|
||||||
|
@ -315,7 +316,7 @@ contract MakerHelpers is Helpers {
|
||||||
|
|
||||||
contract GetDetails is MakerHelpers {
|
contract GetDetails is MakerHelpers {
|
||||||
|
|
||||||
function getMax(uint cdpID) public view returns (uint maxColToFree, uint maxDaiToDraw) {
|
function getMax(uint cdpID) public view returns (uint maxColToFree, uint maxDaiToDraw, uint ethInUSD) {
|
||||||
bytes32 cup = bytes32(cdpID);
|
bytes32 cup = bytes32(cdpID);
|
||||||
(uint ethCol, uint daiDebt, uint usdPerEth) = getCDPStats(cup);
|
(uint ethCol, uint daiDebt, uint usdPerEth) = getCDPStats(cup);
|
||||||
uint colToUSD = wmul(ethCol, usdPerEth) - 10;
|
uint colToUSD = wmul(ethCol, usdPerEth) - 10;
|
||||||
|
@ -323,6 +324,7 @@ contract GetDetails is MakerHelpers {
|
||||||
maxColToFree = wdiv(sub(colToUSD, minColNeeded), usdPerEth);
|
maxColToFree = wdiv(sub(colToUSD, minColNeeded), usdPerEth);
|
||||||
uint maxDebtLimit = wdiv(colToUSD, 1500000000000000000) - 10;
|
uint maxDebtLimit = wdiv(colToUSD, 1500000000000000000) - 10;
|
||||||
maxDaiToDraw = sub(maxDebtLimit, daiDebt);
|
maxDaiToDraw = sub(maxDebtLimit, daiDebt);
|
||||||
|
ethInUSD = usdPerEth;
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
|
@ -465,7 +467,7 @@ contract Save is GetDetails {
|
||||||
getAddressAdmin().transfer(sub(colToFree, ethToSwap));
|
getAddressAdmin().transfer(sub(colToFree, ethToSwap));
|
||||||
uint destAmt = KyberInterface(getAddressKyber()).trade.value(ethToSwap)(
|
uint destAmt = KyberInterface(getAddressKyber()).trade.value(ethToSwap)(
|
||||||
getAddressETH(),
|
getAddressETH(),
|
||||||
colToFree,
|
ethToSwap,
|
||||||
getAddressDAI(),
|
getAddressDAI(),
|
||||||
address(this),
|
address(this),
|
||||||
daiDebt,
|
daiDebt,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user