From eb7cb3d7d4289215118efb1afc6fca8fefc8c8ac Mon Sep 17 00:00:00 2001 From: Thrilok Kumar Date: Fri, 19 Jun 2020 17:18:57 +0530 Subject: [PATCH] Fixed decimal error in curve connector --- contracts/connectors/curve.sol | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/contracts/connectors/curve.sol b/contracts/connectors/curve.sol index 445d90a..e22fbdc 100644 --- a/contracts/connectors/curve.sol +++ b/contracts/connectors/curve.sol @@ -113,9 +113,12 @@ contract CurveProtocol is CurveHelpers { uint _slippageAmt = convert18ToDec(_buyToken.decimals(), wmul(unitAmt, convertTo18(_sellToken.decimals(), _sellAmt))); - uint _buyAmt = curve.get_dy(getTokenI(sellAddr), getTokenI(buyAddr), _sellAmt); - + // uint _buyAmt = curve.get_dy(getTokenI(sellAddr), getTokenI(buyAddr), _sellAmt); + uint initalBal = _buyToken.balanceOf(address(this)); curve.exchange(getTokenI(sellAddr), getTokenI(buyAddr), _sellAmt, _slippageAmt); + uint finalBal = _buyToken.balanceOf(address(this)); + + uint _buyAmt = sub(finalBal, initalBal); setUint(setId, _buyAmt);