// If deploying locally; otherwise use the published addresses
// This is the factory for the underlying Core BPool
bFactory = await BFactory.deployed();
// This is the Smart Pool factory
crpFactory = await CRPFactory.deployed();
// Static call to get the return value
const crpContract = await crpFactory.newCrp.call(
// Transaction that actually deploys the CRP
// Wait for it to get mined
const crp = await ConfigurableRightsPool.at(crpContract);
// Creating the pool transfers collateral tokens
// Must allow the contract to spend them
await dai.approve(crp.address, MAX);
await xyz.approve(crp.address, MAX);
// Create the underlying pool
// Mint 1,000 LBT pool tokens; pull collateral into BPool
// Override with fast block wait times for testing purposes
// (Defaults are 2 hours min delay / 2 weeks min duration)
await crp.createPool(toWei('1000'), 10, 10);