mirror of
https://github.com/Instadapp/dsa-connectors-old.git
synced 2024-07-29 22:47:46 +00:00
Fixed bugs
This commit is contained in:
parent
6adb05a159
commit
05d705bece
|
@ -151,6 +151,8 @@ contract CurveProtocol is CurveHelpers {
|
||||||
uint[4] memory _amts;
|
uint[4] memory _amts;
|
||||||
_amts[uint(getTokenI(token))] = _amt;
|
_amts[uint(getTokenI(token))] = _amt;
|
||||||
|
|
||||||
|
tokenContract.approve(getCurveSwapAddr(), _amt);
|
||||||
|
|
||||||
uint _amt18 = convertTo18(tokenContract.decimals(), _amt);
|
uint _amt18 = convertTo18(tokenContract.decimals(), _amt);
|
||||||
uint _slippageAmt = wmul(unitAmt, _amt18);
|
uint _slippageAmt = wmul(unitAmt, _amt18);
|
||||||
|
|
||||||
|
@ -175,21 +177,20 @@ contract CurveProtocol is CurveHelpers {
|
||||||
uint _amt = getUint(getId, amt);
|
uint _amt = getUint(getId, amt);
|
||||||
int128 tokenId = getTokenI(token);
|
int128 tokenId = getTokenI(token);
|
||||||
|
|
||||||
uint[4] memory _amts;
|
|
||||||
_amts[uint(getTokenI(token))] = _amt;
|
|
||||||
|
|
||||||
TokenInterface curveTokenContract = TokenInterface(getCurveTokenAddr());
|
TokenInterface curveTokenContract = TokenInterface(getCurveTokenAddr());
|
||||||
ICurveZap curveZap = ICurveZap(getCurveZapAddr());
|
ICurveZap curveZap = ICurveZap(getCurveZapAddr());
|
||||||
|
|
||||||
uint _curveAmt = _amt == uint(-1) ?
|
uint _curveAmt;
|
||||||
curveTokenContract.balanceOf(address(this)) :
|
if (_amt == uint(-1)) {
|
||||||
ICurve(getCurveSwapAddr()).calc_token_amount(_amts, false);
|
_curveAmt = curveTokenContract.balanceOf(address(this));
|
||||||
|
_amt = curveZap.calc_withdraw_one_coin(_curveAmt, tokenId);
|
||||||
|
} else {
|
||||||
|
uint[4] memory _amts;
|
||||||
|
_amts[uint(tokenId)] = _amt;
|
||||||
|
_curveAmt = ICurve(getCurveSwapAddr()).calc_token_amount(_amts, false);
|
||||||
|
}
|
||||||
|
|
||||||
_amt = _amt == uint(-1) ? curveZap.calc_withdraw_one_coin(_curveAmt, tokenId) : _amt;
|
curveTokenContract.approve(address(curveZap), _curveAmt);
|
||||||
|
|
||||||
_amts[uint(tokenId)] = _amt;
|
|
||||||
|
|
||||||
curveTokenContract.approve(getCurveSwapAddr(), _curveAmt);
|
|
||||||
|
|
||||||
uint _amt18 = convertTo18(TokenInterface(token).decimals(), _amt);
|
uint _amt18 = convertTo18(TokenInterface(token).decimals(), _amt);
|
||||||
uint _slippageAmt = wmul(unitAmt, _amt18);
|
uint _slippageAmt = wmul(unitAmt, _amt18);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user