Back
Challenge 11 - Initial LP Supply
MediumCPMMLP Shares11 / 20

Challenge 11: Initial LP Supply

When a brand new pool is created, LP shares are often based on the geometric mean of the starting reserves.

Task

Implement initial_lp_supply.

Rule

Return:

floor(sqrt(x_reserve * y_reserve))

A helper integer_sqrt is already provided.

Example

For 400 and 900:

sqrt(400 * 900) = sqrt(360000) = 600
LanguageRust
Loading editor...
Run works without login. Submit requires sign-in so completion can be saved.
Run cases to compare your output against each configured input. Submit saves progress only when every case passes.
    Challenge 11 - Initial LP Supply · CPMM Exercise | learn.sol