aave v3: fixed swapBorrowRate bug

This commit is contained in:
pradyuman-verma 2022-06-18 19:12:19 +05:30
parent 3b6d0be4c4
commit 51f4b1b9f4
No known key found for this signature in database
GPG Key ID: E36FD6BC8923221F
5 changed files with 10 additions and 19 deletions

View File

@ -433,7 +433,7 @@ abstract contract AaveResolver is Events, Helpers {
* @dev Swap borrow rate mode
* @notice Swaps user borrow rate mode between variable and stable
* @param token The address of the token to swap borrow rate.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param rateMode Desired borrow rate mode. (Stable = 1, Variable = 2)
* @param rateMode current rate mode. (Stable = 1, Variable = 2)
*/
function swapBorrowRateMode(address token, uint256 rateMode)
external
@ -442,12 +442,10 @@ abstract contract AaveResolver is Events, Helpers {
{
AaveInterface aave = AaveInterface(aaveProvider.getPool());
uint256 currentRateMode = rateMode == 1 ? 2 : 1;
bool isEth = token == ethAddr;
address _token = isEth ? wethAddr : token;
if (getPaybackBalance(_token, currentRateMode) > 0) {
if (getPaybackBalance(_token, rateMode) > 0) {
aave.swapBorrowRateMode(_token, rateMode);
}

View File

@ -434,7 +434,7 @@ abstract contract AaveResolver is Events, Helpers {
* @dev Swap borrow rate mode
* @notice Swaps user borrow rate mode between variable and stable
* @param token The address of the token to swap borrow rate.(For avax: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param rateMode Desired borrow rate mode. (Stable = 1, Variable = 2)
* @param rateMode Current rate mode (Stable = 1, Variable = 2)
*/
function swapBorrowRateMode(address token, uint256 rateMode)
external
@ -443,12 +443,10 @@ abstract contract AaveResolver is Events, Helpers {
{
AaveInterface aave = AaveInterface(aaveProvider.getPool());
uint256 currentRateMode = rateMode == 1 ? 2 : 1;
bool isAVAX = token == avaxAddr;
address _token = isAVAX ? wavaxAddr : token;
if (getPaybackBalance(_token, currentRateMode) > 0) {
if (getPaybackBalance(_token, rateMode) > 0) {
aave.swapBorrowRateMode(_token, rateMode);
}

View File

@ -432,7 +432,7 @@ abstract contract AaveResolver is Events, Helpers {
* @dev Swap borrow rate mode
* @notice Swaps user borrow rate mode between variable and stable
* @param token The address of the token to swap borrow rate.(For ftm: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param rateMode Desired borrow rate mode. (Stable = 1, Variable = 2)
* @param rateMode Current rate mode. (Stable = 1, Variable = 2)
*/
function swapBorrowRateMode(address token, uint256 rateMode)
external
@ -441,11 +441,10 @@ abstract contract AaveResolver is Events, Helpers {
{
AaveInterface aave = AaveInterface(aaveProvider.getPool());
uint256 currentRateMode = rateMode == 1 ? 2 : 1;
bool isFTM = token == ftmAddr;
address _token = isFTM ? wftmAddr : token;
if (getPaybackBalance(_token, currentRateMode) > 0) {
if (getPaybackBalance(_token, rateMode) > 0) {
aave.swapBorrowRateMode(_token, rateMode);
}

View File

@ -434,7 +434,7 @@ abstract contract AaveResolver is Events, Helpers {
* @dev Swap borrow rate mode
* @notice Swaps user borrow rate mode between variable and stable
* @param token The address of the token to swap borrow rate.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param rateMode Desired borrow rate mode. (Stable = 1, Variable = 2)
* @param rateMode Current borrow rate (Stable = 1, Variable = 2)
*/
function swapBorrowRateMode(address token, uint256 rateMode)
external
@ -443,12 +443,10 @@ abstract contract AaveResolver is Events, Helpers {
{
AaveInterface aave = AaveInterface(aaveProvider.getPool());
uint256 currentRateMode = rateMode == 1 ? 2 : 1;
bool isEth = token == ethAddr;
address _token = isEth ? wethAddr : token;
if (getPaybackBalance(_token, currentRateMode) > 0) {
if (getPaybackBalance(_token, rateMode) > 0) {
aave.swapBorrowRateMode(_token, rateMode);
}

View File

@ -434,7 +434,7 @@ abstract contract AaveResolver is Events, Helpers {
* @dev Swap borrow rate mode
* @notice Swaps user borrow rate mode between variable and stable
* @param token The address of the token to swap borrow rate.(For matic: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param rateMode Desired borrow rate mode. (Stable = 1, Variable = 2)
* @param rateMode Current borrow rate s(Stable = 1, Variable = 2)
*/
function swapBorrowRateMode(address token, uint256 rateMode)
external
@ -443,12 +443,10 @@ abstract contract AaveResolver is Events, Helpers {
{
AaveInterface aave = AaveInterface(aaveProvider.getPool());
uint256 currentRateMode = rateMode == 1 ? 2 : 1;
bool isMatic = token == maticAddr;
address _token = isMatic ? wmaticAddr : token;
if (getPaybackBalance(_token, currentRateMode) > 0) {
if (getPaybackBalance(_token, rateMode) > 0) {
aave.swapBorrowRateMode(_token, rateMode);
}