forked from Uniswap/v3-periphery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPathTest.sol
37 lines (31 loc) · 967 Bytes
/
PathTest.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
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
import '../libraries/Path.sol';
contract PathTest {
function hasMultiplePools(bytes memory path) public pure returns (bool) {
return Path.hasMultiplePools(path);
}
function decodeFirstPool(bytes memory path)
public
pure
returns (
address tokenA,
address tokenB,
uint24 fee
)
{
return Path.decodeFirstPool(path);
}
function getFirstPool(bytes memory path) public pure returns (bytes memory) {
return Path.getFirstPool(path);
}
function skipToken(bytes memory path) public pure returns (bytes memory) {
return Path.skipToken(path);
}
// gas funcs
function getGasCostOfDecodeFirstPool(bytes memory path) public view returns (uint256) {
uint256 gasBefore = gasleft();
Path.decodeFirstPool(path);
return gasBefore - gasleft();
}
}