code.vegaprotocol.io/vega@v0.79.0/datanode/entities/enums.go (about)

     1  // Copyright (C) 2023 Gobalsky Labs Limited
     2  //
     3  // This program is free software: you can redistribute it and/or modify
     4  // it under the terms of the GNU Affero General Public License as
     5  // published by the Free Software Foundation, either version 3 of the
     6  // License, or (at your option) any later version.
     7  //
     8  // This program is distributed in the hope that it will be useful,
     9  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    10  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    11  // GNU Affero General Public License for more details.
    12  //
    13  // You should have received a copy of the GNU Affero General Public License
    14  // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    15  
    16  package entities
    17  
    18  import (
    19  	"fmt"
    20  
    21  	"code.vegaprotocol.io/vega/protos/vega"
    22  	vegapb "code.vegaprotocol.io/vega/protos/vega"
    23  	commandspb "code.vegaprotocol.io/vega/protos/vega/commands/v1"
    24  	eventspb "code.vegaprotocol.io/vega/protos/vega/events/v1"
    25  
    26  	"github.com/jackc/pgtype"
    27  )
    28  
    29  type DispatchMetric vega.DispatchMetric
    30  
    31  const (
    32  	DispatchMetricUnspecified       DispatchMetric = DispatchMetric(vega.DispatchMetric_DISPATCH_METRIC_UNSPECIFIED)
    33  	DispatchMetricMakerFeePaid                     = DispatchMetric(vega.DispatchMetric_DISPATCH_METRIC_MAKER_FEES_PAID)
    34  	DispatchMetricMakerFeesReceived                = DispatchMetric(vega.DispatchMetric_DISPATCH_METRIC_MAKER_FEES_RECEIVED)
    35  	DispatchMetricLPFeesReceived                   = DispatchMetric(vega.DispatchMetric_DISPATCH_METRIC_LP_FEES_RECEIVED)
    36  	DispatchMetricMarketValue                      = DispatchMetric(vega.DispatchMetric_DISPATCH_METRIC_MARKET_VALUE)
    37  	DispatchMetricAverageNotional                  = DispatchMetric(vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL)
    38  	DispatchMetricRelativeReturn                   = DispatchMetric(vega.DispatchMetric_DISPATCH_METRIC_RELATIVE_RETURN)
    39  	DispatchMetricReturnVolatility                 = DispatchMetric(vega.DispatchMetric_DISPATCH_METRIC_RETURN_VOLATILITY)
    40  	DispatchMetricValidatorRanking                 = DispatchMetric(vega.DispatchMetric_DISPATCH_METRIC_VALIDATOR_RANKING)
    41  	DispatchMetricRealisedReturn                   = DispatchMetric(vega.DispatchMetric_DISPATCH_METRIC_REALISED_RETURN)
    42  	DispatchMetricEligibleEntities                 = DispatchMetric(vega.DispatchMetric_DISPATCH_METRIC_ELIGIBLE_ENTITIES)
    43  )
    44  
    45  func (m DispatchMetric) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
    46  	mode, ok := vega.DispatchMetric_name[int32(m)]
    47  	if !ok {
    48  		return buf, fmt.Errorf("unknown dispatch metric: %s", mode)
    49  	}
    50  	return append(buf, []byte(mode)...), nil
    51  }
    52  
    53  func (m *DispatchMetric) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
    54  	val, ok := vega.DispatchMetric_value[string(src)]
    55  	if !ok {
    56  		return fmt.Errorf("unknown dispatch metric: %s", src)
    57  	}
    58  
    59  	*m = DispatchMetric(val)
    60  	return nil
    61  }
    62  
    63  type Side = vega.Side
    64  
    65  const (
    66  	// Default value, always invalid.
    67  	SideUnspecified Side = vega.Side_SIDE_UNSPECIFIED
    68  	// Buy order.
    69  	SideBuy Side = vega.Side_SIDE_BUY
    70  	// Sell order.
    71  	SideSell Side = vega.Side_SIDE_SELL
    72  )
    73  
    74  type TradeType = vega.Trade_Type
    75  
    76  const (
    77  	// Default value, always invalid.
    78  	TradeTypeUnspecified TradeType = vega.Trade_TYPE_UNSPECIFIED
    79  	// Normal trading between two parties.
    80  	TradeTypeDefault TradeType = vega.Trade_TYPE_DEFAULT
    81  	// Trading initiated by the network with another party on the book,
    82  	// which helps to zero-out the positions of one or more distressed parties.
    83  	TradeTypeNetworkCloseOutGood TradeType = vega.Trade_TYPE_NETWORK_CLOSE_OUT_GOOD
    84  	// Trading initiated by the network with another party off the book,
    85  	// with a distressed party in order to zero-out the position of the party.
    86  	TradeTypeNetworkCloseOutBad TradeType = vega.Trade_TYPE_NETWORK_CLOSE_OUT_BAD
    87  )
    88  
    89  type PeggedReference = vega.PeggedReference
    90  
    91  const (
    92  	// Default value for PeggedReference, no reference given.
    93  	PeggedReferenceUnspecified PeggedReference = vega.PeggedReference_PEGGED_REFERENCE_UNSPECIFIED
    94  	// Mid price reference.
    95  	PeggedReferenceMid PeggedReference = vega.PeggedReference_PEGGED_REFERENCE_MID
    96  	// Best bid price reference.
    97  	PeggedReferenceBestBid PeggedReference = vega.PeggedReference_PEGGED_REFERENCE_BEST_BID
    98  	// Best ask price reference.
    99  	PeggedReferenceBestAsk PeggedReference = vega.PeggedReference_PEGGED_REFERENCE_BEST_ASK
   100  )
   101  
   102  type OrderStatus = vega.Order_Status
   103  
   104  const (
   105  	// Default value, always invalid.
   106  	OrderStatusUnspecified OrderStatus = vega.Order_STATUS_UNSPECIFIED
   107  	// Used for active unfilled or partially filled orders.
   108  	OrderStatusActive OrderStatus = vega.Order_STATUS_ACTIVE
   109  	// Used for expired GTT orders.
   110  	OrderStatusExpired OrderStatus = vega.Order_STATUS_EXPIRED
   111  	// Used for orders cancelled by the party that created the order.
   112  	OrderStatusCancelled OrderStatus = vega.Order_STATUS_CANCELLED
   113  	// Used for unfilled FOK or IOC orders, and for orders that were stopped by the network.
   114  	OrderStatusStopped OrderStatus = vega.Order_STATUS_STOPPED
   115  	// Used for closed fully filled orders.
   116  	OrderStatusFilled OrderStatus = vega.Order_STATUS_FILLED
   117  	// Used for orders when not enough collateral was available to fill the margin requirements.
   118  	OrderStatusRejected OrderStatus = vega.Order_STATUS_REJECTED
   119  	// Used for closed partially filled IOC orders.
   120  	OrderStatusPartiallyFilled OrderStatus = vega.Order_STATUS_PARTIALLY_FILLED
   121  	// Order has been removed from the order book and has been parked, this applies to pegged orders only.
   122  	OrderStatusParked OrderStatus = vega.Order_STATUS_PARKED
   123  )
   124  
   125  type OrderType = vega.Order_Type
   126  
   127  const (
   128  	// Default value, always invalid.
   129  	OrderTypeUnspecified OrderType = vega.Order_TYPE_UNSPECIFIED
   130  	// Used for Limit orders.
   131  	OrderTypeLimit OrderType = vega.Order_TYPE_LIMIT
   132  	// Used for Market orders.
   133  	OrderTypeMarket OrderType = vega.Order_TYPE_MARKET
   134  	// Used for orders where the initiating party is the network (with distressed traders).
   135  	OrderTypeNetwork OrderType = vega.Order_TYPE_NETWORK
   136  )
   137  
   138  type OrderTimeInForce = vega.Order_TimeInForce
   139  
   140  const (
   141  	// Default value for TimeInForce, can be valid for an amend.
   142  	OrderTimeInForceUnspecified OrderTimeInForce = vega.Order_TIME_IN_FORCE_UNSPECIFIED
   143  	// Good until cancelled.
   144  	OrderTimeInForceGTC OrderTimeInForce = vega.Order_TIME_IN_FORCE_GTC
   145  	// Good until specified time.
   146  	OrderTimeInForceGTT OrderTimeInForce = vega.Order_TIME_IN_FORCE_GTT
   147  	// Immediate or cancel.
   148  	OrderTimeInForceIOC OrderTimeInForce = vega.Order_TIME_IN_FORCE_IOC
   149  	// Fill or kill.
   150  	OrderTimeInForceFOK OrderTimeInForce = vega.Order_TIME_IN_FORCE_FOK
   151  	// Good for auction.
   152  	OrderTimeInForceGFA OrderTimeInForce = vega.Order_TIME_IN_FORCE_GFA
   153  	// Good for normal.
   154  	OrderTimeInForceGFN OrderTimeInForce = vega.Order_TIME_IN_FORCE_GFN
   155  )
   156  
   157  type OrderError = vega.OrderError
   158  
   159  const (
   160  	// Default value, no error reported.
   161  	OrderErrorUnspecified OrderError = vega.OrderError_ORDER_ERROR_UNSPECIFIED
   162  	// Order was submitted for a market that does not exist.
   163  	OrderErrorInvalidMarketID OrderError = vega.OrderError_ORDER_ERROR_INVALID_MARKET_ID
   164  	// Order was submitted with an invalid identifier.
   165  	OrderErrorInvalidOrderID OrderError = vega.OrderError_ORDER_ERROR_INVALID_ORDER_ID
   166  	// Order was amended with a sequence number that was not previous version + 1.
   167  	OrderErrorOutOfSequence OrderError = vega.OrderError_ORDER_ERROR_OUT_OF_SEQUENCE
   168  	// Order was amended with an invalid remaining size (e.g. remaining greater than total size).
   169  	OrderErrorInvalidRemainingSize OrderError = vega.OrderError_ORDER_ERROR_INVALID_REMAINING_SIZE
   170  	// Node was unable to get Vega (blockchain) time.
   171  	OrderErrorTimeFailure OrderError = vega.OrderError_ORDER_ERROR_TIME_FAILURE
   172  	// Failed to remove an order from the book.
   173  	OrderErrorRemovalFailure OrderError = vega.OrderError_ORDER_ERROR_REMOVAL_FAILURE
   174  	// An order with `TimeInForce.TIME_IN_FORCE_GTT` was submitted or amended
   175  	// with an expiration that was badly formatted or otherwise invalid.
   176  	OrderErrorInvalidExpirationDatetime OrderError = vega.OrderError_ORDER_ERROR_INVALID_EXPIRATION_DATETIME
   177  	// Order was submitted or amended with an invalid reference field.
   178  	OrderErrorInvalidOrderReference OrderError = vega.OrderError_ORDER_ERROR_INVALID_ORDER_REFERENCE
   179  	// Order amend was submitted for an order field that cannot not be amended (e.g. order identifier).
   180  	OrderErrorEditNotAllowed OrderError = vega.OrderError_ORDER_ERROR_EDIT_NOT_ALLOWED
   181  	// Amend failure because amend details do not match original order.
   182  	OrderErrorAmendFailure OrderError = vega.OrderError_ORDER_ERROR_AMEND_FAILURE
   183  	// Order not found in an order book or store.
   184  	OrderErrorNotFound OrderError = vega.OrderError_ORDER_ERROR_NOT_FOUND
   185  	// Order was submitted with an invalid or missing party identifier.
   186  	OrderErrorInvalidParty OrderError = vega.OrderError_ORDER_ERROR_INVALID_PARTY_ID
   187  	// Order was submitted for a market that has closed.
   188  	OrderErrorMarketClosed OrderError = vega.OrderError_ORDER_ERROR_MARKET_CLOSED
   189  	// Order was submitted, but the party did not have enough collateral to cover the order.
   190  	OrderErrorMarginCheckFailed OrderError = vega.OrderError_ORDER_ERROR_MARGIN_CHECK_FAILED
   191  	// Order was submitted, but the party did not have an account for this asset.
   192  	OrderErrorMissingGeneralAccount OrderError = vega.OrderError_ORDER_ERROR_MISSING_GENERAL_ACCOUNT
   193  	// Unspecified internal error.
   194  	OrderErrorInternalError OrderError = vega.OrderError_ORDER_ERROR_INTERNAL_ERROR
   195  	// Order was submitted with an invalid or missing size (e.g. 0).
   196  	OrderErrorInvalidSize OrderError = vega.OrderError_ORDER_ERROR_INVALID_SIZE
   197  	// Order was submitted with an invalid persistence for its type.
   198  	OrderErrorInvalidPersistance OrderError = vega.OrderError_ORDER_ERROR_INVALID_PERSISTENCE
   199  	// Order was submitted with an invalid type field.
   200  	OrderErrorInvalidType OrderError = vega.OrderError_ORDER_ERROR_INVALID_TYPE
   201  	// Order was stopped as it would have traded with another order submitted from the same party.
   202  	OrderErrorSelfTrading OrderError = vega.OrderError_ORDER_ERROR_SELF_TRADING
   203  	// Order was submitted, but the party did not have enough collateral to cover the fees for the order.
   204  	OrderErrorInsufficientFundsToPayFees OrderError = vega.OrderError_ORDER_ERROR_INSUFFICIENT_FUNDS_TO_PAY_FEES
   205  	// Order was submitted with an incorrect or invalid market type.
   206  	OrderErrorIncorrectMarketType OrderError = vega.OrderError_ORDER_ERROR_INCORRECT_MARKET_TYPE
   207  	// Order was submitted with invalid time in force.
   208  	OrderErrorInvalidTimeInForce OrderError = vega.OrderError_ORDER_ERROR_INVALID_TIME_IN_FORCE
   209  	// A GFN order has got to the market when it is in auction mode.
   210  	OrderErrorCannotSendGFNOrderDuringAnAuction OrderError = vega.OrderError_ORDER_ERROR_CANNOT_SEND_GFN_ORDER_DURING_AN_AUCTION
   211  	// A GFA order has got to the market when it is in continuous trading mode.
   212  	OrderErrorCannotSendGFAOrderDuringContinuousTrading OrderError = vega.OrderError_ORDER_ERROR_CANNOT_SEND_GFA_ORDER_DURING_CONTINUOUS_TRADING
   213  	// Attempt to amend order to GTT without ExpiryAt.
   214  	OrderErrorCannotAmendToGTTWithoutExpiryAt OrderError = vega.OrderError_ORDER_ERROR_CANNOT_AMEND_TO_GTT_WITHOUT_EXPIRYAT
   215  	// Attempt to amend ExpiryAt to a value before CreatedAt.
   216  	OrderErrorExpiryAtBeforeCreatedAt OrderError = vega.OrderError_ORDER_ERROR_EXPIRYAT_BEFORE_CREATEDAT
   217  	// Attempt to amend to GTC without an ExpiryAt value.
   218  	OrderErrorCannotHaveGTCAndExpiryAt OrderError = vega.OrderError_ORDER_ERROR_CANNOT_HAVE_GTC_AND_EXPIRYAT
   219  	// Amending to FOK or IOC is invalid.
   220  	OrderErrorCannotAmendToFOKOrIOC OrderError = vega.OrderError_ORDER_ERROR_CANNOT_AMEND_TO_FOK_OR_IOC
   221  	// Amending to GFA or GFN is invalid.
   222  	OrderErrorCannotAmendToGFAOrGFN OrderError = vega.OrderError_ORDER_ERROR_CANNOT_AMEND_TO_GFA_OR_GFN
   223  	// Amending from GFA or GFN is invalid.
   224  	OrderErrorCannotAmendFromGFAOrGFN OrderError = vega.OrderError_ORDER_ERROR_CANNOT_AMEND_FROM_GFA_OR_GFN
   225  	// IOC orders are not allowed during auction.
   226  	OrderErrorCannotSendIOCOrderDuringAuction OrderError = vega.OrderError_ORDER_ERROR_CANNOT_SEND_IOC_ORDER_DURING_AUCTION
   227  	// FOK orders are not allowed during auction.
   228  	OrderErrorCannotSendFOKOrderDurinAuction OrderError = vega.OrderError_ORDER_ERROR_CANNOT_SEND_FOK_ORDER_DURING_AUCTION
   229  	// Pegged orders must be LIMIT orders.
   230  	OrderErrorMustBeLimitOrder OrderError = vega.OrderError_ORDER_ERROR_MUST_BE_LIMIT_ORDER
   231  	// Pegged orders can only have TIF GTC or GTT.
   232  	OrderErrorMustBeGTTOrGTC OrderError = vega.OrderError_ORDER_ERROR_MUST_BE_GTT_OR_GTC
   233  	// Pegged order must have a reference price.
   234  	OrderErrorWithoutReferencePrice OrderError = vega.OrderError_ORDER_ERROR_WITHOUT_REFERENCE_PRICE
   235  	// Buy pegged order cannot reference best ask price.
   236  	OrderErrorBuyCannotReferenceBestAskPrice OrderError = vega.OrderError_ORDER_ERROR_BUY_CANNOT_REFERENCE_BEST_ASK_PRICE
   237  	// Pegged order offset must be >= 0.
   238  	OrderErrorOffsetMustBeGreaterOrEqualToZero OrderError = vega.OrderError_ORDER_ERROR_OFFSET_MUST_BE_GREATER_OR_EQUAL_TO_ZERO
   239  	// Sell pegged order cannot reference best bid price.
   240  	OrderErrorSellCannotReferenceBestBidPrice OrderError = vega.OrderError_ORDER_ERROR_SELL_CANNOT_REFERENCE_BEST_BID_PRICE
   241  	// Pegged order offset must be > zero.
   242  	OrderErrorOffsetMustBeGreaterThanZero OrderError = vega.OrderError_ORDER_ERROR_OFFSET_MUST_BE_GREATER_THAN_ZERO
   243  	// The party has an insufficient balance, or does not have
   244  	// a general account to submit the order (no deposits made
   245  	// for the required asset).
   246  	OrderErrorInsufficientAssetBalance OrderError = vega.OrderError_ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE
   247  	// Cannot amend a non pegged orders details.
   248  	OrderErrorCannotAmendPeggedOrderDetailsOnNonPeggedOrder OrderError = vega.OrderError_ORDER_ERROR_CANNOT_AMEND_PEGGED_ORDER_DETAILS_ON_NON_PEGGED_ORDER
   249  	// We are unable to re-price a pegged order because a market price is unavailable.
   250  	OrderErrorUnableToRepricePeggedOrder OrderError = vega.OrderError_ORDER_ERROR_UNABLE_TO_REPRICE_PEGGED_ORDER
   251  	// It is not possible to amend the price of an existing pegged order.
   252  	OrderErrorUnableToAmendPriceOnPeggedOrder OrderError = vega.OrderError_ORDER_ERROR_UNABLE_TO_AMEND_PRICE_ON_PEGGED_ORDER
   253  	// An FOK, IOC, or GFN order was rejected because it resulted in trades outside the price bounds.
   254  	OrderErrorNonPersistentOrderOutOfPriceBounds OrderError = vega.OrderError_ORDER_ERROR_NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS
   255  	OrderErrorSellOrderNotAllowed                OrderError = vega.OrderError_ORDER_ERROR_SELL_ORDER_NOT_ALLOWED
   256  )
   257  
   258  type PositionStatus int32
   259  
   260  const (
   261  	PositionStatusUnspecified  = PositionStatus(vega.PositionStatus_POSITION_STATUS_UNSPECIFIED)
   262  	PositionStatusOrdersClosed = PositionStatus(vega.PositionStatus_POSITION_STATUS_ORDERS_CLOSED)
   263  	PositionStatusClosedOut    = PositionStatus(vega.PositionStatus_POSITION_STATUS_CLOSED_OUT)
   264  	PositionStatusDistressed   = PositionStatus(vega.PositionStatus_POSITION_STATUS_DISTRESSED)
   265  )
   266  
   267  type TransferType int
   268  
   269  const (
   270  	Unknown TransferType = iota
   271  	OneOff
   272  	Recurring
   273  	GovernanceOneOff
   274  	GovernanceRecurring
   275  )
   276  
   277  const (
   278  	OneOffStr              = "OneOff"
   279  	RecurringStr           = "Recurring"
   280  	GovernanceOneOffStr    = "GovernanceOneOff"
   281  	GovernanceRecurringStr = "GovernanceRecurring"
   282  	UnknownStr             = "Unknown"
   283  )
   284  
   285  func (m TransferType) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   286  	mode := UnknownStr
   287  	switch m {
   288  	case OneOff:
   289  		mode = OneOffStr
   290  	case Recurring:
   291  		mode = RecurringStr
   292  	case GovernanceOneOff:
   293  		mode = GovernanceOneOffStr
   294  	case GovernanceRecurring:
   295  		mode = GovernanceRecurringStr
   296  	}
   297  
   298  	return append(buf, []byte(mode)...), nil
   299  }
   300  
   301  func (m *TransferType) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   302  	val := Unknown
   303  	switch string(src) {
   304  	case OneOffStr:
   305  		val = OneOff
   306  	case RecurringStr:
   307  		val = Recurring
   308  	case GovernanceOneOffStr:
   309  		val = GovernanceOneOff
   310  	case GovernanceRecurringStr:
   311  		val = GovernanceRecurring
   312  	}
   313  
   314  	*m = val
   315  	return nil
   316  }
   317  
   318  type TransferScope int32
   319  
   320  const (
   321  	TransferScopeUnspecified TransferScope = 1
   322  	TransferScopeIndividual  TransferScope = 1
   323  	TransferScopeTeam        TransferScope = 2
   324  )
   325  
   326  type TransferStatus eventspb.Transfer_Status
   327  
   328  const (
   329  	TransferStatusUnspecified = TransferStatus(eventspb.Transfer_STATUS_UNSPECIFIED)
   330  	TransferStatusPending     = TransferStatus(eventspb.Transfer_STATUS_PENDING)
   331  	TransferStatusDone        = TransferStatus(eventspb.Transfer_STATUS_DONE)
   332  	TransferStatusRejected    = TransferStatus(eventspb.Transfer_STATUS_REJECTED)
   333  	TransferStatusStopped     = TransferStatus(eventspb.Transfer_STATUS_STOPPED)
   334  	TransferStatusCancelled   = TransferStatus(eventspb.Transfer_STATUS_CANCELLED)
   335  )
   336  
   337  func (m TransferStatus) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   338  	mode, ok := eventspb.Transfer_Status_name[int32(m)]
   339  	if !ok {
   340  		return buf, fmt.Errorf("unknown transfer status: %s", mode)
   341  	}
   342  	return append(buf, []byte(mode)...), nil
   343  }
   344  
   345  func (m *TransferStatus) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   346  	val, ok := eventspb.Transfer_Status_value[string(src)]
   347  	if !ok {
   348  		return fmt.Errorf("unknown transfer status: %s", src)
   349  	}
   350  
   351  	*m = TransferStatus(val)
   352  	return nil
   353  }
   354  
   355  type AssetStatus vega.Asset_Status
   356  
   357  const (
   358  	AssetStatusUnspecified    = AssetStatus(vega.Asset_STATUS_UNSPECIFIED)
   359  	AssetStatusProposed       = AssetStatus(vega.Asset_STATUS_PROPOSED)
   360  	AssetStatusRejected       = AssetStatus(vega.Asset_STATUS_REJECTED)
   361  	AssetStatusPendingListing = AssetStatus(vega.Asset_STATUS_PENDING_LISTING)
   362  	AssetStatusEnabled        = AssetStatus(vega.Asset_STATUS_ENABLED)
   363  )
   364  
   365  func (m AssetStatus) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   366  	mode, ok := vega.Asset_Status_name[int32(m)]
   367  	if !ok {
   368  		return buf, fmt.Errorf("unknown asset status: %s", mode)
   369  	}
   370  	return append(buf, []byte(mode)...), nil
   371  }
   372  
   373  func (m *AssetStatus) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   374  	val, ok := vega.Asset_Status_value[string(src)]
   375  	if !ok {
   376  		return fmt.Errorf("unknown asset status: %s", src)
   377  	}
   378  
   379  	*m = AssetStatus(val)
   380  	return nil
   381  }
   382  
   383  type MarketTradingMode vega.Market_TradingMode
   384  
   385  const (
   386  	MarketTradingModeUnspecified            = MarketTradingMode(vega.Market_TRADING_MODE_UNSPECIFIED)
   387  	MarketTradingModeContinuous             = MarketTradingMode(vega.Market_TRADING_MODE_CONTINUOUS)
   388  	MarketTradingModeBatchAuction           = MarketTradingMode(vega.Market_TRADING_MODE_BATCH_AUCTION)
   389  	MarketTradingModeOpeningAuction         = MarketTradingMode(vega.Market_TRADING_MODE_OPENING_AUCTION)
   390  	MarketTradingModeMonitoringAuction      = MarketTradingMode(vega.Market_TRADING_MODE_MONITORING_AUCTION)
   391  	MarketTradingModeNoTrading              = MarketTradingMode(vega.Market_TRADING_MODE_NO_TRADING)
   392  	MarketTradingModeSuspendedViaGovernance = MarketTradingMode(vega.Market_TRADING_MODE_SUSPENDED_VIA_GOVERNANCE)
   393  	MarketTradingModelLongBlockAuction      = MarketTradingMode(vega.Market_TRADING_MODE_LONG_BLOCK_AUCTION)
   394  )
   395  
   396  func (m MarketTradingMode) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   397  	mode, ok := vega.Market_TradingMode_name[int32(m)]
   398  	if !ok {
   399  		return buf, fmt.Errorf("unknown trading mode: %s", mode)
   400  	}
   401  	return append(buf, []byte(mode)...), nil
   402  }
   403  
   404  func (m *MarketTradingMode) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   405  	val, ok := vega.Market_TradingMode_value[string(src)]
   406  	if !ok {
   407  		return fmt.Errorf("unknown trading mode: %s", src)
   408  	}
   409  
   410  	*m = MarketTradingMode(val)
   411  	return nil
   412  }
   413  
   414  type MarketState vega.Market_State
   415  
   416  const (
   417  	MarketStateUnspecified            = MarketState(vega.Market_STATE_UNSPECIFIED)
   418  	MarketStateProposed               = MarketState(vega.Market_STATE_PROPOSED)
   419  	MarketStateRejected               = MarketState(vega.Market_STATE_REJECTED)
   420  	MarketStatePending                = MarketState(vega.Market_STATE_PENDING)
   421  	MarketStateCancelled              = MarketState(vega.Market_STATE_CANCELLED)
   422  	MarketStateActive                 = MarketState(vega.Market_STATE_ACTIVE)
   423  	MarketStateSuspended              = MarketState(vega.Market_STATE_SUSPENDED)
   424  	MarketStateClosed                 = MarketState(vega.Market_STATE_CLOSED)
   425  	MarketStateTradingTerminated      = MarketState(vega.Market_STATE_TRADING_TERMINATED)
   426  	MarketStateSettled                = MarketState(vega.Market_STATE_SETTLED)
   427  	MarketStateSuspendedViaGovernance = MarketState(vega.Market_STATE_SUSPENDED_VIA_GOVERNANCE)
   428  )
   429  
   430  func (s MarketState) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   431  	state, ok := vega.Market_State_name[int32(s)]
   432  	if !ok {
   433  		return buf, fmt.Errorf("unknown market state: %s", state)
   434  	}
   435  	return append(buf, []byte(state)...), nil
   436  }
   437  
   438  func (s *MarketState) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   439  	val, ok := vega.Market_State_value[string(src)]
   440  	if !ok {
   441  		return fmt.Errorf("unknown market state: %s", src)
   442  	}
   443  
   444  	*s = MarketState(val)
   445  
   446  	return nil
   447  }
   448  
   449  type DepositStatus vega.Deposit_Status
   450  
   451  const (
   452  	DepositStatusUnspecified       = DepositStatus(vega.Deposit_STATUS_UNSPECIFIED)
   453  	DepositStatusOpen              = DepositStatus(vega.Deposit_STATUS_OPEN)
   454  	DepositStatusCancelled         = DepositStatus(vega.Deposit_STATUS_CANCELLED)
   455  	DepositStatusFinalized         = DepositStatus(vega.Deposit_STATUS_FINALIZED)
   456  	DepositStatusDuplicateRejected = DepositStatus(vega.Deposit_STATUS_DUPLICATE_REJECTED)
   457  )
   458  
   459  func (s DepositStatus) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   460  	status, ok := vega.Deposit_Status_name[int32(s)]
   461  	if !ok {
   462  		return buf, fmt.Errorf("unknown deposit state, %s", status)
   463  	}
   464  	return append(buf, []byte(status)...), nil
   465  }
   466  
   467  func (s *DepositStatus) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   468  	val, ok := vega.Deposit_Status_value[string(src)]
   469  	if !ok {
   470  		return fmt.Errorf("unknown deposit state: %s", src)
   471  	}
   472  
   473  	*s = DepositStatus(val)
   474  
   475  	return nil
   476  }
   477  
   478  type WithdrawalStatus vega.Withdrawal_Status
   479  
   480  const (
   481  	WithdrawalStatusUnspecified = WithdrawalStatus(vega.Withdrawal_STATUS_UNSPECIFIED)
   482  	WithdrawalStatusOpen        = WithdrawalStatus(vega.Withdrawal_STATUS_OPEN)
   483  	WithdrawalStatusRejected    = WithdrawalStatus(vega.Withdrawal_STATUS_REJECTED)
   484  	WithdrawalStatusFinalized   = WithdrawalStatus(vega.Withdrawal_STATUS_FINALIZED)
   485  )
   486  
   487  func (s WithdrawalStatus) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   488  	status, ok := vega.Withdrawal_Status_name[int32(s)]
   489  	if !ok {
   490  		return buf, fmt.Errorf("unknown withdrawal status: %s", status)
   491  	}
   492  	return append(buf, []byte(status)...), nil
   493  }
   494  
   495  func (s *WithdrawalStatus) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   496  	val, ok := vega.Withdrawal_Status_value[string(src)]
   497  	if !ok {
   498  		return fmt.Errorf("unknown withdrawal status: %s", src)
   499  	}
   500  	*s = WithdrawalStatus(val)
   501  	return nil
   502  }
   503  
   504  /************************* Proposal State *****************************/
   505  
   506  type ProposalState vega.Proposal_State
   507  
   508  const (
   509  	ProposalStateUnspecified        = ProposalState(vega.Proposal_STATE_UNSPECIFIED)
   510  	ProposalStateFailed             = ProposalState(vega.Proposal_STATE_FAILED)
   511  	ProposalStateOpen               = ProposalState(vega.Proposal_STATE_OPEN)
   512  	ProposalStatePassed             = ProposalState(vega.Proposal_STATE_PASSED)
   513  	ProposalStateRejected           = ProposalState(vega.Proposal_STATE_REJECTED)
   514  	ProposalStateDeclined           = ProposalState(vega.Proposal_STATE_DECLINED)
   515  	ProposalStateEnacted            = ProposalState(vega.Proposal_STATE_ENACTED)
   516  	ProposalStateWaitingForNodeVote = ProposalState(vega.Proposal_STATE_WAITING_FOR_NODE_VOTE)
   517  )
   518  
   519  func (s ProposalState) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   520  	str, ok := vega.Proposal_State_name[int32(s)]
   521  	if !ok {
   522  		return buf, fmt.Errorf("unknown state: %v", s)
   523  	}
   524  	return append(buf, []byte(str)...), nil
   525  }
   526  
   527  func (s *ProposalState) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   528  	val, ok := vega.Proposal_State_value[string(src)]
   529  	if !ok {
   530  		return fmt.Errorf("unknown state: %s", src)
   531  	}
   532  	*s = ProposalState(val)
   533  	return nil
   534  }
   535  
   536  /************************* Proposal Error *****************************/
   537  
   538  type ProposalError vega.ProposalError
   539  
   540  const (
   541  	ProposalErrorUnspecified                      = ProposalError(vega.ProposalError_PROPOSAL_ERROR_UNSPECIFIED)
   542  	ProposalErrorCloseTimeTooSoon                 = ProposalError(vega.ProposalError_PROPOSAL_ERROR_CLOSE_TIME_TOO_SOON)
   543  	ProposalErrorCloseTimeTooLate                 = ProposalError(vega.ProposalError_PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE)
   544  	ProposalErrorEnactTimeTooSoon                 = ProposalError(vega.ProposalError_PROPOSAL_ERROR_ENACT_TIME_TOO_SOON)
   545  	ProposalErrorEnactTimeTooLate                 = ProposalError(vega.ProposalError_PROPOSAL_ERROR_ENACT_TIME_TOO_LATE)
   546  	ProposalErrorInsufficientTokens               = ProposalError(vega.ProposalError_PROPOSAL_ERROR_INSUFFICIENT_TOKENS)
   547  	ProposalErrorInvalidInstrumentSecurity        = ProposalError(vega.ProposalError_PROPOSAL_ERROR_INVALID_INSTRUMENT_SECURITY)
   548  	ProposalErrorNoProduct                        = ProposalError(vega.ProposalError_PROPOSAL_ERROR_NO_PRODUCT)
   549  	ProposalErrorUnsupportedProduct               = ProposalError(vega.ProposalError_PROPOSAL_ERROR_UNSUPPORTED_PRODUCT)
   550  	ProposalErrorNoTradingMode                    = ProposalError(vega.ProposalError_PROPOSAL_ERROR_NO_TRADING_MODE)
   551  	ProposalErrorUnsupportedTradingMode           = ProposalError(vega.ProposalError_PROPOSAL_ERROR_UNSUPPORTED_TRADING_MODE)
   552  	ProposalErrorNodeValidationFailed             = ProposalError(vega.ProposalError_PROPOSAL_ERROR_NODE_VALIDATION_FAILED)
   553  	ProposalErrorMissingBuiltinAssetField         = ProposalError(vega.ProposalError_PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD)
   554  	ProposalErrorMissingErc20ContractAddress      = ProposalError(vega.ProposalError_PROPOSAL_ERROR_MISSING_ERC20_CONTRACT_ADDRESS)
   555  	ProposalErrorInvalidAsset                     = ProposalError(vega.ProposalError_PROPOSAL_ERROR_INVALID_ASSET)
   556  	ProposalErrorIncompatibleTimestamps           = ProposalError(vega.ProposalError_PROPOSAL_ERROR_INCOMPATIBLE_TIMESTAMPS)
   557  	ProposalErrorNoRiskParameters                 = ProposalError(vega.ProposalError_PROPOSAL_ERROR_NO_RISK_PARAMETERS)
   558  	ProposalErrorNetworkParameterInvalidKey       = ProposalError(vega.ProposalError_PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_KEY)
   559  	ProposalErrorNetworkParameterInvalidValue     = ProposalError(vega.ProposalError_PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_VALUE)
   560  	ProposalErrorNetworkParameterValidationFailed = ProposalError(vega.ProposalError_PROPOSAL_ERROR_NETWORK_PARAMETER_VALIDATION_FAILED)
   561  	ProposalErrorOpeningAuctionDurationTooSmall   = ProposalError(vega.ProposalError_PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_SMALL)
   562  	ProposalErrorOpeningAuctionDurationTooLarge   = ProposalError(vega.ProposalError_PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_LARGE)
   563  	ProposalErrorCouldNotInstantiateMarket        = ProposalError(vega.ProposalError_PROPOSAL_ERROR_COULD_NOT_INSTANTIATE_MARKET)
   564  	ProposalErrorInvalidFutureProduct             = ProposalError(vega.ProposalError_PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT)
   565  	ProposalErrorInvalidRiskParameter             = ProposalError(vega.ProposalError_PROPOSAL_ERROR_INVALID_RISK_PARAMETER)
   566  	ProposalErrorMajorityThresholdNotReached      = ProposalError(vega.ProposalError_PROPOSAL_ERROR_MAJORITY_THRESHOLD_NOT_REACHED)
   567  	ProposalErrorParticipationThresholdNotReached = ProposalError(vega.ProposalError_PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED)
   568  	ProposalErrorInvalidAssetDetails              = ProposalError(vega.ProposalError_PROPOSAL_ERROR_INVALID_ASSET_DETAILS)
   569  	ProposalErrorUnknownType                      = ProposalError(vega.ProposalError_PROPOSAL_ERROR_UNKNOWN_TYPE)
   570  	ProposalErrorUnknownRiskParameterType         = ProposalError(vega.ProposalError_PROPOSAL_ERROR_UNKNOWN_RISK_PARAMETER_TYPE)
   571  	ProposalErrorInvalidFreeform                  = ProposalError(vega.ProposalError_PROPOSAL_ERROR_INVALID_FREEFORM)
   572  	ProposalErrorInsufficientEquityLikeShare      = ProposalError(vega.ProposalError_PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE)
   573  	ProposalErrorInvalidMarket                    = ProposalError(vega.ProposalError_PROPOSAL_ERROR_INVALID_MARKET)
   574  	ProposalErrorTooManyMarketDecimalPlaces       = ProposalError(vega.ProposalError_PROPOSAL_ERROR_TOO_MANY_MARKET_DECIMAL_PLACES)
   575  	ProposalErrorTooManyPriceMonitoringTriggers   = ProposalError(vega.ProposalError_PROPOSAL_ERROR_TOO_MANY_PRICE_MONITORING_TRIGGERS)
   576  	ProposalErrorERC20AddressAlreadyInUse         = ProposalError(vega.ProposalError_PROPOSAL_ERROR_ERC20_ADDRESS_ALREADY_IN_USE)
   577  	ProporsalErrorInvalidGovernanceTransfer       = ProposalError(vega.ProposalError_PROPOSAL_ERROR_GOVERNANCE_TRANSFER_PROPOSAL_INVALID)
   578  	ProporsalErrorFailedGovernanceTransfer        = ProposalError(vega.ProposalError_PROPOSAL_ERROR_GOVERNANCE_TRANSFER_PROPOSAL_FAILED)
   579  	ProporsalErrorFailedGovernanceTransferCancel  = ProposalError(vega.ProposalError_PROPOSAL_ERROR_GOVERNANCE_CANCEL_TRANSFER_PROPOSAL_INVALID)
   580  	ProposalErrorInvalidSpot                      = ProposalError(vega.ProposalError_PROPOSAL_ERROR_INVALID_SPOT)
   581  	ProposalErrorSpotNotEnabled                   = ProposalError(vega.ProposalError_PROPOSAL_ERROR_SPOT_PRODUCT_DISABLED)
   582  	ProposalErrorInvalidSuccessorMarket           = ProposalError(vega.ProposalError_PROPOSAL_ERROR_INVALID_SUCCESSOR_MARKET)
   583  	ProposalErrorInvalidStateUpdate               = ProposalError(vega.ProposalError_PROPOSAL_ERROR_INVALID_MARKET_STATE_UPDATE)
   584  	ProposalErrorInvalidSLAParams                 = ProposalError(vega.ProposalError_PROPOSAL_ERROR_INVALID_SLA_PARAMS)
   585  	ProposalErrorMissingSLAParams                 = ProposalError(vega.ProposalError_PROPOSAL_ERROR_MISSING_SLA_PARAMS)
   586  	ProposalInvalidPerpetualProduct               = ProposalError(vega.ProposalError_PROPOSAL_ERROR_INVALID_PERPETUAL_PRODUCT)
   587  	ProposalErrorInvalidSizeDecimalPlaces         = ProposalError(vega.ProposalError_PROPOSAL_ERROR_INVALID_SIZE_DECIMAL_PLACES)
   588  )
   589  
   590  func (s ProposalError) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   591  	str, ok := vega.ProposalError_name[int32(s)]
   592  	if !ok {
   593  		return buf, fmt.Errorf("unknown proposal error: %v", s)
   594  	}
   595  	return append(buf, []byte(str)...), nil
   596  }
   597  
   598  func (s *ProposalError) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   599  	val, ok := vega.ProposalError_value[string(src)]
   600  	if !ok {
   601  		return fmt.Errorf("unknown proposal error: %s", src)
   602  	}
   603  	*s = ProposalError(val)
   604  	return nil
   605  }
   606  
   607  /************************* VoteValue *****************************/
   608  
   609  type VoteValue vega.Vote_Value
   610  
   611  const (
   612  	VoteValueUnspecified = VoteValue(vega.Vote_VALUE_UNSPECIFIED)
   613  	VoteValueNo          = VoteValue(vega.Vote_VALUE_NO)
   614  	VoteValueYes         = VoteValue(vega.Vote_VALUE_YES)
   615  )
   616  
   617  func (s VoteValue) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   618  	str, ok := vega.Vote_Value_name[int32(s)]
   619  	if !ok {
   620  		return buf, fmt.Errorf("unknown vote value: %v", s)
   621  	}
   622  	return append(buf, []byte(str)...), nil
   623  }
   624  
   625  func (s *VoteValue) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   626  	val, ok := vega.Vote_Value_value[string(src)]
   627  	if !ok {
   628  		return fmt.Errorf("unknown vote value: %s", src)
   629  	}
   630  	*s = VoteValue(val)
   631  	return nil
   632  }
   633  
   634  /************************* NodeSignature Kind *****************************/
   635  
   636  type NodeSignatureKind commandspb.NodeSignatureKind
   637  
   638  const (
   639  	NodeSignatureKindUnspecified          = NodeSignatureKind(commandspb.NodeSignatureKind_NODE_SIGNATURE_KIND_UNSPECIFIED)
   640  	NodeSignatureKindAsset                = NodeSignatureKind(commandspb.NodeSignatureKind_NODE_SIGNATURE_KIND_ASSET_NEW)
   641  	NodeSignatureKindAssetUpdate          = NodeSignatureKind(commandspb.NodeSignatureKind_NODE_SIGNATURE_KIND_ASSET_UPDATE)
   642  	NodeSignatureKindAssetWithdrawal      = NodeSignatureKind(commandspb.NodeSignatureKind_NODE_SIGNATURE_KIND_ASSET_WITHDRAWAL)
   643  	NodeSignatureKindMultisigSignerAdded  = NodeSignatureKind(commandspb.NodeSignatureKind_NODE_SIGNATURE_KIND_ERC20_MULTISIG_SIGNER_ADDED)
   644  	NodeSignatureKindMultisigSignerRemove = NodeSignatureKind(commandspb.NodeSignatureKind_NODE_SIGNATURE_KIND_ERC20_MULTISIG_SIGNER_REMOVED)
   645  )
   646  
   647  func (s NodeSignatureKind) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   648  	str, ok := commandspb.NodeSignatureKind_name[int32(s)]
   649  	if !ok {
   650  		return buf, fmt.Errorf("unknown state: %v", s)
   651  	}
   652  	return append(buf, []byte(str)...), nil
   653  }
   654  
   655  func (s *NodeSignatureKind) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   656  	val, ok := commandspb.NodeSignatureKind_value[string(src)]
   657  	if !ok {
   658  		return fmt.Errorf("unknown state: %s", src)
   659  	}
   660  	*s = NodeSignatureKind(val)
   661  	return nil
   662  }
   663  
   664  type (
   665  	DataSourceSpecStatus vegapb.DataSourceSpec_Status
   666  	OracleSpecStatus     = DataSourceSpecStatus
   667  )
   668  
   669  const (
   670  	OracleSpecUnspecified = DataSourceSpecStatus(vegapb.DataSourceSpec_STATUS_UNSPECIFIED)
   671  	OracleSpecActive      = DataSourceSpecStatus(vegapb.DataSourceSpec_STATUS_ACTIVE)
   672  	OracleSpecDeactivated = DataSourceSpecStatus(vegapb.DataSourceSpec_STATUS_DEACTIVATED)
   673  )
   674  
   675  func (s DataSourceSpecStatus) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   676  	status, ok := vegapb.DataSourceSpec_Status_name[int32(s)]
   677  	if !ok {
   678  		return buf, fmt.Errorf("unknown oracle spec value: %v", s)
   679  	}
   680  	return append(buf, []byte(status)...), nil
   681  }
   682  
   683  func (s *DataSourceSpecStatus) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   684  	val, ok := vegapb.DataSourceSpec_Status_value[string(src)]
   685  	if !ok {
   686  		return fmt.Errorf("unknown oracle spec status: %s", src)
   687  	}
   688  	*s = DataSourceSpecStatus(val)
   689  	return nil
   690  }
   691  
   692  type LiquidityProvisionStatus vega.LiquidityProvision_Status
   693  
   694  const (
   695  	LiquidityProvisionStatusUnspecified = LiquidityProvisionStatus(vega.LiquidityProvision_STATUS_UNSPECIFIED)
   696  	LiquidityProvisionStatusActive      = LiquidityProvisionStatus(vega.LiquidityProvision_STATUS_ACTIVE)
   697  	LiquidityProvisionStatusStopped     = LiquidityProvisionStatus(vega.LiquidityProvision_STATUS_STOPPED)
   698  	LiquidityProvisionStatusCancelled   = LiquidityProvisionStatus(vega.LiquidityProvision_STATUS_CANCELLED)
   699  	LiquidityProvisionStatusRejected    = LiquidityProvisionStatus(vega.LiquidityProvision_STATUS_REJECTED)
   700  	LiquidityProvisionStatusUndeployed  = LiquidityProvisionStatus(vega.LiquidityProvision_STATUS_UNDEPLOYED)
   701  	LiquidityProvisionStatusPending     = LiquidityProvisionStatus(vega.LiquidityProvision_STATUS_PENDING)
   702  )
   703  
   704  func (s LiquidityProvisionStatus) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   705  	status, ok := vega.LiquidityProvision_Status_name[int32(s)]
   706  	if !ok {
   707  		return buf, fmt.Errorf("unknown liquidity provision status: %v", s)
   708  	}
   709  	return append(buf, []byte(status)...), nil
   710  }
   711  
   712  func (s *LiquidityProvisionStatus) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   713  	val, ok := vega.LiquidityProvision_Status_value[string(src)]
   714  	if !ok {
   715  		return fmt.Errorf("unknown liquidity provision status: %s", src)
   716  	}
   717  	*s = LiquidityProvisionStatus(val)
   718  	return nil
   719  }
   720  
   721  type StakeLinkingStatus eventspb.StakeLinking_Status
   722  
   723  const (
   724  	StakeLinkingStatusUnspecified = StakeLinkingStatus(eventspb.StakeLinking_STATUS_UNSPECIFIED)
   725  	StakeLinkingStatusPending     = StakeLinkingStatus(eventspb.StakeLinking_STATUS_PENDING)
   726  	StakeLinkingStatusAccepted    = StakeLinkingStatus(eventspb.StakeLinking_STATUS_ACCEPTED)
   727  	StakeLinkingStatusRejected    = StakeLinkingStatus(eventspb.StakeLinking_STATUS_REJECTED)
   728  )
   729  
   730  func (s StakeLinkingStatus) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   731  	status, ok := eventspb.StakeLinking_Status_name[int32(s)]
   732  	if !ok {
   733  		return buf, fmt.Errorf("unknown stake linking status: %v", s)
   734  	}
   735  	return append(buf, []byte(status)...), nil
   736  }
   737  
   738  func (s *StakeLinkingStatus) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   739  	val, ok := eventspb.StakeLinking_Status_value[string(src)]
   740  	if !ok {
   741  		return fmt.Errorf("unknown stake linking status: %s", src)
   742  	}
   743  	*s = StakeLinkingStatus(val)
   744  	return nil
   745  }
   746  
   747  type StakeLinkingType eventspb.StakeLinking_Type
   748  
   749  const (
   750  	StakeLinkingTypeUnspecified = StakeLinkingType(eventspb.StakeLinking_TYPE_UNSPECIFIED)
   751  	StakeLinkingTypeLink        = StakeLinkingType(eventspb.StakeLinking_TYPE_LINK)
   752  	StakeLinkingTypeUnlink      = StakeLinkingType(eventspb.StakeLinking_TYPE_UNLINK)
   753  )
   754  
   755  func (s StakeLinkingType) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   756  	status, ok := eventspb.StakeLinking_Type_name[int32(s)]
   757  	if !ok {
   758  		return buf, fmt.Errorf("unknown stake linking type: %v", s)
   759  	}
   760  	return append(buf, []byte(status)...), nil
   761  }
   762  
   763  func (s *StakeLinkingType) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   764  	val, ok := eventspb.StakeLinking_Type_value[string(src)]
   765  	if !ok {
   766  		return fmt.Errorf("unknown stake linking type: %s", src)
   767  	}
   768  	*s = StakeLinkingType(val)
   769  
   770  	return nil
   771  }
   772  
   773  /************************* Node *****************************/
   774  
   775  type NodeStatus vega.NodeStatus
   776  
   777  const (
   778  	NodeStatusUnspecified  = NodeStatus(vega.NodeStatus_NODE_STATUS_UNSPECIFIED)
   779  	NodeStatusValidator    = NodeStatus(vega.NodeStatus_NODE_STATUS_VALIDATOR)
   780  	NodeStatusNonValidator = NodeStatus(vega.NodeStatus_NODE_STATUS_NON_VALIDATOR)
   781  )
   782  
   783  func (ns NodeStatus) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   784  	str, ok := vega.NodeStatus_name[int32(ns)]
   785  	if !ok {
   786  		return buf, fmt.Errorf("unknown node status: %v", ns)
   787  	}
   788  	return append(buf, []byte(str)...), nil
   789  }
   790  
   791  func (ns *NodeStatus) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   792  	val, ok := vega.NodeStatus_value[string(src)]
   793  	if !ok {
   794  		return fmt.Errorf("unknown node status: %s", src)
   795  	}
   796  	*ns = NodeStatus(val)
   797  	return nil
   798  }
   799  
   800  type ValidatorNodeStatus vega.ValidatorNodeStatus
   801  
   802  const (
   803  	ValidatorNodeStatusUnspecified = ValidatorNodeStatus(vega.ValidatorNodeStatus_VALIDATOR_NODE_STATUS_UNSPECIFIED)
   804  	ValidatorNodeStatusTendermint  = ValidatorNodeStatus(vega.ValidatorNodeStatus_VALIDATOR_NODE_STATUS_TENDERMINT)
   805  	ValidatorNodeStatusErsatz      = ValidatorNodeStatus(vega.ValidatorNodeStatus_VALIDATOR_NODE_STATUS_ERSATZ)
   806  	ValidatorNodeStatusPending     = ValidatorNodeStatus(vega.ValidatorNodeStatus_VALIDATOR_NODE_STATUS_PENDING)
   807  )
   808  
   809  // ValidatorStatusRanking so we know which direction was a promotion and which was a demotion.
   810  var ValidatorStatusRanking = map[ValidatorNodeStatus]int{
   811  	ValidatorNodeStatusUnspecified: 0,
   812  	ValidatorNodeStatusPending:     1,
   813  	ValidatorNodeStatusErsatz:      2,
   814  	ValidatorNodeStatusTendermint:  3,
   815  }
   816  
   817  func (ns ValidatorNodeStatus) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   818  	str, ok := vega.ValidatorNodeStatus_name[int32(ns)]
   819  	if !ok {
   820  		return buf, fmt.Errorf("unknown validator node status: %v", ns)
   821  	}
   822  	return append(buf, []byte(str)...), nil
   823  }
   824  
   825  func (ns *ValidatorNodeStatus) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   826  	val, ok := vega.ValidatorNodeStatus_value[string(src)]
   827  	if !ok {
   828  		return fmt.Errorf("unknown validator node status: %s", src)
   829  	}
   830  	*ns = ValidatorNodeStatus(val)
   831  	return nil
   832  }
   833  
   834  func (ns *ValidatorNodeStatus) UnmarshalJSON(src []byte) error {
   835  	val, ok := vega.ValidatorNodeStatus_value[string(src)]
   836  	if !ok {
   837  		return fmt.Errorf("unknown validator node status: %s", src)
   838  	}
   839  	*ns = ValidatorNodeStatus(val)
   840  	return nil
   841  }
   842  
   843  /************************* Position status  *****************************/
   844  
   845  func (p PositionStatus) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   846  	str, ok := vega.PositionStatus_name[int32(p)]
   847  	if !ok {
   848  		return buf, fmt.Errorf("unknown position status: %v", p)
   849  	}
   850  	return append(buf, []byte(str)...), nil
   851  }
   852  
   853  func (p *PositionStatus) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   854  	val, ok := vega.PositionStatus_value[string(src)]
   855  	if !ok {
   856  		return fmt.Errorf("unknown position status: %s", string(src))
   857  	}
   858  	*p = PositionStatus(val)
   859  	return nil
   860  }
   861  
   862  /************************* Protocol Upgrade *****************************/
   863  
   864  type ProtocolUpgradeProposalStatus eventspb.ProtocolUpgradeProposalStatus
   865  
   866  func (ps ProtocolUpgradeProposalStatus) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   867  	str, ok := eventspb.ProtocolUpgradeProposalStatus_name[int32(ps)]
   868  	if !ok {
   869  		return buf, fmt.Errorf("unknown protocol upgrade proposal status: %v", ps)
   870  	}
   871  	return append(buf, []byte(str)...), nil
   872  }
   873  
   874  func (ps *ProtocolUpgradeProposalStatus) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   875  	val, ok := eventspb.ProtocolUpgradeProposalStatus_value[string(src)]
   876  	if !ok {
   877  		return fmt.Errorf("unknown protocol upgrade proposal status: %s", src)
   878  	}
   879  	*ps = ProtocolUpgradeProposalStatus(val)
   880  	return nil
   881  }
   882  
   883  type StopOrderExpiryStrategy vega.StopOrder_ExpiryStrategy
   884  
   885  const (
   886  	StopOrderExpiryStrategyUnspecified = StopOrderExpiryStrategy(vega.StopOrder_EXPIRY_STRATEGY_UNSPECIFIED)
   887  	StopOrderExpiryStrategyCancels     = StopOrderExpiryStrategy(vega.StopOrder_EXPIRY_STRATEGY_CANCELS)
   888  	StopOrderExpiryStrategySubmit      = StopOrderExpiryStrategy(vega.StopOrder_EXPIRY_STRATEGY_SUBMIT)
   889  )
   890  
   891  func (s StopOrderExpiryStrategy) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   892  	str, ok := vega.StopOrder_ExpiryStrategy_name[int32(s)]
   893  	if !ok {
   894  		return buf, fmt.Errorf("unknown stop order expiry strategy: %v", s)
   895  	}
   896  	return append(buf, []byte(str)...), nil
   897  }
   898  
   899  func (s *StopOrderExpiryStrategy) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   900  	val, ok := vega.StopOrder_ExpiryStrategy_value[string(src)]
   901  	if !ok {
   902  		return fmt.Errorf("unknown stop order expiry strategy: %s", src)
   903  	}
   904  	*s = StopOrderExpiryStrategy(val)
   905  	return nil
   906  }
   907  
   908  type StopOrderTriggerDirection vega.StopOrder_TriggerDirection
   909  
   910  const (
   911  	StopOrderTriggerDirectionUnspecified = StopOrderTriggerDirection(vega.StopOrder_TRIGGER_DIRECTION_UNSPECIFIED)
   912  	StopOrderTriggerDirectionRisesAbove  = StopOrderTriggerDirection(vega.StopOrder_TRIGGER_DIRECTION_RISES_ABOVE)
   913  	StopOrderTriggerDirectionFallsBelow  = StopOrderTriggerDirection(vega.StopOrder_TRIGGER_DIRECTION_FALLS_BELOW)
   914  )
   915  
   916  func (s StopOrderTriggerDirection) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   917  	str, ok := vega.StopOrder_TriggerDirection_name[int32(s)]
   918  	if !ok {
   919  		return buf, fmt.Errorf("unknown stop order trigger direction: %v", s)
   920  	}
   921  	return append(buf, []byte(str)...), nil
   922  }
   923  
   924  func (s *StopOrderTriggerDirection) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   925  	val, ok := vega.StopOrder_TriggerDirection_value[string(src)]
   926  	if !ok {
   927  		return fmt.Errorf("unknown stop order trigger direction: %s", src)
   928  	}
   929  	*s = StopOrderTriggerDirection(val)
   930  	return nil
   931  }
   932  
   933  type StopOrderStatus vega.StopOrder_Status
   934  
   935  const (
   936  	StopOrderStatusUnspecified = StopOrderStatus(vega.StopOrder_STATUS_UNSPECIFIED)
   937  	StopOrderStatusPending     = StopOrderStatus(vega.StopOrder_STATUS_PENDING)
   938  	StopOrderStatusCancelled   = StopOrderStatus(vega.StopOrder_STATUS_CANCELLED)
   939  	StopOrderStatusStopped     = StopOrderStatus(vega.StopOrder_STATUS_STOPPED)
   940  	StopOrderStatusTriggered   = StopOrderStatus(vega.StopOrder_STATUS_TRIGGERED)
   941  	StopOrderStatusExpired     = StopOrderStatus(vega.StopOrder_STATUS_EXPIRED)
   942  	StopOrderStatusRejected    = StopOrderStatus(vega.StopOrder_STATUS_REJECTED)
   943  )
   944  
   945  func (s StopOrderStatus) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   946  	str, ok := vega.StopOrder_Status_name[int32(s)]
   947  	if !ok {
   948  		return buf, fmt.Errorf("unknown stop order status: %v", s)
   949  	}
   950  	return append(buf, []byte(str)...), nil
   951  }
   952  
   953  func (s *StopOrderStatus) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   954  	val, ok := vega.StopOrder_Status_value[string(src)]
   955  	if !ok {
   956  		return fmt.Errorf("unknown stop order status: %s", src)
   957  	}
   958  	*s = StopOrderStatus(val)
   959  	return nil
   960  }
   961  
   962  type StopOrderRejectionReason vega.StopOrder_RejectionReason
   963  
   964  const (
   965  	StopOrderRejectionReasonUnspecified                  = StopOrderRejectionReason(vega.StopOrder_REJECTION_REASON_UNSPECIFIED)
   966  	StopOrderRejectionReasonTradingNotAllowed            = StopOrderRejectionReason(vega.StopOrder_REJECTION_REASON_TRADING_NOT_ALLOWED)
   967  	StopOrderRejectionReasonExpiryInThePast              = StopOrderRejectionReason(vega.StopOrder_REJECTION_REASON_EXPIRY_IN_THE_PAST)
   968  	StopOrderRejectionReasonMustBeReduceOnly             = StopOrderRejectionReason(vega.StopOrder_REJECTION_REASON_MUST_BE_REDUCE_ONLY)
   969  	StopOrderRejectionReasonMaxStopOrdersPerPartyReached = StopOrderRejectionReason(vega.StopOrder_REJECTION_REASON_MAX_STOP_ORDERS_PER_PARTY_REACHED)
   970  	StopOrderRejectionReasonNotAllowedWithoutAPosition   = StopOrderRejectionReason(vega.StopOrder_REJECTION_REASON_STOP_ORDER_NOT_ALLOWED_WITHOUT_A_POSITION)
   971  	StopOrderRejectionReasonNotClosingThePosition        = StopOrderRejectionReason(vega.StopOrder_REJECTION_REASON_STOP_ORDER_NOT_CLOSING_THE_POSITION)
   972  	StopOrderRejectionReasonNotAllowedDuringAuction      = StopOrderRejectionReason(vega.StopOrder_REJECTION_REASON_STOP_ORDER_NOT_ALLOWED_DURING_OPENING_AUCTION)
   973  	StopOrderRejectionReasonOCONotAllowedSameExpiryTime  = StopOrderRejectionReason(vega.StopOrder_REJECTION_REASON_STOP_ORDER_CANNOT_MATCH_OCO_EXPIRY_TIMES)
   974  	StopOrderRejectionSizeOverrideUnSupportedForSpot     = StopOrderRejectionReason(vega.StopOrder_REJECTION_REASON_STOP_ORDER_SIZE_OVERRIDE_UNSUPPORTED_FOR_SPOT)
   975  	StopOrderRejectionLinkedPercentageInvalid            = StopOrderRejectionReason(vega.StopOrder_REJECTION_REASON_STOP_ORDER_LINKED_PERCENTAGE_INVALID)
   976  	StopeOrderRejectionReasonSellOrderNotAllowed         = StopOrderRejectionReason(vega.StopOrder_REJECTION_REASON_SELL_ORDER_NOT_ALLOWED)
   977  )
   978  
   979  func (s StopOrderRejectionReason) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
   980  	str, ok := vega.StopOrder_RejectionReason_name[int32(s)]
   981  	if !ok {
   982  		return buf, fmt.Errorf("unknown stop order status: %v", s)
   983  	}
   984  	return append(buf, []byte(str)...), nil
   985  }
   986  
   987  func (s *StopOrderRejectionReason) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
   988  	val, ok := vega.StopOrder_RejectionReason_value[string(src)]
   989  	if !ok {
   990  		return fmt.Errorf("unknown stop order status: %s", src)
   991  	}
   992  	*s = StopOrderRejectionReason(val)
   993  	return nil
   994  }
   995  
   996  type FundingPeriodDataPointSource eventspb.FundingPeriodDataPoint_Source
   997  
   998  const (
   999  	FundingPeriodDataPointSourceUnspecified = FundingPeriodDataPointSource(eventspb.FundingPeriodDataPoint_SOURCE_UNSPECIFIED)
  1000  	FundingPeriodDataPointSourceExternal    = FundingPeriodDataPointSource(eventspb.FundingPeriodDataPoint_SOURCE_EXTERNAL)
  1001  	FundingPeriodDataPointSourceInternal    = FundingPeriodDataPointSource(eventspb.FundingPeriodDataPoint_SOURCE_INTERNAL)
  1002  )
  1003  
  1004  func (s FundingPeriodDataPointSource) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
  1005  	str, ok := eventspb.FundingPeriodDataPoint_Source_name[int32(s)]
  1006  	if !ok {
  1007  		return buf, fmt.Errorf("unknown funding period data point source: %v", s)
  1008  	}
  1009  	return append(buf, []byte(str)...), nil
  1010  }
  1011  
  1012  func (s *FundingPeriodDataPointSource) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
  1013  	val, ok := eventspb.FundingPeriodDataPoint_Source_value[string(src)]
  1014  	if !ok {
  1015  		return fmt.Errorf("unknown funding period data point source: %s", src)
  1016  	}
  1017  	*s = FundingPeriodDataPointSource(val)
  1018  	return nil
  1019  }
  1020  
  1021  type LiquidityFeeSettingsMethod vega.LiquidityFeeSettings_Method
  1022  
  1023  const (
  1024  	LiquidityFeeMethodUnspecified     = LiquidityFeeSettingsMethod(vega.LiquidityFeeSettings_METHOD_UNSPECIFIED)
  1025  	LiquidityFeeMethodMarginalCost    = LiquidityFeeSettingsMethod(vega.LiquidityFeeSettings_METHOD_MARGINAL_COST)
  1026  	LiquidityFeeMethodWeightedAverage = LiquidityFeeSettingsMethod(vega.LiquidityFeeSettings_METHOD_WEIGHTED_AVERAGE)
  1027  	LiquidityFeeMethodConstant        = LiquidityFeeSettingsMethod(vega.LiquidityFeeSettings_METHOD_CONSTANT)
  1028  )
  1029  
  1030  func (s LiquidityFeeSettingsMethod) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
  1031  	status, ok := vega.LiquidityFeeSettings_Method_name[int32(s)]
  1032  	if !ok {
  1033  		return buf, fmt.Errorf("unknown liquidity provision status: %v", s)
  1034  	}
  1035  	return append(buf, []byte(status)...), nil
  1036  }
  1037  
  1038  func (s *LiquidityFeeSettingsMethod) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
  1039  	val, ok := vega.LiquidityFeeSettings_Method_value[string(src)]
  1040  	if !ok {
  1041  		return fmt.Errorf("unknown liquidity provision status: %s", src)
  1042  	}
  1043  	*s = LiquidityFeeSettingsMethod(val)
  1044  	return nil
  1045  }
  1046  
  1047  type MarginMode vega.MarginMode
  1048  
  1049  const (
  1050  	MarginModeUnspecified    = MarginMode(vega.MarginMode_MARGIN_MODE_UNSPECIFIED)
  1051  	MarginModeCrossMargin    = MarginMode(vega.MarginMode_MARGIN_MODE_CROSS_MARGIN)
  1052  	MarginModeIsolatedMargin = MarginMode(vega.MarginMode_MARGIN_MODE_ISOLATED_MARGIN)
  1053  )
  1054  
  1055  func (m MarginMode) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
  1056  	str, ok := vega.MarginMode_name[int32(m)]
  1057  	if !ok {
  1058  		return buf, fmt.Errorf("unknown margin mode: %v", m)
  1059  	}
  1060  	return append(buf, []byte(str)...), nil
  1061  }
  1062  
  1063  func (m *MarginMode) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
  1064  	val, ok := vega.MarginMode_value[string(src)]
  1065  	if !ok {
  1066  		return fmt.Errorf("unknown margin mode: %s", src)
  1067  	}
  1068  	*m = MarginMode(val)
  1069  	return nil
  1070  }
  1071  
  1072  type AMMStatus eventspb.AMM_Status
  1073  
  1074  const (
  1075  	AMMStatusUnspecified = AMMStatus(eventspb.AMM_STATUS_UNSPECIFIED)
  1076  	AMMStatusActive      = AMMStatus(eventspb.AMM_STATUS_ACTIVE)
  1077  	AMMStatusRejected    = AMMStatus(eventspb.AMM_STATUS_REJECTED)
  1078  	AMMStatusCancelled   = AMMStatus(eventspb.AMM_STATUS_CANCELLED)
  1079  	AMMStatusStopped     = AMMStatus(eventspb.AMM_STATUS_STOPPED)
  1080  	AMMStatusReduceOnly  = AMMStatus(eventspb.AMM_STATUS_REDUCE_ONLY)
  1081  )
  1082  
  1083  func (s AMMStatus) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
  1084  	status, ok := eventspb.AMM_Status_name[int32(s)]
  1085  	if !ok {
  1086  		return buf, fmt.Errorf("unknown AMM pool status: %v", s)
  1087  	}
  1088  	return append(buf, []byte(status)...), nil
  1089  }
  1090  
  1091  func (s *AMMStatus) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
  1092  	val, ok := eventspb.AMM_Status_value[string(src)]
  1093  	if !ok {
  1094  		return fmt.Errorf("unknown AMM pool status: %s", src)
  1095  	}
  1096  	*s = AMMStatus(val)
  1097  	return nil
  1098  }
  1099  
  1100  func (s *AMMStatus) Where(fieldName *string, nextBindVar func(args *[]any, arg any) string, args ...any) (string, []any) {
  1101  	if fieldName == nil {
  1102  		return fmt.Sprintf("status = %s", nextBindVar(&args, s)), args
  1103  	}
  1104  
  1105  	return fmt.Sprintf("%s = %s", *fieldName, nextBindVar(&args, s)), args
  1106  }
  1107  
  1108  type AMMStatusReason eventspb.AMM_StatusReason
  1109  
  1110  const (
  1111  	AMMStatusReasonUnspecified           = AMMStatusReason(eventspb.AMM_STATUS_REASON_UNSPECIFIED)
  1112  	AMMStatusReasonCancelledByParty      = AMMStatusReason(eventspb.AMM_STATUS_REASON_CANCELLED_BY_PARTY)
  1113  	AMMStatusReasonCannotFillCommitment  = AMMStatusReason(eventspb.AMM_STATUS_REASON_CANNOT_FILL_COMMITMENT)
  1114  	AMMStatusReasonPartyAlreadyOwnsAPool = AMMStatusReason(eventspb.AMM_STATUS_REASON_PARTY_ALREADY_OWNS_AMM_FOR_MARKET)
  1115  	AMMStatusReasonPartyClosedOut        = AMMStatusReason(eventspb.AMM_STATUS_REASON_PARTY_CLOSED_OUT)
  1116  	AMMStatusReasonMarketClosed          = AMMStatusReason(eventspb.AMM_STATUS_REASON_MARKET_CLOSED)
  1117  	AMMStatusReasonCommitmentTooLow      = AMMStatusReason(eventspb.AMM_STATUS_REASON_COMMITMENT_TOO_LOW)
  1118  	AMMStatusReasonCannotRebase          = AMMStatusReason(eventspb.AMM_STATUS_REASON_CANNOT_REBASE)
  1119  )
  1120  
  1121  func (s AMMStatusReason) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) {
  1122  	status, ok := eventspb.AMM_StatusReason_name[int32(s)]
  1123  	if !ok {
  1124  		return buf, fmt.Errorf("unknown AMM pool status reason: %v", s)
  1125  	}
  1126  	return append(buf, []byte(status)...), nil
  1127  }
  1128  
  1129  func (s *AMMStatusReason) DecodeText(_ *pgtype.ConnInfo, src []byte) error {
  1130  	val, ok := eventspb.AMM_StatusReason_value[string(src)]
  1131  	if !ok {
  1132  		return fmt.Errorf("unknown AMM pool status reason: %s", src)
  1133  	}
  1134  	*s = AMMStatusReason(val)
  1135  	return nil
  1136  }
  1137  
  1138  type ProtoEnum interface {
  1139  	GetEnums() map[int32]string
  1140  }