-
Notifications
You must be signed in to change notification settings - Fork 0
/
Liquidity ZAP Contract
52 lines (33 loc) · 1022 Bytes
/
Liquidity ZAP Contract
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//Liquidity ZAP Contract
//Address
//Init Function
function initUniswapZAP(
address token,
address WETH,
address tokenWethPair
)
public
/Parameter
Description
token
Address of the token from LP pair.
WETH
Address of WETH.
tokenWethPair
Address of the LP pair./
//Initializes LP addresses.
//ZAP and unZAP Functions
function zapETH() external payable returns (uint256 liquidity)
//Adds liquidity taking only ETH tokens.
function zapTokens(uint amount) external returns (uint256 liquidity)
//Adds liquidity taking only Tokens.
function unzap() external returns (uint amountToken, uint amountETH)
//Unzaps LP to respective Token and ETH amounts.
function unzapToETH() external returns (uint amount)
//Unzaps LP to ETH only.
function unzapToTokens() external returns (uint amount)
//Unzaps LP to Token only.
//Read-Only Functions
function getLPTokenPerEthUnit(uint ethAmt) public view returns (uint liquidity)
//Returns how many LP tokens is user able to get with given ETH amount.