Skip to content

Commit

Permalink
Great Pool Migration (prep) (#1954)
Browse files Browse the repository at this point in the history
* refactor: rename BasePool to LegacyBasePool

* refactor: move new BasePool out of managed pool

* refactor: rename again to reduce diff
  • Loading branch information
EndymionJkb authored Oct 27, 2022
1 parent bddef99 commit 21dc0f2
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions pkg/pool-linear/contracts/LinearPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import "./LinearMath.sol";
* The Pool will register three tokens in the Vault however: the two assets and the BPT itself,
* so that BPT can be exchanged (effectively joining and exiting) via swaps.
*
* Despite inheriting from BasePool, much of the basic behavior changes. This Pool does not support regular joins and
* exits, as the initial BPT supply is 'preminted' during initialization. No further BPT can be minted, and BPT can
* Despite inheriting from BasePool, much of the basic behavior changes. This Pool does not support regular joins
* and exits, as the initial BPT supply is 'preminted' during initialization. No further BPT can be minted, and BPT can
* only be burned if governance enables Recovery Mode and LPs use it to exit proportionally.
*
* Unlike most other Pools, this one does not attempt to create revenue by charging fees: value is derived by holding
Expand Down Expand Up @@ -86,8 +86,8 @@ abstract contract LinearPool is ILinearPool, IGeneralPool, IRateProvider, BasePo
uint256 private immutable _scalingFactorMainToken;
uint256 private immutable _scalingFactorWrappedToken;

// The lower and upper targets are in BasePool's misc data field, which has 192 bits available (as it shares the
// same storage slot as the swap fee percentage and recovery mode flag, which together take up 64 bits).
// The lower and upper targets are in BasePool's misc data field, which has 192 bits available (as it shares
// the same storage slot as the swap fee percentage and recovery mode flag, which together take up 64 bits).
// We use 64 of these 192 for the targets (32 for each).
//
// The targets are already scaled by the main token's scaling factor (which makes the token behave as if it had 18
Expand Down
6 changes: 3 additions & 3 deletions pkg/pool-utils/contracts/BaseGeneralPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import "./BasePool.sol";
/**
* @dev Extension of `BasePool`, adding a handler for `IGeneralPool.onSwap`.
*
* Derived contracts must call `BasePool`'s constructor, and implement `_onSwapGivenIn` and `_onSwapGivenOut` along with
* `BasePool`'s virtual functions. Inheriting from this contract lets derived contracts choose the General
* specialization setting.
* Derived contracts must call `BasePool`'s constructor, and implement `_onSwapGivenIn` and `_onSwapGivenOut`
* along with `BasePool`'s virtual functions. Inheriting from this contract lets derived contracts choose the
* General specialization setting.
*/
abstract contract BaseGeneralPool is IGeneralPool, BasePool {
// Swap Hooks
Expand Down
6 changes: 3 additions & 3 deletions pkg/pool-utils/contracts/BaseMinimalSwapInfoPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import "./BasePool.sol";
/**
* @dev Extension of `BasePool`, adding a handler for `IMinimalSwapInfoPool.onSwap`.
*
* Derived contracts must call `BasePool`'s constructor, and implement `_onSwapGivenIn` and `_onSwapGivenOut` along with
* `BasePool`'s virtual functions. Inheriting from this contract lets derived contracts choose the Two Token or Minimal
* Swap Info specialization settings.
* Derived contracts must call `BasePool`'s constructor, and implement `_onSwapGivenIn` and `_onSwapGivenOut`
* along with `BasePool`'s virtual functions. Inheriting from this contract lets derived contracts choose the
* Two Token or Minimal Swap Info specialization settings.
*/
abstract contract BaseMinimalSwapInfoPool is IMinimalSwapInfoPool, BasePool {
// Swap Hooks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import "@balancer-labs/v2-interfaces/contracts/vault/IMinimalSwapInfoPool.sol";

import "@balancer-labs/v2-solidity-utils/contracts/helpers/TemporarilyPausable.sol";

import "@balancer-labs/v2-pool-utils/contracts/BalancerPoolToken.sol";
import "@balancer-labs/v2-pool-utils/contracts/BasePoolAuthorization.sol";
import "@balancer-labs/v2-pool-utils/contracts/RecoveryMode.sol";
import "./BalancerPoolToken.sol";
import "./BasePoolAuthorization.sol";
import "./RecoveryMode.sol";

// solhint-disable max-states-count

Expand All @@ -47,7 +47,7 @@ import "@balancer-labs/v2-pool-utils/contracts/RecoveryMode.sol";
* BaseGeneralPool or BaseMinimalSwapInfoPool. Otherwise, subclasses must inherit from the corresponding interfaces
* and implement the swap callbacks themselves.
*/
abstract contract BasePool is
abstract contract NewBasePool is
IBasePool,
IGeneralPool,
IMinimalSwapInfoPool,
Expand Down
2 changes: 2 additions & 0 deletions pkg/pool-utils/contracts/lib/ComposablePoolLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import "@balancer-labs/v2-interfaces/contracts/solidity-utils/openzeppelin/IERC2

import "@balancer-labs/v2-solidity-utils/contracts/math/FixedPoint.sol";

// solhint-disable no-inline-assembly

library ComposablePoolLib {
using FixedPoint for uint256;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ pragma experimental ABIEncoderV2;

import "@balancer-labs/v2-interfaces/contracts/pool-weighted/WeightedPoolUserData.sol";

import "@balancer-labs/v2-pool-utils/contracts/lib/PoolRegistrationLib.sol";
import "../lib/PoolRegistrationLib.sol";
import "../NewBasePool.sol";

import "../managed/vendor/BasePool.sol";

contract MockBasePool is BasePool {
contract MockNewBasePool is NewBasePool {
uint256 public constant ON_SWAP_MINIMAL_RETURN = 0xa987654321;
uint256 public constant ON_SWAP_GENERAL_RETURN = 0x123456789a;
uint256 public constant ON_JOIN_RETURN = 0xbbaa11;
Expand Down Expand Up @@ -50,7 +49,7 @@ contract MockBasePool is BasePool {
uint256 bufferPeriodDuration,
address owner
)
BasePool(
NewBasePool(
vault,
PoolRegistrationLib.registerPoolWithAssetManagers(vault, specialization, tokens, assetManagers),
name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { random } from 'lodash';
import { defaultAbiCoder } from 'ethers/lib/utils';
import { sharedBeforeEach } from '@balancer-labs/v2-common/sharedBeforeEach';

describe('BasePool', function () {
describe('NewBasePool', function () {
let admin: SignerWithAddress,
poolOwner: SignerWithAddress,
deployer: SignerWithAddress,
Expand Down Expand Up @@ -85,7 +85,7 @@ describe('BasePool', function () {
if (!owner) owner = ZERO_ADDRESS;
if (!from) from = deployer;

return deploy('v2-pool-weighted/MockBasePool', {
return deploy('MockNewBasePool', {
from,
args: [
vault.address,
Expand Down
2 changes: 1 addition & 1 deletion pkg/pool-weighted/contracts/managed/ManagedPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ contract ManagedPool is ManagedPoolSettings {
uint256 pauseWindowDuration,
uint256 bufferPeriodDuration
)
BasePool(
NewBasePool(
vault,
PoolRegistrationLib.registerComposablePool(
vault,
Expand Down
5 changes: 2 additions & 3 deletions pkg/pool-weighted/contracts/managed/ManagedPoolSettings.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ import "@balancer-labs/v2-pool-utils/contracts/lib/PoolRegistrationLib.sol";
import "@balancer-labs/v2-pool-utils/contracts/external-fees/InvariantGrowthProtocolSwapFees.sol";
import "@balancer-labs/v2-pool-utils/contracts/external-fees/ProtocolFeeCache.sol";
import "@balancer-labs/v2-pool-utils/contracts/external-fees/ExternalAUMFees.sol";
import "@balancer-labs/v2-pool-utils/contracts/NewBasePool.sol";

import "../lib/GradualValueChange.sol";
import "../managed/CircuitBreakerStorageLib.sol";
import "../WeightedMath.sol";

import "./vendor/BasePool.sol";

import "./ManagedPoolStorageLib.sol";
import "./ManagedPoolAumStorageLib.sol";
import "./ManagedPoolTokenStorageLib.sol";
Expand All @@ -42,7 +41,7 @@ import "./ManagedPoolAddRemoveTokenLib.sol";
/**
* @title Managed Pool Settings
*/
abstract contract ManagedPoolSettings is BasePool, ProtocolFeeCache, IManagedPool {
abstract contract ManagedPoolSettings is NewBasePool, ProtocolFeeCache, IManagedPool {
// ManagedPool weights and swap fees can change over time: these periods are expected to be long enough (e.g. days)
// that any timestamp manipulation would achieve very little.
// solhint-disable not-rely-on-time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ contract MockManagedPoolSettings is ManagedPoolSettings {
uint256 pauseWindowDuration,
uint256 bufferPeriodDuration
)
BasePool(
NewBasePool(
vault,
PoolRegistrationLib.registerPoolWithAssetManagers(
vault,
Expand Down

0 comments on commit 21dc0f2

Please sign in to comment.