-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathPoolAddressTest.sol
More file actions
30 lines (26 loc) · 908 Bytes
/
PoolAddressTest.sol
File metadata and controls
30 lines (26 loc) · 908 Bytes
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
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
import '../libraries/PoolAddress.sol';
contract PoolAddressTest {
function POOL_INIT_CODE_HASH() external pure returns (bytes32) {
return PoolAddress.POOL_INIT_CODE_HASH;
}
function computeAddress(
address factory,
address token0,
address token1,
uint24 fee
) external pure returns (address) {
return PoolAddress.computeAddress(factory, PoolAddress.PoolKey({token0: token0, token1: token1, fee: fee}));
}
function getGasCostOfComputeAddress(
address factory,
address token0,
address token1,
uint24 fee
) external view returns (uint256) {
uint256 gasBefore = gasleft();
PoolAddress.computeAddress(factory, PoolAddress.PoolKey({token0: token0, token1: token1, fee: fee}));
return gasBefore - gasleft();
}
}