mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
minor fix
This commit is contained in:
parent
d4f6b0c332
commit
d8c17a81b5
|
@ -223,17 +223,21 @@ abstract contract CompoundV3Resolver is Events, Helpers {
|
|||
token_
|
||||
);
|
||||
|
||||
amt_ = amt_ == uint256(-1) ? initialBal : amt_;
|
||||
if (token_ == getBaseToken(market)) {
|
||||
//if there are supplies, ensure withdrawn amount is not greater than supplied i.e can't borrow using withdraw.
|
||||
|
||||
require(amt_ <= initialBal, "withdraw-amt-greater-than-supplies");
|
||||
if (amt_ == uint256(-1)) {
|
||||
amt_ = initialBal;
|
||||
} else {
|
||||
//if there are supplies, ensure withdrawn amount is not greater than supplied i.e can't borrow using withdraw.
|
||||
require(amt_ <= initialBal, "withdraw-amt-greater-than-supplies");
|
||||
}
|
||||
|
||||
//if borrow balance > 0, there are no supplies so no withdraw, borrow instead.
|
||||
require(
|
||||
CometInterface(market).borrowBalanceOf(address(this)) == 0,
|
||||
"withdraw-disabled-for-zero-supplies"
|
||||
);
|
||||
} else {
|
||||
amt_ = amt_ == uint256(-1) ? initialBal : amt_;
|
||||
}
|
||||
|
||||
CometInterface(market).withdraw(token_, amt_);
|
||||
|
|
Loading…
Reference in New Issue
Block a user