Skip to content

Commit

Permalink
feat: update logic
Browse files Browse the repository at this point in the history
  • Loading branch information
shriyatyagii committed Jan 17, 2024
1 parent 3a4d38c commit 07b44ce
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions contracts/mainnet/connectors/basic-ERC4626/main.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 07b44ce

Please sign in to comment.