forked from WTFAcademy/WTF-Dapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IPool.sol
119 lines (96 loc) · 3.19 KB
/
IPool.sol
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.24;
interface IMintCallback {
function mintCallback(
uint256 amount0Owed,
uint256 amount1Owed,
bytes calldata data
) external;
}
interface ISwapCallback {
function swapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external;
}
interface IPool {
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function fee() external view returns (uint24);
function tickLower() external view returns (int24);
function tickUpper() external view returns (int24);
function sqrtPriceX96() external view returns (uint160);
function tick() external view returns (int24);
function liquidity() external view returns (uint128);
function initialize(uint160 sqrtPriceX96) external;
/// feeGrowthGlobal0X128 记录从创建到现在,每个流动性累计产生的 token0 的手续费
/// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool
/// @dev This value can overflow the uint256
function feeGrowthGlobal0X128() external view returns (uint256);
/// feeGrowthGlobal1X128 记录从创建到现在,每个流动性累计产生的 token1 的手续费
/// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool
/// @dev This value can overflow the uint256
function feeGrowthGlobal1X128() external view returns (uint256);
function getPosition(
address owner
)
external
view
returns (
uint128 _liquidity,
uint256 feeGrowthInside0LastX128,
uint256 feeGrowthInside1LastX128,
uint128 tokensOwed0,
uint128 tokensOwed1
);
event Mint(
address sender,
address indexed owner,
uint128 amount,
uint256 amount0,
uint256 amount1
);
function mint(
address recipient,
uint128 amount,
bytes calldata data
) external returns (uint256 amount0, uint256 amount1);
event Collect(
address indexed owner,
address recipient,
uint128 amount0,
uint128 amount1
);
function collect(
address recipient,
uint128 amount0Requested,
uint128 amount1Requested
) external returns (uint128 amount0, uint128 amount1);
event Burn(
address indexed owner,
uint128 amount,
uint256 amount0,
uint256 amount1
);
function burn(
uint128 amount
) external returns (uint256 amount0, uint256 amount1);
event Swap(
address indexed sender,
address indexed recipient,
int256 amount0,
int256 amount1,
uint160 sqrtPriceX96,
uint128 liquidity,
int24 tick
);
function swap(
address recipient,
bool zeroForOne,
int256 amountSpecified,
uint160 sqrtPriceLimitX96,
bytes calldata data
) external returns (int256 amount0, int256 amount1);
}