Skip to main content

IPrimitiveEngineErrors.sol

Read code on GitHub

Custom errors are encoded with their selector and arguments

Details

Peripheral smart contracts should try catch and check if data matches another custom error

Errors

BalanceError

Thrown when the balanceOf function is not successful and does not return data

Solidity
error BalanceError()

CalibrationError

Thrown when the parameters of a new pool are invalid, causing initial reserves to be 0

Solidity
error CalibrationError(uint256 delRisky, uint256 delStable)

Parameters

NameTypeDescription
delRiskyuint256undefined
delStableuint256undefined

DeltaInError

Thrown when the deltaIn parameter is 0

Solidity
error DeltaInError()

DeltaOutError

Thrown when the deltaOut parameter is 0

Solidity
error DeltaOutError()

GammaError

Thrown when gamma, equal to 1 - fee %, is outside its bounds: 9_000 <= gamma <= 10_000; 1_000 = 10% fee

Solidity
error GammaError(uint256 value)

Parameters

NameTypeDescription
valueuint256undefined

InvariantError

Thrown when the invariant check fails

Solidity
error InvariantError(int128 invariant, int128 nextInvariant)
Details

Most important check as it verifies the validity of a desired swap

Parameters

NameTypeDescription
invariantint128Pre-swap invariant updated with new tau
nextInvariantint128Post-swap invariant after the swap amounts are applied to reserves

LockedError

Thrown on attempted re-entrancy on a function with a re-entrancy guard

Solidity
error LockedError()

MinLiquidityError

Thrown when liquidity is lower than or equal to the minimum amount of liquidity

Solidity
error MinLiquidityError(uint256 value)

Parameters

NameTypeDescription
valueuint256undefined

PoolDuplicateError

Thrown in create when a pool with computed poolId already exists

Solidity
error PoolDuplicateError()

PoolExpiredError

Thrown when calling an expired pool, where block.timestamp > maturity, + BUFFER if swap

Solidity
error PoolExpiredError()

RiskyBalanceError

Thrown when the expected risky balance is less than the actual balance

Solidity
error RiskyBalanceError(uint256 expected, uint256 actual)

Parameters

NameTypeDescription
expecteduint256Expected risky balance
actualuint256Actual risky balance

RiskyPerLpError

Thrown when riskyPerLp is outside the range of acceptable values, 0 < riskyPerLp <= 1eRiskyDecimals

Solidity
error RiskyPerLpError(uint256 value)

Parameters

NameTypeDescription
valueuint256undefined

SigmaError

Thrown when sigma is outside the range of acceptable values, 1 <= sigma <= 1e7 with 4 precision

Solidity
error SigmaError(uint256 value)

Parameters

NameTypeDescription
valueuint256undefined

StableBalanceError

Thrown when the expected stable balance is less than the actual balance

Solidity
error StableBalanceError(uint256 expected, uint256 actual)

Parameters

NameTypeDescription
expecteduint256Expected stable balance
actualuint256Actual stable balance

StrikeError

Thrown when strike is not valid, i.e. equal to 0 or greater than 2^128

Solidity
error StrikeError(uint256 value)

Parameters

NameTypeDescription
valueuint256undefined

UninitializedError

Thrown when the pool with poolId has not been created

Solidity
error UninitializedError()

ZeroDeltasError

Thrown when the risky or stable amount is 0

Solidity
error ZeroDeltasError()

ZeroLiquidityError

Thrown when the liquidity parameter is 0

Solidity
error ZeroLiquidityError()