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

View File

@ -717,6 +717,7 @@ abstract contract CompoundV3Resolver is Events, Helpers {
TokenInterface tokenContract = TokenInterface(token_);
if (amt_ == uint256(-1)) {
amt_ = _calculateFromAmount(
market,
token_,
@ -725,6 +726,12 @@ abstract contract CompoundV3Resolver is Events, Helpers {
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");