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() vaultTokenContract.asset()
); );
if (_underlyingAmt == uint256(-1)) { bool _isEth = vaultToken == ethAddr;
if (address(_underlyingTokenContract) == wethAddr) {
TokenInterface(wethAddr).deposit{value: address(this).balance}(); if (_isEth) {
} _underlyingAmt = _underlyingAmt == uint256(-1) ? address(this).balance : _underlyingTokenContract.balanceOf(address(this));
_underlyingAmt = _underlyingTokenContract.balanceOf(address(this)); convertEthToWeth(_isEth, TokenInterface(wethAddr), _underlyingAmt);
} else { } else {
if (address(_underlyingTokenContract) == wethAddr) { _underlyingAmt = _underlyingAmt == uint256(-1)
TokenInterface(wethAddr).deposit{value: _underlyingAmt}(); ? _underlyingTokenContract.balanceOf(address(this))
} : _underlyingAmt;
} }
// Returns final amount in token decimals. // Returns final amount in token decimals.