infrastructure-upgrade/lib/v3-periphery/contracts/test/PathTest.sol
T-Hax 735546619e
init
Signed-off-by: T-Hax <>
2023-04-08 18:46:18 +00:00

38 lines
967 B
Solidity

// 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();
}
}