fixed native token bug aave v2

This commit is contained in:
pradyuman-verma 2022-06-18 19:04:48 +05:30
parent 4daba04266
commit 231b8fe34a
No known key found for this signature in database
GPG Key ID: E36FD6BC8923221F
3 changed files with 15 additions and 10 deletions

View File

@ -266,9 +266,11 @@ abstract contract AaveResolver is Events, Helpers {
AaveInterface aave = AaveInterface(aaveProvider.getLendingPool());
for (uint256 i = 0; i < _length; i++) {
address token = tokens[i];
if (getCollateralBalance(token) > 0 && !getIsColl(token)) {
aave.setUserUseReserveAsCollateral(token, true);
bool isAvax = tokens[i] == avaxAddr;
address _token = isAvax ? wavaxAddr : tokens[i];
if (getCollateralBalance(_token) > 0 && !getIsColl(_token)) {
aave.setUserUseReserveAsCollateral(_token, true);
}
}
@ -276,7 +278,6 @@ abstract contract AaveResolver is Events, Helpers {
_eventParam = abi.encode(tokens);
}
/**
* @dev Swap borrow rate mode
* @notice Swaps user borrow rate mode between variable and stable

View File

@ -231,9 +231,11 @@ abstract contract AaveResolver is Events, Helpers {
AaveInterface aave = AaveInterface(aaveProvider.getLendingPool());
for (uint i = 0; i < _length; i++) {
address token = tokens[i];
if (getCollateralBalance(token) > 0 && !getIsColl(token)) {
aave.setUserUseReserveAsCollateral(token, true);
bool isEth = tokens[i] == ethAddr;
address _token = isEth ? wethAddr : tokens[i];
if (getCollateralBalance(_token) > 0 && !getIsColl(_token)) {
aave.setUserUseReserveAsCollateral(_token, true);
}
}

View File

@ -266,9 +266,11 @@ abstract contract AaveResolver is Events, Helpers {
AaveInterface aave = AaveInterface(aaveProvider.getLendingPool());
for (uint256 i = 0; i < _length; i++) {
address token = tokens[i];
if (getCollateralBalance(token) > 0 && !getIsColl(token)) {
aave.setUserUseReserveAsCollateral(token, true);
bool isMatic = tokens[i] == maticAddr;
address _token = isMatic ? wmaticAddr : tokens[i];
if (getCollateralBalance(_token) > 0 && !getIsColl(_token)) {
aave.setUserUseReserveAsCollateral(_token, true);
}
}