-
Notifications
You must be signed in to change notification settings - Fork 19
Pool Creation
Lucas Manuel edited this page Feb 26, 2021
·
7 revisions
This page outlines the full transaction flows that different actors in the system will typically go through, as well as all the prerequisite set up required in the system before these transactions are possible.
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)
- Deploy PoolFactory
- Deploy LiquidityLockerFactory
- Deploy StakeLockerFactory
-
globals.setValidPoolFactory(address(poolFactory), true);
- Validate PoolFactory -
globals.setValidSubFactory(address(poolFactory), address(llFactory), true);
- Validate LiquidityLockerFactory -
globals.setValidSubFactory(address(poolFactory), address(slFactory), true);
- Validate StakeLockerFactory -
globals.setPoolDelegateWhitelist(address(poolDelegate), true);
- Whitelist PoolDelegate -
globals.setLoanAsset(USDC, true);
- Whitelist ERC-20 to be used by Pool (example: USDC) - 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)
- 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.
- Add liquidity to the Balancer pool, obtaining BPTs. Here is a link to the Balancer docs for how to perform this action.
- Approve the StakeLocker to spend the BPTs
- Get the minimum stake amount required from
(,,, uint256 minStake,) = pool.getInitialStakeRequirements();
-
stake
at least the minimum stake amount into the StakeLocker -
finalize
the Pool
Once the Pool is finalized, LPs can start depositing liquidity into the Pool.