mirror of
https://github.com/Instadapp/dsa-connectors-2.0.git
synced 2024-07-29 21:57:39 +00:00
feat: update mainnet connector
This commit is contained in:
parent
4b7d9c6263
commit
cf61ac8b22
|
@ -92,6 +92,8 @@ abstract contract FluidConnector is Events, Stores {
|
||||||
ethAmount_ = isColMax_
|
ethAmount_ = isColMax_
|
||||||
? address(this).balance
|
? address(this).balance
|
||||||
: uint256(newCol_);
|
: uint256(newCol_);
|
||||||
|
|
||||||
|
newCol_ = int256(ethAmount_);
|
||||||
} else {
|
} else {
|
||||||
if (isColMax_) {
|
if (isColMax_) {
|
||||||
newCol_ = int256(
|
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
|
// Payback
|
||||||
if (newDebt_ < 0) {
|
if (newDebt_ < 0) {
|
||||||
if (vaultDetails_.borrowToken == getEthAddr()) {
|
if (vaultDetails_.borrowToken == getEthAddr()) {
|
||||||
// Needs to be positive as it will be send in msg.value
|
// Needs to be positive as it will be send in msg.value
|
||||||
ethAmount_ = isPaybackMax_
|
ethAmount_ = isPaybackMin_
|
||||||
? repayApproveAmt_
|
? repayApproveAmt_
|
||||||
: uint256(-1 * newDebt_);
|
: uint256(-newDebt_);
|
||||||
} else {
|
} else {
|
||||||
isPaybackMax_
|
isPaybackMin_
|
||||||
? TokenInterface(vaultDetails_.borrowToken).approve(
|
? TokenInterface(vaultDetails_.borrowToken).approve(
|
||||||
vaultAddress_,
|
vaultAddress_,
|
||||||
repayApproveAmt_
|
repayApproveAmt_
|
||||||
)
|
)
|
||||||
: TokenInterface(vaultDetails_.borrowToken).approve(
|
: TokenInterface(vaultDetails_.borrowToken).approve(
|
||||||
vaultAddress_,
|
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
|
// Payback
|
||||||
if (newDebt_ < 0) {
|
if (newDebt_ < 0) {
|
||||||
if (vaultDetails_.borrowToken == getEthAddr()) {
|
if (vaultDetails_.borrowToken == getEthAddr()) {
|
||||||
// Needs to be positive as it will be send in msg.value
|
// Needs to be positive as it will be send in msg.value
|
||||||
ethAmount_ = isPaybackMax_
|
ethAmount_ = isPaybackMin_
|
||||||
? repayApproveAmt_
|
? repayApproveAmt_
|
||||||
: uint256(-1 * newDebt_);
|
: uint256(-newDebt_);
|
||||||
} else {
|
} else {
|
||||||
isPaybackMax_
|
isPaybackMin_
|
||||||
? TokenInterface(vaultDetails_.borrowToken).approve(
|
? TokenInterface(vaultDetails_.borrowToken).approve(
|
||||||
vaultAddress_,
|
vaultAddress_,
|
||||||
repayApproveAmt_
|
repayApproveAmt_
|
||||||
)
|
)
|
||||||
: TokenInterface(vaultDetails_.borrowToken).approve(
|
: TokenInterface(vaultDetails_.borrowToken).approve(
|
||||||
vaultAddress_,
|
vaultAddress_,
|
||||||
uint256(-1 * newDebt_)
|
uint256(-newDebt_)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user