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(
|
event LogWithdraw(
|
||||||
uint256 indexed withdrawer,
|
address indexed vault,
|
||||||
uint256 indexed recipient,
|
|
||||||
uint256 shares,
|
|
||||||
uint256 amount0Out,
|
uint256 amount0Out,
|
||||||
uint256 amount1Out
|
uint256 amount1Out
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
pragma solidity ^0.7.6;
|
pragma solidity ^0.7.6;
|
||||||
pragma abicoder v2;
|
pragma abicoder v2;
|
||||||
|
|
||||||
import {TokenInterface} from "../../common/interfaces.sol";
|
import { TokenInterface } from "../../common/interfaces.sol";
|
||||||
import {DSMath} from "../../common/math.sol";
|
import { DSMath } from "../../common/math.sol";
|
||||||
import {Basic} from "../../common/basic.sol";
|
import { Basic } from "../../common/basic.sol";
|
||||||
import "./interface.sol";
|
import "./interface.sol";
|
||||||
|
|
||||||
abstract contract Helpers is DSMath, Basic {
|
abstract contract Helpers is DSMath, Basic {
|
||||||
ILixirFactory constant factory =
|
|
||||||
ILixirFactory(0xFbC744df515F8962C18e79795F469d57EC460691);
|
|
||||||
|
|
||||||
function _deposit(
|
function _deposit(
|
||||||
address payable vaultAddress,
|
address payable vaultAddress,
|
||||||
uint256 amount0Desired,
|
uint256 amount0Desired,
|
||||||
|
@ -58,25 +55,24 @@ abstract contract Helpers is DSMath, Basic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _withdraw(
|
function _withdraw(
|
||||||
address withdrawer,
|
address vaultAddress,
|
||||||
uint256 shares,
|
uint256 shares,
|
||||||
uint256 amount0Min,
|
uint256 amount0Min,
|
||||||
uint256 amount1Min,
|
uint256 amount1Min,
|
||||||
address recipient,
|
address recipient,
|
||||||
uint256 deadline
|
uint256 deadline
|
||||||
) internal returns (uint256 amount0Out, uint256 amount1Out) {
|
) internal returns (uint256 amount0Out, uint256 amount1Out) {
|
||||||
return (0, 0);
|
ILixirVault vault = ILixirVault(vaultAddress);
|
||||||
}
|
(
|
||||||
|
amount0Out,
|
||||||
function _withdrawETH(
|
amount1Out
|
||||||
address withdrawer,
|
) = vault.withdraw(
|
||||||
uint256 shares,
|
shares,
|
||||||
uint256 amountEthMin,
|
amount0Min,
|
||||||
uint256 amountMin,
|
amount1Min,
|
||||||
address payable recipient,
|
recipient,
|
||||||
uint256 deadline
|
deadline
|
||||||
) internal returns (uint256 amountEthOut, uint256 amountOut) {
|
);
|
||||||
return (0, 0);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,17 +202,3 @@ interface ILixirVaultETH is ILixirVault {
|
||||||
|
|
||||||
receive() external payable;
|
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.
|
* @dev Automated Liquidity Concentrator.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {TokenInterface} from "../../common/interfaces.sol";
|
import { TokenInterface } from "../../common/interfaces.sol";
|
||||||
import {Helpers} from "./helpers.sol";
|
import { Helpers } from "./helpers.sol";
|
||||||
import {Events} from "./events.sol";
|
import { Events } from "./events.sol";
|
||||||
|
|
||||||
abstract contract LixirResolver is Helpers, Events {
|
abstract contract LixirResolver is Helpers, Events {
|
||||||
/**
|
/**
|
||||||
|
@ -80,8 +80,7 @@ abstract contract LixirResolver is Helpers, Events {
|
||||||
* @param setIds stores the amount of output tokens
|
* @param setIds stores the amount of output tokens
|
||||||
*/
|
*/
|
||||||
function withdraw(
|
function withdraw(
|
||||||
address payable vault,
|
address vault,
|
||||||
address withdrawer,
|
|
||||||
uint256 shares,
|
uint256 shares,
|
||||||
uint256 amount0Min,
|
uint256 amount0Min,
|
||||||
uint256 amount1Min,
|
uint256 amount1Min,
|
||||||
|
@ -94,21 +93,22 @@ abstract contract LixirResolver is Helpers, Events {
|
||||||
payable
|
payable
|
||||||
returns (string memory _eventName, bytes memory _eventParam)
|
returns (string memory _eventName, bytes memory _eventParam)
|
||||||
{
|
{
|
||||||
// if (tokenId == 0) tokenId = _getLastNftId(address(this));
|
address vault = address(getUint(getId, uint256(vault)));
|
||||||
// uint128 _liquidity = uint128(getUint(getId, liquidity));
|
|
||||||
|
|
||||||
// (uint256 _amtA, uint256 _amtB) = _decreaseLiquidity(
|
(uint256 amount0Out, uint256 amount1Out) = _withdraw(
|
||||||
// tokenId,
|
vault,
|
||||||
// _liquidity,
|
shares,
|
||||||
// amountAMin,
|
amount0Min,
|
||||||
// amountBMin
|
amount1Min,
|
||||||
// );
|
recipient,
|
||||||
|
deadline
|
||||||
|
);
|
||||||
|
|
||||||
// setUint(setIds[0], _amtA);
|
setUint(setIds[0], amount0Out);
|
||||||
// setUint(setIds[1], _amtB);
|
setUint(setIds[1], amount1Out);
|
||||||
|
|
||||||
_eventName = "LogWithdraw(uint256,uint256,uint256,uint256)";
|
_eventName = "LogWithdraw(address,uint256,uint256)";
|
||||||
_eventParam = abi.encode(vault);
|
_eventParam = abi.encode(vault, amount0Out, amount1Out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user