mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
feat: update logic
This commit is contained in:
parent
3a4d38cc5e
commit
07b44ce236
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user