"""
@generated by mypy-protobuf.  Do not edit manually!
isort:skip_file
"""
import builtins
import common.common_pb2
import cosmos.base.v1beta1.coin_pb2
import google.protobuf.descriptor
import google.protobuf.duration_pb2
import google.protobuf.internal.containers
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import typing
import typing_extensions

DESCRIPTOR: google.protobuf.descriptor.FileDescriptor

class _Side:
    ValueType = typing.NewType('ValueType', builtins.int)
    V: typing_extensions.TypeAlias = ValueType
class _SideEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_Side.ValueType], builtins.type):
    DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
    SIDE_UNSPECIFIED: _Side.ValueType  # 0
    BUY: _Side.ValueType  # 1
    SELL: _Side.ValueType  # 2
class Side(_Side, metaclass=_SideEnumTypeWrapper):
    pass

SIDE_UNSPECIFIED: Side.ValueType  # 0
BUY: Side.ValueType  # 1
SELL: Side.ValueType  # 2
global___Side = Side


class _PnLCalcOption:
    ValueType = typing.NewType('ValueType', builtins.int)
    V: typing_extensions.TypeAlias = ValueType
class _PnLCalcOptionEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_PnLCalcOption.ValueType], builtins.type):
    DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
    PNL_CALC_OPTION_UNSPECIFIED: _PnLCalcOption.ValueType  # 0
    SPOT_PRICE: _PnLCalcOption.ValueType  # 1
    TWAP: _PnLCalcOption.ValueType  # 2
    ORACLE: _PnLCalcOption.ValueType  # 3
class PnLCalcOption(_PnLCalcOption, metaclass=_PnLCalcOptionEnumTypeWrapper):
    pass

PNL_CALC_OPTION_UNSPECIFIED: PnLCalcOption.ValueType  # 0
SPOT_PRICE: PnLCalcOption.ValueType  # 1
TWAP: PnLCalcOption.ValueType  # 2
ORACLE: PnLCalcOption.ValueType  # 3
global___PnLCalcOption = PnLCalcOption


class _PnLPreferenceOption:
    ValueType = typing.NewType('ValueType', builtins.int)
    V: typing_extensions.TypeAlias = ValueType
class _PnLPreferenceOptionEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_PnLPreferenceOption.ValueType], builtins.type):
    DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
    PNL_PREFERENCE_UNSPECIFIED: _PnLPreferenceOption.ValueType  # 0
    MAX: _PnLPreferenceOption.ValueType  # 1
    MIN: _PnLPreferenceOption.ValueType  # 2
class PnLPreferenceOption(_PnLPreferenceOption, metaclass=_PnLPreferenceOptionEnumTypeWrapper):
    pass

PNL_PREFERENCE_UNSPECIFIED: PnLPreferenceOption.ValueType  # 0
MAX: PnLPreferenceOption.ValueType  # 1
MIN: PnLPreferenceOption.ValueType  # 2
global___PnLPreferenceOption = PnLPreferenceOption


class _MarginCalculationPriceOption:
    ValueType = typing.NewType('ValueType', builtins.int)
    V: typing_extensions.TypeAlias = ValueType
class _MarginCalculationPriceOptionEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_MarginCalculationPriceOption.ValueType], builtins.type):
    DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
    MARGIN_CALCULATION_PRICE_OPTION_UNSPECIFIED: _MarginCalculationPriceOption.ValueType  # 0
    SPOT: _MarginCalculationPriceOption.ValueType  # 1
    INDEX: _MarginCalculationPriceOption.ValueType  # 2
    MAX_PNL: _MarginCalculationPriceOption.ValueType  # 3
class MarginCalculationPriceOption(_MarginCalculationPriceOption, metaclass=_MarginCalculationPriceOptionEnumTypeWrapper):
    pass

MARGIN_CALCULATION_PRICE_OPTION_UNSPECIFIED: MarginCalculationPriceOption.ValueType  # 0
SPOT: MarginCalculationPriceOption.ValueType  # 1
INDEX: MarginCalculationPriceOption.ValueType  # 2
MAX_PNL: MarginCalculationPriceOption.ValueType  # 3
global___MarginCalculationPriceOption = MarginCalculationPriceOption


