From aef8da7a1f1b9ec8c9e60ff13151ff46e6043ce9 Mon Sep 17 00:00:00 2001 From: Thrilok Kumar Date: Wed, 6 May 2020 04:41:16 +0530 Subject: [PATCH] Added max amt deposit condition --- contracts/connectors/curve.sol | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/contracts/connectors/curve.sol b/contracts/connectors/curve.sol index ed64088..9fac4fd 100644 --- a/contracts/connectors/curve.sol +++ b/contracts/connectors/curve.sol @@ -106,10 +106,6 @@ contract CurveProtocol is CurveHelpers { event LogDeposit(address token, uint256 amt, uint256 mintAmt, uint256 getId, uint256 setId); event LogWithdraw(address token, uint256 amt, uint256 burnAmt, uint256 getId, uint256 setId); - event LogDepositLiquidity(uint256[4] amts, uint256 mintAmt, uint256[4] getId, uint256 setId); - event LogWithdrawLiquidityImbalance(uint256[4] amts, uint256 burnAmt, uint256[4] getId, uint256 setId); - event LogWithdrawLiquidityOneCoin(address receiveCoin, uint256 withdrawnAmt, uint256 curveAmt, uint256 getId, uint256 setId); - function sell( address buyAddr, address sellAddr, @@ -149,11 +145,13 @@ contract CurveProtocol is CurveHelpers { uint setId ) external { uint256 _amt = getUint(getId, amt); + TokenInterface tokenContract = TokenInterface(token); + _amt = _amt == uint(-1) ? tokenContract.balanceOf(address(this)) : _amt; uint[4] memory _amts; _amts[uint(getTokenI(token))] = _amt; - uint _amt18 = convertTo18(TokenInterface(token).decimals(), _amt); + uint _amt18 = convertTo18(tokenContract.decimals(), _amt); uint _slippageAmt = wmul(unitAmt, _amt18); TokenInterface curveTokenContract = TokenInterface(getCurveTokenAddr());