mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
withdraw done
This commit is contained in:
parent
47b2baf98e
commit
67b2911e56
|
@ -9,9 +9,7 @@ contract Events {
|
|||
);
|
||||
|
||||
event LogWithdraw(
|
||||
uint256 indexed withdrawer,
|
||||
uint256 indexed recipient,
|
||||
uint256 shares,
|
||||
address indexed vault,
|
||||
uint256 amount0Out,
|
||||
uint256 amount1Out
|
||||
);
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
pragma solidity ^0.7.6;
|
||||
pragma abicoder v2;
|
||||
|
||||
import {TokenInterface} from "../../common/interfaces.sol";
|
||||
import {DSMath} from "../../common/math.sol";
|
||||
import {Basic} from "../../common/basic.sol";
|
||||
import { TokenInterface } from "../../common/interfaces.sol";
|
||||
import { DSMath } from "../../common/math.sol";
|
||||
import { Basic } from "../../common/basic.sol";
|
||||
import "./interface.sol";
|
||||
|
||||
abstract contract Helpers is DSMath, Basic {
|
||||
ILixirFactory constant factory =
|
||||
ILixirFactory(0xFbC744df515F8962C18e79795F469d57EC460691);
|
||||
|
||||
function _deposit(
|
||||
address payable vaultAddress,
|
||||
uint256 amount0Desired,
|
||||
|
@ -58,25 +55,24 @@ abstract contract Helpers is DSMath, Basic {
|
|||
}
|
||||
}
|
||||
|
||||
function _withdraw(
|
||||
address withdrawer,
|
||||
uint256 shares,
|
||||
uint256 amount0Min,
|
||||
uint256 amount1Min,
|
||||
address recipient,
|
||||
uint256 deadline
|
||||
) internal returns (uint256 amount0Out, uint256 amount1Out) {
|
||||
return (0, 0);
|
||||
}
|
||||
|
||||
function _withdrawETH(
|
||||
address withdrawer,
|
||||
uint256 shares,
|
||||
uint256 amountEthMin,
|
||||
uint256 amountMin,
|
||||
address payable recipient,
|
||||
uint256 deadline
|
||||
) internal returns (uint256 amountEthOut, uint256 amountOut) {
|
||||
return (0, 0);
|
||||
}
|
||||
function _withdraw(
|
||||
address vaultAddress,
|
||||
uint256 shares,
|
||||
uint256 amount0Min,
|
||||
uint256 amount1Min,
|
||||
address recipient,
|
||||
uint256 deadline
|
||||
) internal returns (uint256 amount0Out, uint256 amount1Out) {
|
||||
ILixirVault vault = ILixirVault(vaultAddress);
|
||||
(
|
||||
amount0Out,
|
||||
amount1Out
|
||||
) = vault.withdraw(
|
||||
shares,
|
||||
amount0Min,
|
||||
amount1Min,
|
||||
recipient,
|
||||
deadline
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,17 +202,3 @@ interface ILixirVaultETH is ILixirVault {
|
|||
|
||||
receive() external payable;
|
||||
}
|
||||
|
||||
interface ILixirFactory { // is LixirBase // don't think we need this
|
||||
function vault(
|
||||
address token0,
|
||||
address token1,
|
||||
uint256 index
|
||||
) external view returns (address);
|
||||
|
||||
function vaultsLengthForPair(address token0, address token1)
|
||||
external
|
||||
view
|
||||
returns (uint256);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ pragma abicoder v2;
|
|||
* @dev Automated Liquidity Concentrator.
|
||||
*/
|
||||
|
||||
import {TokenInterface} from "../../common/interfaces.sol";
|
||||
import {Helpers} from "./helpers.sol";
|
||||
import {Events} from "./events.sol";
|
||||
import { TokenInterface } from "../../common/interfaces.sol";
|
||||
import { Helpers } from "./helpers.sol";
|
||||
import { Events } from "./events.sol";
|
||||
|
||||
abstract contract LixirResolver is Helpers, Events {
|
||||
/**
|
||||
|
@ -80,8 +80,7 @@ abstract contract LixirResolver is Helpers, Events {
|
|||
* @param setIds stores the amount of output tokens
|
||||
*/
|
||||
function withdraw(
|
||||
address payable vault,
|
||||
address withdrawer,
|
||||
address vault,
|
||||
uint256 shares,
|
||||
uint256 amount0Min,
|
||||
uint256 amount1Min,
|
||||
|
@ -94,21 +93,22 @@ abstract contract LixirResolver is Helpers, Events {
|
|||
payable
|
||||
returns (string memory _eventName, bytes memory _eventParam)
|
||||
{
|
||||
// if (tokenId == 0) tokenId = _getLastNftId(address(this));
|
||||
// uint128 _liquidity = uint128(getUint(getId, liquidity));
|
||||
address vault = address(getUint(getId, uint256(vault)));
|
||||
|
||||
// (uint256 _amtA, uint256 _amtB) = _decreaseLiquidity(
|
||||
// tokenId,
|
||||
// _liquidity,
|
||||
// amountAMin,
|
||||
// amountBMin
|
||||
// );
|
||||
(uint256 amount0Out, uint256 amount1Out) = _withdraw(
|
||||
vault,
|
||||
shares,
|
||||
amount0Min,
|
||||
amount1Min,
|
||||
recipient,
|
||||
deadline
|
||||
);
|
||||
|
||||
// setUint(setIds[0], _amtA);
|
||||
// setUint(setIds[1], _amtB);
|
||||
setUint(setIds[0], amount0Out);
|
||||
setUint(setIds[1], amount1Out);
|
||||
|
||||
_eventName = "LogWithdraw(uint256,uint256,uint256,uint256)";
|
||||
_eventParam = abi.encode(vault);
|
||||
_eventName = "LogWithdraw(address,uint256,uint256)";
|
||||
_eventParam = abi.encode(vault, amount0Out, amount1Out);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user