class Params(google.protobuf.message.Message):
    DESCRIPTOR: google.protobuf.descriptor.Descriptor
    STOPPED_FIELD_NUMBER: builtins.int
    FEE_POOL_FEE_RATIO_FIELD_NUMBER: builtins.int
    ECOSYSTEM_FUND_FEE_RATIO_FIELD_NUMBER: builtins.int
    LIQUIDATION_FEE_RATIO_FIELD_NUMBER: builtins.int
    PARTIAL_LIQUIDATION_RATIO_FIELD_NUMBER: builtins.int
    FUNDING_RATE_INTERVAL_FIELD_NUMBER: builtins.int
    TWAP_LOOKBACK_WINDOW_FIELD_NUMBER: builtins.int
    stopped: builtins.bool
    """stopped identifies if the perp exchange is stopped or not"""

    fee_pool_fee_ratio: typing.Text
    """FeePoolFeeRatio is the ratio transferred to the the fee pool"""

    ecosystem_fund_fee_ratio: typing.Text
    """EcosystemFundFeeRatio is the ratio transferred to the PerpEF."""

    liquidation_fee_ratio: typing.Text
    """LiquidationFeeRatio is the percentage of liquidated position that will be given
    to out as a reward. Half of the liquidation fee is given to the liquidator,
    and the other half is given to the ecosystem fund.
    """

    partial_liquidation_ratio: typing.Text
    """PartialLiquidationRatio is the share we try to liquidate if the margin is higher than liquidation fee"""

    funding_rate_interval: typing.Text
    """specifies the interval on which the funding rate is updated"""

    @property
    def twap_lookback_window(self) -> google.protobuf.duration_pb2.Duration:
        """amount of time to look back for TWAP calculations"""
        pass
    def __init__(self,
        *,
        stopped: builtins.bool = ...,
        fee_pool_fee_ratio: typing.Text = ...,
        ecosystem_fund_fee_ratio: typing.Text = ...,
        liquidation_fee_ratio: typing.Text = ...,
        partial_liquidation_ratio: typing.Text = ...,
        funding_rate_interval: typing.Text = ...,
        twap_lookback_window: typing.Optional[google.protobuf.duration_pb2.Duration] = ...,
        ) -> None: ...
    def HasField(self, field_name: typing_extensions.Literal["twap_lookback_window",b"twap_lookback_window"]) -> builtins.bool: ...
    def ClearField(self, field_name: typing_extensions.Literal["ecosystem_fund_fee_ratio",b"ecosystem_fund_fee_ratio","fee_pool_fee_ratio",b"fee_pool_fee_ratio","funding_rate_interval",b"funding_rate_interval","liquidation_fee_ratio",b"liquidation_fee_ratio","partial_liquidation_ratio",b"partial_liquidation_ratio","stopped",b"stopped","twap_lookback_window",b"twap_lookback_window"]) -> None: ...
global___Params = Params

