Skip to main content
Helpful?

SlippageCheck

Git Source - Generated with forge doc

a library for checking if a delta exceeds a maximum ceiling or fails to meet a minimum floor

Functions

validateMinOut

Revert if one or both deltas does not meet a minimum output

This should be called when removing liquidity (burn or decrease)

function validateMinOut(BalanceDelta delta, uint128 amount0Min, uint128 amount1Min) internal pure;

Parameters

NameTypeDescription
deltaBalanceDeltaThe principal amount of tokens to be removed, does not include any fees accrued
amount0Minuint128The minimum amount of token0 to receive
amount1Minuint128The minimum amount of token1 to receive

validateMaxIn

Revert if one or both deltas exceeds a maximum input

This should be called when adding liquidity (mint or increase)

function validateMaxIn(BalanceDelta delta, uint128 amount0Max, uint128 amount1Max) internal pure;

Parameters

NameTypeDescription
deltaBalanceDeltaThe principal amount of tokens to be added, does not include any fees accrued (which is possible on increase)
amount0Maxuint128The maximum amount of token0 to spend
amount1Maxuint128The maximum amount of token1 to spend

Errors

MaximumAmountExceeded

error MaximumAmountExceeded(uint128 maximumAmount, uint128 amountRequested);

MinimumAmountInsufficient

error MinimumAmountInsufficient(uint128 minimumAmount, uint128 amountReceived);
Helpful?