From 72ebc67cd10b67ee442aa0b50780b82bfc7558df Mon Sep 17 00:00:00 2001 From: rotnes Date: Thu, 27 Oct 2022 14:31:11 +0200 Subject: [PATCH] chore: husky and small fixe --- contracts/ArrakisV2.sol | 11 ++++------- contracts/abstract/ArrakisV2FactoryStorage.sol | 4 ++-- contracts/abstract/ArrakisV2Storage.sol | 2 +- package.json | 11 +++++++---- yarn.lock | 5 +++++ 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/contracts/ArrakisV2.sol b/contracts/ArrakisV2.sol index 3133f45..56bfbc0 100644 --- a/contracts/ArrakisV2.sol +++ b/contracts/ArrakisV2.sol @@ -227,7 +227,7 @@ contract ArrakisV2 is IUniswapV3MintCallback, ArrakisV2Storage { ) external onlyManager { for (uint256 i = 0; i < ranges_.length; i++) { (bool exist, ) = Position.rangeExist(ranges, ranges_[i]); - require(!exist, "R"); + require(!exist, "NRRE"); // check that the pool exist on Uniswap V3. address pool = factory.getPool( address(token0), @@ -237,7 +237,7 @@ contract ArrakisV2 is IUniswapV3MintCallback, ArrakisV2Storage { require(pool != address(0), "NUP"); require(_pools.contains(pool), "P"); // TODO: can reuse the pool got previously. - require(Pool.validateTickSpacing(pool, ranges_[i]), "R"); + require(Pool.validateTickSpacing(pool, ranges_[i]), "RTS"); ranges.push(ranges_[i]); } @@ -257,7 +257,7 @@ contract ArrakisV2 is IUniswapV3MintCallback, ArrakisV2Storage { ranges, rangesToRemove_[i] ); - require(exist, "NR"); + require(exist, "RRNE"); Position.requireNotActiveRange( factory, @@ -371,9 +371,6 @@ contract ArrakisV2 is IUniswapV3MintCallback, ArrakisV2Storage { ); require(success, "SC"); - token0.safeApprove(address(rebalanceParams_.swap.router), 0); - token1.safeApprove(address(rebalanceParams_.swap.router), 0); - uint256 balance0After = token0.balanceOf(address(this)); uint256 balance1After = token1.balanceOf(address(this)); @@ -417,7 +414,7 @@ contract ArrakisV2 is IUniswapV3MintCallback, ArrakisV2Storage { ranges, rebalanceParams_.deposits[i].range ); - require(exist, "NR"); + require(exist, "DRE"); (uint256 amt0, uint256 amt1) = pool.mint( address(this), diff --git a/contracts/abstract/ArrakisV2FactoryStorage.sol b/contracts/abstract/ArrakisV2FactoryStorage.sol index 377e628..623f3d9 100644 --- a/contracts/abstract/ArrakisV2FactoryStorage.sol +++ b/contracts/abstract/ArrakisV2FactoryStorage.sol @@ -89,7 +89,7 @@ abstract contract ArrakisV2FactoryStorage is (bool success, bytes memory returndata) = proxy.staticcall( hex"f851a440" ); - require(success); + require(success, "PA"); return abi.decode(returndata, (address)); } @@ -103,7 +103,7 @@ abstract contract ArrakisV2FactoryStorage is (bool success, bytes memory returndata) = proxy.staticcall( hex"5c60da1b" ); - require(success); + require(success, "PI"); return abi.decode(returndata, (address)); } diff --git a/contracts/abstract/ArrakisV2Storage.sol b/contracts/abstract/ArrakisV2Storage.sol index 780059c..5f21699 100644 --- a/contracts/abstract/ArrakisV2Storage.sol +++ b/contracts/abstract/ArrakisV2Storage.sol @@ -182,7 +182,7 @@ abstract contract ArrakisV2Storage is function blacklistRouters(address[] calldata routers_) external onlyOwner { for (uint256 i = 0; i < routers_.length; i++) { - require(_routers.contains(routers_[i]), "NR"); + require(_routers.contains(routers_[i]), "RW"); _routers.remove(routers_[i]); } diff --git a/package.json b/package.json index e5af927..d762b60 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,9 @@ "lint": "eslint --cache . && yarn lint:sol", "lint:ts": "eslint -c .eslintrc.json --ext \"**/*.ts\" \"**/*.test.ts\"", "lint:sol": "solhint 'contracts/**/*.sol'", - "postinstall": "yarn husky install", + "postinstall": "husky install", + "prepack": "pinst --disable", + "postpack": "pinst --enable", "test": "npx hardhat test", "verify": "npx hardhat etherscan-verify", "script-matic:create-vault-v2": "npx hardhat --network polygon run ./scripts/createVaultV2.ts", @@ -42,8 +44,8 @@ "@typescript-eslint/eslint-plugin": "5.28.0", "@typescript-eslint/parser": "5.28.0", "@uniswap/v3-core": "1.0.1", - "@uniswap/v3-sdk": "3.8.3", "@uniswap/v3-periphery": "1.4.1", + "@uniswap/v3-sdk": "3.8.3", "chai": "4.3.6", "dotenv": "16.0.1", "eslint": "8.18.0", @@ -58,6 +60,7 @@ "jsbi": "^4.3.0", "lint-staged": "13.0.2", "node-fetch": "3.2.6", + "pinst": "^3.0.0", "prettier": "2.5.1", "prettier-plugin-solidity": "1.0.0-beta.24", "solhint": "3.3.6", @@ -73,7 +76,7 @@ }, "repository": { "type": "git", - "url": "git+ssh://git@github.com/ArrakisFinance/vault-v2-core" + "url": "git+ssh://git@github.com/ArrakisFinance/v2-core" }, "keywords": [ "arrakis", @@ -92,5 +95,5 @@ "homepage": "https://github.com/ArrakisFinance/v2-core#readme", "description": "Arrakis V2 Automated Market Maker", "license": "MIT", - "version": "0.1.0" + "version": "0.1.1" } diff --git a/yarn.lock b/yarn.lock index d30bc26..22ee417 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8286,6 +8286,11 @@ pinkie@^2.0.0: resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" integrity sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg== +pinst@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pinst/-/pinst-3.0.0.tgz#80dec0a85f1f993c6084172020f3dbf512897eec" + integrity sha512-cengSmBxtCyaJqtRSvJorIIZXMXg+lJ3sIljGmtBGUVonMnMsVJbnzl6jGN1HkOWwxNuJynCJ2hXxxqCQrFDdw== + posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"