Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename pool manager to pool admin #81

Merged
merged 1 commit into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/FeeVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ contract FeeVault {

modifier onlyPoolAdmin() {
require(
msg.sender == IPool(pool).manager(),
msg.sender == IPool(pool).admin(),
"FeeVault: caller not pool admin"
);
_;
Expand Down
6 changes: 3 additions & 3 deletions contracts/Loan.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ contract Loan is ILoan {

modifier onlyPoolAdmin() {
require(
msg.sender == IPool(_pool).manager(),
msg.sender == IPool(_pool).admin(),
"Loan: caller is not pool admin"
);
_;
Expand Down Expand Up @@ -180,7 +180,7 @@ contract Loan is ILoan {
returns (ILoanLifeCycleState)
{
require(
msg.sender == _borrower || msg.sender == IPool(_pool).manager(),
msg.sender == _borrower || msg.sender == IPool(_pool).admin(),
"Loan: invalid caller"
);
require(
Expand Down Expand Up @@ -209,7 +209,7 @@ contract Loan is ILoan {
(_state == ILoanLifeCycleState.Canceled &&
msg.sender == _borrower) ||
(_state == ILoanLifeCycleState.Defaulted &&
msg.sender == IPool(_pool).manager()) ||
msg.sender == IPool(_pool).admin()) ||
(_state == ILoanLifeCycleState.Matured &&
msg.sender == _borrower),
"Loan: unable to claim collateral"
Expand Down
48 changes: 24 additions & 24 deletions contracts/Pool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ contract Pool is IPool, ERC20 {
using SafeMath for uint256;
using EnumerableSet for EnumerableSet.AddressSet;

address private _manager;
address private _admin;
address private immutable _factory;
IServiceConfiguration private _serviceConfiguration;
IERC20 private _liquidityAsset;
Expand Down Expand Up @@ -57,12 +57,12 @@ contract Pool is IPool, ERC20 {
}

/**
* @dev Modifier that checks that the caller is the pool's manager.
* @dev Modifier that checks that the caller is the pool's admin.
*/
modifier onlyManager() {
modifier onlyAdmin() {
require(
_manager != address(0) && msg.sender == _manager,
"Pool: caller is not manager"
_admin != address(0) && msg.sender == _admin,
"Pool: caller is not admin"
);
_;
}
Expand Down Expand Up @@ -125,7 +125,7 @@ contract Pool is IPool, ERC20 {
/**
* @dev Constructor for Pool
* @param liquidityAsset asset held by the poo
* @param poolManager manager of the pool
* @param poolAdmin admin of the pool
* @param poolSettings configurable settings for the pool
* @param serviceConfiguration address of global service configuration
* @param tokenName Name used for issued pool tokens
Expand All @@ -134,7 +134,7 @@ contract Pool is IPool, ERC20 {
constructor(
address factory,
address liquidityAsset,
address poolManager,
address poolAdmin,
address serviceConfiguration,
IPoolConfigurableSettings memory poolSettings,
string memory tokenName,
Expand All @@ -143,7 +143,7 @@ contract Pool is IPool, ERC20 {
_factory = factory;
_liquidityAsset = IERC20(liquidityAsset);
_poolSettings = poolSettings;
_manager = poolManager;
_admin = poolAdmin;
_serviceConfiguration = IServiceConfiguration(serviceConfiguration);
_firstLossVault = new FirstLossVault(address(this), liquidityAsset);
_feeVault = new FeeVault(address(this));
Expand Down Expand Up @@ -192,12 +192,12 @@ contract Pool is IPool, ERC20 {
}

/**
* @dev Allow the current pool manager to update the pool fees
* @dev Allow the current pool admin to update the pool fees
* before the pool has been activated.
*/
function setRequestFee(uint256 feeBps)
external
onlyManager
onlyAdmin
atState(IPoolLifeCycleState.Initialized)
{
_poolSettings.requestFeeBps = feeBps;
Expand All @@ -219,12 +219,12 @@ contract Pool is IPool, ERC20 {
}

/**
* @dev Allow the current pool manager to update the withdraw gate at any
* @dev Allow the current pool admin to update the withdraw gate at any
* time if the pool is Initialized or Active
*/
function setWithdrawGate(uint256 _withdrawGateBps)
external
onlyManager
onlyAdmin
atInitializedOrActiveState
{
_poolSettings.withdrawGateBps = _withdrawGateBps;
Expand All @@ -242,10 +242,10 @@ contract Pool is IPool, ERC20 {
}

/**
* @dev The manager of the pool
* @dev The admin of the pool
*/
function manager() external view override returns (address) {
return _manager;
function admin() external view override returns (address) {
return _admin;
}

/**
Expand Down Expand Up @@ -284,11 +284,11 @@ contract Pool is IPool, ERC20 {
}

/**
* @dev Supplies first-loss to the pool. Can only be called by the Pool Manager.
* @dev Supplies first-loss to the pool. Can only be called by the Pool Admin.
*/
function depositFirstLoss(uint256 amount, address spender)
external
onlyManager
onlyAdmin
atInitializedOrActiveState
{
IPoolLifeCycleState poolLifeCycleState = PoolLib
Expand All @@ -309,7 +309,7 @@ contract Pool is IPool, ERC20 {
*/
function withdrawFirstLoss(uint256 amount, address receiver)
external
onlyManager
onlyAdmin
atState(IPoolLifeCycleState.Closed)
returns (uint256)
{
Expand All @@ -325,7 +325,7 @@ contract Pool is IPool, ERC20 {
/**
* @inheritdoc IPool
*/
function updatePoolCapacity(uint256 newCapacity) external onlyManager {
function updatePoolCapacity(uint256 newCapacity) external onlyAdmin {
require(newCapacity >= totalAssets(), "Pool: invalid capacity");
_poolSettings.maxCapacity = newCapacity;
emit PoolSettingsUpdated();
Expand All @@ -334,16 +334,16 @@ contract Pool is IPool, ERC20 {
/**
* @inheritdoc IPool
*/
function updatePoolEndDate(uint256 endDate) external onlyManager {
function updatePoolEndDate(uint256 endDate) external onlyAdmin {
PoolLib.executeUpdateEndDate(endDate, _poolSettings);
}

/**
* @dev Called by the pool manager, this transfers liquidity from the pool to a given loan.
* @dev Called by the pool admin, this transfers liquidity from the pool to a given loan.
*/
function fundLoan(address addr)
external
onlyManager
onlyAdmin
atState(IPoolLifeCycleState.Active)
isPoolLoan(addr)
{
Expand All @@ -365,7 +365,7 @@ contract Pool is IPool, ERC20 {
/**
* @inheritdoc IPool
*/
function defaultLoan(address loan) external onlyManager {
function defaultLoan(address loan) external onlyAdmin {
require(loan != address(0), "Pool: 0 address");
IPoolLifeCycleState state = lifeCycleState();
require(
Expand Down Expand Up @@ -419,7 +419,7 @@ contract Pool is IPool, ERC20 {
);
}

function claimFixedFee() external onlyManager {
function claimFixedFee() external onlyAdmin {
require(
_accountings.fixedFeeDueDate < block.timestamp,
"Pool: fixed fee not due"
Expand Down
18 changes: 9 additions & 9 deletions contracts/interfaces/IPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ interface IPool is IERC4626 {
function withdrawGate() external view returns (uint256);

/**
* @dev The manager for the pool.
* @dev The admin for the pool.
*/
function manager() external view returns (address);
function admin() external view returns (address);

/**
* @dev The amount of first loss available to the pool.
Expand Down Expand Up @@ -165,24 +165,24 @@ interface IPool is IERC4626 {
function poolFeePercentOfInterest() external view returns (uint256);

/**
* @dev Deposits first-loss to the pool. Can only be called by the Pool Manager.
* @dev Deposits first-loss to the pool. Can only be called by the Pool Admin.
*/
function depositFirstLoss(uint256 amount, address spender) external;

/**
* @dev Withdraws first-loss from the pool. Can only be called by the Pool Manager.
* @dev Withdraws first-loss from the pool. Can only be called by the Pool Admin.
*/
function withdrawFirstLoss(uint256 amount, address receiver)
external
returns (uint256);

/**
* @dev Updates the pool capacity. Can only be called by the Pool Manager.
* @dev Updates the pool capacity. Can only be called by the Pool Admin.
*/
function updatePoolCapacity(uint256) external;

/**
* @dev Updates the pool end date. Can only be called by the Pool Manager.
* @dev Updates the pool end date. Can only be called by the Pool Admin.
*/
function updatePoolEndDate(uint256) external;

Expand All @@ -208,7 +208,7 @@ interface IPool is IERC4626 {
function liquidityPoolAssets() external view returns (uint256);

/**
* @dev Called by the pool manager, this transfers liquidity from the pool to a given loan.
* @dev Called by the pool admin, this transfers liquidity from the pool to a given loan.
*/
function fundLoan(address) external;

Expand All @@ -219,13 +219,13 @@ interface IPool is IERC4626 {
function notifyLoanPrincipalReturned() external;

/**
* @dev Called by the pool manager, this marks a loan as in default, triggering liquiditation
* @dev Called by the pool admin, this marks a loan as in default, triggering liquiditation
* proceedings and updating pool accounting.
*/
function defaultLoan(address) external;

/**
* @dev Called by the pool manager, this claims a fixed fee from the pool. Fee can only be
* @dev Called by the pool admin, this claims a fixed fee from the pool. Fee can only be
* claimed once every interval, as set on the pool.
*/
function claimFixedFee() external;
Expand Down
2 changes: 1 addition & 1 deletion contracts/libraries/PoolLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ library PoolLib {
}

/**
* @dev Withdraws first loss capital. Can only be called by the Pool manager under certain conditions.
* @dev Withdraws first loss capital. Can only be called by the Pool admin under certain conditions.
* @param amount Amount of first loss being withdrawn
* @param withdrawReceiver Where the liquidity should be withdrawn to
* @param firstLossVault Vault holding first loss
Expand Down
4 changes: 2 additions & 2 deletions contracts/permissioned/PermissionedPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ contract PermissionedPool is Pool {
constructor(
address factory,
address liquidityAsset,
address poolManager,
address poolAdmin,
address serviceConfiguration,
IPoolConfigurableSettings memory poolSettings,
string memory tokenName,
Expand All @@ -53,7 +53,7 @@ contract PermissionedPool is Pool {
Pool(
factory,
liquidityAsset,
poolManager,
poolAdmin,
serviceConfiguration,
poolSettings,
tokenName,
Expand Down
12 changes: 6 additions & 6 deletions contracts/permissioned/PermissionedPoolFactory.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.16;

import "./interfaces/IPoolManagerAccessControl.sol";
import "./interfaces/IPoolAdminAccessControl.sol";
import "./interfaces/IPermissionedServiceConfiguration.sol";
import "../interfaces/IPoolWithdrawManagerFactory.sol";
import "../PoolFactory.sol";
Expand All @@ -25,14 +25,14 @@ contract PermissionedPoolFactory is PoolFactory {
}

/**
* @dev Check that `msg.sender` is a PoolManager.
* @dev Check that `msg.sender` is a PoolAdmin.
*/
modifier onlyVerifiedPoolManager() {
modifier onlyVerifiedPoolAdmin() {
require(
_serviceConfiguration.poolManagerAccessControl().isAllowed(
_serviceConfiguration.poolAdminAccessControl().isAllowed(
msg.sender
),
"caller is not allowed pool manager"
"caller is not allowed pool admin"
);
_;
}
Expand All @@ -44,7 +44,7 @@ contract PermissionedPoolFactory is PoolFactory {
address liquidityAsset,
address poolWithdrawManagerFactory,
IPoolConfigurableSettings calldata settings
) public override onlyVerifiedPoolManager returns (address poolAddress) {
) public override onlyVerifiedPoolAdmin returns (address poolAddress) {
require(
settings.withdrawRequestPeriodDuration > 0,
"PoolFactory: Invalid duration"
Expand Down
18 changes: 9 additions & 9 deletions contracts/permissioned/PermissionedServiceConfiguration.sol
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.16;

import "./interfaces/IPoolManagerAccessControl.sol";
import "./interfaces/IPoolAdminAccessControl.sol";
import "../ServiceConfiguration.sol";

/**
* @title PermissionedServiceConfiguration
*/
contract PermissionedServiceConfiguration is ServiceConfiguration {
/**
* @dev Access Control logic for the Pool Manager role
* @dev Access Control logic for the Pool Admin role
*/
IPoolManagerAccessControl public poolManagerAccessControl;
IPoolAdminAccessControl public poolAdminAccessControl;

/**
* @dev Set the PoolManagerAccessControl contract.
* @dev Set the PoolAdminAccessControl contract.
* @dev Emits `AddressSet` event.
*/
function setPoolManagerAccessControl(
IPoolManagerAccessControl _poolManagerAccessControl
function setPoolAdminAccessControl(
IPoolAdminAccessControl _poolAdminAccessControl
) public onlyOperator {
poolManagerAccessControl = _poolManagerAccessControl;
poolAdminAccessControl = _poolAdminAccessControl;
emit AddressSet(
"POOL_MANAGER_PERMISSION",
address(poolManagerAccessControl)
"POOL_ADMIN_PERMISSION",
address(poolAdminAccessControl)
);
}
}
6 changes: 3 additions & 3 deletions contracts/permissioned/PoolAccessControl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
* @dev Implementation of the {IPoolAccessControl} interface.
*
* This implementation implements a basic Allow-List of addresses, which can
* be managed only by the Pool Manager.
* be managed only by the Pool Admin.
*/
contract PoolAccessControl is
IPoolAccessControl,
Expand Down Expand Up @@ -85,10 +85,10 @@ contract PoolAccessControl is
event CredentialSchemaRemoved(string schema);

/**
* @dev Modifier that checks that the caller is the pool's manager.
* @dev Modifier that checks that the caller is the pool's admin.
*/
modifier onlyPoolAdmin() {
require(msg.sender == _pool.manager(), "Pool: caller is not manager");
require(msg.sender == _pool.admin(), "Pool: caller is not admin");
_;
}

Expand Down
Loading