feat: update logic

This commit is contained in:
Shriya Tyagi 2024-01-17 16:05:23 +04:00
parent 3a4d38cc5e
commit 07b44ce236

View File

@ -37,15 +37,15 @@ abstract contract BasicConnector is Events, DSMath, Basic {
vaultTokenContract.asset()
);
if (_underlyingAmt == uint256(-1)) {
if (address(_underlyingTokenContract) == wethAddr) {
TokenInterface(wethAddr).deposit{value: address(this).balance}();
}
_underlyingAmt = _underlyingTokenContract.balanceOf(address(this));
bool _isEth = vaultToken == ethAddr;
if (_isEth) {
_underlyingAmt = _underlyingAmt == uint256(-1) ? address(this).balance : _underlyingTokenContract.balanceOf(address(this));
convertEthToWeth(_isEth, TokenInterface(wethAddr), _underlyingAmt);
} else {
if (address(_underlyingTokenContract) == wethAddr) {
TokenInterface(wethAddr).deposit{value: _underlyingAmt}();
}
_underlyingAmt = _underlyingAmt == uint256(-1)
? _underlyingTokenContract.balanceOf(address(this))
: _underlyingAmt;
}
// Returns final amount in token decimals.