basic test environment works

This commit is contained in:
Tim Olson
2023-08-20 10:20:47 -04:00
parent 4cf4276663
commit 007135d232
6 changed files with 148 additions and 73 deletions

View File

@@ -1,22 +0,0 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// the version of OpenZeppelin required by Uniswap v3 doesn't have IERC20Metadata yet, so we copy it here.
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}

View File

@@ -1,10 +1,10 @@
import "openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./IERC20Metadata.sol";
pragma solidity =0.7.6;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract MockERC20 is ERC20, IERC20Metadata {
contract MockERC20 is ERC20 {
constructor(string name, string symbol, uint8 decimals)
constructor(string memory name, string memory symbol, uint8 decimals)
ERC20(name, symbol)
{
_setupDecimals(decimals);

14
src/Util.sol Normal file
View File

@@ -0,0 +1,14 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
pragma abicoder v2;
library Util {
function roundTick(int24 tick, int24 window) public pure returns (int24) {
// NOTE: we round half toward zero
int24 mod = tick % window;
if (tick < 0)
return - mod <= window / 2 ? tick - mod : tick - (window + mod);
else
return mod > window / 2 ? tick + (window - mod) : tick - mod;
}
}