mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
minor fixes
This commit is contained in:
parent
27454a75d8
commit
a4bf92bdbb
|
@ -157,10 +157,9 @@ abstract contract CompoundV3Resolver is Events, Helpers {
|
||||||
market != address(0) && token != address(0) && to != address(0),
|
market != address(0) && token != address(0) && to != address(0),
|
||||||
"invalid market/token/to address"
|
"invalid market/token/to address"
|
||||||
);
|
);
|
||||||
|
require(from != address(this), "from-cannot-be-address(this)-use-paybackOnBehalf");
|
||||||
|
|
||||||
bool isEth = token == ethAddr;
|
address token_ = token == ethAddr ? wethAddr : token;
|
||||||
address token_ = isEth ? wethAddr : token;
|
|
||||||
TokenInterface tokenContract = TokenInterface(token_);
|
|
||||||
|
|
||||||
if (token_ == getBaseToken(market)) {
|
if (token_ == getBaseToken(market)) {
|
||||||
require(
|
require(
|
||||||
|
@ -707,12 +706,10 @@ abstract contract CompoundV3Resolver is Events, Helpers {
|
||||||
market != address(0) && token != address(0) && to != address(0),
|
market != address(0) && token != address(0) && to != address(0),
|
||||||
"invalid market/token/to address"
|
"invalid market/token/to address"
|
||||||
);
|
);
|
||||||
|
require(from != address(this), "from-cannot-be-address(this)-use-paybackOnBehalf");
|
||||||
|
|
||||||
address token_ = getBaseToken(market);
|
address token_ = getBaseToken(market);
|
||||||
bool isEth = token == ethAddr;
|
require(token == token_ || token == ethAddr, "invalid-token");
|
||||||
require(token == token_ || isEth, "invalid-token");
|
|
||||||
|
|
||||||
TokenInterface tokenContract = TokenInterface(token_);
|
|
||||||
|
|
||||||
if (amt_ == uint256(-1)) {
|
if (amt_ == uint256(-1)) {
|
||||||
amt_ = _calculateFromAmount(
|
amt_ = _calculateFromAmount(
|
||||||
|
@ -724,17 +721,7 @@ abstract contract CompoundV3Resolver is Events, Helpers {
|
||||||
Action.REPAY
|
Action.REPAY
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
require(
|
uint256 borrowedBalance_ = CometInterface(market).borrowBalanceOf(to);
|
||||||
amt_ <= borrowedBalance_,
|
|
||||||
"withdraw-amt-greater-than-supplies"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint256 borrowedBalance_ = CometInterface(market).borrowBalanceOf(to);
|
|
||||||
|
|
||||||
if (amt_ == uint256(-1)) {
|
|
||||||
amt_ = borrowedBalance_;
|
|
||||||
} else {
|
|
||||||
require(
|
require(
|
||||||
amt_ <= borrowedBalance_,
|
amt_ <= borrowedBalance_,
|
||||||
"payback-amt-greater-than-borrows"
|
"payback-amt-greater-than-borrows"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user