Port to Solidity 0.8.21 passes 3 tests

This commit is contained in:
7400
2023-10-25 08:14:19 -07:00
parent 72cbdbc2fd
commit 499782828a
28 changed files with 63 additions and 36 deletions

View File

@@ -61,7 +61,7 @@ library FullMath {
// Factor powers of two out of denominator
// Compute largest power of two divisor of denominator.
// Always >= 1.
uint256 twos = -denominator & denominator;
uint256 twos = uint256(-int256(denominator)) & denominator;
// Divide denominator by power of two
assembly {
denominator := div(denominator, twos)

View File

@@ -22,7 +22,7 @@ library TickMath {
/// at the given tick
function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
require(absTick <= uint256(MAX_TICK), 'T');
require(absTick <= uint256(int256(MAX_TICK)), 'T');
uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;
if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.0;
pragma solidity >=0.8.0;
//pragma solidity ^0.7.0;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';

View File

@@ -2,8 +2,8 @@
pragma solidity >=0.7.5;
pragma abicoder v2;
import '@openzeppelin/contracts/token/ERC721/IERC721Metadata.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol';
import './IPoolInitializer.sol';
import './IERC721Permit.sol';

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;
// pragma solidity =0.7.6;
pragma solidity >=0.8.0;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';

View File

@@ -32,7 +32,7 @@ library PoolAddress {
/// @return pool The contract address of the V3 pool
function computeAddress(address factory, PoolKey memory key) internal pure returns (address pool) {
require(key.token0 < key.token1);
pool = address(
pool = address(uint160(
uint256(
keccak256(
abi.encodePacked(
@@ -43,6 +43,6 @@ library PoolAddress {
)
)
)
);
));
}
}