mirror of
https://github.com/Instadapp/dsa-connectors-old.git
synced 2024-07-29 22:47:46 +00:00
Fixed withdraw issue
This commit is contained in:
parent
05d705bece
commit
9fc53baf0d
|
@ -179,15 +179,17 @@ contract CurveProtocol is CurveHelpers {
|
||||||
|
|
||||||
TokenInterface curveTokenContract = TokenInterface(getCurveTokenAddr());
|
TokenInterface curveTokenContract = TokenInterface(getCurveTokenAddr());
|
||||||
ICurveZap curveZap = ICurveZap(getCurveZapAddr());
|
ICurveZap curveZap = ICurveZap(getCurveZapAddr());
|
||||||
|
ICurve curveSwap = ICurve(getCurveSwapAddr());
|
||||||
|
|
||||||
uint _curveAmt;
|
uint _curveAmt;
|
||||||
|
uint[4] memory _amts;
|
||||||
if (_amt == uint(-1)) {
|
if (_amt == uint(-1)) {
|
||||||
_curveAmt = curveTokenContract.balanceOf(address(this));
|
_curveAmt = curveTokenContract.balanceOf(address(this));
|
||||||
_amt = curveZap.calc_withdraw_one_coin(_curveAmt, tokenId);
|
_amt = curveZap.calc_withdraw_one_coin(_curveAmt, tokenId);
|
||||||
} else {
|
|
||||||
uint[4] memory _amts;
|
|
||||||
_amts[uint(tokenId)] = _amt;
|
_amts[uint(tokenId)] = _amt;
|
||||||
_curveAmt = ICurve(getCurveSwapAddr()).calc_token_amount(_amts, false);
|
} else {
|
||||||
|
_amts[uint(tokenId)] = _amt;
|
||||||
|
_curveAmt = curveSwap.calc_token_amount(_amts, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
curveTokenContract.approve(address(curveZap), _curveAmt);
|
curveTokenContract.approve(address(curveZap), _curveAmt);
|
||||||
|
@ -197,7 +199,7 @@ contract CurveProtocol is CurveHelpers {
|
||||||
|
|
||||||
require(_curveAmt < _slippageAmt, "excess-burning");
|
require(_curveAmt < _slippageAmt, "excess-burning");
|
||||||
|
|
||||||
curveZap.remove_liquidity_one_coin(_curveAmt, tokenId, _amt);
|
curveSwap.remove_liquidity_imbalance(_amts, _slippageAmt);
|
||||||
|
|
||||||
setUint(setId, _curveAmt);
|
setUint(setId, _curveAmt);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user