feat: fix approve

This commit is contained in:
Shriya Tyagi 2024-05-23 20:03:34 +05:30
parent ab3d5dc02d
commit e146d1d862

View File

@ -6,12 +6,13 @@ pragma solidity ^0.8.2;
* @dev Lending & Borrowing. * @dev Lending & Borrowing.
*/ */
import {Stores} from "../../common/stores.sol"; import {Basic} from "../../common/basic.sol";
import {TokenInterface} from "../../common/interfaces.sol"; import {TokenInterface} from "../../common/interfaces.sol";
import {Events} from "./events.sol"; import {Events} from "./events.sol";
import {IVault} from "./interface.sol"; import {IVault} from "./interface.sol";
abstract contract FluidConnector is Events, Stores { abstract contract FluidConnector is Events, Basic {
/** /**
* @dev Returns Eth address * @dev Returns Eth address
*/ */
@ -103,7 +104,8 @@ abstract contract FluidConnector is Events, Stores {
); );
} }
TokenInterface(vaultDetails_.supplyToken).approve( approve(
TokenInterface(vaultDetails_.supplyToken),
vaultAddress_, vaultAddress_,
uint256(newCol_) uint256(newCol_)
); );
@ -121,11 +123,13 @@ abstract contract FluidConnector is Events, Stores {
: uint256(-newDebt_); : uint256(-newDebt_);
} else { } else {
isPaybackMin_ isPaybackMin_
? TokenInterface(vaultDetails_.borrowToken).approve( ? approve(
TokenInterface(vaultDetails_.borrowToken),
vaultAddress_, vaultAddress_,
repayApproveAmt_ repayApproveAmt_
) )
: TokenInterface(vaultDetails_.borrowToken).approve( : approve(
TokenInterface(vaultDetails_.borrowToken),
vaultAddress_, vaultAddress_,
uint256(-newDebt_) uint256(-newDebt_)
); );
@ -208,7 +212,8 @@ abstract contract FluidConnector is Events, Stores {
); );
} }
TokenInterface(vaultDetails_.supplyToken).approve( approve(
TokenInterface(vaultDetails_.supplyToken),
vaultAddress_, vaultAddress_,
uint256(newCol_) uint256(newCol_)
); );
@ -226,11 +231,13 @@ abstract contract FluidConnector is Events, Stores {
: uint256(-newDebt_); : uint256(-newDebt_);
} else { } else {
isPaybackMin_ isPaybackMin_
? TokenInterface(vaultDetails_.borrowToken).approve( ? approve(
TokenInterface(vaultDetails_.borrowToken),
vaultAddress_, vaultAddress_,
repayApproveAmt_ repayApproveAmt_
) )
: TokenInterface(vaultDetails_.borrowToken).approve( : approve(
TokenInterface(vaultDetails_.borrowToken),
vaultAddress_, vaultAddress_,
uint256(-newDebt_) uint256(-newDebt_)
); );