From cf61ac8b2257d0a2c048d310ec1d202ad8686012 Mon Sep 17 00:00:00 2001 From: Shriya Tyagi Date: Sun, 11 Feb 2024 14:33:32 +0400 Subject: [PATCH] feat: update mainnet connector --- contracts/mainnet/connectors/fluid/main.sol | 22 +++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/contracts/mainnet/connectors/fluid/main.sol b/contracts/mainnet/connectors/fluid/main.sol index 8b57dda..0cab810 100644 --- a/contracts/mainnet/connectors/fluid/main.sol +++ b/contracts/mainnet/connectors/fluid/main.sol @@ -92,6 +92,8 @@ abstract contract FluidConnector is Events, Stores { ethAmount_ = isColMax_ ? address(this).balance : uint256(newCol_); + + newCol_ = int256(ethAmount_); } else { if (isColMax_) { newCol_ = int256( @@ -108,24 +110,24 @@ abstract contract FluidConnector is Events, Stores { } } - bool isPaybackMax_ = newDebt_ == type(int256).min; + bool isPaybackMin_ = newDebt_ == type(int256).min; // Payback if (newDebt_ < 0) { if (vaultDetails_.borrowToken == getEthAddr()) { // Needs to be positive as it will be send in msg.value - ethAmount_ = isPaybackMax_ + ethAmount_ = isPaybackMin_ ? repayApproveAmt_ - : uint256(-1 * newDebt_); + : uint256(-newDebt_); } else { - isPaybackMax_ + isPaybackMin_ ? TokenInterface(vaultDetails_.borrowToken).approve( vaultAddress_, repayApproveAmt_ ) : TokenInterface(vaultDetails_.borrowToken).approve( vaultAddress_, - uint256(-1 * newDebt_) + uint256(-newDebt_) ); } } @@ -211,24 +213,24 @@ abstract contract FluidConnector is Events, Stores { } } - bool isPaybackMax_ = newDebt_ == type(int256).min; + bool isPaybackMin_ = newDebt_ == type(int256).min; // Payback if (newDebt_ < 0) { if (vaultDetails_.borrowToken == getEthAddr()) { // Needs to be positive as it will be send in msg.value - ethAmount_ = isPaybackMax_ + ethAmount_ = isPaybackMin_ ? repayApproveAmt_ - : uint256(-1 * newDebt_); + : uint256(-newDebt_); } else { - isPaybackMax_ + isPaybackMin_ ? TokenInterface(vaultDetails_.borrowToken).approve( vaultAddress_, repayApproveAmt_ ) : TokenInterface(vaultDetails_.borrowToken).approve( vaultAddress_, - uint256(-1 * newDebt_) + uint256(-newDebt_) ); } }