PoolDirectory
PoolDirectory is the main directory of all pools created and it is used to create new pools.
The API and Usage is shown below:
struct Pool {
string name;
address creator;
address comptroller;
uint256 blockPosted;
uint256 timestampPosted;
}
The
Pool
struct is used to store metadata for every pool that is created. It contains details like:- name
- creator
- comptroller
- and timestamps
// @dev interface
function pools(uint256 id) external view returns(Pool memory);
// @dev Usage
Pool memory marketPoolOne = poolDirectory.pools(1);
Returns the pool metadata provided a pool id.
// @dev interface
function getAllPools() external view returns(Pool[] memory);
// @dev Usage
Pool[] memory marketPools = poolDirectory.getAllPools();
Returns all the pools created by the pool directory.
// @dev interface
function getAllPoolsLength() external view returns(uint);
// @dev Usage
uint marketPoolLength = poolDirectory.getAllPoolsLength();
Returns the number of pools which were created by the pool directory.
// @dev interface
function getPublicPools() external view returns(uint256[] memory, Pool[] memory);
// @dev Usage
(uint256[] memory indexes, Pool[] memory marketPublicPools) =
poolDirectory.getPublicPools();
returns all pools that are whitelisted or private.
// @dev interface
function getPublicPoolsByVerification() external view returns(uint256[] memory, Pool[] memory);
// @dev Usage
(uint256[] memory indexes, Pool[] memory marketVerifiedPools) =
poolDirectory.getPublicPoolsByVerification();
returns all pools that are managed by a whitelisted admin
// @dev interface
function enforceDeployerWhitelist() external view returns(bool);
// @dev Usage
bool isMarketWhitelisted = poolDirectory.enforceDeployerWhitelist();
returns
true
if permissionless pool deployment is disabled// @dev interface
function adminWhitelist(address admin) external view returns(bool);
// @dev Usage
bool amIWhitelisted = poolDirectory.adminWhitelist(msg.sender);
returns
true
if an admin is verified// @dev interface
function deployPool(
string memory name,
address implementation,
bool enforceWhitelist,
uint256 closeFactor,
uint256 liquidationIncentive,
address priceOracle
) external returns(uint256, address);
Allows for pool creators or whitelisted users to deploy pools
☺
returns the
poolId
and address
of the pool once it is deployed.// @dev interface
function setPoolName(uint256 index, string calldata name) external;
Allows pool admins to change the name of their pool
Last modified 1yr ago