mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
interfaces and skeleton done
This commit is contained in:
parent
ce17b2b0f9
commit
d43f0a228a
|
|
@ -2,18 +2,20 @@ pragma solidity ^0.7.0;
|
|||
|
||||
contract Events {
|
||||
event LogDeposit(
|
||||
uint256 indexed tokenId,
|
||||
uint256 liquidity,
|
||||
uint256 amtA,
|
||||
uint256 amtB,
|
||||
int24 tickLower,
|
||||
int24 tickUpper
|
||||
address indexed depositor,
|
||||
address indexed recipient,
|
||||
uint256 shares,
|
||||
uint256 amount0In,
|
||||
uint256 amount1In,
|
||||
uint256 total0,
|
||||
uint256 total1
|
||||
);
|
||||
|
||||
event LogWithdraw(
|
||||
uint256 indexed tokenId,
|
||||
uint256 liquidity,
|
||||
uint256 amountA,
|
||||
uint256 amountB
|
||||
uint256 indexed withdrawer,
|
||||
uint256 indexed recipient,
|
||||
uint256 shares,
|
||||
uint256 amount0Out,
|
||||
uint256 amount1Out,
|
||||
);
|
||||
}
|
||||
|
|
@ -7,4 +7,49 @@ import {Basic} from "../../common/basic.sol";
|
|||
import "./interface.sol";
|
||||
|
||||
abstract contract Helpers is DSMath, Basic {
|
||||
ILixirFactory constant factory =
|
||||
ILixirFactory(0xfbc744df515f8962c18e79795f469d57ec460691);
|
||||
|
||||
function _deposit(
|
||||
uint256 amount0Desired,
|
||||
uint256 amount1Desired,
|
||||
uint256 amount0Min,
|
||||
uint256 amount1Min,
|
||||
address recipient,
|
||||
uint256 deadline
|
||||
) returns (
|
||||
uint256 shares,
|
||||
uint256 amount0In,
|
||||
uint256 amount1In
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
function _depositETH(
|
||||
uint256 amountDesired,
|
||||
uint256 amountEthMin,
|
||||
uint256 amountMin,
|
||||
address recipient,
|
||||
uint256 deadline
|
||||
) returns (
|
||||
uint256 shares,
|
||||
uint256 amountEthIn,
|
||||
uint256 amountIn
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
function _withdraw(
|
||||
|
||||
) returns () {
|
||||
|
||||
}
|
||||
|
||||
function _withdrawETH(
|
||||
|
||||
) returns () {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,218 @@
|
|||
pragma solidity ^0.7.6;
|
||||
|
||||
interface anInterface {
|
||||
function aFunction() external;
|
||||
import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';
|
||||
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
|
||||
|
||||
interface IERC20Permit {
|
||||
/**
|
||||
* @dev Sets `value` as the allowance of `spender` over `owner`'s tokens,
|
||||
* given `owner`'s signed approval.
|
||||
*
|
||||
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
|
||||
* ordering also apply here.
|
||||
*
|
||||
* Emits an {Approval} event.
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
* - `spender` cannot be the zero address.
|
||||
* - `deadline` must be a timestamp in the future.
|
||||
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
|
||||
* over the EIP712-formatted function arguments.
|
||||
* - the signature must use ``owner``'s current nonce (see {nonces}).
|
||||
*
|
||||
* For more information on the signature format, see the
|
||||
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
|
||||
* section].
|
||||
*/
|
||||
function permit(
|
||||
address owner,
|
||||
address spender,
|
||||
uint256 value,
|
||||
uint256 deadline,
|
||||
uint8 v,
|
||||
bytes32 r,
|
||||
bytes32 s
|
||||
) external;
|
||||
|
||||
/**
|
||||
* @dev Returns the current nonce for `owner`. This value must be
|
||||
* included whenever a signature is generated for {permit}.
|
||||
*
|
||||
* Every successful call to {permit} increases ``owner``'s nonce by one. This
|
||||
* prevents a signature from being used multiple times.
|
||||
*/
|
||||
function nonces(address owner) external view returns (uint256);
|
||||
|
||||
/**
|
||||
* @dev Returns the domain separator used in the encoding of the signature for `permit`, as defined by {EIP712}.
|
||||
*/
|
||||
// solhint-disable-next-line func-name-mixedcase
|
||||
function DOMAIN_SEPARATOR() external view returns (bytes32);
|
||||
}
|
||||
|
||||
interface ILixirVaultToken is IERC20, IERC20Permit {
|
||||
}
|
||||
|
||||
interface ILixirVault is ILixirVaultToken {
|
||||
function initialize(
|
||||
string memory name,
|
||||
string memory symbol,
|
||||
address _token0,
|
||||
address _token1,
|
||||
address _strategist,
|
||||
address _keeper,
|
||||
address _strategy
|
||||
) external;
|
||||
|
||||
function token0() external view returns (IERC20);
|
||||
|
||||
function token1() external view returns (IERC20);
|
||||
|
||||
function activeFee() external view returns (uint24);
|
||||
|
||||
function activePool() external view returns (IUniswapV3Pool);
|
||||
|
||||
function performanceFee() external view returns (uint24);
|
||||
|
||||
function strategist() external view returns (address);
|
||||
|
||||
function strategy() external view returns (address);
|
||||
|
||||
function keeper() external view returns (address);
|
||||
|
||||
function setKeeper(address _keeper) external;
|
||||
|
||||
function setStrategist(address _strategist) external;
|
||||
|
||||
function setStrategy(address _strategy) external;
|
||||
|
||||
function setPerformanceFee(uint24 newFee) external;
|
||||
|
||||
function mainPosition()
|
||||
external
|
||||
view
|
||||
returns (int24 tickLower, int24 tickUpper);
|
||||
|
||||
function rangePosition()
|
||||
external
|
||||
view
|
||||
returns (int24 tickLower, int24 tickUpper);
|
||||
|
||||
function rebalance(
|
||||
int24 mainTickLower,
|
||||
int24 mainTickUpper,
|
||||
int24 rangeTickLower0,
|
||||
int24 rangeTickUpper0,
|
||||
int24 rangeTickLower1,
|
||||
int24 rangeTickUpper1,
|
||||
uint24 fee
|
||||
) external;
|
||||
|
||||
function withdraw(
|
||||
uint256 shares,
|
||||
uint256 amount0Min,
|
||||
uint256 amount1Min,
|
||||
address receiver,
|
||||
uint256 deadline
|
||||
) external returns (uint256 amount0Out, uint256 amount1Out);
|
||||
|
||||
function withdrawFrom(
|
||||
address withdrawer,
|
||||
uint256 shares,
|
||||
uint256 amount0Min,
|
||||
uint256 amount1Min,
|
||||
address recipient,
|
||||
uint256 deadline
|
||||
) external returns (uint256 amount0Out, uint256 amount1Out);
|
||||
|
||||
function deposit(
|
||||
uint256 amount0Desired,
|
||||
uint256 amount1Desired,
|
||||
uint256 amount0Min,
|
||||
uint256 amount1Min,
|
||||
address recipient,
|
||||
uint256 deadline
|
||||
)
|
||||
external
|
||||
returns (
|
||||
uint256 shares,
|
||||
uint256 amount0,
|
||||
uint256 amount1
|
||||
);
|
||||
|
||||
function calculateTotals()
|
||||
external
|
||||
view
|
||||
returns (
|
||||
uint256 total0,
|
||||
uint256 total1,
|
||||
uint128 mL,
|
||||
uint128 rL
|
||||
);
|
||||
|
||||
function calculateTotalsFromTick(int24 virtualTick)
|
||||
external
|
||||
view
|
||||
returns (
|
||||
uint256 total0,
|
||||
uint256 total1,
|
||||
uint128 mL,
|
||||
uint128 rL
|
||||
);
|
||||
}
|
||||
|
||||
interface ILixirVaultETH is ILixirVault {
|
||||
|
||||
enum TOKEN {ZERO, ONE}
|
||||
|
||||
function WETH_TOKEN() external view returns (TOKEN);
|
||||
|
||||
function depositETH(
|
||||
uint256 amountDesired,
|
||||
uint256 amountEthMin,
|
||||
uint256 amountMin,
|
||||
address recipient,
|
||||
uint256 deadline
|
||||
)
|
||||
external
|
||||
payable
|
||||
returns (
|
||||
uint256 shares,
|
||||
uint256 amountEthIn,
|
||||
uint256 amountIn
|
||||
);
|
||||
|
||||
function withdrawETHFrom(
|
||||
address withdrawer,
|
||||
uint256 shares,
|
||||
uint256 amountEthMin,
|
||||
uint256 amountMin,
|
||||
address payable recipient,
|
||||
uint256 deadline
|
||||
) external returns (uint256 amountEthOut, uint256 amountOut);
|
||||
|
||||
function withdrawETH(
|
||||
uint256 shares,
|
||||
uint256 amountEthMin,
|
||||
uint256 amountMin,
|
||||
address payable recipient,
|
||||
uint256 deadline
|
||||
) external returns (uint256 amountEthOut, uint256 amountOut);
|
||||
|
||||
receive() external payable;
|
||||
}
|
||||
|
||||
interface ILixirFactory { // is LixirBase // don't think we need this
|
||||
function vault(
|
||||
address token0,
|
||||
address token1,
|
||||
uint256 index
|
||||
) public view returns (address);
|
||||
|
||||
function vaultsLengthForPair(address token0, address token1)
|
||||
external
|
||||
view
|
||||
returns (uint256);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,17 +14,22 @@ abstract contract LixirResolver is Helpers, Events {
|
|||
/**
|
||||
* @dev Add liqudity to the vault
|
||||
* @notice Mint Lixir Vault Tokens
|
||||
* @param vault vault address
|
||||
* @param token0 token0 address
|
||||
* @param token1 token1 address
|
||||
* @param amount0 amount of tokenA
|
||||
* @param amount1 amount of tokenB
|
||||
* @param getIds ID to retrieve amtA
|
||||
* @param setId ID stores the amount of LP token
|
||||
*/
|
||||
function desosit(
|
||||
address vault,
|
||||
uint256 amount0,
|
||||
uint256 amount1,
|
||||
// split amount0/1 into amount0/1Desired and amount0/1Min?
|
||||
address token0,
|
||||
address token1,
|
||||
uint256 amount0Desired,
|
||||
uint256 amount1Desired,
|
||||
uint256 amount0Min,
|
||||
uint256 amount1Min,
|
||||
address recipient,
|
||||
uint256 deadline,
|
||||
uint256[] calldata getIds,
|
||||
uint256 setId
|
||||
)
|
||||
|
|
@ -32,7 +37,10 @@ abstract contract LixirResolver is Helpers, Events {
|
|||
payable
|
||||
returns (string memory _eventName, bytes memory _eventParam)
|
||||
{
|
||||
// grab the correct vault from the factory
|
||||
|
||||
// check if one of these is ETH, you have to use depositETH, not deposit
|
||||
|
||||
// MintParams memory params;
|
||||
// {
|
||||
// params = MintParams(
|
||||
|
|
@ -67,18 +75,22 @@ abstract contract LixirResolver is Helpers, Events {
|
|||
/**
|
||||
* @dev Decrease Liquidity
|
||||
* @notice Withdraw Liquidity from Lixir Vault
|
||||
* @param vault Lixir Vault address
|
||||
* @param liquidity LP Token amount.
|
||||
* @param amountAMin Min amount of tokenA.
|
||||
* @param amountBMin Min amount of tokenB.
|
||||
* @param vault Lixir vault address
|
||||
* @param withdrawer the DSA account
|
||||
* @param shares the amount of Lixir Vault Tokens to remove
|
||||
* @param amount0Min Min amount of token0.
|
||||
* @param amount1Min Min amount of token1.
|
||||
* @param getId ID to retrieve LP token amounts
|
||||
* @param setIds stores the amount of output tokens
|
||||
*/
|
||||
function withdraw(
|
||||
address vault,
|
||||
uint256 liquidity,
|
||||
uint256 amountAMin,
|
||||
uint256 amountBMin,
|
||||
address withdrawer,
|
||||
uint256 shares,
|
||||
uint256 amount0Min,
|
||||
uint256 amount1Min,
|
||||
address recipient,
|
||||
uint256 deadline,
|
||||
uint256 getId,
|
||||
uint256[] calldata setIds
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user