Skip to content

Pool Creation

Lucas Manuel edited this page Apr 4, 2021 · 7 revisions

Creating a Pool in Maple is a multi-step process, which requires the following prerequisite transactions (assuming that the Maple protocol is in a fresh, newly deployed state)

Governor Transactions (all one-time transactions, prerequisite to the creation of a Pool)

  1. Deploy PoolFactory
  2. Deploy LiquidityLockerFactory
  3. Deploy StakeLockerFactory
  4. globals.setValidPoolFactory(address(poolFactory), true); - Validate PoolFactory
  5. globals.setValidSubFactory(address(poolFactory), address(llFactory), true); - Validate LiquidityLockerFactory
  6. globals.setValidSubFactory(address(poolFactory), address(slFactory), true); - Validate StakeLockerFactory
  7. globals.setPoolDelegateAllowlist(address(poolDelegate), true); - Validate PoolDelegate
  8. globals.setLiquidityAsset(USDC, true); - Validate ERC-20 to be used by Pool (example: USDC)
  9. Create and finalize 50-50 MPL-USDC Balancer Pool (example for USDC, if liquidityAsset is DAI, must create and finalize MPL-DAI 50-50 Balancer Pool. Other pair asset MUST be MPL)
  10. setValidBalancerPool(address(bPool), true); - Validate Balancer pool

PoolDelegate Transactions

  1. Create a Pool from the PoolFactory:
function createPool(
    address liquidityAsset, 
    address stakeAsset,
    address slFactory, 
    address llFactory,
    uint256 stakingFee, 
    uint256 delegateFee,
    uint256 liquidityCap
)

Example:

poolFactory.createPool(
    USDC,
    address(bPool),
    address(slFactory),
    address(llFactory),
    500,
    100,
    100_000_000 * 10 ** 6
));

NOTE: Once a Pool is created, it is in the Initialized state, meaning that it has been deployed successfully, but is not yet operational.

  1. Add liquidity to the Balancer pool, obtaining BPTs. Here is a link to the Balancer docs for how to perform this action.
  2. Approve the StakeLocker to spend the BPTs
  3. Get the minimum stake amount required from (,,, uint256 minStake,) = pool.getInitialStakeRequirements();
  4. stake at least the minimum stake amount into the StakeLocker
  5. finalize the Pool

Once the Pool is finalized, LPs can start depositing liquidity into the Pool.