Skip to content

Commit

Permalink
fix: consistent naming
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmikko committed May 21, 2023
1 parent 1cff068 commit 3b718d2
Show file tree
Hide file tree
Showing 30 changed files with 171 additions and 258 deletions.
2 changes: 1 addition & 1 deletion contracts/credit/CreditFacadeV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {ClaimAction} from "../interfaces/IWithdrawalManager.sol";
import {IPriceOracleV2} from "@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol";
import {IPriceFeedOnDemand} from "../interfaces/IPriceFeedOnDemand.sol";

import {IPool4626} from "../interfaces/IPool4626.sol";
import {IPoolV3} from "../interfaces/IPoolV3.sol";
import {IDegenNFT} from "@gearbox-protocol/core-v2/contracts/interfaces/IDegenNFT.sol";
import {IWETH} from "@gearbox-protocol/core-v2/contracts/interfaces/external/IWETH.sol";
import {IWETHGateway} from "../interfaces/IWETHGateway.sol";
Expand Down
6 changes: 3 additions & 3 deletions contracts/credit/CreditManagerV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {IERC20Helper} from "../libraries/IERC20Helper.sol";
// INTERFACES
import {IAccountFactory} from "../interfaces/IAccountFactory.sol";
import {ICreditAccount} from "../interfaces/ICreditAccount.sol";
import {IPoolBase, IPool4626} from "../interfaces/IPool4626.sol";
import {IPoolBase, IPoolV3} from "../interfaces/IPoolV3.sol";
import {IWETHGateway} from "../interfaces/IWETHGateway.sol";
import {ClaimAction, IWithdrawalManager} from "../interfaces/IWithdrawalManager.sol";
import {
Expand Down Expand Up @@ -210,7 +210,7 @@ contract CreditManagerV3 is ICreditManagerV3, SanityCheckTrait, ReentrancyGuardT

underlying = IPoolBase(pool).underlyingToken(); // U:[CM-1]

try IPool4626(_pool).supportsQuotas() returns (bool sq) {
try IPoolV3(_pool).supportsQuotas() returns (bool sq) {
supportsQuotas = sq;
} catch {}

Expand Down Expand Up @@ -1243,7 +1243,7 @@ contract CreditManagerV3 is ICreditManagerV3, SanityCheckTrait, ReentrancyGuardT
/// this contract is responsible for aligning quota interest values between the
/// pool, gauge and the Credit Manager
function poolQuotaKeeper() public view returns (address) {
return IPool4626(pool).poolQuotaKeeper();
return IPoolV3(pool).poolQuotaKeeper();
}

///
Expand Down
2 changes: 1 addition & 1 deletion contracts/credit/CreditManagerV3_USDT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity ^0.8.17;

import {CreditManagerV3} from "./CreditManagerV3.sol";
import {USDT_Transfer} from "../traits/USDT_Transfer.sol";
import {IPoolBase} from "../interfaces/IPool4626.sol";
import {IPoolBase} from "../interfaces/IPoolV3.sol";
/// @title Credit Manager

contract CreditManagerV3_USDT is CreditManagerV3, USDT_Transfer {
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IExceptions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ error BorrowingMoreU2ForbiddenException();
/// @dev Thrown on returning a value that violates the current bounds
error ValueOutOfRangeException();

// interface IPool4626Exceptions {
// interface IPoolV3Exceptions {
error ExpectedLiquidityLimitException();

error CreditManagerCantBorrowException();
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IPoolQuotaKeeper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pragma solidity ^0.8.17;

import {IVersion} from "@gearbox-protocol/core-v2/contracts/interfaces/IVersion.sol";
import {IPool4626} from "./IPool4626.sol";
import {IPoolV3} from "./IPoolV3.sol";

struct TokenQuotaParams {
uint96 totalQuoted;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {IERC4626} from "@openzeppelin/contracts/interfaces/IERC4626.sol";
import {AddressProvider} from "@gearbox-protocol/core-v2/contracts/core/AddressProvider.sol";
import {IVersion} from "@gearbox-protocol/core-v2/contracts/interfaces/IVersion.sol";

interface IPool4626Events {
interface IPoolV3Events {
/// @dev Emits on new liquidity being added to the pool
event DepositWithReferral(address indexed sender, address indexed onBehalfOf, uint256 amount, uint16 referralCode);

Expand Down Expand Up @@ -76,7 +76,7 @@ interface IPoolBase {

/// @title Pool 4626
/// More: https://dev.gearbox.fi/developers/pool/abstractpoolservice
interface IPool4626 is IPool4626Events, IPoolBase, IERC4626, IVersion {
interface IPoolV3 is IPoolV3Events, IPoolBase, IERC4626, IVersion {
function depositReferral(uint256 assets, address receiver, uint16 referralCode) external returns (uint256 shares);

function burn(uint256 shares) external;
Expand Down
10 changes: 5 additions & 5 deletions contracts/pool/Gauge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {IGearStaking} from "../interfaces/IGearStaking.sol";

import {RAY, SECONDS_PER_YEAR, MAX_WITHDRAW_FEE} from "@gearbox-protocol/core-v2/contracts/libraries/Constants.sol";
import {PERCENTAGE_FACTOR} from "@gearbox-protocol/core-v2/contracts/libraries/PercentageMath.sol";
import {Pool4626} from "./Pool4626.sol";
import {PoolV3} from "./PoolV3.sol";

// EXCEPTIONS
import "../interfaces/IExceptions.sol";
Expand All @@ -35,7 +35,7 @@ contract Gauge is IGauge, ACLNonReentrantTrait {
address public immutable addressProvider;

/// @dev Address of the pool
Pool4626 public immutable pool;
PoolV3 public immutable pool;

/// @dev Mapping from token address to its rate parameters
mapping(address => QuotaRateParams) public quotaRateParams;
Expand All @@ -59,14 +59,14 @@ contract Gauge is IGauge, ACLNonReentrantTrait {
/// @dev Constructor

constructor(address _pool, address _gearStaking)
ACLNonReentrantTrait(address(Pool4626(_pool).addressProvider()))
ACLNonReentrantTrait(address(PoolV3(_pool).addressProvider()))
nonZeroAddress(_pool)
nonZeroAddress(_gearStaking)
{
// Additional check that receiver is not address(0)

addressProvider = address(Pool4626(_pool).addressProvider()); // F:[P4-01]
pool = Pool4626(_pool); // F:[P4-01]
addressProvider = address(PoolV3(_pool).addressProvider()); // F:[P4-01]
pool = PoolV3(_pool); // F:[P4-01]
voter = IGearStaking(_gearStaking);
epochLU = voter.getCurrentEpoch();
}
Expand Down
14 changes: 7 additions & 7 deletions contracts/pool/PoolQuotaKeeper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {CreditLogic} from "../libraries/CreditLogic.sol";

import {QuotasLogic} from "../libraries/QuotasLogic.sol";

import {IPool4626} from "../interfaces/IPool4626.sol";
import {IPoolV3} from "../interfaces/IPoolV3.sol";
import {IPoolQuotaKeeper, TokenQuotaParams, AccountQuota} from "../interfaces/IPoolQuotaKeeper.sol";
import {IGauge} from "../interfaces/IGauge.sol";
import {ICreditManagerV3} from "../interfaces/ICreditManagerV3.sol";
Expand Down Expand Up @@ -86,11 +86,11 @@ contract PoolQuotaKeeper is IPoolQuotaKeeper, ACLNonReentrantTrait, ContractsReg
/// @dev Constructor
/// @param _pool Pool address
constructor(address _pool)
ACLNonReentrantTrait(IPool4626(_pool).addressProvider())
ContractsRegisterTrait(IPool4626(_pool).addressProvider())
ACLNonReentrantTrait(IPoolV3(_pool).addressProvider())
ContractsRegisterTrait(IPoolV3(_pool).addressProvider())
{
pool = _pool; // F:[PQK-1]
underlying = IPool4626(_pool).asset(); // F:[PQK-1]
underlying = IPoolV3(_pool).asset(); // F:[PQK-1]
}

/// @dev Updates credit account's accountQuotas for multiple tokens
Expand All @@ -114,7 +114,7 @@ contract PoolQuotaKeeper is IPoolQuotaKeeper, ACLNonReentrantTrait, ContractsReg
});

if (quotaRevenueChange != 0) {
IPool4626(pool).changeQuotaRevenue(quotaRevenueChange);
IPoolV3(pool).changeQuotaRevenue(quotaRevenueChange);
}
}

Expand Down Expand Up @@ -150,7 +150,7 @@ contract PoolQuotaKeeper is IPoolQuotaKeeper, ACLNonReentrantTrait, ContractsReg
}

if (quotaRevenueChange != 0) {
IPool4626(pool).changeQuotaRevenue(quotaRevenueChange);
IPoolV3(pool).changeQuotaRevenue(quotaRevenueChange);
}
}

Expand Down Expand Up @@ -283,7 +283,7 @@ contract PoolQuotaKeeper is IPoolQuotaKeeper, ACLNonReentrantTrait, ContractsReg
}
}

IPool4626(pool).updateQuotaRevenue(quotaRevenue); // F:[PQK-7]
IPoolV3(pool).updateQuotaRevenue(quotaRevenue); // F:[PQK-7]
lastQuotaRateUpdate = uint40(block.timestamp); // F:[PQK-7]
}

Expand Down
4 changes: 2 additions & 2 deletions contracts/pool/Pool4626.sol → contracts/pool/PoolV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {ContractsRegisterTrait} from "../traits/ContractsRegisterTrait.sol";
import {CreditLogic} from "../libraries/CreditLogic.sol";

import {IInterestRateModel} from "../interfaces/IInterestRateModel.sol";
import {IPool4626} from "../interfaces/IPool4626.sol";
import {IPoolV3} from "../interfaces/IPoolV3.sol";
import {ICreditManagerV3} from "../interfaces/ICreditManagerV3.sol";
import {IPoolQuotaKeeper} from "../interfaces/IPoolQuotaKeeper.sol";

Expand All @@ -42,7 +42,7 @@ struct CreditManagerDebt {

/// @title Core pool contract compatible with ERC4626
/// @notice Implements pool & diesel token business logic
contract Pool4626 is ERC4626, IPool4626, ACLNonReentrantTrait, ContractsRegisterTrait {
contract PoolV3 is ERC4626, IPoolV3, ACLNonReentrantTrait, ContractsRegisterTrait {
using Math for uint256;
using EnumerableSet for EnumerableSet.AddressSet;
using SafeERC20 for IERC20;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
// (c) Gearbox Holdings, 2022
pragma solidity ^0.8.17;

import {Pool4626} from "./Pool4626.sol";
import {PoolV3} from "./PoolV3.sol";
import {USDT_Transfer} from "../traits/USDT_Transfer.sol";
import {IPool4626} from "../interfaces/IPool4626.sol";
import {IPoolV3} from "../interfaces/IPoolV3.sol";

/// @title Core pool contract compatible with ERC4626
/// @notice Implements pool & dieselUSDT_Transferogic

contract Pool4626_USDT is Pool4626, USDT_Transfer {
contract PoolV3_USDT is PoolV3, USDT_Transfer {
constructor(
address _addressProvider,
address _underlyingToken,
address _interestRateModel,
uint256 _expectedLiquidityLimit,
bool _supportsQuotas
)
Pool4626(_addressProvider, _underlyingToken, _interestRateModel, _expectedLiquidityLimit, _supportsQuotas)
PoolV3(_addressProvider, _underlyingToken, _interestRateModel, _expectedLiquidityLimit, _supportsQuotas)
USDT_Transfer(_underlyingToken)
{
// Additional check that receiver is not address(0)
Expand Down
4 changes: 2 additions & 2 deletions contracts/support/DataCompressor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {ICreditFilter} from "@gearbox-protocol/core-v2/contracts/interfaces/V1/I
import {ICreditConfigurator} from "../interfaces/ICreditConfiguratorV3.sol";
import {ICreditAccount} from "@gearbox-protocol/core-v2/contracts/interfaces/ICreditAccount.sol";
import {IPoolService} from "@gearbox-protocol/core-v2/contracts/interfaces/IPoolService.sol";
import {IPool4626} from "../interfaces/IPool4626.sol";
import {IPoolV3} from "../interfaces/IPoolV3.sol";

import {IVersion} from "@gearbox-protocol/core-v2/contracts/interfaces/IVersion.sol";

Expand Down Expand Up @@ -350,7 +350,7 @@ contract DataCompressor is IDataCompressor, ContractsRegisterTrait {
uint256 dieselSupply = IERC20(result.dieselToken).totalSupply();

uint256 totalLP =
(result.version > 1) ? IPool4626(_pool).convertToAssets(dieselSupply) : pool.fromDiesel(dieselSupply);
(result.version > 1) ? IPoolV3(_pool).convertToAssets(dieselSupply) : pool.fromDiesel(dieselSupply);

result.depositAPY_RAY = totalLP == 0
? result.borrowAPY_RAY
Expand Down
12 changes: 6 additions & 6 deletions contracts/support/WETHGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
import {ContractsRegisterTrait} from "../traits/ContractsRegisterTrait.sol";

import {IPoolService} from "@gearbox-protocol/core-v2/contracts/interfaces/IPoolService.sol";
import {IPool4626} from "../interfaces/IPool4626.sol";
import {IPoolV3} from "../interfaces/IPoolV3.sol";

import {IWETH} from "@gearbox-protocol/core-v2/contracts/interfaces/external/IWETH.sol";
import {IWETHGateway} from "../interfaces/IWETHGateway.sol";
Expand Down Expand Up @@ -83,7 +83,7 @@ contract WETHGateway is IWETHGateway, ReentrancyGuard, ContractsRegisterTrait {
IWETH(weth).deposit{value: msg.value}();

_checkAllowance(pool, msg.value);
return IPool4626(pool).deposit(msg.value, receiver);
return IPoolV3(pool).deposit(msg.value, receiver);
}

function depositReferral(address pool, address receiver, uint16 referralCode)
Expand All @@ -96,7 +96,7 @@ contract WETHGateway is IWETHGateway, ReentrancyGuard, ContractsRegisterTrait {
IWETH(weth).deposit{value: msg.value}();

_checkAllowance(pool, msg.value);
return IPool4626(pool).depositReferral(msg.value, receiver, referralCode);
return IPoolV3(pool).depositReferral(msg.value, receiver, referralCode);
}

function mint(address pool, uint256 shares, address receiver)
Expand All @@ -110,7 +110,7 @@ contract WETHGateway is IWETHGateway, ReentrancyGuard, ContractsRegisterTrait {
IWETH(weth).deposit{value: msg.value}();

_checkAllowance(pool, msg.value);
assets = IPool4626(pool).mint(shares, receiver);
assets = IPoolV3(pool).mint(shares, receiver);
}

function withdraw(address pool, uint256 assets, address receiver, address owner)
Expand All @@ -120,7 +120,7 @@ contract WETHGateway is IWETHGateway, ReentrancyGuard, ContractsRegisterTrait {
unwrapAndTransferWethTo(receiver)
returns (uint256 shares)
{
return IPool4626(pool).withdraw(assets, address(this), owner);
return IPoolV3(pool).withdraw(assets, address(this), owner);
}

function redeem(address pool, uint256 shares, address receiver, address owner)
Expand All @@ -130,7 +130,7 @@ contract WETHGateway is IWETHGateway, ReentrancyGuard, ContractsRegisterTrait {
unwrapAndTransferWethTo(receiver)
returns (uint256 assets)
{
return IPool4626(pool).redeem(shares, address(this), owner);
return IPoolV3(pool).redeem(shares, address(this), owner);
}

// CREDIT MANAGERS
Expand Down
6 changes: 3 additions & 3 deletions contracts/support/risk-controller/ControllerTimelock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {IControllerTimelock, QueuedTransactionData} from "../../interfaces/ICont
import {ICreditManagerV3} from "../../interfaces/ICreditManagerV3.sol";
import {ICreditConfigurator} from "../../interfaces/ICreditConfiguratorV3.sol";
import {ICreditFacade} from "../../interfaces/ICreditFacade.sol";
import {IPool4626} from "../../interfaces/IPool4626.sol";
import {IPoolV3} from "../../interfaces/IPoolV3.sol";
import {ILPPriceFeed} from "../../interfaces/ILPPriceFeed.sol";

/// @dev
Expand Down Expand Up @@ -59,7 +59,7 @@ contract ControllerTimelock is PolicyManager, IControllerTimelock {
{
ICreditFacade creditFacade = ICreditFacade(ICreditManagerV3(creditManager).creditFacade());
address creditConfigurator = ICreditManagerV3(creditManager).creditConfigurator();
IPool4626 pool = IPool4626(ICreditManagerV3(creditManager).pool());
IPoolV3 pool = IPoolV3(ICreditManagerV3(creditManager).pool());

uint40 oldExpirationDate = creditFacade.expirationDate();
uint256 totalBorrowed = pool.creditManagerBorrowed(address(creditManager));
Expand Down Expand Up @@ -159,7 +159,7 @@ contract ControllerTimelock is PolicyManager, IControllerTimelock {
external
adminOnly // F: [RCT-05]
{
IPool4626 pool = IPool4626(ICreditManagerV3(creditManager).pool());
IPoolV3 pool = IPoolV3(ICreditManagerV3(creditManager).pool());

uint256 debtLimitCurrent = pool.creditManagerLimit(address(creditManager));

Expand Down
4 changes: 2 additions & 2 deletions contracts/test/gas/credit/CreditFacade.gas.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ import {CreditFacadeTestHelper} from "../../helpers/CreditFacadeTestHelper.sol";
import "../../../interfaces/IExceptions.sol";

// MOCKS
import {AdapterMock} from "../../mocks/adapters/AdapterMock.sol";
import {AdapterMock} from "../../mocks//adapters/AdapterMock.sol";
import {TargetContractMock} from "@gearbox-protocol/core-v2/contracts/test/mocks/adapters/TargetContractMock.sol";
import {ERC20BlacklistableMock} from "../../mocks/token/ERC20Blacklistable.sol";
import {ERC20BlacklistableMock} from "../../mocks//token/ERC20Blacklistable.sol";

// SUITES
import {TokensTestSuite} from "../../suites/TokensTestSuite.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import "../../../interfaces/IExceptions.sol";
import "../../lib/constants.sol";

// MOCKS
import {AdapterMock} from "../../mocks/adapters/AdapterMock.sol";
import {AdapterMock} from "../../mocks//adapters/AdapterMock.sol";
import {TargetContractMock} from "@gearbox-protocol/core-v2/contracts/test/mocks/adapters/TargetContractMock.sol";

// SUITES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ import {CreditFacadeTestHelper} from "../../helpers/CreditFacadeTestHelper.sol";
import "../../../interfaces/IExceptions.sol";

// MOCKS
import {AdapterMock} from "../../mocks/adapters/AdapterMock.sol";
import {AdapterMock} from "../../mocks//adapters/AdapterMock.sol";
import {TargetContractMock} from "@gearbox-protocol/core-v2/contracts/test/mocks/adapters/TargetContractMock.sol";
import {ERC20BlacklistableMock} from "../../mocks/token/ERC20Blacklistable.sol";
import {GeneralMock} from "../../mocks/GeneralMock.sol";
import {ERC20BlacklistableMock} from "../../mocks//token/ERC20Blacklistable.sol";
import {GeneralMock} from "../../mocks//GeneralMock.sol";

// SUITES
import {TokensTestSuite} from "../../suites/TokensTestSuite.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {TokenAlreadyAddedException} from "../../../interfaces/IExceptions.sol";

// MOCKS
import {PriceFeedMock} from "@gearbox-protocol/core-v2/contracts/test/mocks/oracles/PriceFeedMock.sol";
import {PoolServiceMock} from "../../mocks/pool/PoolServiceMock.sol";
import {PoolServiceMock} from "../../mocks//pool/PoolServiceMock.sol";
import {TargetContractMock} from "@gearbox-protocol/core-v2/contracts/test/mocks/adapters/TargetContractMock.sol";
import {
ERC20ApproveRestrictedRevert,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {BalanceHelper} from "../../helpers/BalanceHelper.sol";

// MOCKS
import {PriceFeedMock} from "@gearbox-protocol/core-v2/contracts/test/mocks/oracles/PriceFeedMock.sol";
import {PoolServiceMock} from "../../mocks/pool/PoolServiceMock.sol";
import {PoolServiceMock} from "../../mocks//pool/PoolServiceMock.sol";
import {PoolQuotaKeeper} from "../../../pool/PoolQuotaKeeper.sol";
import {TargetContractMock} from "@gearbox-protocol/core-v2/contracts/test/mocks/adapters/TargetContractMock.sol";

Expand Down
8 changes: 4 additions & 4 deletions contracts/test/mocks/credit/CreditManagerMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "../../../interfaces/IAddressProviderV3.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {ICreditManagerV3} from "../../../interfaces/ICreditManagerV3.sol";
import {IPool4626} from "../../../interfaces/IPool4626.sol";
import {IPoolV3} from "../../../interfaces/IPoolV3.sol";
import {IPoolQuotaKeeper} from "../../../interfaces/IPoolQuotaKeeper.sol";

contract CreditManagerMock {
Expand Down Expand Up @@ -44,12 +44,12 @@ contract CreditManagerMock {

/// @notice Outdated
function lendCreditAccount(uint256 borrowedAmount, address ca) external {
IPool4626(poolService).lendCreditAccount(borrowedAmount, ca);
IPoolV3(poolService).lendCreditAccount(borrowedAmount, ca);
}

/// @notice Outdated
function repayCreditAccount(uint256 borrowedAmount, uint256 profit, uint256 loss) external {
IPool4626(poolService).repayCreditAccount(borrowedAmount, profit, loss);
IPoolV3(poolService).repayCreditAccount(borrowedAmount, profit, loss);
}

/// @notice Outdated
Expand All @@ -58,7 +58,7 @@ contract CreditManagerMock {
returns (uint256 caQuotaInterestChange, bool tokensToEnable, uint256 tokensToDisable)
{
(caQuotaInterestChange,,) =
IPoolQuotaKeeper(IPool4626(pool).poolQuotaKeeper()).updateQuota(_creditAccount, token, quotaChange);
IPoolQuotaKeeper(IPoolV3(pool).poolQuotaKeeper()).updateQuota(_creditAccount, token, quotaChange);
}

function addToken(address token, uint256 mask) external {
Expand Down
Loading

0 comments on commit 3b718d2

Please sign in to comment.