This commit is contained in:
Thrilok kumar 2022-09-03 01:22:14 +05:30
parent 611ff8a3e7
commit 745f7c6a61

View File

@ -717,14 +717,21 @@ abstract contract CompoundV3Resolver is Events, Helpers {
TokenInterface tokenContract = TokenInterface(token_);
amt_ = _calculateFromAmount(
market,
token_,
from,
amt_,
isEth,
Action.REPAY
);
if (amt_ == uint256(-1)) {
amt_ = _calculateFromAmount(
market,
token_,
from,
amt_,
isEth,
Action.REPAY
);
} else {
require(
amt_ <= borrowedBalance_,
"withdraw-amt-greater-than-supplies"
);
}
uint256 supplyBalance_ = CometInterface(market).balanceOf(to);
require(supplyBalance_ == 0, "cannot-repay-when-supplied");