Module orca_whirlpool.internal.errors

Expand source code
from enum import Enum


class WhirlpoolErrorCode(str, Enum):
    pass


class MathErrorCode(WhirlpoolErrorCode):
    MultiplicationOverflow = "MultiplicationOverflow"
    MulDivOverflow = "MulDivOverflow"
    MultiplicationShiftRightOverflow = "MultiplicationShiftRightOverflow"
    DivideByZero = "DivideByZero"


class TokenErrorCode(WhirlpoolErrorCode):
    TokenMaxExceeded = "TokenMaxExceeded"
    TokenMinSubceeded = "TokenMinSubceeded"


class SwapErrorCode(WhirlpoolErrorCode):
    InvalidSqrtPriceLimitDirection = "InvalidSqrtPriceLimitDirection"
    SqrtPriceOutOfBounds = "SqrtPriceOutOfBounds"
    ZeroTradableAmount = "ZeroTradableAmount"
    AmountOutBelowMinimum = "AmountOutBelowMinimum"
    AmountInAboveMaximum = "AmountInAboveMaximum"
    TickArrayCrossingAboveMax = "TickArrayCrossingAboveMax"
    TickArrayIndexNotInitialized = "TickArrayIndexNotInitialized"
    TickArraySequenceInvalid = "TickArraySequenceInvalid"
    SqrtPriceMaxExceeded = "SqrtPriceMaxExceeded"
    SqrtPriceMinSubceeded = "SqrtPriceMinSubceeded"
    TickArray0MustBeInitialized = "TickArray0MustBeInitialized"


class WhirlpoolError(Exception):
    def __init__(self, error_code: WhirlpoolErrorCode, message: str = None):
        if message is not None:
            super().__init__(f"{str(error_code)}: {message}")
        else:
            super().__init__(str(error_code))

Classes

class MathErrorCode (value, names=None, *, module=None, qualname=None, type=None, start=1)

An enumeration.

Expand source code
class MathErrorCode(WhirlpoolErrorCode):
    MultiplicationOverflow = "MultiplicationOverflow"
    MulDivOverflow = "MulDivOverflow"
    MultiplicationShiftRightOverflow = "MultiplicationShiftRightOverflow"
    DivideByZero = "DivideByZero"

Ancestors

Class variables

var DivideByZero
var MulDivOverflow
var MultiplicationOverflow
var MultiplicationShiftRightOverflow
class SwapErrorCode (value, names=None, *, module=None, qualname=None, type=None, start=1)

An enumeration.

Expand source code
class SwapErrorCode(WhirlpoolErrorCode):
    InvalidSqrtPriceLimitDirection = "InvalidSqrtPriceLimitDirection"
    SqrtPriceOutOfBounds = "SqrtPriceOutOfBounds"
    ZeroTradableAmount = "ZeroTradableAmount"
    AmountOutBelowMinimum = "AmountOutBelowMinimum"
    AmountInAboveMaximum = "AmountInAboveMaximum"
    TickArrayCrossingAboveMax = "TickArrayCrossingAboveMax"
    TickArrayIndexNotInitialized = "TickArrayIndexNotInitialized"
    TickArraySequenceInvalid = "TickArraySequenceInvalid"
    SqrtPriceMaxExceeded = "SqrtPriceMaxExceeded"
    SqrtPriceMinSubceeded = "SqrtPriceMinSubceeded"
    TickArray0MustBeInitialized = "TickArray0MustBeInitialized"

Ancestors

Class variables

var AmountInAboveMaximum
var AmountOutBelowMinimum
var InvalidSqrtPriceLimitDirection
var SqrtPriceMaxExceeded
var SqrtPriceMinSubceeded
var SqrtPriceOutOfBounds
var TickArray0MustBeInitialized
var TickArrayCrossingAboveMax
var TickArrayIndexNotInitialized
var TickArraySequenceInvalid
var ZeroTradableAmount
class TokenErrorCode (value, names=None, *, module=None, qualname=None, type=None, start=1)

An enumeration.

Expand source code
class TokenErrorCode(WhirlpoolErrorCode):
    TokenMaxExceeded = "TokenMaxExceeded"
    TokenMinSubceeded = "TokenMinSubceeded"

Ancestors

Class variables

var TokenMaxExceeded
var TokenMinSubceeded
class WhirlpoolError (error_code: WhirlpoolErrorCode, message: str = None)

Common base class for all non-exit exceptions.

Expand source code
class WhirlpoolError(Exception):
    def __init__(self, error_code: WhirlpoolErrorCode, message: str = None):
        if message is not None:
            super().__init__(f"{str(error_code)}: {message}")
        else:
            super().__init__(str(error_code))

Ancestors

  • builtins.Exception
  • builtins.BaseException
class WhirlpoolErrorCode (value, names=None, *, module=None, qualname=None, type=None, start=1)

An enumeration.

Expand source code
class WhirlpoolErrorCode(str, Enum):
    pass

Ancestors

  • builtins.str
  • enum.Enum

Subclasses