class GenesisState(google.protobuf.message.Message):
    """GenesisState defines the perp module's genesis state."""
    DESCRIPTOR: google.protobuf.descriptor.Descriptor
    PARAMS_FIELD_NUMBER: builtins.int
    VAULT_BALANCE_FIELD_NUMBER: builtins.int
    PERP_EF_BALANCE_FIELD_NUMBER: builtins.int
    FEE_POOL_BALANCE_FIELD_NUMBER: builtins.int
    PAIR_METADATA_FIELD_NUMBER: builtins.int
    POSITIONS_FIELD_NUMBER: builtins.int
    PREPAID_BAD_DEBTS_FIELD_NUMBER: builtins.int
    WHITELISTED_ADDRESSES_FIELD_NUMBER: builtins.int
    @property
    def params(self) -> global___Params: ...
    @property
    def vault_balance(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[cosmos.base.v1beta1.coin_pb2.Coin]: ...
    @property
    def perp_ef_balance(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[cosmos.base.v1beta1.coin_pb2.Coin]: ...
    @property
    def fee_pool_balance(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[cosmos.base.v1beta1.coin_pb2.Coin]: ...
    @property
    def pair_metadata(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___PairMetadata]: ...
    @property
    def positions(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Position]: ...
    @property
    def prepaid_bad_debts(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___PrepaidBadDebt]: ...
    @property
    def whitelisted_addresses(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[typing.Text]: ...
    def __init__(self,
        *,
        params: typing.Optional[global___Params] = ...,
        vault_balance: typing.Optional[typing.Iterable[cosmos.base.v1beta1.coin_pb2.Coin]] = ...,
        perp_ef_balance: typing.Optional[typing.Iterable[cosmos.base.v1beta1.coin_pb2.Coin]] = ...,
        fee_pool_balance: typing.Optional[typing.Iterable[cosmos.base.v1beta1.coin_pb2.Coin]] = ...,
        pair_metadata: typing.Optional[typing.Iterable[global___PairMetadata]] = ...,
        positions: typing.Optional[typing.Iterable[global___Position]] = ...,
        prepaid_bad_debts: typing.Optional[typing.Iterable[global___PrepaidBadDebt]] = ...,
        whitelisted_addresses: typing.Optional[typing.Iterable[typing.Text]] = ...,
        ) -> None: ...
    def HasField(self, field_name: typing_extensions.Literal["params",b"params"]) -> builtins.bool: ...
    def ClearField(self, field_name: typing_extensions.Literal["fee_pool_balance",b"fee_pool_balance","pair_metadata",b"pair_metadata","params",b"params","perp_ef_balance",b"perp_ef_balance","positions",b"positions","prepaid_bad_debts",b"prepaid_bad_debts","vault_balance",b"vault_balance","whitelisted_addresses",b"whitelisted_addresses"]) -> None: ...
global___GenesisState = GenesisState

class Position(google.protobuf.message.Message):
    """Position identifies and records information on a user's position on one of
    the virtual liquidity pools.
    """
    DESCRIPTOR: google.protobuf.descriptor.Descriptor
    TRADER_ADDRESS_FIELD_NUMBER: builtins.int
    PAIR_FIELD_NUMBER: builtins.int
    SIZE_FIELD_NUMBER: builtins.int
    MARGIN_FIELD_NUMBER: builtins.int
    OPEN_NOTIONAL_FIELD_NUMBER: builtins.int
    LAST_UPDATE_CUMULATIVE_PREMIUM_FRACTION_FIELD_NUMBER: builtins.int
    BLOCK_NUMBER_FIELD_NUMBER: builtins.int
    trader_address: typing.Text
    """address identifies the address owner of this position"""

    @property
    def pair(self) -> common.common_pb2.AssetPair:
        """pair identifies the pair associated with this position"""
        pass
    size: typing.Text
    """Position size.
    signed int
    """

    margin: typing.Text
    """Amount of margin remaining in the position."""

    open_notional: typing.Text
    """OpenNotional is the quote denom value of the position when opening.
    Used to calculate PnL.
    """

    last_update_cumulative_premium_fraction: typing.Text
    """The last cumulative funding payment this position has applied.
    Used to calculate the next funding payment.
    int
    """

    block_number: builtins.int
    """BlockNumber is the last block number when this position changed."""

    def __init__(self,
        *,
        trader_address: typing.Text = ...,
        pair: typing.Optional[common.common_pb2.AssetPair] = ...,
        size: typing.Text = ...,
        margin: typing.Text = ...,
        open_notional: typing.Text = ...,
        last_update_cumulative_premium_fraction: typing.Text = ...,
        block_number: builtins.int = ...,
        ) -> None: ...
    def HasField(self, field_name: typing_extensions.Literal["pair",b"pair"]) -> builtins.bool: ...
    def ClearField(self, field_name: typing_extensions.Literal["block_number",b"block_number","last_update_cumulative_premium_fraction",b"last_update_cumulative_premium_fraction","margin",b"margin","open_notional",b"open_notional","pair",b"pair","size",b"size","trader_address",b"trader_address"]) -> None: ...
global___Position = Position

class PositionResp(google.protobuf.message.Message):
    DESCRIPTOR: google.protobuf.descriptor.Descriptor
    POSITION_FIELD_NUMBER: builtins.int
    EXCHANGED_NOTIONAL_VALUE_FIELD_NUMBER: builtins.int
    EXCHANGED_POSITION_SIZE_FIELD_NUMBER: builtins.int
    BAD_DEBT_FIELD_NUMBER: builtins.int
    FUNDING_PAYMENT_FIELD_NUMBER: builtins.int
    REALIZED_PNL_FIELD_NUMBER: builtins.int
    UNREALIZED_PNL_AFTER_FIELD_NUMBER: builtins.int
    MARGIN_TO_VAULT_FIELD_NUMBER: builtins.int
    POSITION_NOTIONAL_FIELD_NUMBER: builtins.int
    @property
    def position(self) -> global___Position: ...
    exchanged_notional_value: typing.Text
    """The amount of quote assets exchanged."""

    exchanged_position_size: typing.Text
    """The amount of base assets exchanged."""

    bad_debt: typing.Text
    """The amount of bad debt accrued during this position change.
    Measured in absolute value of quote units.
    If greater than zero, then the position change event will likely fail.
    """

    funding_payment: typing.Text
    """The funding payment applied on this position change."""

    realized_pnl: typing.Text
    """The amount of PnL realized on this position changed, measured in quote units."""

    unrealized_pnl_after: typing.Text
    """The unrealized PnL in the position after the position change."""

    margin_to_vault: typing.Text
    """The amount of margin the trader has to give to the vault.
    A negative value means the vault pays the trader.
    """

    position_notional: typing.Text
    """The position's notional value after the position change, measured in quote units."""

    def __init__(self,
        *,
        position: typing.Optional[global___Position] = ...,
        exchanged_notional_value: typing.Text = ...,
        exchanged_position_size: typing.Text = ...,
        bad_debt: typing.Text = ...,
        funding_payment: typing.Text = ...,
        realized_pnl: typing.Text = ...,
        unrealized_pnl_after: typing.Text = ...,
        margin_to_vault: typing.Text = ...,
        position_notional: typing.Text = ...,
        ) -> None: ...
    def HasField(self, field_name: typing_extensions.Literal["position",b"position"]) -> builtins.bool: ...
    def ClearField(self, field_name: typing_extensions.Literal["bad_debt",b"bad_debt","exchanged_notional_value",b"exchanged_notional_value","exchanged_position_size",b"exchanged_position_size","funding_payment",b"funding_payment","margin_to_vault",b"margin_to_vault","position",b"position","position_notional",b"position_notional","realized_pnl",b"realized_pnl","unrealized_pnl_after",b"unrealized_pnl_after"]) -> None: ...
global___PositionResp = PositionResp

class LiquidateResp(google.protobuf.message.Message):
    DESCRIPTOR: google.protobuf.descriptor.Descriptor
    BAD_DEBT_FIELD_NUMBER: builtins.int
    FEE_TO_LIQUIDATOR_FIELD_NUMBER: builtins.int
    FEE_TO_PERP_ECOSYSTEM_FUND_FIELD_NUMBER: builtins.int
    LIQUIDATOR_FIELD_NUMBER: builtins.int
    POSITION_RESP_FIELD_NUMBER: builtins.int
    bad_debt: typing.Text
    """Amount of bad debt created by the liquidation event"""

    fee_to_liquidator: typing.Text
    """Fee paid to the liquidator"""

    fee_to_perp_ecosystem_fund: typing.Text
    """Fee paid to the Perp EF fund"""

    liquidator: typing.Text
    """Address of the liquidator"""

    @property
    def position_resp(self) -> global___PositionResp:
        """Position response from the close or open reverse position"""
        pass
    def __init__(self,
        *,
        bad_debt: typing.Text = ...,
        fee_to_liquidator: typing.Text = ...,
        fee_to_perp_ecosystem_fund: typing.Text = ...,
        liquidator: typing.Text = ...,
        position_resp: typing.Optional[global___PositionResp] = ...,
        ) -> None: ...
    def HasField(self, field_name: typing_extensions.Literal["position_resp",b"position_resp"]) -> builtins.bool: ...
    def ClearField(self, field_name: typing_extensions.Literal["bad_debt",b"bad_debt","fee_to_liquidator",b"fee_to_liquidator","fee_to_perp_ecosystem_fund",b"fee_to_perp_ecosystem_fund","liquidator",b"liquidator","position_resp",b"position_resp"]) -> None: ...
global___LiquidateResp = LiquidateResp

class PairMetadata(google.protobuf.message.Message):
    DESCRIPTOR: google.protobuf.descriptor.Descriptor
    PAIR_FIELD_NUMBER: builtins.int
    CUMULATIVE_PREMIUM_FRACTIONS_FIELD_NUMBER: builtins.int
    @property
    def pair(self) -> common.common_pb2.AssetPair: ...
    @property
    def cumulative_premium_fractions(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[typing.Text]: ...
    def __init__(self,
        *,
        pair: typing.Optional[common.common_pb2.AssetPair] = ...,
        cumulative_premium_fractions: typing.Optional[typing.Iterable[typing.Text]] = ...,
        ) -> None: ...
    def HasField(self, field_name: typing_extensions.Literal["pair",b"pair"]) -> builtins.bool: ...
    def ClearField(self, field_name: typing_extensions.Literal["cumulative_premium_fractions",b"cumulative_premium_fractions","pair",b"pair"]) -> None: ...
global___PairMetadata = PairMetadata

class PrepaidBadDebt(google.protobuf.message.Message):
    DESCRIPTOR: google.protobuf.descriptor.Descriptor
    DENOM_FIELD_NUMBER: builtins.int
    AMOUNT_FIELD_NUMBER: builtins.int
    denom: typing.Text
    amount: typing.Text
    def __init__(self,
        *,
        denom: typing.Text = ...,
        amount: typing.Text = ...,
        ) -> None: ...
    def ClearField(self, field_name: typing_extensions.Literal["amount",b"amount","denom",b"denom"]) -> None: ...
global___PrepaidBadDebt = PrepaidBadDebt
