From 748343da7c20b96d104cb631a8238b3aa0b964a3 Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Wed, 12 Jul 2023 15:46:00 +0300 Subject: [PATCH 1/3] [Core] use solidity 0.8.20 --- .github/workflows/echidna_core.yml | 3 ++- hardhat.base.config.ts | 3 ++- src/core/contracts/AlgebraCommunityVault.sol | 2 +- src/core/contracts/AlgebraFactory.sol | 4 ++-- src/core/contracts/AlgebraPool.sol | 2 +- src/core/contracts/AlgebraPoolDeployer.sol | 2 +- src/core/contracts/base/AlgebraPoolBase.sol | 2 +- src/core/contracts/base/Positions.sol | 2 +- src/core/contracts/base/ReentrancyGuard.sol | 2 +- src/core/contracts/base/ReservesManager.sol | 2 +- src/core/contracts/base/SwapCalculation.sol | 2 +- src/core/contracts/base/TickStructure.sol | 2 +- src/core/contracts/base/common/Timestamp.sol | 2 +- src/core/contracts/libraries/Constants.sol | 2 +- src/core/contracts/libraries/Plugins.sol | 2 +- src/core/contracts/libraries/PriceMovementMath.sol | 2 +- src/core/contracts/libraries/TickManagement.sol | 2 +- src/core/contracts/libraries/TickTree.sol | 2 +- src/core/contracts/libraries/TokenDeltaMath.sol | 2 +- src/core/contracts/test/AlgebraPoolSwapTest.sol | 2 +- src/core/contracts/test/BitMathTest.sol | 2 +- src/core/contracts/test/FullMathTest.sol | 2 +- src/core/contracts/test/LiquidityMathTest.sol | 2 +- src/core/contracts/test/MockDefaultPluginFactory.sol | 2 +- src/core/contracts/test/MockPoolPlugin.sol | 2 +- src/core/contracts/test/MockTimeAlgebraPool.sol | 2 +- src/core/contracts/test/MockTimeAlgebraPoolDeployer.sol | 2 +- src/core/contracts/test/PriceMovementMathTest.sol | 2 +- src/core/contracts/test/SafeMathTest.sol | 2 +- src/core/contracts/test/TestAlgebraCallee.sol | 2 +- src/core/contracts/test/TestAlgebraReentrantCallee.sol | 2 +- src/core/contracts/test/TestAlgebraRouter.sol | 2 +- src/core/contracts/test/TestAlgebraSwapPay.sol | 2 +- src/core/contracts/test/TestERC20.sol | 2 +- src/core/contracts/test/TickMathTest.sol | 2 +- src/core/contracts/test/TickTest.sol | 2 +- src/core/contracts/test/TickTreeTest.sol | 2 +- src/core/contracts/test/TokenDeltaMathTest.sol | 2 +- src/core/contracts/test/echidna/BitMathEchidnaTest.sol | 2 +- src/core/contracts/test/echidna/FullMathEchidnaTest.sol | 2 +- .../contracts/test/echidna/LowGasSafeMathEchidnaTest.sol | 2 +- .../echidna/PoolMockEchidna/AssertSwapEchidnaTest.sol | 2 +- .../test/echidna/PoolMockEchidna/PoolMockEchidna.sol | 2 +- .../echidna/PoolMockEchidna/PropBalancesEchidnaTest.sol | 2 +- .../echidna/PoolMockEchidna/PropReservesEchidnaTest.sol | 2 +- .../test/echidna/PriceMovementMathEchidnaTest.sol | 2 +- src/core/contracts/test/echidna/TickMathEchidnaTest.sol | 2 +- .../test/echidna/TickOverflowSafetyEchidnaTest.sol | 2 +- src/core/contracts/test/echidna/TickTreeEchidnaTest.sol | 2 +- .../contracts/test/echidna/TokenDeltaMathEchidnaTest.sol | 2 +- .../contracts/test/echidna/UnsafeMathEchidnaTest.sol | 2 +- src/core/hardhat.config.ts | 9 ++++++--- src/core/test/__snapshots__/AlgebraFactory.spec.ts.snap | 8 ++++---- src/periphery/contracts/libraries/PoolAddress.sol | 2 +- src/plugins/contracts/DataStorageFactory.sol | 2 +- src/plugins/contracts/DataStorageOperator.sol | 2 +- src/plugins/contracts/libraries/AdaptiveFee.sol | 2 +- src/plugins/contracts/libraries/DataStorage.sol | 2 +- src/plugins/contracts/test/AdaptiveFeeTest.sol | 2 +- src/plugins/contracts/test/DataStorageTest.sol | 2 +- src/plugins/contracts/test/MockFactory.sol | 2 +- src/plugins/contracts/test/MockPool.sol | 2 +- src/plugins/contracts/test/MockTimeDSFactory.sol | 2 +- .../contracts/test/MockTimeDataStorageOperator.sol | 2 +- src/plugins/contracts/test/MockTimeVirtualPool.sol | 2 +- src/plugins/contracts/test/TestERC20.sol | 2 +- src/plugins/contracts/test/TestVirtualPool.sol | 2 +- .../contracts/test/echidna/AdaptiveFeeEchidnaTest.sol | 2 +- .../contracts/test/echidna/DataStorageEchidnaTest.sol | 2 +- src/plugins/hardhat.config.ts | 9 ++++++--- 70 files changed, 86 insertions(+), 78 deletions(-) diff --git a/.github/workflows/echidna_core.yml b/.github/workflows/echidna_core.yml index 1eab76256..ee3dc70cb 100644 --- a/.github/workflows/echidna_core.yml +++ b/.github/workflows/echidna_core.yml @@ -46,9 +46,10 @@ jobs: - name: Run ${{ matrix.testName }} uses: crytic/echidna-action@v2 with: - solc-version: 0.8.17 + solc-version: 0.8.20 files: ./src/core/contracts/test/echidna/${{ matrix.testName }}.sol contract: ${{ matrix.testName }} crytic-args: --hardhat-ignore-compile + solc-args: --evm-version paris config: ./src/core/contracts/test/echidna/echidna.config.yml diff --git a/hardhat.base.config.ts b/hardhat.base.config.ts index ca8843917..630f6a748 100644 --- a/hardhat.base.config.ts +++ b/hardhat.base.config.ts @@ -14,7 +14,8 @@ export default { networks: { hardhat: { allowUnlimitedContractSize: true, - loggingEnabled: false + loggingEnabled: false, + evm: 'paris' }, hhnode: { url: `http://127.0.0.1:8545`, diff --git a/src/core/contracts/AlgebraCommunityVault.sol b/src/core/contracts/AlgebraCommunityVault.sol index fb916ae2a..876f6d090 100644 --- a/src/core/contracts/AlgebraCommunityVault.sol +++ b/src/core/contracts/AlgebraCommunityVault.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; import './libraries/SafeTransfer.sol'; import './libraries/FullMath.sol'; diff --git a/src/core/contracts/AlgebraFactory.sol b/src/core/contracts/AlgebraFactory.sol index b202c3280..e52be29c7 100644 --- a/src/core/contracts/AlgebraFactory.sol +++ b/src/core/contracts/AlgebraFactory.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; import './libraries/Constants.sol'; @@ -47,7 +47,7 @@ contract AlgebraFactory is IAlgebraFactory, Ownable2Step, AccessControlEnumerabl mapping(address => mapping(address => address)) public override poolByPair; /// @dev keccak256 of AlgebraPool init bytecode. Used to compute pool address deterministically - bytes32 private constant POOL_INIT_CODE_HASH = 0x657fbc706c7366902c0d63df8f6b4b838a098f6c1a50f77ccf970f0b6a1ad169; + bytes32 private constant POOL_INIT_CODE_HASH = 0x560efc6163a446c8560280a76dfff4345df92a36afdd8015e0c5f8709039d00c; constructor(address _poolDeployer) { require(_poolDeployer != address(0)); diff --git a/src/core/contracts/AlgebraPool.sol b/src/core/contracts/AlgebraPool.sol index b9c7c5eb7..51a10eae5 100644 --- a/src/core/contracts/AlgebraPool.sol +++ b/src/core/contracts/AlgebraPool.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import './base/AlgebraPoolBase.sol'; diff --git a/src/core/contracts/AlgebraPoolDeployer.sol b/src/core/contracts/AlgebraPoolDeployer.sol index 63cb14b97..7d5f9c0b5 100644 --- a/src/core/contracts/AlgebraPoolDeployer.sol +++ b/src/core/contracts/AlgebraPoolDeployer.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; import './AlgebraPool.sol'; diff --git a/src/core/contracts/base/AlgebraPoolBase.sol b/src/core/contracts/base/AlgebraPoolBase.sol index f1619af5b..9864e2fd4 100644 --- a/src/core/contracts/base/AlgebraPoolBase.sol +++ b/src/core/contracts/base/AlgebraPoolBase.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../interfaces/callback/IAlgebraSwapCallback.sol'; import '../interfaces/callback/IAlgebraMintCallback.sol'; diff --git a/src/core/contracts/base/Positions.sol b/src/core/contracts/base/Positions.sol index 707e14bae..86eacaf94 100644 --- a/src/core/contracts/base/Positions.sol +++ b/src/core/contracts/base/Positions.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; import './AlgebraPoolBase.sol'; import '../libraries/LiquidityMath.sol'; diff --git a/src/core/contracts/base/ReentrancyGuard.sol b/src/core/contracts/base/ReentrancyGuard.sol index 7406666ce..ee250dfc1 100644 --- a/src/core/contracts/base/ReentrancyGuard.sol +++ b/src/core/contracts/base/ReentrancyGuard.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; import './AlgebraPoolBase.sol'; diff --git a/src/core/contracts/base/ReservesManager.sol b/src/core/contracts/base/ReservesManager.sol index 9252aaef8..fe0e17e52 100644 --- a/src/core/contracts/base/ReservesManager.sol +++ b/src/core/contracts/base/ReservesManager.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../libraries/SafeCast.sol'; import './AlgebraPoolBase.sol'; diff --git a/src/core/contracts/base/SwapCalculation.sol b/src/core/contracts/base/SwapCalculation.sol index 438da708b..2f6912f6a 100644 --- a/src/core/contracts/base/SwapCalculation.sol +++ b/src/core/contracts/base/SwapCalculation.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../libraries/PriceMovementMath.sol'; import '../libraries/LowGasSafeMath.sol'; diff --git a/src/core/contracts/base/TickStructure.sol b/src/core/contracts/base/TickStructure.sol index b776ccee3..76c23b09f 100644 --- a/src/core/contracts/base/TickStructure.sol +++ b/src/core/contracts/base/TickStructure.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../libraries/TickManagement.sol'; import '../libraries/TickTree.sol'; diff --git a/src/core/contracts/base/common/Timestamp.sol b/src/core/contracts/base/common/Timestamp.sol index 5cbbb0604..973bc7804 100644 --- a/src/core/contracts/base/common/Timestamp.sol +++ b/src/core/contracts/base/common/Timestamp.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; /// @title Abstract contract with modified blockTimestamp functionality /// @notice Allows the pool and other contracts to get a timestamp truncated to 32 bits diff --git a/src/core/contracts/libraries/Constants.sol b/src/core/contracts/libraries/Constants.sol index 0488f8a86..86af53005 100644 --- a/src/core/contracts/libraries/Constants.sol +++ b/src/core/contracts/libraries/Constants.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-or-later -pragma solidity =0.8.17; +pragma solidity =0.8.20; /// @title Contains common constants for Algebra contracts /// @dev Constants moved to the library, not the base contract, to further emphasize their constant nature diff --git a/src/core/contracts/libraries/Plugins.sol b/src/core/contracts/libraries/Plugins.sol index df4c0f13e..f47a7591f 100644 --- a/src/core/contracts/libraries/Plugins.sol +++ b/src/core/contracts/libraries/Plugins.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-or-later -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../interfaces/IAlgebraPoolErrors.sol'; diff --git a/src/core/contracts/libraries/PriceMovementMath.sol b/src/core/contracts/libraries/PriceMovementMath.sol index f7c48e3fe..fd83f7c52 100644 --- a/src/core/contracts/libraries/PriceMovementMath.sol +++ b/src/core/contracts/libraries/PriceMovementMath.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../interfaces/IAlgebraPoolErrors.sol'; import './FullMath.sol'; diff --git a/src/core/contracts/libraries/TickManagement.sol b/src/core/contracts/libraries/TickManagement.sol index b9c30711f..fe990aa14 100644 --- a/src/core/contracts/libraries/TickManagement.sol +++ b/src/core/contracts/libraries/TickManagement.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../interfaces/IAlgebraPoolErrors.sol'; diff --git a/src/core/contracts/libraries/TickTree.sol b/src/core/contracts/libraries/TickTree.sol index d5c7c4839..83c411900 100644 --- a/src/core/contracts/libraries/TickTree.sol +++ b/src/core/contracts/libraries/TickTree.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; import './TickMath.sol'; diff --git a/src/core/contracts/libraries/TokenDeltaMath.sol b/src/core/contracts/libraries/TokenDeltaMath.sol index b2dcf8858..175544008 100644 --- a/src/core/contracts/libraries/TokenDeltaMath.sol +++ b/src/core/contracts/libraries/TokenDeltaMath.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; import './SafeCast.sol'; import './FullMath.sol'; diff --git a/src/core/contracts/test/AlgebraPoolSwapTest.sol b/src/core/contracts/test/AlgebraPoolSwapTest.sol index e4e7a3575..1c142da98 100644 --- a/src/core/contracts/test/AlgebraPoolSwapTest.sol +++ b/src/core/contracts/test/AlgebraPoolSwapTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../interfaces/IERC20Minimal.sol'; diff --git a/src/core/contracts/test/BitMathTest.sol b/src/core/contracts/test/BitMathTest.sol index f744a9b92..fb82c1434 100644 --- a/src/core/contracts/test/BitMathTest.sol +++ b/src/core/contracts/test/BitMathTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../libraries/TickTree.sol'; diff --git a/src/core/contracts/test/FullMathTest.sol b/src/core/contracts/test/FullMathTest.sol index e5271ccfe..3b2c171b8 100644 --- a/src/core/contracts/test/FullMathTest.sol +++ b/src/core/contracts/test/FullMathTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../libraries/FullMath.sol'; diff --git a/src/core/contracts/test/LiquidityMathTest.sol b/src/core/contracts/test/LiquidityMathTest.sol index e7d91b803..1b91134d7 100644 --- a/src/core/contracts/test/LiquidityMathTest.sol +++ b/src/core/contracts/test/LiquidityMathTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '../libraries/LiquidityMath.sol'; diff --git a/src/core/contracts/test/MockDefaultPluginFactory.sol b/src/core/contracts/test/MockDefaultPluginFactory.sol index eb0e2070e..5194bd625 100644 --- a/src/core/contracts/test/MockDefaultPluginFactory.sol +++ b/src/core/contracts/test/MockDefaultPluginFactory.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '../interfaces/plugin/IAlgebraPluginFactory.sol'; diff --git a/src/core/contracts/test/MockPoolPlugin.sol b/src/core/contracts/test/MockPoolPlugin.sol index 98a1af940..5b9382cbf 100644 --- a/src/core/contracts/test/MockPoolPlugin.sol +++ b/src/core/contracts/test/MockPoolPlugin.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '../interfaces/plugin/IAlgebraPlugin.sol'; diff --git a/src/core/contracts/test/MockTimeAlgebraPool.sol b/src/core/contracts/test/MockTimeAlgebraPool.sol index ecc5f0b9c..514612ee3 100644 --- a/src/core/contracts/test/MockTimeAlgebraPool.sol +++ b/src/core/contracts/test/MockTimeAlgebraPool.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '../AlgebraPool.sol'; diff --git a/src/core/contracts/test/MockTimeAlgebraPoolDeployer.sol b/src/core/contracts/test/MockTimeAlgebraPoolDeployer.sol index 1e19a30b4..67c4e66dd 100644 --- a/src/core/contracts/test/MockTimeAlgebraPoolDeployer.sol +++ b/src/core/contracts/test/MockTimeAlgebraPoolDeployer.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../interfaces/IAlgebraPoolDeployer.sol'; diff --git a/src/core/contracts/test/PriceMovementMathTest.sol b/src/core/contracts/test/PriceMovementMathTest.sol index 44b67b31a..504720f7c 100644 --- a/src/core/contracts/test/PriceMovementMathTest.sol +++ b/src/core/contracts/test/PriceMovementMathTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '../libraries/PriceMovementMath.sol'; diff --git a/src/core/contracts/test/SafeMathTest.sol b/src/core/contracts/test/SafeMathTest.sol index 22246f3e3..8e2035ba8 100644 --- a/src/core/contracts/test/SafeMathTest.sol +++ b/src/core/contracts/test/SafeMathTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../libraries/LowGasSafeMath.sol'; import '../libraries/SafeCast.sol'; diff --git a/src/core/contracts/test/TestAlgebraCallee.sol b/src/core/contracts/test/TestAlgebraCallee.sol index d8d8d69f7..d9e17ae7c 100644 --- a/src/core/contracts/test/TestAlgebraCallee.sol +++ b/src/core/contracts/test/TestAlgebraCallee.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '../interfaces/IERC20Minimal.sol'; diff --git a/src/core/contracts/test/TestAlgebraReentrantCallee.sol b/src/core/contracts/test/TestAlgebraReentrantCallee.sol index be46c49e9..2842f14b9 100644 --- a/src/core/contracts/test/TestAlgebraReentrantCallee.sol +++ b/src/core/contracts/test/TestAlgebraReentrantCallee.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../libraries/TickMath.sol'; diff --git a/src/core/contracts/test/TestAlgebraRouter.sol b/src/core/contracts/test/TestAlgebraRouter.sol index e98be4b21..09fef0943 100644 --- a/src/core/contracts/test/TestAlgebraRouter.sol +++ b/src/core/contracts/test/TestAlgebraRouter.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '../libraries/SafeCast.sol'; diff --git a/src/core/contracts/test/TestAlgebraSwapPay.sol b/src/core/contracts/test/TestAlgebraSwapPay.sol index b3f2b46fc..c2ad0e371 100644 --- a/src/core/contracts/test/TestAlgebraSwapPay.sol +++ b/src/core/contracts/test/TestAlgebraSwapPay.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '../interfaces/IERC20Minimal.sol'; diff --git a/src/core/contracts/test/TestERC20.sol b/src/core/contracts/test/TestERC20.sol index 20e125807..87d04d4ea 100644 --- a/src/core/contracts/test/TestERC20.sol +++ b/src/core/contracts/test/TestERC20.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '../interfaces/IERC20Minimal.sol'; diff --git a/src/core/contracts/test/TickMathTest.sol b/src/core/contracts/test/TickMathTest.sol index b2a3b9b2c..0531b4a18 100644 --- a/src/core/contracts/test/TickMathTest.sol +++ b/src/core/contracts/test/TickMathTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '../libraries/TickMath.sol'; diff --git a/src/core/contracts/test/TickTest.sol b/src/core/contracts/test/TickTest.sol index 6695320e0..7b4ab6d80 100644 --- a/src/core/contracts/test/TickTest.sol +++ b/src/core/contracts/test/TickTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v2; import '../libraries/TickManagement.sol'; diff --git a/src/core/contracts/test/TickTreeTest.sol b/src/core/contracts/test/TickTreeTest.sol index 8e90d753f..0b8135ca4 100644 --- a/src/core/contracts/test/TickTreeTest.sol +++ b/src/core/contracts/test/TickTreeTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '../libraries/TickTree.sol'; diff --git a/src/core/contracts/test/TokenDeltaMathTest.sol b/src/core/contracts/test/TokenDeltaMathTest.sol index 3e9c5bd72..de38ee3b9 100644 --- a/src/core/contracts/test/TokenDeltaMathTest.sol +++ b/src/core/contracts/test/TokenDeltaMathTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '../libraries/TokenDeltaMath.sol'; diff --git a/src/core/contracts/test/echidna/BitMathEchidnaTest.sol b/src/core/contracts/test/echidna/BitMathEchidnaTest.sol index c098bd5e1..69bc86951 100644 --- a/src/core/contracts/test/echidna/BitMathEchidnaTest.sol +++ b/src/core/contracts/test/echidna/BitMathEchidnaTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../../libraries/TickTree.sol'; diff --git a/src/core/contracts/test/echidna/FullMathEchidnaTest.sol b/src/core/contracts/test/echidna/FullMathEchidnaTest.sol index a9ce32c56..368be98db 100644 --- a/src/core/contracts/test/echidna/FullMathEchidnaTest.sol +++ b/src/core/contracts/test/echidna/FullMathEchidnaTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../../libraries/FullMath.sol'; diff --git a/src/core/contracts/test/echidna/LowGasSafeMathEchidnaTest.sol b/src/core/contracts/test/echidna/LowGasSafeMathEchidnaTest.sol index 4148ab4d4..a5dfb8559 100644 --- a/src/core/contracts/test/echidna/LowGasSafeMathEchidnaTest.sol +++ b/src/core/contracts/test/echidna/LowGasSafeMathEchidnaTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../../libraries/LowGasSafeMath.sol'; diff --git a/src/core/contracts/test/echidna/PoolMockEchidna/AssertSwapEchidnaTest.sol b/src/core/contracts/test/echidna/PoolMockEchidna/AssertSwapEchidnaTest.sol index c55115592..024aaf0a7 100644 --- a/src/core/contracts/test/echidna/PoolMockEchidna/AssertSwapEchidnaTest.sol +++ b/src/core/contracts/test/echidna/PoolMockEchidna/AssertSwapEchidnaTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import './PoolMockEchidna.sol'; diff --git a/src/core/contracts/test/echidna/PoolMockEchidna/PoolMockEchidna.sol b/src/core/contracts/test/echidna/PoolMockEchidna/PoolMockEchidna.sol index af950edb0..4b2433bc6 100644 --- a/src/core/contracts/test/echidna/PoolMockEchidna/PoolMockEchidna.sol +++ b/src/core/contracts/test/echidna/PoolMockEchidna/PoolMockEchidna.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../../../AlgebraPool.sol'; diff --git a/src/core/contracts/test/echidna/PoolMockEchidna/PropBalancesEchidnaTest.sol b/src/core/contracts/test/echidna/PoolMockEchidna/PropBalancesEchidnaTest.sol index 5f45ebe12..2b4a27d1e 100644 --- a/src/core/contracts/test/echidna/PoolMockEchidna/PropBalancesEchidnaTest.sol +++ b/src/core/contracts/test/echidna/PoolMockEchidna/PropBalancesEchidnaTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import './PoolMockEchidna.sol'; diff --git a/src/core/contracts/test/echidna/PoolMockEchidna/PropReservesEchidnaTest.sol b/src/core/contracts/test/echidna/PoolMockEchidna/PropReservesEchidnaTest.sol index 321b3f301..32f4ac951 100644 --- a/src/core/contracts/test/echidna/PoolMockEchidna/PropReservesEchidnaTest.sol +++ b/src/core/contracts/test/echidna/PoolMockEchidna/PropReservesEchidnaTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import './PoolMockEchidna.sol'; diff --git a/src/core/contracts/test/echidna/PriceMovementMathEchidnaTest.sol b/src/core/contracts/test/echidna/PriceMovementMathEchidnaTest.sol index cd2acdb53..da920163c 100644 --- a/src/core/contracts/test/echidna/PriceMovementMathEchidnaTest.sol +++ b/src/core/contracts/test/echidna/PriceMovementMathEchidnaTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../../libraries/PriceMovementMath.sol'; import '../../libraries/TickMath.sol'; diff --git a/src/core/contracts/test/echidna/TickMathEchidnaTest.sol b/src/core/contracts/test/echidna/TickMathEchidnaTest.sol index f6dfca283..44eaf1e25 100644 --- a/src/core/contracts/test/echidna/TickMathEchidnaTest.sol +++ b/src/core/contracts/test/echidna/TickMathEchidnaTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../../libraries/TickMath.sol'; diff --git a/src/core/contracts/test/echidna/TickOverflowSafetyEchidnaTest.sol b/src/core/contracts/test/echidna/TickOverflowSafetyEchidnaTest.sol index 6f3ee1130..7dc8e3633 100644 --- a/src/core/contracts/test/echidna/TickOverflowSafetyEchidnaTest.sol +++ b/src/core/contracts/test/echidna/TickOverflowSafetyEchidnaTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../../libraries/TickManagement.sol'; diff --git a/src/core/contracts/test/echidna/TickTreeEchidnaTest.sol b/src/core/contracts/test/echidna/TickTreeEchidnaTest.sol index 52e08b0e4..59b5adf77 100644 --- a/src/core/contracts/test/echidna/TickTreeEchidnaTest.sol +++ b/src/core/contracts/test/echidna/TickTreeEchidnaTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '../../libraries/TickTree.sol'; diff --git a/src/core/contracts/test/echidna/TokenDeltaMathEchidnaTest.sol b/src/core/contracts/test/echidna/TokenDeltaMathEchidnaTest.sol index cc0071fea..9a7f7b2d3 100644 --- a/src/core/contracts/test/echidna/TokenDeltaMathEchidnaTest.sol +++ b/src/core/contracts/test/echidna/TokenDeltaMathEchidnaTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../../libraries/FullMath.sol'; import '../../libraries/TokenDeltaMath.sol'; diff --git a/src/core/contracts/test/echidna/UnsafeMathEchidnaTest.sol b/src/core/contracts/test/echidna/UnsafeMathEchidnaTest.sol index aeadfec9c..c8732d95d 100644 --- a/src/core/contracts/test/echidna/UnsafeMathEchidnaTest.sol +++ b/src/core/contracts/test/echidna/UnsafeMathEchidnaTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../../libraries/FullMath.sol'; diff --git a/src/core/hardhat.config.ts b/src/core/hardhat.config.ts index 5db1e3b9d..82d2ddc9f 100644 --- a/src/core/hardhat.config.ts +++ b/src/core/hardhat.config.ts @@ -6,8 +6,9 @@ import { SolcUserConfig } from 'hardhat/types'; import baseConfig from '../../hardhat.base.config'; const HIGHEST_OPTIMIZER_COMPILER_SETTINGS: SolcUserConfig = { - version: '0.8.17', + version: '0.8.20', settings: { + evmVersion: 'paris', optimizer: { enabled: true, runs: 1_000_000, @@ -19,8 +20,9 @@ const HIGHEST_OPTIMIZER_COMPILER_SETTINGS: SolcUserConfig = { } const DEFAULT_COMPILER_SETTINGS: SolcUserConfig = { - version: '0.8.17', + version: '0.8.20', settings: { + evmVersion: 'paris', optimizer: { enabled: true, runs: 200, @@ -32,8 +34,9 @@ const DEFAULT_COMPILER_SETTINGS: SolcUserConfig = { } const LOWEST_COMPILER_SETTINGS: SolcUserConfig = { - version: '0.8.17', + version: '0.8.20', settings: { + evmVersion: 'paris', optimizer: { enabled: true, runs: 0, diff --git a/src/core/test/__snapshots__/AlgebraFactory.spec.ts.snap b/src/core/test/__snapshots__/AlgebraFactory.spec.ts.snap index 64fb6a185..70f6fcbc2 100644 --- a/src/core/test/__snapshots__/AlgebraFactory.spec.ts.snap +++ b/src/core/test/__snapshots__/AlgebraFactory.spec.ts.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AlgebraFactory #createPool gas [ @skip-on-coverage ] 1`] = `4239728`; +exports[`AlgebraFactory #createPool gas [ @skip-on-coverage ] 1`] = `4193216`; -exports[`AlgebraFactory #createPool gas for second pool [ @skip-on-coverage ] 1`] = `4239728`; +exports[`AlgebraFactory #createPool gas for second pool [ @skip-on-coverage ] 1`] = `4193216`; -exports[`AlgebraFactory factory bytecode size [ @skip-on-coverage ] 1`] = `7730`; +exports[`AlgebraFactory factory bytecode size [ @skip-on-coverage ] 1`] = `7702`; -exports[`AlgebraFactory pool bytecode size [ @skip-on-coverage ] 1`] = `20105`; +exports[`AlgebraFactory pool bytecode size [ @skip-on-coverage ] 1`] = `19867`; diff --git a/src/periphery/contracts/libraries/PoolAddress.sol b/src/periphery/contracts/libraries/PoolAddress.sol index 278f786e4..6ca114bc2 100644 --- a/src/periphery/contracts/libraries/PoolAddress.sol +++ b/src/periphery/contracts/libraries/PoolAddress.sol @@ -5,7 +5,7 @@ pragma solidity >=0.5.0; /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery library PoolAddress { - bytes32 internal constant POOL_INIT_CODE_HASH = 0x657fbc706c7366902c0d63df8f6b4b838a098f6c1a50f77ccf970f0b6a1ad169; + bytes32 internal constant POOL_INIT_CODE_HASH = 0x560efc6163a446c8560280a76dfff4345df92a36afdd8015e0c5f8709039d00c; /// @notice The identifying key of the pool struct PoolKey { diff --git a/src/plugins/contracts/DataStorageFactory.sol b/src/plugins/contracts/DataStorageFactory.sol index 297668f7c..9b420bd65 100644 --- a/src/plugins/contracts/DataStorageFactory.sol +++ b/src/plugins/contracts/DataStorageFactory.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; import './libraries/AdaptiveFee.sol'; diff --git a/src/plugins/contracts/DataStorageOperator.sol b/src/plugins/contracts/DataStorageOperator.sol index 63b69d13c..f39d39744 100644 --- a/src/plugins/contracts/DataStorageOperator.sol +++ b/src/plugins/contracts/DataStorageOperator.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '@cryptoalgebra/core/contracts/base/common/Timestamp.sol'; import '@cryptoalgebra/core/contracts/libraries/Plugins.sol'; diff --git a/src/plugins/contracts/libraries/AdaptiveFee.sol b/src/plugins/contracts/libraries/AdaptiveFee.sol index 9bb34a8d7..52e49dda8 100644 --- a/src/plugins/contracts/libraries/AdaptiveFee.sol +++ b/src/plugins/contracts/libraries/AdaptiveFee.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '@cryptoalgebra/core/contracts/libraries/Constants.sol'; import '../base/AlgebraFeeConfiguration.sol'; diff --git a/src/plugins/contracts/libraries/DataStorage.sol b/src/plugins/contracts/libraries/DataStorage.sol index 82b98db31..2b30b7e29 100644 --- a/src/plugins/contracts/libraries/DataStorage.sol +++ b/src/plugins/contracts/libraries/DataStorage.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; /// @title DataStorage /// @notice Provides price, liquidity, volatility data useful for a wide variety of system designs diff --git a/src/plugins/contracts/test/AdaptiveFeeTest.sol b/src/plugins/contracts/test/AdaptiveFeeTest.sol index 3410c9222..9fe396ba6 100644 --- a/src/plugins/contracts/test/AdaptiveFeeTest.sol +++ b/src/plugins/contracts/test/AdaptiveFeeTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '../base/AlgebraFeeConfiguration.sol'; diff --git a/src/plugins/contracts/test/DataStorageTest.sol b/src/plugins/contracts/test/DataStorageTest.sol index 2062df5d3..ec33ba7fb 100644 --- a/src/plugins/contracts/test/DataStorageTest.sol +++ b/src/plugins/contracts/test/DataStorageTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v2; import '../libraries/DataStorage.sol'; diff --git a/src/plugins/contracts/test/MockFactory.sol b/src/plugins/contracts/test/MockFactory.sol index 1f4cba9b6..ab1bc2f8c 100644 --- a/src/plugins/contracts/test/MockFactory.sol +++ b/src/plugins/contracts/test/MockFactory.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; /// @title Mock of Algebra factory for plugins testing contract MockFactory { diff --git a/src/plugins/contracts/test/MockPool.sol b/src/plugins/contracts/test/MockPool.sol index e4f6c64c7..5cf19bb30 100644 --- a/src/plugins/contracts/test/MockPool.sol +++ b/src/plugins/contracts/test/MockPool.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '@cryptoalgebra/core/contracts/libraries/TickManagement.sol'; diff --git a/src/plugins/contracts/test/MockTimeDSFactory.sol b/src/plugins/contracts/test/MockTimeDSFactory.sol index 9231b1084..a717b82ec 100644 --- a/src/plugins/contracts/test/MockTimeDSFactory.sol +++ b/src/plugins/contracts/test/MockTimeDSFactory.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../base/AlgebraFeeConfiguration.sol'; import '../libraries/AdaptiveFee.sol'; diff --git a/src/plugins/contracts/test/MockTimeDataStorageOperator.sol b/src/plugins/contracts/test/MockTimeDataStorageOperator.sol index bda3c69fe..53529b80c 100644 --- a/src/plugins/contracts/test/MockTimeDataStorageOperator.sol +++ b/src/plugins/contracts/test/MockTimeDataStorageOperator.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../DataStorageOperator.sol'; diff --git a/src/plugins/contracts/test/MockTimeVirtualPool.sol b/src/plugins/contracts/test/MockTimeVirtualPool.sol index 7b263ef6d..beac37a82 100644 --- a/src/plugins/contracts/test/MockTimeVirtualPool.sol +++ b/src/plugins/contracts/test/MockTimeVirtualPool.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '../interfaces/IAlgebraVirtualPool.sol'; diff --git a/src/plugins/contracts/test/TestERC20.sol b/src/plugins/contracts/test/TestERC20.sol index 65314366f..e98e94a6e 100644 --- a/src/plugins/contracts/test/TestERC20.sol +++ b/src/plugins/contracts/test/TestERC20.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '@cryptoalgebra/core/contracts/interfaces/IERC20Minimal.sol'; diff --git a/src/plugins/contracts/test/TestVirtualPool.sol b/src/plugins/contracts/test/TestVirtualPool.sol index 335890e61..7804dc86a 100644 --- a/src/plugins/contracts/test/TestVirtualPool.sol +++ b/src/plugins/contracts/test/TestVirtualPool.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; pragma abicoder v1; import '@cryptoalgebra/core/contracts/interfaces/IAlgebraPool.sol'; diff --git a/src/plugins/contracts/test/echidna/AdaptiveFeeEchidnaTest.sol b/src/plugins/contracts/test/echidna/AdaptiveFeeEchidnaTest.sol index 9f5b09bc6..5a2c247a2 100644 --- a/src/plugins/contracts/test/echidna/AdaptiveFeeEchidnaTest.sol +++ b/src/plugins/contracts/test/echidna/AdaptiveFeeEchidnaTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import '../../libraries/AdaptiveFee.sol'; diff --git a/src/plugins/contracts/test/echidna/DataStorageEchidnaTest.sol b/src/plugins/contracts/test/echidna/DataStorageEchidnaTest.sol index 43fb065ad..dde058e8c 100644 --- a/src/plugins/contracts/test/echidna/DataStorageEchidnaTest.sol +++ b/src/plugins/contracts/test/echidna/DataStorageEchidnaTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.17; +pragma solidity =0.8.20; import './../DataStorageTest.sol'; diff --git a/src/plugins/hardhat.config.ts b/src/plugins/hardhat.config.ts index d29e01da6..52b3b3070 100644 --- a/src/plugins/hardhat.config.ts +++ b/src/plugins/hardhat.config.ts @@ -5,8 +5,9 @@ import { SolcUserConfig } from 'hardhat/types'; import baseConfig from '../../hardhat.base.config'; const HIGHEST_OPTIMIZER_COMPILER_SETTINGS: SolcUserConfig = { - version: '0.8.17', + version: '0.8.20', settings: { + evmVersion: 'paris', optimizer: { enabled: true, runs: 1_000_000, @@ -18,8 +19,9 @@ const HIGHEST_OPTIMIZER_COMPILER_SETTINGS: SolcUserConfig = { } const DEFAULT_COMPILER_SETTINGS: SolcUserConfig = { - version: '0.8.17', + version: '0.8.20', settings: { + evmVersion: 'paris', optimizer: { enabled: true, runs: 200, @@ -31,8 +33,9 @@ const DEFAULT_COMPILER_SETTINGS: SolcUserConfig = { } const LOWEST_COMPILER_SETTINGS: SolcUserConfig = { - version: '0.8.17', + version: '0.8.20', settings: { + evmVersion: 'paris', optimizer: { enabled: true, runs: 0, From 3e924fae6201dc20352521d6e589cf8a5ae12f8c Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Wed, 12 Jul 2023 15:49:53 +0300 Subject: [PATCH 2/3] [Common] bump hardhat --- package-lock.json | 386 ++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 189 insertions(+), 199 deletions(-) diff --git a/package-lock.json b/package-lock.json index ea7ba65ca..b50916b96 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "decimal.js": "^10.4.3", "dotenv": "^10.0.0", "ethers": "5.7.2", - "hardhat": "2.13.1", + "hardhat": "2.16.1", "hardhat-contract-sizer": "^2.8.0", "hardhat-dependency-compiler": "1.1.2", "hardhat-output-validator": "^0.1.19", @@ -3024,9 +3024,9 @@ } }, "node_modules/@nomiclabs/hardhat-etherscan/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "peer": true, "bin": { @@ -3315,16 +3315,16 @@ } }, "node_modules/@npmcli/map-workspaces/node_modules/glob": { - "version": "10.3.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.1.tgz", - "integrity": "sha512-9BKYcEeIs7QwlCYs+Y3GBvqAMISufUS0i2ELd11zpZjxI5V9iyRj0HgzB5/cLf2NY4vcYBTYzJ7GIui7j/4DOw==", + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", "dev": true, "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^2.0.3", "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2", - "path-scurry": "^1.10.0" + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" }, "bin": { "glob": "dist/cjs/src/bin.js" @@ -3440,16 +3440,16 @@ } }, "node_modules/@npmcli/package-json/node_modules/glob": { - "version": "10.3.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.1.tgz", - "integrity": "sha512-9BKYcEeIs7QwlCYs+Y3GBvqAMISufUS0i2ELd11zpZjxI5V9iyRj0HgzB5/cLf2NY4vcYBTYzJ7GIui7j/4DOw==", + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", "dev": true, "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^2.0.3", "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2", - "path-scurry": "^1.10.0" + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" }, "bin": { "glob": "dist/cjs/src/bin.js" @@ -4505,9 +4505,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.4.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.0.tgz", - "integrity": "sha512-jfT7iTf/4kOQ9S7CHV9BIyRaQqHu67mOjsIQBC3BKZvzvUB6zLxEwJ6sBE3ozcvP8kF6Uk5PXN0Q+c0dfhGX0g==", + "version": "20.4.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", + "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", "dev": true }, "node_modules/@types/normalize-package-data": { @@ -5262,9 +5262,9 @@ } }, "node_modules/bin-links": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-4.0.1.tgz", - "integrity": "sha512-bmFEM39CyX336ZGGRsGPlc6jZHriIoHacOQcTt72MktIjpPhZoP4te2jOyUXF3BLILmJ8aNLncoPVeIIFlrDeA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-4.0.2.tgz", + "integrity": "sha512-jxJ0PbXR8eQyPlExCvCs3JFnikvs1Yp4gUJt6nmgathdOwvur+q22KWC3h20gvWl4T/14DXKj2IlkJwwZkZPOw==", "dev": true, "dependencies": { "cmd-shim": "^6.0.0", @@ -5604,16 +5604,16 @@ } }, "node_modules/cacache/node_modules/glob": { - "version": "10.3.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.1.tgz", - "integrity": "sha512-9BKYcEeIs7QwlCYs+Y3GBvqAMISufUS0i2ELd11zpZjxI5V9iyRj0HgzB5/cLf2NY4vcYBTYzJ7GIui7j/4DOw==", + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", "dev": true, "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^2.0.3", "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2", - "path-scurry": "^1.10.0" + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" }, "bin": { "glob": "dist/cjs/src/bin.js" @@ -5666,6 +5666,7 @@ "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", "dev": true, + "peer": true, "dependencies": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" @@ -5710,9 +5711,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001513", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001513.tgz", - "integrity": "sha512-pnjGJo7SOOjAGytZZ203Em95MRM8Cr6jhCXNF/FAXTpCTRTECnqQWLpiTRqrFtdYcth8hf4WECUpkezuYsMVww==", + "version": "1.0.30001515", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001515.tgz", + "integrity": "sha512-eEFDwUOZbE24sb+Ecsx3+OvNETqjWIdabMy52oOkIgcUtAsQifjUG9q4U9dgTHJM2mfk4uEPxc0+xuFdJ629QA==", "dev": true, "funding": [ { @@ -6333,9 +6334,9 @@ } }, "node_modules/conventional-changelog-writer/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -6902,9 +6903,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.453", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.453.tgz", - "integrity": "sha512-BU8UtQz6CB3T7RIGhId4BjmjJVXQDujb0+amGL8jpcluFJr6lwspBOvkUbnttfpZCm4zFMHmjrX1QrdPWBBMjQ==", + "version": "1.4.457", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.457.tgz", + "integrity": "sha512-/g3UyNDmDd6ebeWapmAoiyy+Sy2HyJ+/X8KyvNeHfKRFfHaA2W8oF5fxD5F3tjBDcjpwo0iek6YNgxNXDBoEtA==", "dev": true }, "node_modules/elliptic": { @@ -8637,6 +8638,7 @@ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", "dev": true, + "peer": true, "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", @@ -8873,9 +8875,9 @@ } }, "node_modules/git-semver-tags/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -9112,23 +9114,23 @@ } }, "node_modules/hardhat": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.13.1.tgz", - "integrity": "sha512-ZZL7LQxHmbw4JQJsiEv2qE35nbR+isr2sIdtgZVPp0+zWqRkpr1OT7gmvhCNYfjpEPyfjZIxWriQWlphJhVPLQ==", + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.16.1.tgz", + "integrity": "sha512-QpBjGXFhhSYoYBGEHyoau/A63crZOP+i3GbNxzLGkL6IklzT+piN14+wGnINNCg5BLSKisQI/RAySPzaWRcx/g==", "dev": true, "dependencies": { "@ethersproject/abi": "^5.1.2", "@metamask/eth-sig-util": "^4.0.0", - "@nomicfoundation/ethereumjs-block": "5.0.0", - "@nomicfoundation/ethereumjs-blockchain": "7.0.0", - "@nomicfoundation/ethereumjs-common": "4.0.0", - "@nomicfoundation/ethereumjs-evm": "2.0.0", - "@nomicfoundation/ethereumjs-rlp": "5.0.0", - "@nomicfoundation/ethereumjs-statemanager": "2.0.0", - "@nomicfoundation/ethereumjs-trie": "6.0.0", - "@nomicfoundation/ethereumjs-tx": "5.0.0", - "@nomicfoundation/ethereumjs-util": "9.0.0", - "@nomicfoundation/ethereumjs-vm": "7.0.0", + "@nomicfoundation/ethereumjs-block": "5.0.1", + "@nomicfoundation/ethereumjs-blockchain": "7.0.1", + "@nomicfoundation/ethereumjs-common": "4.0.1", + "@nomicfoundation/ethereumjs-evm": "2.0.1", + "@nomicfoundation/ethereumjs-rlp": "5.0.1", + "@nomicfoundation/ethereumjs-statemanager": "2.0.1", + "@nomicfoundation/ethereumjs-trie": "6.0.1", + "@nomicfoundation/ethereumjs-tx": "5.0.1", + "@nomicfoundation/ethereumjs-util": "9.0.1", + "@nomicfoundation/ethereumjs-vm": "7.0.1", "@nomicfoundation/solidity-analyzer": "^0.1.0", "@sentry/node": "^5.18.1", "@types/bn.js": "^5.1.0", @@ -9156,7 +9158,6 @@ "mnemonist": "^0.38.0", "mocha": "^10.0.0", "p-map": "^4.0.0", - "qs": "^6.7.0", "raw-body": "^2.4.1", "resolve": "1.17.0", "semver": "^6.3.0", @@ -9399,16 +9400,16 @@ } }, "node_modules/hardhat/node_modules/@nomicfoundation/ethereumjs-block": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-block/-/ethereumjs-block-5.0.0.tgz", - "integrity": "sha512-DfhVbqM5DjriguuSv6r3TgOpyXC76oX8D/VEODsSwJQ1bZGqu4xLLfYPPTacpCAYOnewzJsZli+Ao9TBTAo2uw==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-block/-/ethereumjs-block-5.0.1.tgz", + "integrity": "sha512-u1Yioemi6Ckj3xspygu/SfFvm8vZEO8/Yx5a1QLzi6nVU0jz3Pg2OmHKJ5w+D9Ogk1vhwRiqEBAqcb0GVhCyHw==", "dev": true, "dependencies": { - "@nomicfoundation/ethereumjs-common": "4.0.0", - "@nomicfoundation/ethereumjs-rlp": "5.0.0", - "@nomicfoundation/ethereumjs-trie": "6.0.0", - "@nomicfoundation/ethereumjs-tx": "5.0.0", - "@nomicfoundation/ethereumjs-util": "9.0.0", + "@nomicfoundation/ethereumjs-common": "4.0.1", + "@nomicfoundation/ethereumjs-rlp": "5.0.1", + "@nomicfoundation/ethereumjs-trie": "6.0.1", + "@nomicfoundation/ethereumjs-tx": "5.0.1", + "@nomicfoundation/ethereumjs-util": "9.0.1", "ethereum-cryptography": "0.1.3", "ethers": "^5.7.1" }, @@ -9440,18 +9441,18 @@ } }, "node_modules/hardhat/node_modules/@nomicfoundation/ethereumjs-blockchain": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-blockchain/-/ethereumjs-blockchain-7.0.0.tgz", - "integrity": "sha512-cVRCrXZminZr0Mbx2hm0/109GZLn1v5bf0/k+SIbGn50yZm6YCdQt9CgGT0Gk56N2vy8NhXD4apo167m4LWk6Q==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-blockchain/-/ethereumjs-blockchain-7.0.1.tgz", + "integrity": "sha512-NhzndlGg829XXbqJEYrF1VeZhAwSPgsK/OB7TVrdzft3y918hW5KNd7gIZ85sn6peDZOdjBsAXIpXZ38oBYE5A==", "dev": true, "dependencies": { - "@nomicfoundation/ethereumjs-block": "5.0.0", - "@nomicfoundation/ethereumjs-common": "4.0.0", - "@nomicfoundation/ethereumjs-ethash": "3.0.0", - "@nomicfoundation/ethereumjs-rlp": "5.0.0", - "@nomicfoundation/ethereumjs-trie": "6.0.0", - "@nomicfoundation/ethereumjs-tx": "5.0.0", - "@nomicfoundation/ethereumjs-util": "9.0.0", + "@nomicfoundation/ethereumjs-block": "5.0.1", + "@nomicfoundation/ethereumjs-common": "4.0.1", + "@nomicfoundation/ethereumjs-ethash": "3.0.1", + "@nomicfoundation/ethereumjs-rlp": "5.0.1", + "@nomicfoundation/ethereumjs-trie": "6.0.1", + "@nomicfoundation/ethereumjs-tx": "5.0.1", + "@nomicfoundation/ethereumjs-util": "9.0.1", "abstract-level": "^1.0.3", "debug": "^4.3.3", "ethereum-cryptography": "0.1.3", @@ -9487,24 +9488,24 @@ } }, "node_modules/hardhat/node_modules/@nomicfoundation/ethereumjs-common": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-common/-/ethereumjs-common-4.0.0.tgz", - "integrity": "sha512-UPpm5FAGAf2B6hQ8aVgO44Rdo0k73oMMCViqNJcKMlk1s9l3rxwuPTp1l20NiGvNO2Pzqk3chFL+BzmLL2g4wQ==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-common/-/ethereumjs-common-4.0.1.tgz", + "integrity": "sha512-OBErlkfp54GpeiE06brBW/TTbtbuBJV5YI5Nz/aB2evTDo+KawyEzPjBlSr84z/8MFfj8wS2wxzQX1o32cev5g==", "dev": true, "dependencies": { - "@nomicfoundation/ethereumjs-util": "9.0.0", + "@nomicfoundation/ethereumjs-util": "9.0.1", "crc-32": "^1.2.0" } }, "node_modules/hardhat/node_modules/@nomicfoundation/ethereumjs-ethash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-ethash/-/ethereumjs-ethash-3.0.0.tgz", - "integrity": "sha512-6zNv5Y3vNIsxjrsbKjMInVpo8cmR0c7yjZbBpy7NYuIMtm0JKhQoXsiFN56t/1sfn9V3v0wgrkAixo5v6bahpA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-ethash/-/ethereumjs-ethash-3.0.1.tgz", + "integrity": "sha512-KDjGIB5igzWOp8Ik5I6QiRH5DH+XgILlplsHR7TEuWANZA759G6krQ6o8bvj+tRUz08YygMQu/sGd9mJ1DYT8w==", "dev": true, "dependencies": { - "@nomicfoundation/ethereumjs-block": "5.0.0", - "@nomicfoundation/ethereumjs-rlp": "5.0.0", - "@nomicfoundation/ethereumjs-util": "9.0.0", + "@nomicfoundation/ethereumjs-block": "5.0.1", + "@nomicfoundation/ethereumjs-rlp": "5.0.1", + "@nomicfoundation/ethereumjs-util": "9.0.1", "abstract-level": "^1.0.3", "bigint-crypto-utils": "^3.0.23", "ethereum-cryptography": "0.1.3" @@ -9537,15 +9538,15 @@ } }, "node_modules/hardhat/node_modules/@nomicfoundation/ethereumjs-evm": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-evm/-/ethereumjs-evm-2.0.0.tgz", - "integrity": "sha512-D+tr3M9sictopr3E20OVgme7YF/d0fU566WKh+ofXwmxapz/Dd8RSLSaVeKgfCI2BkzVA+XqXY08NNCV8w8fWA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-evm/-/ethereumjs-evm-2.0.1.tgz", + "integrity": "sha512-oL8vJcnk0Bx/onl+TgQOQ1t/534GKFaEG17fZmwtPFeH8S5soiBYPCLUrvANOl4sCp9elYxIMzIiTtMtNNN8EQ==", "dev": true, "dependencies": { "@ethersproject/providers": "^5.7.1", - "@nomicfoundation/ethereumjs-common": "4.0.0", - "@nomicfoundation/ethereumjs-tx": "5.0.0", - "@nomicfoundation/ethereumjs-util": "9.0.0", + "@nomicfoundation/ethereumjs-common": "4.0.1", + "@nomicfoundation/ethereumjs-tx": "5.0.1", + "@nomicfoundation/ethereumjs-util": "9.0.1", "debug": "^4.3.3", "ethereum-cryptography": "0.1.3", "mcl-wasm": "^0.7.1", @@ -9579,9 +9580,9 @@ } }, "node_modules/hardhat/node_modules/@nomicfoundation/ethereumjs-rlp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-rlp/-/ethereumjs-rlp-5.0.0.tgz", - "integrity": "sha512-U1A0y330PtGb8Wft4yPVv0myWYJTesi89ItGoB0ICdqz7793KmUhpfQb2vJUXBi98wSdnxkIABO/GmsQvGKVDw==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-rlp/-/ethereumjs-rlp-5.0.1.tgz", + "integrity": "sha512-xtxrMGa8kP4zF5ApBQBtjlSbN5E2HI8m8FYgVSYAnO6ssUoY5pVPGy2H8+xdf/bmMa22Ce8nWMH3aEW8CcqMeQ==", "dev": true, "bin": { "rlp": "bin/rlp" @@ -9591,13 +9592,13 @@ } }, "node_modules/hardhat/node_modules/@nomicfoundation/ethereumjs-statemanager": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-statemanager/-/ethereumjs-statemanager-2.0.0.tgz", - "integrity": "sha512-tgXtsx8yIDlxWMN+ThqPtGK0ITAuITrDy+GYIgGrnT6ZtelvXWM7SUYR0Mcv578lmGCoIwyHFtSBqOkOBYHLjw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-statemanager/-/ethereumjs-statemanager-2.0.1.tgz", + "integrity": "sha512-B5ApMOnlruVOR7gisBaYwFX+L/AP7i/2oAahatssjPIBVDF6wTX1K7Qpa39E/nzsH8iYuL3krkYeUFIdO3EMUQ==", "dev": true, "dependencies": { - "@nomicfoundation/ethereumjs-common": "4.0.0", - "@nomicfoundation/ethereumjs-rlp": "5.0.0", + "@nomicfoundation/ethereumjs-common": "4.0.1", + "@nomicfoundation/ethereumjs-rlp": "5.0.1", "debug": "^4.3.3", "ethereum-cryptography": "0.1.3", "ethers": "^5.7.1", @@ -9628,13 +9629,13 @@ } }, "node_modules/hardhat/node_modules/@nomicfoundation/ethereumjs-trie": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-trie/-/ethereumjs-trie-6.0.0.tgz", - "integrity": "sha512-YqPWiNxrZvL+Ef7KHqgru1IlaIGXhu78wd2fxNFOvi/NAQBF845dVfTKKXs1L9x0QBRRQRephgxHCKMuISGppw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-trie/-/ethereumjs-trie-6.0.1.tgz", + "integrity": "sha512-A64It/IMpDVODzCgxDgAAla8jNjNtsoQZIzZUfIV5AY6Coi4nvn7+VReBn5itlxMiL2yaTlQr9TRWp3CSI6VoA==", "dev": true, "dependencies": { - "@nomicfoundation/ethereumjs-rlp": "5.0.0", - "@nomicfoundation/ethereumjs-util": "9.0.0", + "@nomicfoundation/ethereumjs-rlp": "5.0.1", + "@nomicfoundation/ethereumjs-util": "9.0.1", "@types/readable-stream": "^2.3.13", "ethereum-cryptography": "0.1.3", "readable-stream": "^3.6.0" @@ -9667,16 +9668,16 @@ } }, "node_modules/hardhat/node_modules/@nomicfoundation/ethereumjs-tx": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-tx/-/ethereumjs-tx-5.0.0.tgz", - "integrity": "sha512-LTyxI+zBJ+HuEBblUGbxvfKl1hg1uJlz2XhnszNagiBWQSgLb1vQCa1QaXV5Q8cUDYkr/Xe4NXWiUGEvH4e6lA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-tx/-/ethereumjs-tx-5.0.1.tgz", + "integrity": "sha512-0HwxUF2u2hrsIM1fsasjXvlbDOq1ZHFV2dd1yGq8CA+MEYhaxZr8OTScpVkkxqMwBcc5y83FyPl0J9MZn3kY0w==", "dev": true, "dependencies": { "@chainsafe/ssz": "^0.9.2", "@ethersproject/providers": "^5.7.2", - "@nomicfoundation/ethereumjs-common": "4.0.0", - "@nomicfoundation/ethereumjs-rlp": "5.0.0", - "@nomicfoundation/ethereumjs-util": "9.0.0", + "@nomicfoundation/ethereumjs-common": "4.0.1", + "@nomicfoundation/ethereumjs-rlp": "5.0.1", + "@nomicfoundation/ethereumjs-util": "9.0.1", "ethereum-cryptography": "0.1.3" }, "engines": { @@ -9707,13 +9708,13 @@ } }, "node_modules/hardhat/node_modules/@nomicfoundation/ethereumjs-util": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-util/-/ethereumjs-util-9.0.0.tgz", - "integrity": "sha512-9EG98CsEC9BnI7AY27F4QXZ8Vf0re8R9XoxQ0//KWF+B7quu6GQvgTq1RlNUjGh/XNCCJNf8E3LOY9ULR85wFQ==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-util/-/ethereumjs-util-9.0.1.tgz", + "integrity": "sha512-TwbhOWQ8QoSCFhV/DDfSmyfFIHjPjFBj957219+V3jTZYZ2rf9PmDtNOeZWAE3p3vlp8xb02XGpd0v6nTUPbsA==", "dev": true, "dependencies": { "@chainsafe/ssz": "^0.10.0", - "@nomicfoundation/ethereumjs-rlp": "5.0.0", + "@nomicfoundation/ethereumjs-rlp": "5.0.1", "ethereum-cryptography": "0.1.3" }, "engines": { @@ -9754,20 +9755,20 @@ } }, "node_modules/hardhat/node_modules/@nomicfoundation/ethereumjs-vm": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-vm/-/ethereumjs-vm-7.0.0.tgz", - "integrity": "sha512-eHkEoe/4r4+g+fZyIIlQjBHEjCPFs8CHiIEEMvMfvFrV4hyHnuTg4LH7l92ok7TGZqpWxgMG2JOEUFkNsXrKuQ==", - "dev": true, - "dependencies": { - "@nomicfoundation/ethereumjs-block": "5.0.0", - "@nomicfoundation/ethereumjs-blockchain": "7.0.0", - "@nomicfoundation/ethereumjs-common": "4.0.0", - "@nomicfoundation/ethereumjs-evm": "2.0.0", - "@nomicfoundation/ethereumjs-rlp": "5.0.0", - "@nomicfoundation/ethereumjs-statemanager": "2.0.0", - "@nomicfoundation/ethereumjs-trie": "6.0.0", - "@nomicfoundation/ethereumjs-tx": "5.0.0", - "@nomicfoundation/ethereumjs-util": "9.0.0", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-vm/-/ethereumjs-vm-7.0.1.tgz", + "integrity": "sha512-rArhyn0jPsS/D+ApFsz3yVJMQ29+pVzNZ0VJgkzAZ+7FqXSRtThl1C1prhmlVr3YNUlfpZ69Ak+RUT4g7VoOuQ==", + "dev": true, + "dependencies": { + "@nomicfoundation/ethereumjs-block": "5.0.1", + "@nomicfoundation/ethereumjs-blockchain": "7.0.1", + "@nomicfoundation/ethereumjs-common": "4.0.1", + "@nomicfoundation/ethereumjs-evm": "2.0.1", + "@nomicfoundation/ethereumjs-rlp": "5.0.1", + "@nomicfoundation/ethereumjs-statemanager": "2.0.1", + "@nomicfoundation/ethereumjs-trie": "6.0.1", + "@nomicfoundation/ethereumjs-tx": "5.0.1", + "@nomicfoundation/ethereumjs-util": "9.0.1", "debug": "^4.3.3", "ethereum-cryptography": "0.1.3", "mcl-wasm": "^0.7.1", @@ -9813,9 +9814,9 @@ } }, "node_modules/hardhat/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -9870,6 +9871,7 @@ "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", "dev": true, + "peer": true, "engines": { "node": ">= 0.4" }, @@ -9882,6 +9884,7 @@ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true, + "peer": true, "engines": { "node": ">= 0.4" }, @@ -10245,9 +10248,9 @@ } }, "node_modules/immutable": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.0.tgz", - "integrity": "sha512-0AOCmOip+xgJwEVTQj1EfiDDOkPmuyllDuTuEX+DDXUgapLAsBIfkg3sxCYyCEA8mQqZrrxPUGjcOQ2JS3WLkg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.1.tgz", + "integrity": "sha512-lj9cnmB/kVS0QHsJnYKD1uo3o39nrbKxszjnqS9Fr6NB7bZzW45U6WSGBPKXDL/CvDKqDNPA4r3DoDQ8GTxo2A==", "dev": true }, "node_modules/import-fresh": { @@ -11042,9 +11045,9 @@ } }, "node_modules/istanbul-lib-instrument/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -12912,9 +12915,9 @@ } }, "node_modules/make-dir/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -13238,9 +13241,9 @@ } }, "node_modules/meow/node_modules/read-pkg/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, "bin": { "semver": "bin/semver" @@ -14081,9 +14084,9 @@ } }, "node_modules/node-environment-flags/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, "peer": true, "bin": { @@ -14884,6 +14887,7 @@ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", "dev": true, + "peer": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -15296,16 +15300,16 @@ } }, "node_modules/pacote/node_modules/glob": { - "version": "10.3.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.1.tgz", - "integrity": "sha512-9BKYcEeIs7QwlCYs+Y3GBvqAMISufUS0i2ELd11zpZjxI5V9iyRj0HgzB5/cLf2NY4vcYBTYzJ7GIui7j/4DOw==", + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", "dev": true, "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^2.0.3", "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2", - "path-scurry": "^1.10.0" + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" }, "bin": { "glob": "dist/cjs/src/bin.js" @@ -15318,9 +15322,9 @@ } }, "node_modules/pacote/node_modules/glob/node_modules/minipass": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-6.0.2.tgz", - "integrity": "sha512-MzWSV5nYVT7mVyWCwn2o7JH13w2TBRmmSqSRCKzTw+lmft9X4z+3wjvs06Tzijo5z4W/kahUCDpRXTF+ZrmF/w==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.2.tgz", + "integrity": "sha512-eL79dXrE1q9dBbDCLg7xfn/vl7MS4F1gvJAgjJrQli/jbQWdUttuVawphqpffoIYfRdq78LHx6GP4bU/EQ2ATA==", "dev": true, "engines": { "node": ">=16 || 14 >=14.17" @@ -15552,13 +15556,13 @@ "dev": true }, "node_modules/path-scurry": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.0.tgz", - "integrity": "sha512-tZFEaRQbMLjwrsmidsGJ6wDMv0iazJWk6SfIKnY4Xru8auXgmJkOBa5DUbYFcFD2Rzk2+KDlIiF0GVXNCbgC7g==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", "dev": true, "dependencies": { "lru-cache": "^9.1.1 || ^10.0.0", - "minipass": "^5.0.0 || ^6.0.2" + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { "node": ">=16 || 14 >=14.17" @@ -15950,9 +15954,9 @@ } }, "node_modules/prettier-plugin-solidity/node_modules/@solidity-parser/parser": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.16.0.tgz", - "integrity": "sha512-ESipEcHyRHg4Np4SqBCfcXwyxxna1DgFVz69bgpLV8vzl/NP1DtcKsJ4dJZXWQhY/Z4J2LeKBiOkOVZn9ct33Q==", + "version": "0.16.1", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.16.1.tgz", + "integrity": "sha512-PdhRFNhbTtu3x8Axm0uYpqOy/lODYQK+MlYSgqIsq2L8SFYEHJPHNUiOTAJbDGzNjjr1/n9AcIayxafR/fWmYw==", "dev": true, "dependencies": { "antlr4ts": "^0.5.0-alpha.4" @@ -16375,18 +16379,13 @@ } }, "node_modules/qs": { - "version": "6.11.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", - "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", "dev": true, - "dependencies": { - "side-channel": "^1.0.4" - }, + "peer": true, "engines": { "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" } }, "node_modules/queue-microtask": { @@ -16680,9 +16679,9 @@ } }, "node_modules/read-pkg/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, "bin": { "semver": "bin/semver" @@ -16908,16 +16907,6 @@ "node": ">= 0.12" } }, - "node_modules/request/node_modules/qs": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", - "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", - "dev": true, - "peer": true, - "engines": { - "node": ">=0.6" - } - }, "node_modules/request/node_modules/uuid": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", @@ -17432,9 +17421,9 @@ } }, "node_modules/semver": { - "version": "7.5.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", - "integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -17574,6 +17563,7 @@ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", "dev": true, + "peer": true, "dependencies": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", @@ -17761,9 +17751,9 @@ } }, "node_modules/solc/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, "bin": { "semver": "bin/semver" @@ -17826,9 +17816,9 @@ } }, "node_modules/solhint/node_modules/@solidity-parser/parser": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.16.0.tgz", - "integrity": "sha512-ESipEcHyRHg4Np4SqBCfcXwyxxna1DgFVz69bgpLV8vzl/NP1DtcKsJ4dJZXWQhY/Z4J2LeKBiOkOVZn9ct33Q==", + "version": "0.16.1", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.16.1.tgz", + "integrity": "sha512-PdhRFNhbTtu3x8Axm0uYpqOy/lODYQK+MlYSgqIsq2L8SFYEHJPHNUiOTAJbDGzNjjr1/n9AcIayxafR/fWmYw==", "dev": true, "dependencies": { "antlr4ts": "^0.5.0-alpha.4" @@ -17960,9 +17950,9 @@ } }, "node_modules/solhint/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -18028,9 +18018,9 @@ } }, "node_modules/solidity-coverage/node_modules/@solidity-parser/parser": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.16.0.tgz", - "integrity": "sha512-ESipEcHyRHg4Np4SqBCfcXwyxxna1DgFVz69bgpLV8vzl/NP1DtcKsJ4dJZXWQhY/Z4J2LeKBiOkOVZn9ct33Q==", + "version": "0.16.1", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.16.1.tgz", + "integrity": "sha512-PdhRFNhbTtu3x8Axm0uYpqOy/lODYQK+MlYSgqIsq2L8SFYEHJPHNUiOTAJbDGzNjjr1/n9AcIayxafR/fWmYw==", "dev": true, "peer": true, "dependencies": { @@ -20291,9 +20281,9 @@ "peer": true }, "node_modules/which-typed-array": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", - "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.10.tgz", + "integrity": "sha512-uxoA5vLUfRPdjCuJ1h5LlYdmTLbYfums398v3WLkM+i/Wltl2/XyZpQWKbN++ck5L64SR/grOHqtXCUKmlZPNA==", "dev": true, "peer": true, "dependencies": { @@ -20524,9 +20514,9 @@ } }, "node_modules/write-json-file/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, "bin": { "semver": "bin/semver" diff --git a/package.json b/package.json index bc98461ab..de034c3b4 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "decimal.js": "^10.4.3", "dotenv": "^10.0.0", "ethers": "5.7.2", - "hardhat": "2.13.1", + "hardhat": "2.16.1", "hardhat-contract-sizer": "^2.8.0", "hardhat-dependency-compiler": "1.1.2", "hardhat-output-validator": "^0.1.19", From 235d062946c041fa5440ef747b39536435d66a44 Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Wed, 12 Jul 2023 15:53:52 +0300 Subject: [PATCH 3/3] [Core] update docs --- docs/Contracts/Core/AlgebraCommunityVault.md | 225 +++++++++++++++++- docs/Contracts/Core/AlgebraFactory.md | 108 ++++++--- .../Contracts/Core/AlgebraFeeConfiguration.md | 22 -- docs/Contracts/Core/AlgebraPool.md | 75 ++++-- docs/Contracts/Core/AlgebraPoolBase.md | 77 +++--- docs/Contracts/Core/AlgebraPoolDeployer.md | 10 +- docs/Contracts/Core/DataStorage.md | 14 -- docs/Contracts/Core/DataStorageOperator.md | 174 -------------- docs/Contracts/Core/DerivedState.md | 41 ---- .../Core/IAlgebraDynamicFeePlugin.md | 35 +++ docs/Contracts/Core/IAlgebraFactory.md | 186 +++++++++++---- docs/Contracts/Core/IAlgebraPlugin.md | 224 +++++++++++++++++ docs/Contracts/Core/IAlgebraPluginFactory.md | 37 +++ docs/Contracts/Core/IAlgebraPoolActions.md | 29 ++- docs/Contracts/Core/IAlgebraPoolDeployer.md | 10 +- .../Core/IAlgebraPoolDerivedState.md | 44 ---- docs/Contracts/Core/IAlgebraPoolErrors.md | 41 ++-- docs/Contracts/Core/IAlgebraPoolEvents.md | 36 +-- docs/Contracts/Core/IAlgebraPoolImmutables.md | 18 +- .../Core/IAlgebraPoolPermissionedActions.md | 152 +++++++----- docs/Contracts/Core/IAlgebraPoolState.md | 199 ++++++++-------- docs/Contracts/Core/IAlgebraVirtualPool.md | 40 ---- docs/Contracts/Core/IDataStorageOperator.md | 176 -------------- docs/Contracts/Core/PoolMockEchidna.md | 150 ++++++++++++ docs/Contracts/Core/Positions.md | 1 + docs/Contracts/Core/ReservesManager.md | 1 + 26 files changed, 1234 insertions(+), 891 deletions(-) delete mode 100644 docs/Contracts/Core/AlgebraFeeConfiguration.md delete mode 100644 docs/Contracts/Core/DataStorage.md delete mode 100644 docs/Contracts/Core/DataStorageOperator.md delete mode 100644 docs/Contracts/Core/DerivedState.md create mode 100644 docs/Contracts/Core/IAlgebraDynamicFeePlugin.md create mode 100644 docs/Contracts/Core/IAlgebraPlugin.md create mode 100644 docs/Contracts/Core/IAlgebraPluginFactory.md delete mode 100644 docs/Contracts/Core/IAlgebraPoolDerivedState.md delete mode 100644 docs/Contracts/Core/IAlgebraVirtualPool.md delete mode 100644 docs/Contracts/Core/IDataStorageOperator.md create mode 100644 docs/Contracts/Core/PoolMockEchidna.md diff --git a/docs/Contracts/Core/AlgebraCommunityVault.md b/docs/Contracts/Core/AlgebraCommunityVault.md index 0d6162e47..f10c4819a 100644 --- a/docs/Contracts/Core/AlgebraCommunityVault.md +++ b/docs/Contracts/Core/AlgebraCommunityVault.md @@ -7,8 +7,21 @@ Algebra community fee vault Community fee from pools is sent here, if it is enabled +*Developer note: Role system is used to withdraw tokens +Version: Algebra Integral* ## Modifiers +### onlyFactoryOwner + + +`modifier onlyFactoryOwner()` internal + + + + + + + ### onlyWithdrawer @@ -20,6 +33,17 @@ Community fee from pools is sent here, if it is enabled +### onlyAlgebraFeeManager + + +`modifier onlyAlgebraFeeManager()` internal + + + + + + + ## Events ### TokensWithdrawal @@ -27,15 +51,73 @@ Community fee from pools is sent here, if it is enabled `event TokensWithdrawal(address token, address to, uint256 amount)` +Event emitted when a fees has been claimed +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | address | The address of token fee | +| to | address | The address where claimed rewards were sent to | +| amount | uint256 | The amount of fees tokens claimed by communityFeeReceiver | + + +### AlgebraTokensWithdrawal + + +`event AlgebraTokensWithdrawal(address token, address to, uint256 amount)` + +Event emitted when a fees has been claimed + + | Name | Type | Description | | ---- | ---- | ----------- | -| token | address | | -| to | address | | -| amount | uint256 | | +| token | address | The address of token fee | +| to | address | The address where claimed rewards were sent to | +| amount | uint256 | The amount of fees tokens claimed by Algebra | + + +### AlgebraFeeReceiver + + +`event AlgebraFeeReceiver(address newAlgebraFeeReceiver)` + +Emitted when a AlgebraFeeReceiver address changed + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| newAlgebraFeeReceiver | address | New Algebra fee receiver address | + + +### AlgebraFee + + +`event AlgebraFee(uint16 newAlgebraFee)` + +Emitted when the Algebra fee is changed + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| newAlgebraFee | uint16 | The new Algebra fee value | + + +### CommunityFeeReceiver + + +`event CommunityFeeReceiver(address newCommunityFeeReceiver)` + +Emitted when a CommunityFeeReceiver address changed + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| newCommunityFeeReceiver | address | New fee receiver address | @@ -45,33 +127,61 @@ Community fee from pools is sent here, if it is enabled *Developer note: The role can be granted in AlgebraFactory* +### address communityFeeReceiver + +Address to which protocol commissions are sent from vault + +### uint16 algebraFee + +The percentage of the protocol fee that Algebra will receive + +*Developer note: Value in thousandths,i.e. 1e-3* +### bool hasNewAlgebraFeeProposal + +Represents whether there is a new Algebra fee proposal or not + +### uint16 proposedNewAlgebraFee + +Suggested Algebra fee value + +### address algebraFeeReceiver + +Address of recipient Algebra part of community fee + +### address algebraFeeManager + +Address of Algebra fee manager + ## Functions ### constructor -`constructor() public` public +`constructor(address _algebraFeeManager) public` public +| Name | Type | Description | +| ---- | ---- | ----------- | +| _algebraFeeManager | address | | ### withdraw -`function withdraw(address token, address to, uint256 amount) external` external - +`function withdraw(address token, uint256 amount) external` external +Withdraw protocol fees from vault +*Developer note: Can only be called by algebraFeeManager or communityFeeReceiver* | Name | Type | Description | | ---- | ---- | ----------- | -| token | address | | -| to | address | | -| amount | uint256 | | +| token | address | The token address | +| amount | uint256 | The amount of token | ### withdrawTokens @@ -79,13 +189,108 @@ Community fee from pools is sent here, if it is enabled `function withdrawTokens(struct AlgebraCommunityVault.WithdrawTokensParams[] params) external` external +Withdraw protocol fees from vault. Used to claim fees for multiple tokens +*Developer note: Can be called by algebraFeeManager or communityFeeReceiver* + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| params | struct AlgebraCommunityVault.WithdrawTokensParams[] | Array of WithdrawTokensParams objects containing token addresses and amounts to withdraw | + + +### acceptAlgebraFeeChangeProposal + + +`function acceptAlgebraFeeChangeProposal(uint16 newAlgebraFee) external` external + +Accepts the proposed new Algebra fee +*Developer note: Can only be called by the factory owner* + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| newAlgebraFee | uint16 | New Algebra fee value | + + +### changeCommunityFeeReceiver + + +`function changeCommunityFeeReceiver(address newCommunityFeeReceiver) external` external + +Change community fee receiver address +*Developer note: Can only be called by the factory owner* + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| newCommunityFeeReceiver | address | New community fee receiver address | + + +### transferAlgebraFeeManagerRole + + +`function transferAlgebraFeeManagerRole(address _newAlgebraFeeManager) external` external + +Transfers Algebra fee manager role + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| _newAlgebraFeeManager | address | new Algebra fee manager address | + + +### acceptAlgebraFeeManagerRole + + +`function acceptAlgebraFeeManagerRole() external` external + +Accept Algebra fee manager role + + + + + +### proposeAlgebraFeeChange + + +`function proposeAlgebraFeeChange(uint16 newAlgebraFee) external` external + +Suggests new Algebra fee value + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| newAlgebraFee | uint16 | new Algebra fee value | + + +### cancelAlgebraFeeChangeProposal + + +`function cancelAlgebraFeeChangeProposal() external` external + +Cancels Algebra fee change proposal + + + + + +### changeAlgebraFeeReceiver + + +`function changeAlgebraFeeReceiver(address newAlgebraFeeReceiver) external` external +Change Algebra community fee part receiver | Name | Type | Description | | ---- | ---- | ----------- | -| params | struct AlgebraCommunityVault.WithdrawTokensParams[] | | +| newAlgebraFeeReceiver | address | The address of new Algebra fee receiver | diff --git a/docs/Contracts/Core/AlgebraFactory.md b/docs/Contracts/Core/AlgebraFactory.md index d8ba3cd8d..1cd655323 100644 --- a/docs/Contracts/Core/AlgebraFactory.md +++ b/docs/Contracts/Core/AlgebraFactory.md @@ -5,9 +5,9 @@ Algebra factory -Is used to deploy pools and its dataStorages +Is used to deploy pools and its plugins -*Developer note: Version: Algebra V2.1* +*Developer note: Version: Algebra Integral* @@ -24,24 +24,26 @@ Returns the current poolDeployerAddress Returns the current communityVaultAddress -### address farmingAddress +### uint16 defaultCommunityFee +Returns the default community fee +### uint16 defaultFee -*Developer note: Is retrieved from the pools to restrict calling certain functions not by a tokenomics contract* -### uint8 defaultCommunityFee +Returns the default fee -Returns the default community fee +### int24 defaultTickspacing -### uint256 renounceOwnershipStartTimestamp +Returns the default tickspacing +### uint256 renounceOwnershipStartTimestamp -### struct AlgebraFeeConfiguration defaultFeeConfiguration +### contract IAlgebraPluginFactory defaultPluginFactory +Return the current pluginFactory address -*Developer note: values of constants for sigmoids in fee calculation formula* ### mapping(address => mapping(address => address)) poolByPair Returns the pool address for a given pair of tokens, or address 0 if it does not exist @@ -85,21 +87,59 @@ Returns the current owner of the factory `function hasRoleOrOwner(bytes32 role, address account) public view returns (bool)` view public +Returns `true` if `account` has been granted `role` or `account` is owner. + -*Developer note: Returns `true` if `account` has been granted `role` or `account` is owner.* +| Name | Type | Description | +| ---- | ---- | ----------- | +| role | bytes32 | The hash corresponding to the role | +| account | address | The address for which the role is checked | +**Returns:** | Name | Type | Description | | ---- | ---- | ----------- | -| role | bytes32 | | -| account | address | | +| [0] | bool | bool Whether the address has this role or the owner role or not | + +### defaultConfigurationForPool + + +`function defaultConfigurationForPool() external view returns (uint16 communityFee, int24 tickSpacing, uint16 fee)` view external + +Returns the default communityFee and tickspacing + + + **Returns:** | Name | Type | Description | | ---- | ---- | ----------- | -| [0] | bool | | +| communityFee | uint16 | which will be set at the creation of the pool | +| tickSpacing | int24 | which will be set at the creation of the pool | +| fee | uint16 | which will be set at the creation of the pool | + +### computePoolAddress + + +`function computePoolAddress(address token0, address token1) public view returns (address pool)` view public + +Deterministically computes the pool address given the token0 and token1 +*Developer note: The method does not check if such a pool has been created* + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| token0 | address | first token | +| token1 | address | second token | + +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| pool | address | The contract address of the Algebra pool | ### createPool @@ -123,50 +163,64 @@ The call will revert if the pool already exists or the token arguments are inval | ---- | ---- | ----------- | | pool | address | The address of the newly created pool | -### setFarmingAddress +### setDefaultCommunityFee -`function setFarmingAddress(address newFarmingAddress) external` external +`function setDefaultCommunityFee(uint16 newDefaultCommunityFee) external` external -*Developer note: updates tokenomics address on the factory* +*Developer note: updates default community fee for new pools* | Name | Type | Description | | ---- | ---- | ----------- | -| newFarmingAddress | address | The new tokenomics contract address | +| newDefaultCommunityFee | uint16 | The new community fee, _must_ be <= MAX_COMMUNITY_FEE | -### setDefaultCommunityFee +### setDefaultFee -`function setDefaultCommunityFee(uint8 newDefaultCommunityFee) external` external +`function setDefaultFee(uint16 newDefaultFee) external` external -*Developer note: updates default community fee for new pools* +*Developer note: updates default fee for new pools* + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| newDefaultFee | uint16 | The new fee, _must_ be <= MAX_DEFAULT_FEE | + + +### setDefaultTickspacing + + +`function setDefaultTickspacing(int24 newDefaultTickspacing) external` external + + +*Developer note: updates default tickspacing for new pools* | Name | Type | Description | | ---- | ---- | ----------- | -| newDefaultCommunityFee | uint8 | The new community fee, _must_ be <= MAX_COMMUNITY_FEE | +| newDefaultTickspacing | int24 | The new tickspacing, _must_ be <= MAX_TICK_SPACING and >= MIN_TICK_SPACING | + +### setDefaultPluginFactory -### setDefaultFeeConfiguration +`function setDefaultPluginFactory(address newDefaultPluginFactory) external` external -`function setDefaultFeeConfiguration(struct AlgebraFeeConfiguration newConfig) external` external -Changes initial fee configuration for new pools -*Developer note: changes coefficients for sigmoids: α / (1 + e^( (β-x) / γ)) -alpha1 + alpha2 + baseFee (max possible fee) must be <= type(uint16).max and gammas must be > 0* +*Developer note: updates pluginFactory address* | Name | Type | Description | | ---- | ---- | ----------- | -| newConfig | struct AlgebraFeeConfiguration | new default fee configuration. See the #AdaptiveFee.sol library for details | +| newDefaultPluginFactory | address | address of new plugin factory | ### startRenounceOwnership diff --git a/docs/Contracts/Core/AlgebraFeeConfiguration.md b/docs/Contracts/Core/AlgebraFeeConfiguration.md deleted file mode 100644 index 20b55c176..000000000 --- a/docs/Contracts/Core/AlgebraFeeConfiguration.md +++ /dev/null @@ -1,22 +0,0 @@ -# AlgebraFeeConfiguration - - - - - - - - - - -```solidity -struct AlgebraFeeConfiguration { - uint16 alpha1; - uint16 alpha2; - uint32 beta1; - uint32 beta2; - uint16 gamma1; - uint16 gamma2; - uint16 baseFee; -} -``` diff --git a/docs/Contracts/Core/AlgebraPool.md b/docs/Contracts/Core/AlgebraPool.md index dab34b3bd..2dac6f4d2 100644 --- a/docs/Contracts/Core/AlgebraPool.md +++ b/docs/Contracts/Core/AlgebraPool.md @@ -7,7 +7,7 @@ Algebra concentrated liquidity pool This contract is responsible for liquidity positions, swaps and flashloans -*Developer note: Version: Algebra V2.1* +*Developer note: Version: Algebra Integral* @@ -26,28 +26,28 @@ Initialization should be done in one transaction with pool creation to avoid fro | Name | Type | Description | | ---- | ---- | ----------- | -| initialPrice | uint160 | | +| initialPrice | uint160 | The initial sqrt price of the pool as a Q64.96 | ### mint -`function mint(address sender, address recipient, int24 bottomTick, int24 topTick, uint128 liquidityDesired, bytes data) external returns (uint256 amount0, uint256 amount1, uint128 liquidityActual)` external +`function mint(address leftoversRecipient, address recipient, int24 bottomTick, int24 topTick, uint128 liquidityDesired, bytes data) external returns (uint256 amount0, uint256 amount1, uint128 liquidityActual)` external Adds liquidity for the given recipient/bottomTick/topTick position *Developer note: The caller of this method receives a callback in the form of IAlgebraMintCallback# AlgebraMintCallback in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends -on bottomTick, topTick, the amount of liquidity, and the current price. If bottomTick == topTick position is treated as a limit order* +on bottomTick, topTick, the amount of liquidity, and the current price.* | Name | Type | Description | | ---- | ---- | ----------- | -| sender | address | The address which will receive potential surplus of paid tokens | +| leftoversRecipient | address | The address which will receive potential surplus of paid tokens | | recipient | address | The address for which the liquidity will be created | | bottomTick | int24 | The lower tick of the position in which to add liquidity | | topTick | int24 | The upper tick of the position in which to add liquidity | -| liquidityDesired | uint128 | | +| liquidityDesired | uint128 | The desired amount of liquidity to mint | | data | bytes | Any data that should be passed through to the callback | **Returns:** @@ -61,7 +61,7 @@ on bottomTick, topTick, the amount of liquidity, and the current price. If botto ### burn -`function burn(int24 bottomTick, int24 topTick, uint128 amount) external returns (uint256 amount0, uint256 amount1)` external +`function burn(int24 bottomTick, int24 topTick, uint128 amount, bytes data) external returns (uint256 amount0, uint256 amount1)` external Burn liquidity from the sender and account tokens owed for the liquidity to the position *Developer note: Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0 @@ -74,6 +74,7 @@ Fees must be collected separately via a call to #collect* | bottomTick | int24 | The lower tick of the position for which to burn liquidity | | topTick | int24 | The upper tick of the position for which to burn liquidity | | amount | uint128 | How much liquidity to burn | +| data | bytes | Any data that should be passed through to the plugin | **Returns:** @@ -135,22 +136,24 @@ Swap token0 for token1, or token1 for token0 | amount0 | int256 | The delta of the balance of token0 of the pool, exact when negative, minimum when positive | | amount1 | int256 | The delta of the balance of token1 of the pool, exact when negative, minimum when positive | -### swapSupportingFeeOnInputTokens +### swapWithPaymentInAdvance -`function swapSupportingFeeOnInputTokens(address sender, address recipient, bool zeroToOne, int256 amountRequired, uint160 limitSqrtPrice, bytes data) external returns (int256 amount0, int256 amount1)` external +`function swapWithPaymentInAdvance(address leftoversRecipient, address recipient, bool zeroToOne, int256 amountToSell, uint160 limitSqrtPrice, bytes data) external returns (int256 amount0, int256 amount1)` external -Swap token0 for token1, or token1 for token0 (tokens that have fee on transfer) -*Developer note: The caller of this method receives a callback in the form of IAlgebraSwapCallback#AlgebraSwapCallback* +Swap token0 for token1, or token1 for token0 with prepayment +*Developer note: The caller of this method receives a callback in the form of IAlgebraSwapCallback#AlgebraSwapCallback +caller must send tokens in callback before swap calculation +the actually sent amount of tokens is used for further calculations* | Name | Type | Description | | ---- | ---- | ----------- | -| sender | address | The address called this function (Comes from the Router) | +| leftoversRecipient | address | The address which will receive potential surplus of paid tokens | | recipient | address | The address to receive the output of the swap | | zeroToOne | bool | The direction of the swap, true for token0 to token1, false for token1 to token0 | -| amountRequired | int256 | The amount of the swap, which implicitly configures the swap as exact input | +| amountToSell | int256 | The amount of the swap, only positive (exact input) amount allowed | | limitSqrtPrice | uint160 | The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this value after the swap. If one for zero, the price cannot be greater than this value after the swap | | data | bytes | Any data to be passed through to the callback. If using the Router it should contain SwapRouter#SwapCallbackData | @@ -184,21 +187,21 @@ If there are no in-range liquidity providers, the fee will be transferred to the ### setCommunityFee -`function setCommunityFee(uint8 newCommunityFee) external` external +`function setCommunityFee(uint16 newCommunityFee) external` external -Set the community's % share of the fees. Cannot exceed 25% (250). Only factory owner or POOLS_ADMINISTRATOR_ROLE role +Set the community's % share of the fees. Only factory owner or POOLS_ADMINISTRATOR_ROLE role | Name | Type | Description | | ---- | ---- | ----------- | -| newCommunityFee | uint8 | | +| newCommunityFee | uint16 | The new community fee percent in thousandths (1e-3) | ### setTickSpacing -`function setTickSpacing(int24 newTickSpacing, int24 newTickspacingLimitOrders) external` external +`function setTickSpacing(int24 newTickSpacing) external` external Set the new tick spacing values. Only factory owner or POOLS_ADMINISTRATOR_ROLE role @@ -207,21 +210,49 @@ Set the new tick spacing values. Only factory owner or POOLS_ADMINISTRATOR_ROLE | Name | Type | Description | | ---- | ---- | ----------- | | newTickSpacing | int24 | The new tick spacing value | -| newTickspacingLimitOrders | int24 | | -### setIncentive +### setPlugin + + +`function setPlugin(address newPluginAddress) external` external + +Set the new plugin address. Only factory owner or POOLS_ADMINISTRATOR_ROLE role + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| newPluginAddress | address | The new plugin address | + + +### setPluginConfig + + +`function setPluginConfig(uint8 newConfig) external` external + +Set new plugin config + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| newConfig | uint8 | In the new configuration of the plugin, each bit of which is responsible for a particular hook. Only factory owner or POOLS_ADMINISTRATOR_ROLE role | + + +### setFee -`function setIncentive(address newIncentiveAddress) external` external +`function setFee(uint16 newFee) external` external -Sets an active incentive. Only farming +Set new pool fee. Can be called by owner if dynamic fee is disabled. +Called by the plugin if dynamic fee is enabled | Name | Type | Description | | ---- | ---- | ----------- | -| newIncentiveAddress | address | The address associated with the incentive | +| newFee | uint16 | The new fee value | diff --git a/docs/Contracts/Core/AlgebraPoolBase.md b/docs/Contracts/Core/AlgebraPoolBase.md index 5de4fe87a..e1b6bd92e 100644 --- a/docs/Contracts/Core/AlgebraPoolBase.md +++ b/docs/Contracts/Core/AlgebraPoolBase.md @@ -7,6 +7,7 @@ Algebra pool base abstract contract Contains state variables, immutables and common internal functions +*Developer note: Decoupling into a separate abstract contract simplifies testing* ## Modifiers ### onlyValidTicks @@ -27,13 +28,9 @@ Contains state variables, immutables and common internal functions ## Variables -### address dataStorageOperator immutable - -The contract that stores all the timepoints and can perform actions with them - ### address factory immutable -The contract that deployed the pool, which must adhere to the IAlgebraFactory interface +The Algebra factory contract, which must adhere to the IAlgebraFactory interface ### address token0 immutable @@ -62,50 +59,45 @@ The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for The globalState structure in the pool stores many values but requires only one slot and is exposed as a single method to save gas when accessed externally. -### uint128 liquidity - -The currently in range liquidity available to the pool - -*Developer note: This value has no relationship to the total liquidity across all ticks. -Returned value cannot exceed type(uint128).max* -### int24 tickSpacing - -The current tick spacing - -*Developer note: Ticks can only be used at multiples of this value -e.g.: a tickSpacing of 60 means ticks can be initialized every 60th tick, i.e., ..., -120, -60, 0, 60, 120, ... -This value is an int24 to avoid casting even though it is always positive.* -### int24 tickSpacingLimitOrders +### mapping(int24 => struct TickManagement.Tick) ticks -The current tick spacing for limit orders +Look up information about a specific tick in the pool -*Developer note: Ticks can only be used for limit orders at multiples of this value -This value is an int24 to avoid casting even though it is always positive.* ### uint32 communityFeeLastTimestamp The timestamp of the last sending of tokens to community vault -### uint160 secondsPerLiquidityCumulative +### address plugin -The accumulator of seconds per liquidity since the pool was first initialized +Returns the address of currently used plugin -### address activeIncentive +*Developer note: The plugin is subject to change* +### mapping(int16 => uint256) tickTable -Returns the information about active incentive +Returns 256 packed tick initialized boolean values. See TickTree for more information -*Developer note: if there is no active incentive at the moment, incentiveAddress would be equal to address(0)* -### mapping(int24 => struct TickManagement.Tick) ticks +### int24 nextTickGlobal -Look up information about a specific tick in the pool +The next initialized tick after current global tick -### mapping(int24 => struct LimitOrderManagement.LimitOrder) limitOrders +### int24 prevTickGlobal -Returns the summary information about a limit orders at tick +The previous initialized tick before (or at) current global tick -### mapping(int16 => uint256) tickTable +### uint128 liquidity -Returns 256 packed tick initialized boolean values. See TickTree for more information +The currently in range liquidity available to the pool +*Developer note: This value has no relationship to the total liquidity across all ticks. +Returned value cannot exceed type(uint128).max* +### int24 tickSpacing + +The current tick spacing + +*Developer note: Ticks can only be initialized by new mints at multiples of this value +e.g.: a tickSpacing of 60 means ticks can be initialized every 60th tick, i.e., ..., -120, -60, 0, 60, 120, ... +However, tickspacing can be changed after the ticks have been initialized. +This value is an int24 to avoid casting even though it is always positive.* ## Functions ### maxLiquidityPerTick @@ -144,6 +136,25 @@ The amounts of token0 and token1 that will be sent to the vault | [0] | uint128 | | | [1] | uint128 | | +### fee + + +`function fee() external view returns (uint16 currentFee)` view external + +The current pool fee value +*Developer note: In case dynamic fee is enabled in the pool, this method will call the plugin to get the current fee. +If the plugin implements complex fee logic, this method may return an incorrect value or revert. +In this case, see the plugin implementation and related documentation.* + + + + +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| currentFee | uint16 | The current pool fee value in hundredths of a bip, i.e. 1e-6 | + diff --git a/docs/Contracts/Core/AlgebraPoolDeployer.md b/docs/Contracts/Core/AlgebraPoolDeployer.md index 85f11579b..43c1c9f2d 100644 --- a/docs/Contracts/Core/AlgebraPoolDeployer.md +++ b/docs/Contracts/Core/AlgebraPoolDeployer.md @@ -7,7 +7,7 @@ Algebra pool deployer Is used by AlgebraFactory to deploy pools -*Developer note: Version: Algebra V2.1* +*Developer note: Version: Algebra Integral* @@ -31,7 +31,7 @@ Is used by AlgebraFactory to deploy pools ### getDeployParameters -`function getDeployParameters() external view returns (address _dataStorage, address _factory, address _communityVault, address _token0, address _token1)` view external +`function getDeployParameters() external view returns (address _plugin, address _factory, address _communityVault, address _token0, address _token1)` view external Get the parameters to be used in constructing the pool, set transiently during pool creation. *Developer note: Called by the pool constructor to fetch the parameters of the pool* @@ -43,7 +43,7 @@ Get the parameters to be used in constructing the pool, set transiently during p | Name | Type | Description | | ---- | ---- | ----------- | -| _dataStorage | address | | +| _plugin | address | | | _factory | address | | | _communityVault | address | | | _token0 | address | | @@ -52,7 +52,7 @@ Get the parameters to be used in constructing the pool, set transiently during p ### deploy -`function deploy(address dataStorage, address token0, address token1) external returns (address pool)` external +`function deploy(address plugin, address token0, address token1) external returns (address pool)` external *Developer note: Deploys a pool with the given parameters by transiently setting the parameters in cache.* @@ -61,7 +61,7 @@ Get the parameters to be used in constructing the pool, set transiently during p | Name | Type | Description | | ---- | ---- | ----------- | -| dataStorage | address | The pools associated dataStorage | +| plugin | address | The pool associated plugin (if any) | | token0 | address | The first token of the pool by address sort order | | token1 | address | The second token of the pool by address sort order | diff --git a/docs/Contracts/Core/DataStorage.md b/docs/Contracts/Core/DataStorage.md deleted file mode 100644 index e803b2c75..000000000 --- a/docs/Contracts/Core/DataStorage.md +++ /dev/null @@ -1,14 +0,0 @@ - - -## Errors -## targetIsTooOld - - -`error targetIsTooOld()` - -`target` timestamp is older than oldest timepoint - - - - - diff --git a/docs/Contracts/Core/DataStorageOperator.md b/docs/Contracts/Core/DataStorageOperator.md deleted file mode 100644 index 0e84ea291..000000000 --- a/docs/Contracts/Core/DataStorageOperator.md +++ /dev/null @@ -1,174 +0,0 @@ - - -# DataStorageOperator - - -Algebra timepoints data operator - -This contract stores timepoints and calculates adaptive fee and statistical averages - - -## Modifiers -### onlyPool - - -`modifier onlyPool()` internal - - - - - - - - - -## Variables -### struct DataStorage.Timepoint[65536] timepoints - -Returns data belonging to a certain timepoint - -*Developer note: There is more convenient function to fetch a timepoint: getTimepoints(). Which requires not an index but seconds* -### struct AlgebraFeeConfiguration feeConfig - - - -### bytes32 FEE_CONFIG_MANAGER constant - - - -*Developer note: The role can be granted in AlgebraFactory* - -## Functions -### constructor - - -`constructor(address _pool) public` public - - - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _pool | address | | - - -### initialize - - -`function initialize(uint32 time, int24 tick) external` external - -Initialize the dataStorage array by writing the first slot. Called once for the lifecycle of the timepoints array - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| time | uint32 | The time of the dataStorage initialization, via block.timestamp truncated to uint32 | -| tick | int24 | Initial tick | - - -### changeFeeConfiguration - - -`function changeFeeConfiguration(struct AlgebraFeeConfiguration _config) external` external - -Changes fee configuration for the pool - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _config | struct AlgebraFeeConfiguration | | - - -### getSingleTimepoint - - -`function getSingleTimepoint(uint32 time, uint32 secondsAgo, int24 tick, uint16 lastIndex) external view returns (int56 tickCumulative, uint112 volatilityCumulative)` view external - - -*Developer note: Reverts if a timepoint at or before the desired timepoint timestamp does not exist. -0 may be passed as `secondsAgo' to return the current cumulative values. -If called with a timestamp falling between two timepoints, returns the counterfactual accumulator values -at exactly the timestamp between the two timepoints.* - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| time | uint32 | The current block timestamp | -| secondsAgo | uint32 | The amount of time to look back, in seconds, at which point to return a timepoint | -| tick | int24 | The current tick | -| lastIndex | uint16 | | - -**Returns:** - -| Name | Type | Description | -| ---- | ---- | ----------- | -| tickCumulative | int56 | The cumulative tick since the pool was first initialized, as of `secondsAgo` | -| volatilityCumulative | uint112 | The cumulative volatility value since the pool was first initialized, as of `secondsAgo` | - -### getTimepoints - - -`function getTimepoints(uint32[] secondsAgos) external view returns (int56[] tickCumulatives, uint112[] volatilityCumulatives)` view external - -Returns the accumulator values as of each time seconds ago from the given time in the array of `secondsAgos` -*Developer note: Reverts if `secondsAgos` > oldest timepoint* - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| secondsAgos | uint32[] | Each amount of time to look back, in seconds, at which point to return a timepoint | - -**Returns:** - -| Name | Type | Description | -| ---- | ---- | ----------- | -| tickCumulatives | int56[] | The cumulative tick since the pool was first initialized, as of each `secondsAgo` | -| volatilityCumulatives | uint112[] | The cumulative volatility values since the pool was first initialized, as of each `secondsAgo` | - -### write - - -`function write(uint16 index, uint32 blockTimestamp, int24 tick) external returns (uint16 indexUpdated, uint16 newFee)` external - -Writes a dataStorage timepoint to the array -*Developer note: Writable at most once per block. Index represents the most recently written element. index must be tracked externally.* - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| index | uint16 | The index of the timepoint that was most recently written to the timepoints array | -| blockTimestamp | uint32 | The timestamp of the new timepoint | -| tick | int24 | The active tick at the time of the new timepoint | - -**Returns:** - -| Name | Type | Description | -| ---- | ---- | ----------- | -| indexUpdated | uint16 | The new index of the most recently written element in the dataStorage array | -| newFee | uint16 | The fee in hundredths of a bip, i.e. 1e-6 | - -### prepayTimepointsStorageSlots - - -`function prepayTimepointsStorageSlots(uint16 startIndex, uint16 amount) external` external - -Fills uninitialized timepoints with nonzero value -*Developer note: Can be used to reduce the gas cost of future swaps* - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| startIndex | uint16 | The start index, must be not initialized | -| amount | uint16 | of slots to fill, startIndex + amount must be <= type(uint16).max | - - - - - diff --git a/docs/Contracts/Core/DerivedState.md b/docs/Contracts/Core/DerivedState.md deleted file mode 100644 index 98fa32ee9..000000000 --- a/docs/Contracts/Core/DerivedState.md +++ /dev/null @@ -1,41 +0,0 @@ - - -# DerivedState - - -Pool state that is not stored - -Contains view functions to provide information about the pool that is computed rather than stored on the blockchain - - - - - -## Functions -### getInnerCumulatives - - -`function getInnerCumulatives(int24 bottomTick, int24 topTick) external view returns (uint160 innerSecondsSpentPerLiquidity, uint32 innerSecondsSpent)` view external - -Returns a snapshot of seconds per liquidity and seconds inside a tick range -*Developer note: Snapshots must only be compared to other snapshots, taken over a period for which a position existed. -I.e., snapshots cannot be compared if a position is not held for the entire period between when the first -snapshot is taken and the second snapshot is taken.* - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| bottomTick | int24 | The lower tick of the range | -| topTick | int24 | The upper tick of the range | - -**Returns:** - -| Name | Type | Description | -| ---- | ---- | ----------- | -| innerSecondsSpentPerLiquidity | uint160 | The snapshot of seconds per liquidity for the range | -| innerSecondsSpent | uint32 | The snapshot of the number of seconds during which the price was in this range | - - - - diff --git a/docs/Contracts/Core/IAlgebraDynamicFeePlugin.md b/docs/Contracts/Core/IAlgebraDynamicFeePlugin.md new file mode 100644 index 000000000..289de3d94 --- /dev/null +++ b/docs/Contracts/Core/IAlgebraDynamicFeePlugin.md @@ -0,0 +1,35 @@ + + +# IAlgebraDynamicFeePlugin + + +The interface for the Algebra plugin with dynamic fee logic + + + +*Developer note: A plugin with a dynamic fee must implement this interface so that the current fee can be known through the pool +If the dynamic fee logic does not allow the fee to be calculated without additional data, the method should revert with the appropriate message* + + + + +## Functions +### getCurrentFee + + +`function getCurrentFee() external view returns (uint16 fee)` view external + +Returns fee from plugin + + + + +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| fee | uint16 | The pool fee value in hundredths of a bip, i.e. 1e-6 | + + + + diff --git a/docs/Contracts/Core/IAlgebraFactory.md b/docs/Contracts/Core/IAlgebraFactory.md index 6e9933bbd..e4501ce73 100644 --- a/docs/Contracts/Core/IAlgebraFactory.md +++ b/docs/Contracts/Core/IAlgebraFactory.md @@ -71,47 +71,60 @@ Emitted when a pool is created | pool | address | The address of the created pool | -### FarmingAddress +### DefaultCommunityFee -`event FarmingAddress(address newFarmingAddress)` +`event DefaultCommunityFee(uint16 newDefaultCommunityFee)` -Emitted when the farming address is changed +Emitted when the default community fee is changed | Name | Type | Description | | ---- | ---- | ----------- | -| newFarmingAddress | address | The farming address after the address was changed | +| newDefaultCommunityFee | uint16 | The new default community fee value | -### DefaultFeeConfiguration +### DefaultTickspacing -`event DefaultFeeConfiguration(struct AlgebraFeeConfiguration newConfig)` +`event DefaultTickspacing(int24 newDefaultTickspacing)` -Emitted when the default fee configuration is changed -*Developer note: See the AdaptiveFee library for more details* +Emitted when the default tickspacing is changed | Name | Type | Description | | ---- | ---- | ----------- | -| newConfig | struct AlgebraFeeConfiguration | The structure with dynamic fee parameters | +| newDefaultTickspacing | int24 | The new default tickspacing value | -### DefaultCommunityFee +### DefaultFee -`event DefaultCommunityFee(uint8 newDefaultCommunityFee)` +`event DefaultFee(uint16 newDefaultFee)` -Emitted when the default community fee is changed +Emitted when the default fee is changed | Name | Type | Description | | ---- | ---- | ----------- | -| newDefaultCommunityFee | uint8 | The new default community fee value | +| newDefaultFee | uint16 | The new default fee value | + + +### DefaultPluginFactory + + +`event DefaultPluginFactory(address defaultPluginFactoryAddress)` + +Emitted when the defaultPluginFactory address is changed + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| defaultPluginFactoryAddress | address | The new defaultPluginFactory address | @@ -131,28 +144,27 @@ role that can change communityFee and tickspacing in pools | Name | Type | Description | | ---- | ---- | ----------- | -| [0] | bytes32 | | +| [0] | bytes32 | The hash corresponding to this role | ### hasRoleOrOwner `function hasRoleOrOwner(bytes32 role, address account) external view returns (bool)` view external - -*Developer note: Returns `true` if `account` has been granted `role` or `account` is owner.* +Returns `true` if `account` has been granted `role` or `account` is owner. | Name | Type | Description | | ---- | ---- | ----------- | -| role | bytes32 | | -| account | address | | +| role | bytes32 | The hash corresponding to the role | +| account | address | The address for which the role is checked | **Returns:** | Name | Type | Description | | ---- | ---- | ----------- | -| [0] | bool | | +| [0] | bool | bool Whether the address has this role or the owner role or not | ### owner @@ -187,13 +199,28 @@ Returns the current poolDeployerAddress | ---- | ---- | ----------- | | [0] | address | The address of the poolDeployer | -### farmingAddress +### communityVault + + +`function communityVault() external view returns (address)` view external + +Returns the current communityVaultAddress + + -`function farmingAddress() external view returns (address)` view external +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| [0] | address | The address to which community fees are transferred | + +### defaultCommunityFee + +`function defaultCommunityFee() external view returns (uint16)` view external -*Developer note: Is retrieved from the pools to restrict calling certain functions not by a tokenomics contract* +Returns the default community fee @@ -202,14 +229,14 @@ Returns the current poolDeployerAddress | Name | Type | Description | | ---- | ---- | ----------- | -| [0] | address | The tokenomics contract address | +| [0] | uint16 | Fee which will be set at the creation of the pool | -### communityVault +### defaultFee -`function communityVault() external view returns (address)` view external +`function defaultFee() external view returns (uint16)` view external -Returns the current communityVaultAddress +Returns the default fee @@ -218,23 +245,78 @@ Returns the current communityVaultAddress | Name | Type | Description | | ---- | ---- | ----------- | -| [0] | address | The address to which community fees are transferred | +| [0] | uint16 | Fee which will be set at the creation of the pool | -### defaultCommunityFee +### defaultTickspacing -`function defaultCommunityFee() external view returns (uint8)` view external +`function defaultTickspacing() external view returns (int24)` view external -Returns the default community fee +Returns the default tickspacing + + + + +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| [0] | int24 | Tickspacing which will be set at the creation of the pool | +### defaultPluginFactory +`function defaultPluginFactory() external view returns (contract IAlgebraPluginFactory)` view external + +Return the current pluginFactory address + + + + +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| [0] | contract IAlgebraPluginFactory | Algebra plugin factory | + +### defaultConfigurationForPool + + +`function defaultConfigurationForPool() external view returns (uint16 communityFee, int24 tickSpacing, uint16 fee)` view external + +Returns the default communityFee and tickspacing + + + + +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| communityFee | uint16 | which will be set at the creation of the pool | +| tickSpacing | int24 | which will be set at the creation of the pool | +| fee | uint16 | which will be set at the creation of the pool | + +### computePoolAddress + + +`function computePoolAddress(address token0, address token1) external view returns (address pool)` view external + +Deterministically computes the pool address given the token0 and token1 +*Developer note: The method does not check if such a pool has been created* + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| token0 | address | first token | +| token1 | address | second token | **Returns:** | Name | Type | Description | | ---- | ---- | ----------- | -| [0] | uint8 | Fee which will be set at the creation of the pool | +| pool | address | The contract address of the Algebra pool | ### poolByPair @@ -295,50 +377,64 @@ The call will revert if the pool already exists or the token arguments are inval | ---- | ---- | ----------- | | pool | address | The address of the newly created pool | -### setFarmingAddress +### setDefaultCommunityFee -`function setFarmingAddress(address newFarmingAddress) external` external +`function setDefaultCommunityFee(uint16 newDefaultCommunityFee) external` external -*Developer note: updates tokenomics address on the factory* +*Developer note: updates default community fee for new pools* | Name | Type | Description | | ---- | ---- | ----------- | -| newFarmingAddress | address | The new tokenomics contract address | +| newDefaultCommunityFee | uint16 | The new community fee, _must_ be <= MAX_COMMUNITY_FEE | -### setDefaultCommunityFee +### setDefaultFee -`function setDefaultCommunityFee(uint8 newDefaultCommunityFee) external` external +`function setDefaultFee(uint16 newDefaultFee) external` external -*Developer note: updates default community fee for new pools* +*Developer note: updates default fee for new pools* | Name | Type | Description | | ---- | ---- | ----------- | -| newDefaultCommunityFee | uint8 | The new community fee, _must_ be <= MAX_COMMUNITY_FEE | +| newDefaultFee | uint16 | The new fee, _must_ be <= MAX_DEFAULT_FEE | + + +### setDefaultTickspacing + + +`function setDefaultTickspacing(int24 newDefaultTickspacing) external` external + + +*Developer note: updates default tickspacing for new pools* + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| newDefaultTickspacing | int24 | The new tickspacing, _must_ be <= MAX_TICK_SPACING and >= MIN_TICK_SPACING | + +### setDefaultPluginFactory -### setDefaultFeeConfiguration +`function setDefaultPluginFactory(address newDefaultPluginFactory) external` external -`function setDefaultFeeConfiguration(struct AlgebraFeeConfiguration newConfig) external` external -Changes initial fee configuration for new pools -*Developer note: changes coefficients for sigmoids: α / (1 + e^( (β-x) / γ)) -alpha1 + alpha2 + baseFee (max possible fee) must be <= type(uint16).max and gammas must be > 0* +*Developer note: updates pluginFactory address* | Name | Type | Description | | ---- | ---- | ----------- | -| newConfig | struct AlgebraFeeConfiguration | new default fee configuration. See the #AdaptiveFee.sol library for details | +| newDefaultPluginFactory | address | address of new plugin factory | ### startRenounceOwnership diff --git a/docs/Contracts/Core/IAlgebraPlugin.md b/docs/Contracts/Core/IAlgebraPlugin.md new file mode 100644 index 000000000..8ad766197 --- /dev/null +++ b/docs/Contracts/Core/IAlgebraPlugin.md @@ -0,0 +1,224 @@ + + +# IAlgebraPlugin + + +The Algebra plugin interface + + + +*Developer note: The plugin will be called by the pool using hook methods depending on the current pool settings* + + + + +## Functions +### defaultPluginConfig + + +`function defaultPluginConfig() external view returns (uint8)` view external + +Returns plugin config + + + + +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| [0] | uint8 | config Each bit of the config is responsible for enabling/disabling the hooks. The last bit indicates whether the plugin contains dynamic fees logic | + +### beforeInitialize + + +`function beforeInitialize(address sender, uint160 sqrtPriceX96) external returns (bytes4)` external + +The hook called before the state of a pool is initialized + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| sender | address | The initial msg.sender for the initialize call | +| sqrtPriceX96 | uint160 | The sqrt(price) of the pool as a Q64.96 | + +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| [0] | bytes4 | bytes4 The function selector for the hook | + +### afterInitialize + + +`function afterInitialize(address sender, uint160 sqrtPriceX96, int24 tick) external returns (bytes4)` external + +The hook called after the state of a pool is initialized + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| sender | address | The initial msg.sender for the initialize call | +| sqrtPriceX96 | uint160 | The sqrt(price) of the pool as a Q64.96 | +| tick | int24 | The current tick after the state of a pool is initialized | + +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| [0] | bytes4 | bytes4 The function selector for the hook | + +### beforeModifyPosition + + +`function beforeModifyPosition(address sender, address recipient, int24 bottomTick, int24 topTick, int128 desiredLiquidityDelta, bytes data) external returns (bytes4)` external + +The hook called before a position is modified + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| sender | address | The initial msg.sender for the modify position call | +| recipient | address | Address to which the liquidity will be assigned in case of a mint or to which tokens will be sent in case of a burn | +| bottomTick | int24 | The lower tick of the position | +| topTick | int24 | The upper tick of the position | +| desiredLiquidityDelta | int128 | The desired amount of liquidity to mint/burn | +| data | bytes | Data that passed through the callback | + +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| [0] | bytes4 | bytes4 The function selector for the hook | + +### afterModifyPosition + + +`function afterModifyPosition(address sender, address recipient, int24 bottomTick, int24 topTick, int128 desiredLiquidityDelta, uint256 amount0, uint256 amount1, bytes data) external returns (bytes4)` external + +The hook called after a position is modified + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| sender | address | The initial msg.sender for the modify position call | +| recipient | address | Address to which the liquidity will be assigned in case of a mint or to which tokens will be sent in case of a burn | +| bottomTick | int24 | The lower tick of the position | +| topTick | int24 | The upper tick of the position | +| desiredLiquidityDelta | int128 | The desired amount of liquidity to mint/burn | +| amount0 | uint256 | The amount of token0 sent to the recipient or was paid to mint | +| amount1 | uint256 | The amount of token0 sent to the recipient or was paid to mint | +| data | bytes | Data that passed through the callback | + +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| [0] | bytes4 | bytes4 The function selector for the hook | + +### beforeSwap + + +`function beforeSwap(address sender, address recipient, bool zeroToOne, int256 amountRequired, uint160 limitSqrtPrice, bool withPaymentInAdvance, bytes data) external returns (bytes4)` external + +The hook called before a swap + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| sender | address | The initial msg.sender for the swap call | +| recipient | address | The address to receive the output of the swap | +| zeroToOne | bool | The direction of the swap, true for token0 to token1, false for token1 to token0 | +| amountRequired | int256 | The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative) | +| limitSqrtPrice | uint160 | The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this value after the swap. If one for zero, the price cannot be greater than this value after the swap | +| withPaymentInAdvance | bool | The flag indicating whether the `swapWithPaymentInAdvance` method was called | +| data | bytes | Data that passed through the callback | + +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| [0] | bytes4 | bytes4 The function selector for the hook | + +### afterSwap + + +`function afterSwap(address sender, address recipient, bool zeroToOne, int256 amountRequired, uint160 limitSqrtPrice, int256 amount0, int256 amount1, bytes data) external returns (bytes4)` external + +The hook called after a swap + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| sender | address | The initial msg.sender for the swap call | +| recipient | address | The address to receive the output of the swap | +| zeroToOne | bool | The direction of the swap, true for token0 to token1, false for token1 to token0 | +| amountRequired | int256 | The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative) | +| limitSqrtPrice | uint160 | The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this value after the swap. If one for zero, the price cannot be greater than this value after the swap | +| amount0 | int256 | The delta of the balance of token0 of the pool, exact when negative, minimum when positive | +| amount1 | int256 | The delta of the balance of token1 of the pool, exact when negative, minimum when positive | +| data | bytes | Data that passed through the callback | + +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| [0] | bytes4 | bytes4 The function selector for the hook | + +### beforeFlash + + +`function beforeFlash(address sender, address recipient, uint256 amount0, uint256 amount1, bytes data) external returns (bytes4)` external + +The hook called before flash + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| sender | address | The initial msg.sender for the flash call | +| recipient | address | The address which will receive the token0 and token1 amounts | +| amount0 | uint256 | The amount of token0 being requested for flash | +| amount1 | uint256 | The amount of token1 being requested for flash | +| data | bytes | Data that passed through the callback | + +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| [0] | bytes4 | bytes4 The function selector for the hook | + +### afterFlash + + +`function afterFlash(address sender, address recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1, bytes data) external returns (bytes4)` external + +The hook called after flash + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| sender | address | The initial msg.sender for the flash call | +| recipient | address | The address which will receive the token0 and token1 amounts | +| amount0 | uint256 | The amount of token0 being requested for flash | +| amount1 | uint256 | The amount of token1 being requested for flash | +| paid0 | uint256 | The amount of token0 being paid for flash | +| paid1 | uint256 | The amount of token1 being paid for flash | +| data | bytes | Data that passed through the callback | + +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| [0] | bytes4 | bytes4 The function selector for the hook | + + + + diff --git a/docs/Contracts/Core/IAlgebraPluginFactory.md b/docs/Contracts/Core/IAlgebraPluginFactory.md new file mode 100644 index 000000000..4d4794567 --- /dev/null +++ b/docs/Contracts/Core/IAlgebraPluginFactory.md @@ -0,0 +1,37 @@ + + +# IAlgebraPluginFactory + + +An interface for a contract that is capable of deploying Algebra plugins + + + +*Developer note: Such a factory is needed if the plugin should be automatically created and connected to each new pool* + + + + +## Functions +### createPlugin + + +`function createPlugin(address pool) external returns (address)` external + +Deploys new plugin contract for pool + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| pool | address | The address of the pool for which the new plugin will be created | + +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| [0] | address | New plugin address | + + + + diff --git a/docs/Contracts/Core/IAlgebraPoolActions.md b/docs/Contracts/Core/IAlgebraPoolActions.md index d72316b6f..fe4d3df13 100644 --- a/docs/Contracts/Core/IAlgebraPoolActions.md +++ b/docs/Contracts/Core/IAlgebraPoolActions.md @@ -17,7 +17,7 @@ https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces* ### initialize -`function initialize(uint160 price) external` external +`function initialize(uint160 initialPrice) external` external Sets the initial price for the pool *Developer note: Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value @@ -27,28 +27,28 @@ Initialization should be done in one transaction with pool creation to avoid fro | Name | Type | Description | | ---- | ---- | ----------- | -| price | uint160 | the initial sqrt price of the pool as a Q64.96 | +| initialPrice | uint160 | The initial sqrt price of the pool as a Q64.96 | ### mint -`function mint(address sender, address recipient, int24 bottomTick, int24 topTick, uint128 amount, bytes data) external returns (uint256 amount0, uint256 amount1, uint128 liquidityActual)` external +`function mint(address leftoversRecipient, address recipient, int24 bottomTick, int24 topTick, uint128 liquidityDesired, bytes data) external returns (uint256 amount0, uint256 amount1, uint128 liquidityActual)` external Adds liquidity for the given recipient/bottomTick/topTick position *Developer note: The caller of this method receives a callback in the form of IAlgebraMintCallback# AlgebraMintCallback in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends -on bottomTick, topTick, the amount of liquidity, and the current price. If bottomTick == topTick position is treated as a limit order* +on bottomTick, topTick, the amount of liquidity, and the current price.* | Name | Type | Description | | ---- | ---- | ----------- | -| sender | address | The address which will receive potential surplus of paid tokens | +| leftoversRecipient | address | The address which will receive potential surplus of paid tokens | | recipient | address | The address for which the liquidity will be created | | bottomTick | int24 | The lower tick of the position in which to add liquidity | | topTick | int24 | The upper tick of the position in which to add liquidity | -| amount | uint128 | The desired amount of liquidity to mint | +| liquidityDesired | uint128 | The desired amount of liquidity to mint | | data | bytes | Any data that should be passed through to the callback | **Returns:** @@ -90,7 +90,7 @@ actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated ### burn -`function burn(int24 bottomTick, int24 topTick, uint128 amount) external returns (uint256 amount0, uint256 amount1)` external +`function burn(int24 bottomTick, int24 topTick, uint128 amount, bytes data) external returns (uint256 amount0, uint256 amount1)` external Burn liquidity from the sender and account tokens owed for the liquidity to the position *Developer note: Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0 @@ -103,6 +103,7 @@ Fees must be collected separately via a call to #collect* | bottomTick | int24 | The lower tick of the position for which to burn liquidity | | topTick | int24 | The upper tick of the position for which to burn liquidity | | amount | uint128 | How much liquidity to burn | +| data | bytes | Any data that should be passed through to the plugin | **Returns:** @@ -136,22 +137,24 @@ Swap token0 for token1, or token1 for token0 | amount0 | int256 | The delta of the balance of token0 of the pool, exact when negative, minimum when positive | | amount1 | int256 | The delta of the balance of token1 of the pool, exact when negative, minimum when positive | -### swapSupportingFeeOnInputTokens +### swapWithPaymentInAdvance -`function swapSupportingFeeOnInputTokens(address sender, address recipient, bool zeroToOne, int256 amountRequired, uint160 limitSqrtPrice, bytes data) external returns (int256 amount0, int256 amount1)` external +`function swapWithPaymentInAdvance(address leftoversRecipient, address recipient, bool zeroToOne, int256 amountToSell, uint160 limitSqrtPrice, bytes data) external returns (int256 amount0, int256 amount1)` external -Swap token0 for token1, or token1 for token0 (tokens that have fee on transfer) -*Developer note: The caller of this method receives a callback in the form of IAlgebraSwapCallback#AlgebraSwapCallback* +Swap token0 for token1, or token1 for token0 with prepayment +*Developer note: The caller of this method receives a callback in the form of IAlgebraSwapCallback#AlgebraSwapCallback +caller must send tokens in callback before swap calculation +the actually sent amount of tokens is used for further calculations* | Name | Type | Description | | ---- | ---- | ----------- | -| sender | address | The address called this function (Comes from the Router) | +| leftoversRecipient | address | The address which will receive potential surplus of paid tokens | | recipient | address | The address to receive the output of the swap | | zeroToOne | bool | The direction of the swap, true for token0 to token1, false for token1 to token0 | -| amountRequired | int256 | The amount of the swap, which implicitly configures the swap as exact input | +| amountToSell | int256 | The amount of the swap, only positive (exact input) amount allowed | | limitSqrtPrice | uint160 | The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this value after the swap. If one for zero, the price cannot be greater than this value after the swap | | data | bytes | Any data to be passed through to the callback. If using the Router it should contain SwapRouter#SwapCallbackData | diff --git a/docs/Contracts/Core/IAlgebraPoolDeployer.md b/docs/Contracts/Core/IAlgebraPoolDeployer.md index 137412bf8..3fb479457 100644 --- a/docs/Contracts/Core/IAlgebraPoolDeployer.md +++ b/docs/Contracts/Core/IAlgebraPoolDeployer.md @@ -19,7 +19,7 @@ https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces* ### getDeployParameters -`function getDeployParameters() external view returns (address dataStorage, address factory, address communityVault, address token0, address token1)` view external +`function getDeployParameters() external view returns (address plugin, address factory, address communityVault, address token0, address token1)` view external Get the parameters to be used in constructing the pool, set transiently during pool creation. *Developer note: Called by the pool constructor to fetch the parameters of the pool* @@ -31,8 +31,8 @@ Get the parameters to be used in constructing the pool, set transiently during p | Name | Type | Description | | ---- | ---- | ----------- | -| dataStorage | address | The pools associated dataStorage | -| factory | address | The factory address | +| plugin | address | The pool associated plugin (if any) | +| factory | address | The Algebra Factory address | | communityVault | address | The community vault address | | token0 | address | The first token of the pool by address sort order | | token1 | address | The second token of the pool by address sort order | @@ -40,7 +40,7 @@ Get the parameters to be used in constructing the pool, set transiently during p ### deploy -`function deploy(address dataStorage, address token0, address token1) external returns (address pool)` external +`function deploy(address plugin, address token0, address token1) external returns (address pool)` external *Developer note: Deploys a pool with the given parameters by transiently setting the parameters in cache.* @@ -49,7 +49,7 @@ Get the parameters to be used in constructing the pool, set transiently during p | Name | Type | Description | | ---- | ---- | ----------- | -| dataStorage | address | The pools associated dataStorage | +| plugin | address | The pool associated plugin (if any) | | token0 | address | The first token of the pool by address sort order | | token1 | address | The second token of the pool by address sort order | diff --git a/docs/Contracts/Core/IAlgebraPoolDerivedState.md b/docs/Contracts/Core/IAlgebraPoolDerivedState.md deleted file mode 100644 index cefd61b12..000000000 --- a/docs/Contracts/Core/IAlgebraPoolDerivedState.md +++ /dev/null @@ -1,44 +0,0 @@ - - -# IAlgebraPoolDerivedState - - -Pool state that is not stored - -Contains view functions to provide information about the pool that is computed rather than stored on the -blockchain. The functions here may have variable gas costs. - -*Developer note: Credit to Uniswap Labs under GPL-2.0-or-later license: -https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces* - - - - -## Functions -### getInnerCumulatives - - -`function getInnerCumulatives(int24 bottomTick, int24 topTick) external view returns (uint160 innerSecondsSpentPerLiquidity, uint32 innerSecondsSpent)` view external - -Returns a snapshot of seconds per liquidity and seconds inside a tick range -*Developer note: Snapshots must only be compared to other snapshots, taken over a period for which a position existed. -I.e., snapshots cannot be compared if a position is not held for the entire period between when the first -snapshot is taken and the second snapshot is taken.* - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| bottomTick | int24 | The lower tick of the range | -| topTick | int24 | The upper tick of the range | - -**Returns:** - -| Name | Type | Description | -| ---- | ---- | ----------- | -| innerSecondsSpentPerLiquidity | uint160 | The snapshot of seconds per liquidity for the range | -| innerSecondsSpent | uint32 | The snapshot of the number of seconds during which the price was in this range | - - - - diff --git a/docs/Contracts/Core/IAlgebraPoolErrors.md b/docs/Contracts/Core/IAlgebraPoolErrors.md index d9546a7f2..68f5698ab 100644 --- a/docs/Contracts/Core/IAlgebraPoolErrors.md +++ b/docs/Contracts/Core/IAlgebraPoolErrors.md @@ -67,17 +67,6 @@ Emitted if the pool received fewer tokens than it should have -## insufficientAmountReceivedAtMint - - -`error insufficientAmountReceivedAtMint()` - -Emitted if the pool received fewer tokens than it should have to mint calculated actual liquidity - - - - - ## zeroLiquidityDesired @@ -188,26 +177,40 @@ Emitted if a method is called that is accessible only to the farming -## invalidTickForLimitOrder +## dynamicFeeActive + + +`error dynamicFeeActive()` + + + + + + + +## dynamicFeeDisabled + + +`error dynamicFeeDisabled()` -`error invalidTickForLimitOrder()` -Emitted if tick is too low/high for limit order +## invalidHookResponse -## invalidAmountForLimitOrder +`error invalidHookResponse(bytes4 selector)` -`error invalidAmountForLimitOrder()` -Emitted if amount is too high for limit order +| Name | Type | Description | +| ---- | ---- | ----------- | +| selector | bytes4 | | ## liquiditySub @@ -232,10 +235,10 @@ Emitted if liquidity overflows -## topTickLowerThanBottomTick +## topTickLowerOrEqBottomTick -`error topTickLowerThanBottomTick()` +`error topTickLowerOrEqBottomTick()` diff --git a/docs/Contracts/Core/IAlgebraPoolEvents.md b/docs/Contracts/Core/IAlgebraPoolEvents.md index 60d1fb45d..0df652cd1 100644 --- a/docs/Contracts/Core/IAlgebraPoolEvents.md +++ b/docs/Contracts/Core/IAlgebraPoolEvents.md @@ -18,7 +18,7 @@ https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces* `event Initialize(uint160 price, int24 tick)` Emitted exactly once by a pool when #initialize is first called on the pool -*Developer note: Mint/Burn/Swap cannot be emitted by the pool before Initialize* +*Developer note: Mint/Burn/Swaps cannot be emitted by the pool before Initialize* @@ -34,7 +34,6 @@ Emitted exactly once by a pool when #initialize is first called on the pool `event Mint(address sender, address owner, int24 bottomTick, int24 topTick, uint128 liquidityAmount, uint256 amount0, uint256 amount1)` Emitted when liquidity is minted for a given position -*Developer note: If the top and bottom ticks match, this should be treated as a limit order* @@ -131,7 +130,7 @@ Emitted by the pool for any flashes of token0/token1 ### CommunityFee -`event CommunityFee(uint8 communityFeeNew)` +`event CommunityFee(uint16 communityFeeNew)` Emitted when the community fee is changed by the pool @@ -139,13 +138,13 @@ Emitted when the community fee is changed by the pool | Name | Type | Description | | ---- | ---- | ----------- | -| communityFeeNew | uint8 | The updated value of the community fee in thousandths (1e-3) | +| communityFeeNew | uint16 | The updated value of the community fee in thousandths (1e-3) | ### TickSpacing -`event TickSpacing(int24 newTickSpacing, int24 newTickSpacingLimitOrders)` +`event TickSpacing(int24 newTickSpacing)` Emitted when the tick spacing changes @@ -154,47 +153,48 @@ Emitted when the tick spacing changes | Name | Type | Description | | ---- | ---- | ----------- | | newTickSpacing | int24 | The updated value of the new tick spacing | -| newTickSpacingLimitOrders | int24 | The updated value of the new tick spacing for limit orders | -### Incentive +### Plugin -`event Incentive(address newIncentiveAddress)` +`event Plugin(address newPluginAddress)` -Emitted when new activeIncentive is set +Emitted when the plugin address changes | Name | Type | Description | | ---- | ---- | ----------- | -| newIncentiveAddress | address | The address of the new incentive | +| newPluginAddress | address | New plugin address | -### Fee +### PluginConfig -`event Fee(uint16 fee)` +`event PluginConfig(uint8 newPluginConfig)` -Emitted when the fee changes inside the pool +Emitted when the plugin config changes | Name | Type | Description | | ---- | ---- | ----------- | -| fee | uint16 | The current fee in hundredths of a bip, i.e. 1e-6 | +| newPluginConfig | uint8 | New plugin config | -### DataStorageFailure +### Fee -`event DataStorageFailure()` +`event Fee(uint16 fee)` -Emitted in case of an error when trying to write to the DataStorage -*Developer note: This shouldn't happen* +Emitted when the fee changes inside the pool +| Name | Type | Description | +| ---- | ---- | ----------- | +| fee | uint16 | The current fee in hundredths of a bip, i.e. 1e-6 | diff --git a/docs/Contracts/Core/IAlgebraPoolImmutables.md b/docs/Contracts/Core/IAlgebraPoolImmutables.md index 70e60f890..9141938fc 100644 --- a/docs/Contracts/Core/IAlgebraPoolImmutables.md +++ b/docs/Contracts/Core/IAlgebraPoolImmutables.md @@ -14,28 +14,12 @@ https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces* ## Functions -### dataStorageOperator - - -`function dataStorageOperator() external view returns (address)` view external - -The contract that stores all the timepoints and can perform actions with them - - - - -**Returns:** - -| Name | Type | Description | -| ---- | ---- | ----------- | -| [0] | address | The operator address | - ### factory `function factory() external view returns (address)` view external -The contract that deployed the pool, which must adhere to the IAlgebraFactory interface +The Algebra factory contract, which must adhere to the IAlgebraFactory interface diff --git a/docs/Contracts/Core/IAlgebraPoolPermissionedActions.md b/docs/Contracts/Core/IAlgebraPoolPermissionedActions.md index 0f26c6b9e..7ec385eb8 100644 --- a/docs/Contracts/Core/IAlgebraPoolPermissionedActions.md +++ b/docs/Contracts/Core/IAlgebraPoolPermissionedActions.md @@ -1,62 +1,90 @@ - - -# IAlgebraPoolPermissionedActions - - -Permissioned pool actions - -Contains pool methods that may only be called by permissioned addresses - -*Developer note: Credit to Uniswap Labs under GPL-2.0-or-later license: -https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces* - - - - -## Functions -### setCommunityFee - - -`function setCommunityFee(uint8 communityFee) external` external - -Set the community's % share of the fees. Cannot exceed 25% (250). Only factory owner or POOLS_ADMINISTRATOR_ROLE role - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| communityFee | uint8 | new community fee percent in thousandths (1e-3) | - - -### setTickSpacing - - -`function setTickSpacing(int24 newTickSpacing, int24 newTickSpacingLimitOrders) external` external - -Set the new tick spacing values. Only factory owner or POOLS_ADMINISTRATOR_ROLE role - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| newTickSpacing | int24 | The new tick spacing value | -| newTickSpacingLimitOrders | int24 | The new tick spacing value for limit orders | - - -### setIncentive - - -`function setIncentive(address newIncentiveAddress) external` external - -Sets an active incentive. Only farming - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| newIncentiveAddress | address | The address associated with the incentive | - - - - - + + +# IAlgebraPoolPermissionedActions + + +Permissioned pool actions + +Contains pool methods that may only be called by permissioned addresses + +*Developer note: Credit to Uniswap Labs under GPL-2.0-or-later license: +https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces* + + + + +## Functions +### setCommunityFee + + +`function setCommunityFee(uint16 newCommunityFee) external` external + +Set the community's % share of the fees. Only factory owner or POOLS_ADMINISTRATOR_ROLE role + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| newCommunityFee | uint16 | The new community fee percent in thousandths (1e-3) | + + +### setTickSpacing + + +`function setTickSpacing(int24 newTickSpacing) external` external + +Set the new tick spacing values. Only factory owner or POOLS_ADMINISTRATOR_ROLE role + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| newTickSpacing | int24 | The new tick spacing value | + + +### setPlugin + + +`function setPlugin(address newPluginAddress) external` external + +Set the new plugin address. Only factory owner or POOLS_ADMINISTRATOR_ROLE role + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| newPluginAddress | address | The new plugin address | + + +### setPluginConfig + + +`function setPluginConfig(uint8 newConfig) external` external + +Set new plugin config + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| newConfig | uint8 | In the new configuration of the plugin, each bit of which is responsible for a particular hook. Only factory owner or POOLS_ADMINISTRATOR_ROLE role | + + +### setFee + + +`function setFee(uint16 newFee) external` external + +Set new pool fee. Can be called by owner if dynamic fee is disabled. +Called by the plugin if dynamic fee is enabled + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| newFee | uint16 | The new fee value | + + + + + diff --git a/docs/Contracts/Core/IAlgebraPoolState.md b/docs/Contracts/Core/IAlgebraPoolState.md index 7a2f54a14..cf5c79bb2 100644 --- a/docs/Contracts/Core/IAlgebraPoolState.md +++ b/docs/Contracts/Core/IAlgebraPoolState.md @@ -17,7 +17,7 @@ https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces* ### globalState -`function globalState() external view returns (uint160 price, int24 tick, int24 prevInitializedTick, uint16 fee, uint16 timepointIndex, uint8 communityFee, bool unlocked)` view external +`function globalState() external view returns (uint160 price, int24 tick, uint16 fee, uint8 pluginConfig, uint16 communityFee, bool unlocked)` view external The globalState structure in the pool stores many values but requires only one slot and is exposed as a single method to save gas when accessed externally. @@ -29,38 +29,43 @@ and is exposed as a single method to save gas when accessed externally. | Name | Type | Description | | ---- | ---- | ----------- | -| price | uint160 | The current price of the pool as a sqrt(dToken1/dToken0) Q64.96 value; | -| tick | int24 | The current tick of the pool, i.e. according to the last tick transition that was run; This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(price) if the price is on a tick boundary; | -| prevInitializedTick | int24 | The previous initialized tick | -| fee | uint16 | The last pool fee value in hundredths of a bip, i.e. 1e-6 | -| timepointIndex | uint16 | The index of the last written timepoint | -| communityFee | uint8 | The community fee percentage of the swap fee in thousandths (1e-3) | +| price | uint160 | The current price of the pool as a sqrt(dToken1/dToken0) Q64.96 value | +| tick | int24 | The current tick of the pool, i.e. according to the last tick transition that was run This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(price) if the price is on a tick boundary | +| fee | uint16 | The last known pool fee value in hundredths of a bip, i.e. 1e-6 | +| pluginConfig | uint8 | The current plugin config. Each bit of the config is responsible for enabling/disabling the hooks The last bit indicates whether the plugin contains dynamic fees logic | +| communityFee | uint16 | The community fee percentage of the swap fee in thousandths (1e-3) | | unlocked | bool | Whether the pool is currently locked to reentrancy | -### totalFeeGrowth0Token +### ticks -`function totalFeeGrowth0Token() external view returns (uint256)` view external +`function ticks(int24 tick) external view returns (uint256 liquidityTotal, int128 liquidityDelta, int24 prevTick, int24 nextTick, uint256 outerFeeGrowth0Token, uint256 outerFeeGrowth1Token)` view external -The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool -*Developer note: This value can overflow the uint256* +Look up information about a specific tick in the pool +| Name | Type | Description | +| ---- | ---- | ----------- | +| tick | int24 | The tick to look up | **Returns:** | Name | Type | Description | | ---- | ---- | ----------- | -| [0] | uint256 | | +| liquidityTotal | uint256 | The total amount of position liquidity that uses the pool either as tick lower or tick upper | +| liquidityDelta | int128 | How much liquidity changes when the pool price crosses the tick | +| prevTick | int24 | The previous tick in tick list | +| nextTick | int24 | The next tick in tick list | +| outerFeeGrowth0Token | uint256 | The fee growth on the other side of the tick from the current tick in token0 | +| outerFeeGrowth1Token | uint256 | The fee growth on the other side of the tick from the current tick in token1 In addition, these values are only relative and must be used only in comparison to previous snapshots for a specific position. | -### totalFeeGrowth1Token +### communityFeeLastTimestamp -`function totalFeeGrowth1Token() external view returns (uint256)` view external +`function communityFeeLastTimestamp() external view returns (uint32)` view external -The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool -*Developer note: This value can overflow the uint256* +The timestamp of the last sending of tokens to community vault @@ -69,16 +74,15 @@ The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for | Name | Type | Description | | ---- | ---- | ----------- | -| [0] | uint256 | | +| [0] | uint32 | The timestamp truncated to 32 bits | -### liquidity +### getCommunityFeePending -`function liquidity() external view returns (uint128)` view external +`function getCommunityFeePending() external view returns (uint128 communityFeePending0, uint128 communityFeePending1)` view external -The currently in range liquidity available to the pool -*Developer note: This value has no relationship to the total liquidity across all ticks. -Returned value cannot exceed type(uint128).max* +The amounts of token0 and token1 that will be sent to the vault +*Developer note: Will be sent COMMUNITY_FEE_TRANSFER_FREQUENCY after communityFeeLastTimestamp* @@ -87,17 +91,16 @@ Returned value cannot exceed type(uint128).max* | Name | Type | Description | | ---- | ---- | ----------- | -| [0] | uint128 | | +| communityFeePending0 | uint128 | The amount of token0 that will be sent to the vault | +| communityFeePending1 | uint128 | The amount of token1 that will be sent to the vault | -### tickSpacing +### plugin -`function tickSpacing() external view returns (int24)` view external +`function plugin() external view returns (address pluginAddress)` view external -The current tick spacing -*Developer note: Ticks can only be used at multiples of this value -e.g.: a tickSpacing of 60 means ticks can be initialized every 60th tick, i.e., ..., -120, -60, 0, 60, 120, ... -This value is an int24 to avoid casting even though it is always positive.* +Returns the address of currently used plugin +*Developer note: The plugin is subject to change* @@ -106,32 +109,34 @@ This value is an int24 to avoid casting even though it is always positive.* | Name | Type | Description | | ---- | ---- | ----------- | -| [0] | int24 | The current tick spacing | +| pluginAddress | address | The address of currently used plugin | -### tickSpacingLimitOrders +### tickTable -`function tickSpacingLimitOrders() external view returns (int24)` view external +`function tickTable(int16 wordPosition) external view returns (uint256)` view external -The current tick spacing for limit orders -*Developer note: Ticks can only be used for limit orders at multiples of this value -This value is an int24 to avoid casting even though it is always positive.* +Returns 256 packed tick initialized boolean values. See TickTree for more information +| Name | Type | Description | +| ---- | ---- | ----------- | +| wordPosition | int16 | Index of 256-bits word with ticks | **Returns:** | Name | Type | Description | | ---- | ---- | ----------- | -| [0] | int24 | The current tick spacing for limit orders | +| [0] | uint256 | The 256-bits word with packed ticks info | -### communityFeeLastTimestamp +### totalFeeGrowth0Token -`function communityFeeLastTimestamp() external view returns (uint32)` view external +`function totalFeeGrowth0Token() external view returns (uint256)` view external -The timestamp of the last sending of tokens to community vault +The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool +*Developer note: This value can overflow the uint256* @@ -140,15 +145,15 @@ The timestamp of the last sending of tokens to community vault | Name | Type | Description | | ---- | ---- | ----------- | -| [0] | uint32 | | +| [0] | uint256 | The fee growth accumulator for token0 | -### getCommunityFeePending +### totalFeeGrowth1Token -`function getCommunityFeePending() external view returns (uint128 communityFeePending0, uint128 communityFeePending1)` view external +`function totalFeeGrowth1Token() external view returns (uint256)` view external -The amounts of token0 and token1 that will be sent to the vault -*Developer note: Will be sent COMMUNITY_FEE_TRANSFER_FREQUENCY after communityFeeLastTimestamp* +The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool +*Developer note: This value can overflow the uint256* @@ -157,17 +162,17 @@ The amounts of token0 and token1 that will be sent to the vault | Name | Type | Description | | ---- | ---- | ----------- | -| communityFeePending0 | uint128 | | -| communityFeePending1 | uint128 | | +| [0] | uint256 | The fee growth accumulator for token1 | -### getReserves +### fee -`function getReserves() external view returns (uint128 reserve0, uint128 reserve1)` view external +`function fee() external view returns (uint16 currentFee)` view external -The tracked token0 and token1 reserves of pool -*Developer note: If at any time the real balance is larger, the excess will be transferred to liquidity providers as additional fee. -If the balance exceeds uint128, the excess will be sent to the communityVault.* +The current pool fee value +*Developer note: In case dynamic fee is enabled in the pool, this method will call the plugin to get the current fee. +If the plugin implements complex fee logic, this method may return an incorrect value or revert. +In this case, see the plugin implementation and related documentation.* @@ -176,15 +181,16 @@ If the balance exceeds uint128, the excess will be sent to the communityVault.* | Name | Type | Description | | ---- | ---- | ----------- | -| reserve0 | uint128 | | -| reserve1 | uint128 | | +| currentFee | uint16 | The current pool fee value in hundredths of a bip, i.e. 1e-6 | -### secondsPerLiquidityCumulative +### getReserves -`function secondsPerLiquidityCumulative() external view returns (uint160)` view external +`function getReserves() external view returns (uint128 reserve0, uint128 reserve1)` view external -The accumulator of seconds per liquidity since the pool was first initialized +The tracked token0 and token1 reserves of pool +*Developer note: If at any time the real balance is larger, the excess will be transferred to liquidity providers as additional fee. +If the balance exceeds uint128, the excess will be sent to the communityVault.* @@ -193,107 +199,92 @@ The accumulator of seconds per liquidity since the pool was first initialized | Name | Type | Description | | ---- | ---- | ----------- | -| [0] | uint160 | | +| reserve0 | uint128 | The last known reserve of token0 | +| reserve1 | uint128 | The last known reserve of token1 | -### ticks +### positions -`function ticks(int24 tick) external view returns (uint128 liquidityTotal, int128 liquidityDelta, uint256 outerFeeGrowth0Token, uint256 outerFeeGrowth1Token, int24 prevTick, int24 nextTick, uint160 outerSecondsPerLiquidity, uint32 outerSecondsSpent, bool hasLimitOrders)` view external +`function positions(bytes32 key) external view returns (uint256 liquidity, uint256 innerFeeGrowth0Token, uint256 innerFeeGrowth1Token, uint128 fees0, uint128 fees1)` view external -Look up information about a specific tick in the pool +Returns the information about a position by the position's key | Name | Type | Description | | ---- | ---- | ----------- | -| tick | int24 | The tick to look up | +| key | bytes32 | The position's key is a packed concatenation of the owner address, bottomTick and topTick indexes | **Returns:** | Name | Type | Description | | ---- | ---- | ----------- | -| liquidityTotal | uint128 | The total amount of position liquidity that uses the pool either as tick lower or tick upper | -| liquidityDelta | int128 | How much liquidity changes when the pool price crosses the tick | -| outerFeeGrowth0Token | uint256 | The fee growth on the other side of the tick from the current tick in token0 | -| outerFeeGrowth1Token | uint256 | The fee growth on the other side of the tick from the current tick in token1 | -| prevTick | int24 | The previous tick in tick list | -| nextTick | int24 | The next tick in tick list | -| outerSecondsPerLiquidity | uint160 | The seconds spent per liquidity on the other side of the tick from the current tick | -| outerSecondsSpent | uint32 | The seconds spent on the other side of the tick from the current tick | -| hasLimitOrders | bool | Whether there are limit orders on this tick or not In addition, these values are only relative and must be used only in comparison to previous snapshots for a specific position. | +| liquidity | uint256 | The amount of liquidity in the position | +| innerFeeGrowth0Token | uint256 | Fee growth of token0 inside the tick range as of the last mint/burn/poke | +| innerFeeGrowth1Token | uint256 | Fee growth of token1 inside the tick range as of the last mint/burn/poke | +| fees0 | uint128 | The computed amount of token0 owed to the position as of the last mint/burn/poke | +| fees1 | uint128 | The computed amount of token1 owed to the position as of the last mint/burn/poke | -### limitOrders +### liquidity -`function limitOrders(int24 tick) external view returns (uint128 amountToSell, uint128 soldAmount, uint256 boughtAmount0Cumulative, uint256 boughtAmount1Cumulative, bool initialized)` view external +`function liquidity() external view returns (uint128)` view external -Returns the summary information about a limit orders at tick +The currently in range liquidity available to the pool +*Developer note: This value has no relationship to the total liquidity across all ticks. +Returned value cannot exceed type(uint128).max* -| Name | Type | Description | -| ---- | ---- | ----------- | -| tick | int24 | The tick to look up | **Returns:** | Name | Type | Description | | ---- | ---- | ----------- | -| amountToSell | uint128 | The amount of tokens to sell. Has only relative meaning | -| soldAmount | uint128 | The amount of tokens already sold. Has only relative meaning | -| boughtAmount0Cumulative | uint256 | The accumulator of bought tokens0 per amountToSell. Has only relative meaning | -| boughtAmount1Cumulative | uint256 | The accumulator of bought tokens1 per amountToSell. Has only relative meaning | -| initialized | bool | Will be true if a limit order was created at least once on this tick | +| [0] | uint128 | The current in range liquidity | -### tickTable +### tickSpacing -`function tickTable(int16 wordPosition) external view returns (uint256)` view external +`function tickSpacing() external view returns (int24)` view external -Returns 256 packed tick initialized boolean values. See TickTree for more information +The current tick spacing +*Developer note: Ticks can only be initialized by new mints at multiples of this value +e.g.: a tickSpacing of 60 means ticks can be initialized every 60th tick, i.e., ..., -120, -60, 0, 60, 120, ... +However, tickspacing can be changed after the ticks have been initialized. +This value is an int24 to avoid casting even though it is always positive.* -| Name | Type | Description | -| ---- | ---- | ----------- | -| wordPosition | int16 | | **Returns:** | Name | Type | Description | | ---- | ---- | ----------- | -| [0] | uint256 | | +| [0] | int24 | The current tick spacing | -### positions +### prevTickGlobal -`function positions(bytes32 key) external view returns (uint256 liquidity, uint256 innerFeeGrowth0Token, uint256 innerFeeGrowth1Token, uint128 fees0, uint128 fees1)` view external +`function prevTickGlobal() external view returns (int24)` view external -Returns the information about a position by the position's key +The previous initialized tick before (or at) current global tick -| Name | Type | Description | -| ---- | ---- | ----------- | -| key | bytes32 | The position's key is a hash of a preimage composed by the owner, bottomTick and topTick | **Returns:** | Name | Type | Description | | ---- | ---- | ----------- | -| liquidity | uint256 | The amount of liquidity in the position | -| innerFeeGrowth0Token | uint256 | Fee growth of token0 inside the tick range as of the last mint/burn/poke | -| innerFeeGrowth1Token | uint256 | Fee growth of token1 inside the tick range as of the last mint/burn/poke | -| fees0 | uint128 | The computed amount of token0 owed to the position as of the last mint/burn/poke | -| fees1 | uint128 | The computed amount of token1 owed to the position as of the last mint/burn/poke | +| [0] | int24 | The previous initialized tick | -### activeIncentive +### nextTickGlobal -`function activeIncentive() external view returns (address incentiveAddress)` view external +`function nextTickGlobal() external view returns (int24)` view external -Returns the information about active incentive -*Developer note: if there is no active incentive at the moment, incentiveAddress would be equal to address(0)* +The next initialized tick after current global tick @@ -302,7 +293,7 @@ Returns the information about active incentive | Name | Type | Description | | ---- | ---- | ----------- | -| incentiveAddress | address | The address associated with the current active incentive | +| [0] | int24 | The next initialized tick | diff --git a/docs/Contracts/Core/IAlgebraVirtualPool.md b/docs/Contracts/Core/IAlgebraVirtualPool.md deleted file mode 100644 index 67a241bc0..000000000 --- a/docs/Contracts/Core/IAlgebraVirtualPool.md +++ /dev/null @@ -1,40 +0,0 @@ - - -# IAlgebraVirtualPool - - -The interface for the virtual pool - - - -*Developer note: Used to calculate active liquidity in farmings* - - - - -## Functions -### crossTo - - -`function crossTo(int24 targetTick, bool zeroToOne) external returns (bool success)` external - - -*Developer note: This function is called by the main pool if an initialized ticks are crossed by swap. -If any one of crossed ticks is also initialized in a virtual pool it should be crossed too* - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| targetTick | int24 | The target tick up to which we need to cross all active ticks | -| zeroToOne | bool | The direction | - -**Returns:** - -| Name | Type | Description | -| ---- | ---- | ----------- | -| success | bool | | - - - - diff --git a/docs/Contracts/Core/IDataStorageOperator.md b/docs/Contracts/Core/IDataStorageOperator.md deleted file mode 100644 index 73ffb4075..000000000 --- a/docs/Contracts/Core/IDataStorageOperator.md +++ /dev/null @@ -1,176 +0,0 @@ - - -# IDataStorageOperator - - -The interface for the DataStorageOperator - - - -*Developer note: This contract stores timepoints and calculates adaptive fee and statistical averages* - - -## Events -### FeeConfiguration - - -`event FeeConfiguration(struct AlgebraFeeConfiguration feeConfig)` - -Emitted when the fee configuration is changed -*Developer note: See the AdaptiveFee library for more details* - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| feeConfig | struct AlgebraFeeConfiguration | The structure with dynamic fee parameters | - - - - -## Functions -### timepoints - - -`function timepoints(uint256 index) external view returns (bool initialized, uint32 blockTimestamp, int56 tickCumulative, uint88 volatilityCumulative, int24 tick, int24 averageTick, uint16 windowStartIndex)` view external - -Returns data belonging to a certain timepoint -*Developer note: There is more convenient function to fetch a timepoint: getTimepoints(). Which requires not an index but seconds* - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| index | uint256 | The index of timepoint in the array | - -**Returns:** - -| Name | Type | Description | -| ---- | ---- | ----------- | -| initialized | bool | Whether the timepoint has been initialized and the values are safe to use | -| blockTimestamp | uint32 | The timestamp of the timepoint | -| tickCumulative | int56 | The tick multiplied by seconds elapsed for the life of the pool as of the timepoint timestamp | -| volatilityCumulative | uint88 | Cumulative standard deviation for the life of the pool as of the timepoint timestamp | -| tick | int24 | The tick at blockTimestamp | -| averageTick | int24 | Time-weighted average tick | -| windowStartIndex | uint16 | Index of closest timepoint >= WINDOW seconds ago | - -### initialize - - -`function initialize(uint32 time, int24 tick) external` external - -Initialize the dataStorage array by writing the first slot. Called once for the lifecycle of the timepoints array - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| time | uint32 | The time of the dataStorage initialization, via block.timestamp truncated to uint32 | -| tick | int24 | Initial tick | - - -### getSingleTimepoint - - -`function getSingleTimepoint(uint32 time, uint32 secondsAgo, int24 tick, uint16 index) external view returns (int56 tickCumulative, uint112 volatilityCumulative)` view external - - -*Developer note: Reverts if a timepoint at or before the desired timepoint timestamp does not exist. -0 may be passed as `secondsAgo' to return the current cumulative values. -If called with a timestamp falling between two timepoints, returns the counterfactual accumulator values -at exactly the timestamp between the two timepoints.* - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| time | uint32 | The current block timestamp | -| secondsAgo | uint32 | The amount of time to look back, in seconds, at which point to return a timepoint | -| tick | int24 | The current tick | -| index | uint16 | The index of the timepoint that was most recently written to the timepoints array | - -**Returns:** - -| Name | Type | Description | -| ---- | ---- | ----------- | -| tickCumulative | int56 | The cumulative tick since the pool was first initialized, as of `secondsAgo` | -| volatilityCumulative | uint112 | The cumulative volatility value since the pool was first initialized, as of `secondsAgo` | - -### getTimepoints - - -`function getTimepoints(uint32[] secondsAgos) external view returns (int56[] tickCumulatives, uint112[] volatilityCumulatives)` view external - -Returns the accumulator values as of each time seconds ago from the given time in the array of `secondsAgos` -*Developer note: Reverts if `secondsAgos` > oldest timepoint* - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| secondsAgos | uint32[] | Each amount of time to look back, in seconds, at which point to return a timepoint | - -**Returns:** - -| Name | Type | Description | -| ---- | ---- | ----------- | -| tickCumulatives | int56[] | The cumulative tick since the pool was first initialized, as of each `secondsAgo` | -| volatilityCumulatives | uint112[] | The cumulative volatility values since the pool was first initialized, as of each `secondsAgo` | - -### write - - -`function write(uint16 index, uint32 blockTimestamp, int24 tick) external returns (uint16 indexUpdated, uint16 newFee)` external - -Writes a dataStorage timepoint to the array -*Developer note: Writable at most once per block. Index represents the most recently written element. index must be tracked externally.* - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| index | uint16 | The index of the timepoint that was most recently written to the timepoints array | -| blockTimestamp | uint32 | The timestamp of the new timepoint | -| tick | int24 | The active tick at the time of the new timepoint | - -**Returns:** - -| Name | Type | Description | -| ---- | ---- | ----------- | -| indexUpdated | uint16 | The new index of the most recently written element in the dataStorage array | -| newFee | uint16 | The fee in hundredths of a bip, i.e. 1e-6 | - -### changeFeeConfiguration - - -`function changeFeeConfiguration(struct AlgebraFeeConfiguration feeConfig) external` external - -Changes fee configuration for the pool - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| feeConfig | struct AlgebraFeeConfiguration | | - - -### prepayTimepointsStorageSlots - - -`function prepayTimepointsStorageSlots(uint16 startIndex, uint16 amount) external` external - -Fills uninitialized timepoints with nonzero value -*Developer note: Can be used to reduce the gas cost of future swaps* - - - -| Name | Type | Description | -| ---- | ---- | ----------- | -| startIndex | uint16 | The start index, must be not initialized | -| amount | uint16 | of slots to fill, startIndex + amount must be <= type(uint16).max | - - - - - diff --git a/docs/Contracts/Core/PoolMockEchidna.md b/docs/Contracts/Core/PoolMockEchidna.md new file mode 100644 index 000000000..2c45c6589 --- /dev/null +++ b/docs/Contracts/Core/PoolMockEchidna.md @@ -0,0 +1,150 @@ + + +# PoolMockEchidna + + + + + + + + + + +## Functions +### donate + + +`function donate(uint256 amount0, uint256 amount1) public` public + + + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| amount0 | uint256 | | +| amount1 | uint256 | | + + +### mintWrapped + + +`function mintWrapped(int24 bottomTick, int24 topTick, uint128 liquidityDesired, uint256 pay0, uint256 pay1) public` public + + + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| bottomTick | int24 | | +| topTick | int24 | | +| liquidityDesired | uint128 | | +| pay0 | uint256 | | +| pay1 | uint256 | | + + +### mintAroundCurrentTickWrapped + + +`function mintAroundCurrentTickWrapped(int24 tickDelta, uint128 liquidityDesired, uint256 pay0, uint256 pay1) public` public + + + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| tickDelta | int24 | | +| liquidityDesired | uint128 | | +| pay0 | uint256 | | +| pay1 | uint256 | | + + +### burnLastMintedPosition + + +`function burnLastMintedPosition(uint128 liquidityDelta) public` public + + + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| liquidityDelta | uint128 | | + + +### collectLastMintedPosition + + +`function collectLastMintedPosition(uint128 amount0Requested, uint128 amount1Requested) public` public + + + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| amount0Requested | uint128 | | +| amount1Requested | uint128 | | + + +### flashWrapped + + +`function flashWrapped(address recipient, uint256 amount0, uint256 amount1) public` public + + + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| recipient | address | | +| amount0 | uint256 | | +| amount1 | uint256 | | + + +### swapSupportingFeeOnInputTokensWrapped + + +`function swapSupportingFeeOnInputTokensWrapped(bool zeroToOne, int256 amountRequired, uint160 limitSqrtPrice, uint256 pay0, uint256 pay1) public` public + + + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| zeroToOne | bool | | +| amountRequired | int256 | | +| limitSqrtPrice | uint160 | | +| pay0 | uint256 | | +| pay1 | uint256 | | + + +### hasRoleOrOwner + + +`function hasRoleOrOwner(bytes32, address) public pure returns (bool)` pure public + + + + + +| Name | Type | Description | +| ---- | ---- | ----------- | +| | bytes32 | | +| | address | | + +**Returns:** + +| Name | Type | Description | +| ---- | ---- | ----------- | +| [0] | bool | | + + + + diff --git a/docs/Contracts/Core/Positions.md b/docs/Contracts/Core/Positions.md index 05355ccb7..514adf165 100644 --- a/docs/Contracts/Core/Positions.md +++ b/docs/Contracts/Core/Positions.md @@ -7,6 +7,7 @@ Algebra positions abstract contract Contains the logic of recalculation and change of liquidity positions +*Developer note: Relies on method _insertOrRemovePairOfTicks, which is implemented in TickStructure* diff --git a/docs/Contracts/Core/ReservesManager.md b/docs/Contracts/Core/ReservesManager.md index 59e492e15..f8c5194b2 100644 --- a/docs/Contracts/Core/ReservesManager.md +++ b/docs/Contracts/Core/ReservesManager.md @@ -7,6 +7,7 @@ Algebra reserves management abstract contract Encapsulates logic for tracking and changing pool reserves +*Developer note: The reserve mechanism allows the pool to keep track of unexpected increases in balances*