mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
aave v3: fixed swapBorrowRate bug
This commit is contained in:
parent
3b6d0be4c4
commit
51f4b1b9f4
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user