Back
Challenge 9 - Slippage In Basis Points
MediumCPMMSlippage9 / 20

Challenge 9: Slippage In Basis Points

Slippage measures how far the executed average price moved from the pre-trade spot price.

Task

Implement slippage_bps.

Formula

Use:

(spot_price_bps - execution_price_bps) * 10_000 / spot_price_bps

Example

For:

  • spot price = 20_000
  • execution price = 18_100

Then:

(20_000 - 18_100) * 10_000 / 20_000 = 950
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 9 - Slippage In Basis Points · CPMM Exercise | learn.sol