mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
commit
f72bc33e30
|
@ -263,7 +263,13 @@ abstract contract AaveResolver is Events, Helpers {
|
||||||
|
|
||||||
TokenInterface tokenContract = TokenInterface(_token);
|
TokenInterface tokenContract = TokenInterface(_token);
|
||||||
|
|
||||||
_amt = _amt == uint256(-1) ? getPaybackBalance(_token, rateMode) : _amt;
|
if (_amt == uint256(-1)) {
|
||||||
|
uint256 _amtDSA = isEth
|
||||||
|
? address(this).balance
|
||||||
|
: tokenContract.balanceOf(address(this));
|
||||||
|
uint256 _amtDebt = getPaybackBalance(_token, rateMode);
|
||||||
|
_amt = _amtDSA > _amtDebt ? _amtDebt : _amtDSA;
|
||||||
|
}
|
||||||
|
|
||||||
if (isEth) convertEthToWeth(isEth, tokenContract, _amt);
|
if (isEth) convertEthToWeth(isEth, tokenContract, _amt);
|
||||||
|
|
||||||
|
@ -351,9 +357,17 @@ abstract contract AaveResolver is Events, Helpers {
|
||||||
|
|
||||||
TokenInterface tokenContract = TokenInterface(_token);
|
TokenInterface tokenContract = TokenInterface(_token);
|
||||||
|
|
||||||
_amt = _amt == uint256(-1)
|
if (_amt == uint256(-1)) {
|
||||||
? getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf)
|
uint256 _amtDSA = isEth
|
||||||
: _amt;
|
? address(this).balance
|
||||||
|
: tokenContract.balanceOf(address(this));
|
||||||
|
uint256 _amtDebt = getOnBehalfOfPaybackBalance(
|
||||||
|
_token,
|
||||||
|
rateMode,
|
||||||
|
onBehalfOf
|
||||||
|
);
|
||||||
|
_amt = _amtDSA > _amtDebt ? _amtDebt : _amtDSA;
|
||||||
|
}
|
||||||
|
|
||||||
if (isEth) convertEthToWeth(isEth, tokenContract, _amt);
|
if (isEth) convertEthToWeth(isEth, tokenContract, _amt);
|
||||||
|
|
||||||
|
@ -517,5 +531,5 @@ abstract contract AaveResolver is Events, Helpers {
|
||||||
}
|
}
|
||||||
|
|
||||||
contract ConnectV2AaveV3 is AaveResolver {
|
contract ConnectV2AaveV3 is AaveResolver {
|
||||||
string public constant name = "AaveV3-v1.1";
|
string public constant name = "AaveV3-v1.2";
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,7 +262,14 @@ abstract contract SparkConnector is Events, Helpers {
|
||||||
address _token = isEth ? wethAddr : token;
|
address _token = isEth ? wethAddr : token;
|
||||||
|
|
||||||
TokenInterface tokenContract = TokenInterface(_token);
|
TokenInterface tokenContract = TokenInterface(_token);
|
||||||
_amt = _amt == uint256(-1) ? getPaybackBalance(_token, rateMode) : _amt;
|
|
||||||
|
if (_amt == uint256(-1)) {
|
||||||
|
uint256 _amtDSA = isEth
|
||||||
|
? address(this).balance
|
||||||
|
: tokenContract.balanceOf(address(this));
|
||||||
|
uint256 _amtDebt = getPaybackBalance(_token, rateMode);
|
||||||
|
_amt = _amtDSA > _amtDebt ? _amtDebt : _amtDSA;
|
||||||
|
}
|
||||||
|
|
||||||
if (isEth) convertEthToWeth(isEth, tokenContract, _amt);
|
if (isEth) convertEthToWeth(isEth, tokenContract, _amt);
|
||||||
|
|
||||||
|
@ -350,9 +357,17 @@ abstract contract SparkConnector is Events, Helpers {
|
||||||
|
|
||||||
TokenInterface tokenContract = TokenInterface(_token);
|
TokenInterface tokenContract = TokenInterface(_token);
|
||||||
|
|
||||||
_amt = _amt == uint256(-1)
|
if (_amt == uint256(-1)) {
|
||||||
? getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf)
|
uint256 _amtDSA = isEth
|
||||||
: _amt;
|
? address(this).balance
|
||||||
|
: tokenContract.balanceOf(address(this));
|
||||||
|
uint256 _amtDebt = getOnBehalfOfPaybackBalance(
|
||||||
|
_token,
|
||||||
|
rateMode,
|
||||||
|
onBehalfOf
|
||||||
|
);
|
||||||
|
_amt = _amtDSA > _amtDebt ? _amtDebt : _amtDSA;
|
||||||
|
}
|
||||||
|
|
||||||
if (isEth) convertEthToWeth(isEth, tokenContract, _amt);
|
if (isEth) convertEthToWeth(isEth, tokenContract, _amt);
|
||||||
|
|
||||||
|
@ -511,5 +526,5 @@ abstract contract SparkConnector is Events, Helpers {
|
||||||
}
|
}
|
||||||
|
|
||||||
contract ConnectV2Spark is SparkConnector {
|
contract ConnectV2Spark is SparkConnector {
|
||||||
string public constant name = "Spark-v1.0";
|
string public constant name = "Spark-v1.1";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user