PoolDirectory is the main directory of all pools created and it is used to create new pools.
The API and Usage is shown below:

Structs / Data Objects


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

View Methods

pools(uint id) -> Pool

// @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.

getAllPools -> Pool[]

// @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.

getAllPoolsLength -> uint

// @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.

getPublicPools -> Pool[]

// @dev interface
function getPublicPools() external view returns(uint256[] memory, Pool[] memory);
// @dev Usage
(uint256[] memory indexes, Pool[] memory marketPublicPools) =
returns all pools that are whitelisted or private.

getPublicPoolsByVerification -> Pool[]

// @dev interface
function getPublicPoolsByVerification() external view returns(uint256[] memory, Pool[] memory);
// @dev Usage
(uint256[] memory indexes, Pool[] memory marketVerifiedPools) =
returns all pools that are managed by a whitelisted admin

enforceDeployerWhitelist -> bool

// @dev interface
function enforceDeployerWhitelist() external view returns(bool);
// @dev Usage
bool isMarketWhitelisted = poolDirectory.enforceDeployerWhitelist();
returns true if permissionless pool deployment is disabled

adminWhitelist(address admin) -> bool

// @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

Writeable Methods

deployPool(string, address, bool, uint, uint, address)

// @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.

setPoolName(uint256 poolId, string calldata name)

// @dev interface
function setPoolName(uint256 index, string calldata name) external;
Allows pool admins to change the name of their pool