PoolDirectory
The sdk instance used by the directory.
The raw web3 contract instance for the directory.
Contract address of the directory.
Type:
string
Controls if the deployer whitelist is to be enforced.
Parameters:
enforceDeployerWhitelist: boolean
- Boolean indicating if the deployer whitelist is to be enforced.
Adds Ethereum accounts to the deployer whitelist.
Parameters:
deployers: string[]
- Array of Ethereum accounts to be whitelisted.
Bookmarks a pool Unitroller (Comptroller proxy) contract addresses.
Parameters:
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.
Maps Ethereum accounts to booleans indicating if they are allowed to deploy pools.
Parameters:
deployer: string
- Deployer address to get the whitelist status of.
Returns:
Promise<boolean>
Returns a boolean indicating if the deployer whitelist is enforced.
Parameters:
Returns:
Promise<boolean>
Returns arrays of all Fuse pools' data.
Parameters:
Returns arrays of Fuse pool Unitroller (Comptroller proxy) contract addresses bookmarked by
account
.Parameters:
account: string
- The account to get the bookmarks of.
Returns:
Promise<string[]>
Returns arrays of Fuse pool indexes and data created by
account
.Parameters:
account: string
- The account to get the created pools of.
Returns arrays of all public Fuse pool indexes and data.
Parameters:
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.
Returns the address of the current owner.
Parameters:
Returns:
Promise<string>
Maps Fuse pool Comptroller addresses to bools indicating if they have been posted to the directory.
Parameters:
Returns:
Promise<boolean>
Returns pool by poold.
Parameters:
poolId: string | number | BN
- ID of the pool to fetch.
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);
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.
Leaves the contract without owner.
Parameters:
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.
Transfers ownership of the contract to a new account.
Parameters:
newOwner: string
- The account to transfer the ownership to.
Last modified 1yr ago