PoolDirectory

Properties
Methods

Properties

sdk

The sdk instance used by the directory.

Type: MarketSDK

contract

The raw web3 contract instance for the directory.

Type: web3.eth.Contract

address

Contract address of the directory.

Type: string

Methods

_setDeployerWhitelistEnforcement

Controls if the deployer whitelist is to be enforced.

Parameters:

  • enforceDeployerWhitelist: boolean - Boolean indicating if the deployer whitelist is to be enforced.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

_whitelistDeployers

Adds Ethereum accounts to the deployer whitelist.

Parameters:

  • deployers: string[] - Array of Ethereum accounts to be whitelisted.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

bookmarkPool

Bookmarks a pool Unitroller (Comptroller proxy) contract addresses.

Parameters:

  • comptroller: string | Comptroller - The pool Unitroller to bookmark.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

deployPool

Deploys a new pool and adds it to the directory.

Parameters:

  • name: string - The name of the pool.

  • implementation: string - The Comptroller implementation contract address.

  • enforceWhitelist: boolean - Boolean indicating if the pool's supplier/borrow whitelist is to be enforced.

  • closeFactor: number | string | BN - The pool's close factor (scaled by 1e18).

  • maxAssets: number | string | BN - Maximum number of assets in the pool.

  • iquidationIncentive: number | string | BN - The pool's liquidation incentive (scaled by 1e18).

  • priceOracle: string - The pool's PriceOracle contract address.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

deployerWhitelist

Maps Ethereum accounts to booleans indicating if they are allowed to deploy pools.

Parameters:

  • deployer: string - Deployer address to get the whitelist status of.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<boolean>

enforceDeployerWhitelist

Returns a boolean indicating if the deployer whitelist is enforced.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<boolean>

getAllPools

Returns arrays of all Fuse pools' data.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<Pool[]>

getBookmarks

Returns arrays of Fuse pool Unitroller (Comptroller proxy) contract addresses bookmarked by account.

Parameters:

  • account: string - The account to get the bookmarks of.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string[]>

getPoolsByAccount

Returns arrays of Fuse pool indexes and data created by account.

Parameters:

  • account: string - The account to get the created pools of.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise< indexes: BN[]; pools: Pool[]; >

getPublicPools

Returns arrays of all public Fuse pool indexes and data.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise< indexes: BN[]; pools: Pool[]; >

initialize

Initializes a deployer whitelist if desired.

Parameters:

  • _enforceDeployerWhitelist: boolean - Boolean indicating if the deployer whitelist is to be enforced.

  • _deployerWHitelist: string [] - Array of Ethereum accounts to be whitelisted.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

owner

Returns the address of the current owner.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

poolExists

Maps Fuse pool Comptroller addresses to bools indicating if they have been posted to the directory.

Parameters:

  • comptroller: string | Comptroller - The comptroller to check for.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<boolean>

pools

Returns pool by poold.

Parameters:

  • poolId: string | number | BN - ID of the pool to fetch.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<Pool>

import Web3 from "web3";
import { MarketSDK, MarketOptions } from "market-sdk";

const options: MarketOptions = {
  poolDirectory: "SET_DIRECTORY_ADDRESS",
  marketLens: "SET_MARKET_LENS_ADDRESS"
};
const web3 = new Web3("SET_RPC_OR_PROVIDER");
const sdk = await MarketSDK.init(web3, options);
const directory = new PoolDirectory(sdk, sdk.options!.poolDirectory);

const [pool0, pool1] = await Promise.all([
  directory.pools(0),
  directory.pools(1)
]);

console.log("Pool#0 Name:", pool0.name);
console.log("Pool#0 Comptroller Address:", pool0.comptroller.address);
console.log("Pool#0 Creator Address:", pool0.creator);
console.log()

console.log("Pool#1 Name:", pool1.name);
console.log("Pool#1 Comptroller Address:", pool1.comptroller.address);
console.log("Pool#1 Creator Address:", pool1.creator);

registerPool

Adds a new Fuse pool to the directory.

Parameters:

  • name: string - The name of the pool.

  • comptroller: string - The pool's Comptroller proxy contract address.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

renounceOwnership

Leaves the contract without owner.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

setPoolName

Changes the name of a pool.

Parameters:

  • poolId: number | string | BN - Id of the pool to change the name of.

  • newName: string - the new name for the pool.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

transferOwnership

Transfers ownership of the contract to a new account.

Parameters:

  • newOwner: string - The account to transfer the ownership to.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

Last updated