Skip to content

Commit

Permalink
[Common] update natspecs & packages
Browse files Browse the repository at this point in the history
  • Loading branch information
IliaAzhel committed Oct 8, 2024
1 parent 8e5967b commit 00791ad
Show file tree
Hide file tree
Showing 27 changed files with 43 additions and 51 deletions.
2 changes: 1 addition & 1 deletion src/core/contracts/AlgebraCommunityVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import './interfaces/vault/IAlgebraCommunityVault.sol';
/// @title Algebra community fee vault
/// @notice Community fee from pools is sent here, if it is enabled
/// @dev Role system is used to withdraw tokens
/// @dev Version: Algebra Integral 1.1
/// @dev Version: Algebra Integral 1.2
contract AlgebraCommunityVault is IAlgebraCommunityVault {
/// @dev The role can be granted in AlgebraFactory
bytes32 public constant COMMUNITY_FEE_WITHDRAWER_ROLE = keccak256('COMMUNITY_FEE_WITHDRAWER');
Expand Down
2 changes: 1 addition & 1 deletion src/core/contracts/AlgebraFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import '@openzeppelin/contracts/security/ReentrancyGuard.sol';

/// @title Algebra factory
/// @notice Is used to deploy pools and its plugins
/// @dev Version: Algebra Integral 1.1
/// @dev Version: Algebra Integral 1.2
contract AlgebraFactory is IAlgebraFactory, Ownable2Step, AccessControlEnumerable, ReentrancyGuard {
/// @inheritdoc IAlgebraFactory
bytes32 public constant override POOLS_ADMINISTRATOR_ROLE = keccak256('POOLS_ADMINISTRATOR'); // it`s here for the public visibility of the value
Expand Down
2 changes: 1 addition & 1 deletion src/core/contracts/AlgebraPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import './interfaces/IAlgebraFactory.sol';

/// @title Algebra concentrated liquidity pool
/// @notice This contract is responsible for liquidity positions, swaps and flashloans
/// @dev Version: Algebra Integral 1.1
/// @dev Version: Algebra Integral 1.2
contract AlgebraPool is AlgebraPoolBase, TickStructure, ReentrancyGuard, Positions, SwapCalculation, ReservesManager {
using SafeCast for uint256;
using SafeCast for uint128;
Expand Down
2 changes: 1 addition & 1 deletion src/core/contracts/AlgebraPoolDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import './AlgebraPool.sol';

/// @title Algebra pool deployer
/// @notice Is used by AlgebraFactory to deploy pools
/// @dev Version: Algebra Integral 1.1
/// @dev Version: Algebra Integral 1.2
contract AlgebraPoolDeployer is IAlgebraPoolDeployer {
/// @dev two storage slots for dense cache packing
bytes32 private cache0;
Expand Down
2 changes: 1 addition & 1 deletion src/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.1.0",
"version": "1.2.0",
"keywords": [
"algebra"
],
Expand Down
2 changes: 1 addition & 1 deletion src/farming/contracts/FarmingCenter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import '@cryptoalgebra/integral-base-plugin/contracts/interfaces/plugins/IFarmin
import './interfaces/IFarmingCenter.sol';
import './libraries/IncentiveId.sol';

/// @title Algebra Integral 1.1 main farming contract
/// @title Algebra Integral 1.2 main farming contract
/// @dev Manages farmings and performs entry, exit and other actions.
contract FarmingCenter is IFarmingCenter, IPositionFollower, Multicall {
/// @inheritdoc IFarmingCenter
Expand Down
2 changes: 1 addition & 1 deletion src/farming/contracts/farmings/AlgebraEternalFarming.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import '../libraries/NFTPositionInfo.sol';

import './EternalVirtualPool.sol';

/// @title Algebra Integral 1.1 eternal (v2-like) farming
/// @title Algebra Integral 1.2 eternal (v2-like) farming
/// @notice Manages rewards and virtual pools
contract AlgebraEternalFarming is IAlgebraEternalFarming {
using SafeCast for int256;
Expand Down
2 changes: 1 addition & 1 deletion src/farming/contracts/farmings/EternalVirtualPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import '@cryptoalgebra/integral-core/contracts/interfaces/pool/IAlgebraPoolError

import '../base/VirtualTickStructure.sol';

/// @title Algebra Integral 1.1 eternal virtual pool
/// @title Algebra Integral 1.2 eternal virtual pool
/// @notice used to track active liquidity in farming and distribute rewards
contract EternalVirtualPool is Timestamp, VirtualTickStructure {
using TickManagement for mapping(int24 => TickManagement.Tick);
Expand Down
8 changes: 4 additions & 4 deletions src/farming/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@cryptoalgebra/integral-farming",
"description": "Liquidity mining contracts for Algebra Integral protocol",
"license": "GPL-3.0-or-later",
"version": "1.1.0",
"version": "1.2.0",
"publishConfig": {
"access": "public"
},
Expand All @@ -24,9 +24,9 @@
],
"dependencies": {
"@openzeppelin/contracts": "4.9.3",
"@cryptoalgebra/integral-core": "1.1.0",
"@cryptoalgebra/integral-periphery": "1.1.0",
"@cryptoalgebra/integral-base-plugin": "1.1.0"
"@cryptoalgebra/integral-core": "1.2.0",
"@cryptoalgebra/integral-periphery": "1.2.0",
"@cryptoalgebra/integral-base-plugin": "1.2.0"
},
"devDependencies": {
"@types/lodash": "^4.14.170",
Expand Down
2 changes: 1 addition & 1 deletion src/periphery/contracts/AlgebraCustomPoolEntryPoint.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {IAlgebraFactory} from '@cryptoalgebra/integral-core/contracts/interfaces

/// @title Algebra custom pool entry point
/// @notice Is used to create custom pools
/// @dev Version: Algebra Integral 2.0
/// @dev Version: Algebra Integral 1.2
contract AlgebraCustomPoolEntryPoint is IAlgebraCustomPoolEntryPoint {
/// @inheritdoc IAlgebraCustomPoolEntryPoint
address public immutable override factory;
Expand Down
2 changes: 1 addition & 1 deletion src/periphery/contracts/NonfungiblePositionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import './base/PeripheryValidation.sol';
import './base/SelfPermit.sol';
import './base/PoolInitializer.sol';

/// @title Algebra Integral 1.1 NFT positions
/// @title Algebra Integral 1.2 NFT positions
/// @notice Wraps Algebra positions in the ERC721 non-fungible token interface
/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:
/// https://github.com/Uniswap/v3-periphery
Expand Down
2 changes: 1 addition & 1 deletion src/periphery/contracts/SwapRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import './libraries/Path.sol';
import './libraries/PoolAddress.sol';
import './libraries/CallbackValidation.sol';

/// @title Algebra Integral 1.1 Swap Router
/// @title Algebra Integral 1.2 Swap Router
/// @notice Router for stateless execution of swaps against Algebra
/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:
/// https://github.com/Uniswap/v3-periphery
Expand Down
2 changes: 1 addition & 1 deletion src/periphery/contracts/lens/Quoter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import '../libraries/Path.sol';
import '../libraries/PoolAddress.sol';
import '../libraries/CallbackValidation.sol';

/// @title Algebra Integral 1.1 Quoter
/// @title Algebra Integral 1.2 Quoter
/// @notice Allows getting the expected amount out or amount in for a given swap without executing the swap
/// @dev These functions are not gas efficient and should _not_ be called on chain. Instead, optimistically execute
/// the swap and check the amounts in the callback.
Expand Down
2 changes: 1 addition & 1 deletion src/periphery/contracts/lens/QuoterV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import '../libraries/PoolAddress.sol';
import '../libraries/CallbackValidation.sol';
import '../libraries/PoolTicksCounter.sol';

/// @title Algebra Integral 1.1 QuoterV2
/// @title Algebra Integral 1.2 QuoterV2
/// @notice Allows getting the expected amount out or amount in for a given swap without executing the swap
/// @dev These functions are not gas efficient and should _not_ be called on chain. Instead, optimistically execute
/// the swap and check the amounts in the callback.
Expand Down
2 changes: 1 addition & 1 deletion src/periphery/contracts/lens/TickLens.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import '@cryptoalgebra/integral-core/contracts/libraries/TickTree.sol';

import '../interfaces/ITickLens.sol';

/// @title Algebra Integral 1.1 Tick Lens contract
/// @title Algebra Integral 1.2 Tick Lens contract
/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:
/// https://github.com/Uniswap/v3-periphery
contract TickLens is ITickLens {
Expand Down
4 changes: 2 additions & 2 deletions src/periphery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.1.0",
"version": "1.2.0",
"keywords": [
"algebra",
"periphery"
Expand All @@ -27,7 +27,7 @@
"dependencies": {
"@openzeppelin/contracts": "4.9.3",
"@uniswap/v2-core": "1.0.1",
"@cryptoalgebra/integral-core": "1.1.0"
"@cryptoalgebra/integral-core": "1.2.0"
},
"devDependencies": {
"is-svg": "^4.3.1"
Expand Down
17 changes: 7 additions & 10 deletions src/plugin/contracts/AlgebraBasePluginV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ import './plugins/FarmingProxyPlugin.sol';
import './plugins/SlidingFeePlugin.sol';
import './plugins/VolatilityOraclePlugin.sol';

/// @title Algebra Integral 1.1 default plugin
/// @notice This contract stores timepoints and calculates adaptive fee and statistical averages
/// @title Algebra Integral 1.2 adaptive fee plugin
contract AlgebraBasePluginV1 is DynamicFeePlugin, FarmingProxyPlugin, VolatilityOraclePlugin {
using Plugins for uint8;

/// @inheritdoc IAlgebraPlugin
uint8 public constant override defaultPluginConfig = uint8(Plugins.AFTER_INIT_FLAG | Plugins.BEFORE_SWAP_FLAG | Plugins.AFTER_SWAP_FLAG | Plugins.DYNAMIC_FEE);
uint8 public constant override defaultPluginConfig =
uint8(Plugins.AFTER_INIT_FLAG | Plugins.BEFORE_SWAP_FLAG | Plugins.AFTER_SWAP_FLAG | Plugins.DYNAMIC_FEE);

constructor(address _pool, address _factory, address _pluginFactory) BasePlugin(_pool, _factory, _pluginFactory) {

}
constructor(address _pool, address _factory, address _pluginFactory) BasePlugin(_pool, _factory, _pluginFactory) {}

// ###### HOOKS ######

Expand Down Expand Up @@ -72,9 +70,8 @@ contract AlgebraBasePluginV1 is DynamicFeePlugin, FarmingProxyPlugin, Volatility
return IAlgebraPlugin.afterFlash.selector;
}

function getCurrentFee() external view override returns(uint16 fee) {
function getCurrentFee() external view override returns (uint16 fee) {
uint88 volatilityAverage = _getAverageVolatilityLast();
fee =_getCurrentFee(volatilityAverage);
}

fee = _getCurrentFee(volatilityAverage);
}
}
3 changes: 1 addition & 2 deletions src/plugin/contracts/AlgebraBasePluginV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import './plugins/FarmingProxyPlugin.sol';
import './plugins/SlidingFeePlugin.sol';
import './plugins/VolatilityOraclePlugin.sol';

/// @title Algebra Integral 1.1 default plugin
/// @notice This contract stores timepoints and calculates adaptive fee and statistical averages
/// @title Algebra Integral 1.2 sliding fee plugin
contract AlgebraBasePluginV2 is SlidingFeePlugin, FarmingProxyPlugin, VolatilityOraclePlugin {
using Plugins for uint8;

Expand Down
4 changes: 2 additions & 2 deletions src/plugin/contracts/BasePluginV1Factory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import './interfaces/IBasePluginV1Factory.sol';
import './libraries/AdaptiveFee.sol';
import './AlgebraBasePluginV1.sol';

/// @title Algebra Integral 1.1 default plugin factory
/// @notice This contract creates Algebra default plugins for Algebra liquidity pools
/// @title Algebra Integral 1.2 default plugin factory
/// @notice This contract creates Algebra adaptive fee plugins for Algebra liquidity pools
/// @dev This plugin factory can only be used for Algebra base pools
contract BasePluginV1Factory is IBasePluginV1Factory {
/// @inheritdoc IBasePluginV1Factory
Expand Down
6 changes: 3 additions & 3 deletions src/plugin/contracts/BasePluginV2Factory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import './interfaces/IBasePluginV2Factory.sol';
import './AlgebraBasePluginV2.sol';
import './interfaces/plugins/ISlidingFeePlugin.sol';

/// @title Algebra Integral 1.1 default plugin factory
/// @notice This contract creates Algebra default plugins for Algebra liquidity pools
/// @title Algebra Integral 1.2 default plugin factory
/// @notice This contract creates Algebra sliding fee plugins for Algebra liquidity pools
/// @dev This plugin factory can only be used for Algebra base pools
contract BasePluginV2Factory is IBasePluginV2Factory {
/// @inheritdoc IBasePluginV2Factory
Expand Down Expand Up @@ -76,4 +76,4 @@ contract BasePluginV2Factory is IBasePluginV2Factory {
defaultBaseFee = newDefaultBaseFee;
emit DefaultBaseFee(newDefaultBaseFee);
}
}
}
2 changes: 1 addition & 1 deletion src/plugin/contracts/base/BasePlugin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import '@cryptoalgebra/integral-core/contracts/interfaces/IAlgebraPool.sol';

import '../interfaces/IBasePlugin.sol';

/// @title Algebra Integral 1.1 default plugin
/// @title Algebra Integral 1.2 default plugin
/// @notice This contract stores timepoints and calculates adaptive fee and statistical averages
abstract contract BasePlugin is IBasePlugin, Timestamp {
using Plugins for uint8;
Expand Down
2 changes: 1 addition & 1 deletion src/plugin/contracts/lens/AlgebraOracleV1TWAP.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import './IAlgebraOracleV1TWAP.sol';

import '../libraries/integration/OracleLibrary.sol';

/// @title Algebra Integral 1.1 base plugin V1 oracle frontend
/// @title Algebra Integral 1.2 base plugin V1 oracle frontend
/// @notice Provides data from oracle corresponding pool
/// @dev These functions are not very gas efficient and it is better not to use them on-chain
contract AlgebraOracleV1TWAP is IAlgebraOracleV1TWAP {
Expand Down
1 change: 0 additions & 1 deletion src/plugin/contracts/libraries/VolatilityOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pragma solidity =0.8.20;
/// @dev Instances of stored oracle data, "timepoints", are collected in the oracle array
/// Timepoints are overwritten when the full length of the timepoints array is populated.
/// The most recent timepoint is available by passing 0 to getSingleTimepoint().
/// Version for AlgebraBasePluginV1
library VolatilityOracle {
/// @notice `target` timestamp is older than oldest timepoint
error targetIsTooOld();
Expand Down
2 changes: 1 addition & 1 deletion src/plugin/contracts/plugins/DynamicFeePlugin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import '../libraries/AdaptiveFee.sol';
import '../types/AlgebraFeeConfigurationU144.sol';
import '../base/BasePlugin.sol';

/// @title Algebra Integral 1.1 default plugin
/// @title Algebra Integral 1.2 default plugin
/// @notice This contract stores timepoints and calculates adaptive fee and statistical averages
abstract contract DynamicFeePlugin is BasePlugin, IDynamicFeeManager {
using Plugins for uint8;
Expand Down
2 changes: 1 addition & 1 deletion src/plugin/contracts/plugins/FarmingProxyPlugin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import '../interfaces/plugins/IFarmingPlugin.sol';

import '../base/BasePlugin.sol';

/// @title Algebra Integral 1.1 default plugin
/// @title Algebra Integral 1.2 default plugin
/// @notice This contract stores timepoints and calculates adaptive fee and statistical averages
abstract contract FarmingProxyPlugin is BasePlugin, IFarmingPlugin {
using Plugins for uint8;
Expand Down
9 changes: 3 additions & 6 deletions src/plugin/contracts/plugins/VolatilityOraclePlugin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import '../interfaces/plugins/IVolatilityOracle.sol';
import '../libraries/VolatilityOracle.sol';
import '../base/BasePlugin.sol';

/// @title Algebra Integral 1.1 default plugin
/// @title Algebra Integral 1.2 VolatilityOraclePlugin plugin
/// @notice This contract stores timepoints and calculates adaptive fee and statistical averages
abstract contract VolatilityOraclePlugin is BasePlugin, IVolatilityOracle{
abstract contract VolatilityOraclePlugin is BasePlugin, IVolatilityOracle {
using Plugins for uint8;

uint256 internal constant UINT16_MODULO = 65536;
Expand All @@ -39,11 +39,9 @@ abstract contract VolatilityOraclePlugin is BasePlugin, IVolatilityOracle{
(uint160 price, int24 tick, , ) = _getPoolState();
require(price != 0, 'Pool is not initialized');
_initialize_TWAP(tick);

}

function _initialize_TWAP(int24 tick) internal {

uint32 time = _blockTimestamp();
timepoints.initialize(time, tick);
lastTimepointTimestamp = time;
Expand Down Expand Up @@ -103,7 +101,6 @@ abstract contract VolatilityOraclePlugin is BasePlugin, IVolatilityOracle{
}

function _getAverageVolatilityLast() internal view returns (uint88 volatilityAverage) {

uint32 currentTimestamp = _blockTimestamp();
(, int24 tick, , ) = _getPoolState();

Expand All @@ -113,7 +110,7 @@ abstract contract VolatilityOraclePlugin is BasePlugin, IVolatilityOracle{
volatilityAverage = timepoints.getAverageVolatility(currentTimestamp, tick, lastTimepointIndex, oldestIndex);
}

function _getLastTick() internal view returns(int24 lastTick) {
function _getLastTick() internal view returns (int24 lastTick) {
VolatilityOracle.Timepoint memory lastTimepoint = timepoints[timepointIndex];
return lastTimepoint.tick;
}
Expand Down
6 changes: 3 additions & 3 deletions src/plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.1.0",
"version": "1.2.0",
"keywords": [
"algebra"
],
Expand All @@ -14,8 +14,8 @@
"url": "https://github.com/cryptoalgebra/Algebra/"
},
"dependencies": {
"@cryptoalgebra/integral-core": "1.1.0",
"@cryptoalgebra/integral-periphery": "1.1.0"
"@cryptoalgebra/integral-core": "1.2.0",
"@cryptoalgebra/integral-periphery": "1.2.0"
},
"scripts": {
"precommit": "pretty-quick --staged --pattern **/*.sol && hardhat compile",
Expand Down

0 comments on commit 00791ad

Please sign in to comment.