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

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
//pragma solidity =0.7.6;
pragma solidity >=0.8.0;
pragma abicoder v2;
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
// pragma solidity =0.7.6;
pragma solidity >=0.8.0;
import "./OrderLib.sol";
import "./Vault.sol";
pragma abicoder v2;

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
//pragma solidity =0.7.6;
pragma solidity >=0.8.0;
import "./VaultDeployer.sol";
pragma abicoder v2;

View File

@@ -1,15 +1,22 @@
pragma solidity =0.7.6;
//pragma solidity =0.7.6;
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract MockERC20 is ERC20 {
constructor(string memory name, string memory symbol, uint8 decimals)
uint8 private _decimals;
constructor(string memory name, string memory symbol, uint8 decimals_)
ERC20(name, symbol)
{
_setupDecimals(decimals);
// _setupDecimals(decimals);
_decimals = decimals_;
}
function decimals() public view override returns (uint8) {
return _decimals;
}
function mint(address account, uint256 amount) external {
_mint(account, amount);

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
// pragma solidity =0.7.6;
pragma solidity >=0.8.0;
pragma abicoder v2;
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
//pragma solidity =0.7.6;
pragma solidity >=0.8.0;
pragma abicoder v2;
import "v3-core/contracts/interfaces/IUniswapV3Pool.sol";

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
//pragma solidity =0.7.6;
pragma solidity >=0.8.0;
pragma abicoder v2;
import "./Constants.sol";

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
//pragma solidity =0.7.6;
pragma solidity >=0.8.0;
pragma abicoder v2;
library Util {

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
//pragma solidity =0.7.6;
pragma solidity >=0.8.0;
pragma abicoder v2;
import "./Constants.sol";
@@ -31,7 +32,7 @@ contract Vault {
}
function withdraw(uint256 amount) public {
_withdrawNative(msg.sender, amount);
_withdrawNative(payable(msg.sender), amount);
}
function withdrawTo(address payable recipient, uint256 amount) public {

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
//pragma solidity =0.7.6;
pragma solidity >=0.8.0;
pragma abicoder v2;
import "./Constants.sol";
@@ -10,7 +11,7 @@ library VaultAddress {
// keccak-256 hash of the Vault's bytecode (not the deployed bytecode but the initialization bytecode)
// can paste into:
// https://emn178.github.io/online-tools/keccak_256.html
bytes32 internal constant VAULT_INIT_CODE_HASH = 0xbc5f4b6509a7bbf6d9bcbd2b24c599e63143e9ba77aebe3d9486f1cbfcbda9ea;
bytes32 internal constant VAULT_INIT_CODE_HASH = 0x060e1878e07cde3b1fe03b6a8929c62c502510ed5dda30b278951f11dfc03490;
// the contract being constructed must not have any constructor arguments or the determinism will be broken. instead, use a callback to
// get construction arguments
@@ -22,7 +23,7 @@ library VaultAddress {
function computeAddress(address factory, address owner, uint8 num) internal pure returns (address vault) {
bytes32 salt = keccak256(abi.encodePacked(owner,num));
vault = address(
vault = address(uint160(
uint256(
keccak256(
abi.encodePacked(
@@ -33,6 +34,6 @@ library VaultAddress {
)
)
)
);
));
}
}

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
//pragma solidity =0.7.6;
pragma solidity >=0.8.0;
import "./Vault.sol";
pragma abicoder v2;
@@ -32,7 +33,7 @@ contract VaultDeployer {
function _deployVault(address owner, uint8 num) internal returns (address payable vault) {
parameters = Parameters(owner);
vault = address(new Vault{salt: keccak256(abi.encodePacked(owner,num))}());
vault = payable(address(new Vault{salt: keccak256(abi.encodePacked(owner,num))}()));
delete parameters;
emit VaultCreated( owner, num );
}

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
//pragma solidity =0.7.6;
pragma solidity >=0.8.0;
pragma abicoder v2;
interface IVaultDeployer {