From 03da4f49b20bb2a9e4efa4190903a9edf49d764c Mon Sep 17 00:00:00 2001 From: Kevin Yang <5478483+k-yang@users.noreply.github.com> Date: Tue, 4 Jul 2023 20:51:43 -0400 Subject: [PATCH] try: sdk.Uint for perp AMM reserves --- proto/nibiru/perp/v2/state.proto | 8 +- x/perp/v2/types/amm.go | 132 ++++++++++++++-------------- x/perp/v2/types/state.pb.go | 143 ++++++++++++++++--------------- 3 files changed, 144 insertions(+), 139 deletions(-) diff --git a/proto/nibiru/perp/v2/state.proto b/proto/nibiru/perp/v2/state.proto index fbc92eac5..df1e11f9d 100644 --- a/proto/nibiru/perp/v2/state.proto +++ b/proto/nibiru/perp/v2/state.proto @@ -115,13 +115,13 @@ message AMM { // the amount of base reserves this AMM has string base_reserve = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.Uint", (gogoproto.nullable) = false ]; // the amount of quote reserves this AMM has string quote_reserve = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.Uint", (gogoproto.nullable) = false ]; @@ -139,13 +139,13 @@ message AMM { // Total long refers to the sum of long open notional in base. string total_long = 6 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.Uint", (gogoproto.nullable) = false ]; // Total short refers to the sum of short open notional in base. string total_short = 7 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.Uint", (gogoproto.nullable) = false ]; } diff --git a/x/perp/v2/types/amm.go b/x/perp/v2/types/amm.go index 8eff30219..1366f48b9 100644 --- a/x/perp/v2/types/amm.go +++ b/x/perp/v2/types/amm.go @@ -13,12 +13,12 @@ import ( ) func (amm AMM) Validate() error { - if amm.BaseReserve.LTE(sdk.ZeroDec()) { - return fmt.Errorf("init pool token supply must be > 0") + if amm.BaseReserve.IsNil() || amm.BaseReserve.IsZero() { + return fmt.Errorf("base reserves must be > 0") } - if amm.QuoteReserve.LTE(sdk.ZeroDec()) { - return fmt.Errorf("init pool token supply must be > 0") + if amm.QuoteReserve.IsNil() || amm.QuoteReserve.IsZero() { + return fmt.Errorf("quote reserves must be > 0") } if amm.PriceMultiplier.LTE(sdk.ZeroDec()) { @@ -29,10 +29,6 @@ func (amm AMM) Validate() error { return fmt.Errorf("init sqrt depth must be > 0") } - if !amm.QuoteReserve.IsPositive() || !amm.BaseReserve.IsPositive() { - return ErrInvalidAmmReserves.Wrapf("amm %s has invalid reserves", amm.String()) - } - computedSqrtDepth, err := amm.ComputeSqrtDepth() if err != nil { return err @@ -52,13 +48,13 @@ func (amm AMM) Validate() error { } // returns the amount of quote reserve equivalent to the amount of quote asset given -func (amm AMM) FromQuoteAssetToReserve(quoteAsset sdk.Dec) sdk.Dec { - return quoteAsset.Quo(amm.PriceMultiplier) +func (amm AMM) FromQuoteAssetToReserve(quoteAsset sdkmath.Uint) sdkmath.Uint { + return sdkmath.NewUintFromBigInt(amm.PriceMultiplier.QuoInt64(int64(quoteAsset.Uint64())).BigInt()) } // returns the amount of quote asset equivalent to the amount of quote reserve given -func (amm AMM) FromQuoteReserveToAsset(quoteReserve sdk.Dec) sdk.Dec { - return quoteReserve.Mul(amm.PriceMultiplier) +func (amm AMM) FromQuoteReserveToAsset(quoteReserve sdkmath.Uint) sdkmath.Uint { + return sdkmath.NewUintFromBigInt(amm.PriceMultiplier.MulInt64(int64(quoteReserve.Uint64())).BigInt()) } // Returns the amount of base reserve equivalent to the amount of quote reserve given @@ -68,36 +64,37 @@ func (amm AMM) FromQuoteReserveToAsset(quoteReserve sdk.Dec) sdk.Dec { // - dir: the direction of the trade // // returns: -// - baseReserveDelta: the amount of base reserve after the trade, unsigned +// - baseReserveDelta: the amount of base reserve after the trade, always positive // - err: error // -// NOTE: baseReserveDelta is always positive -// Throws an error if input quoteReserveAmt is negative, or if the final quote reserve is not positive +// Throws an error if the final quote reserve is not positive func (amm AMM) GetBaseReserveAmt( - quoteReserveAmt sdk.Dec, // unsigned + quoteReserveAmt sdkmath.Uint, // unsigned dir Direction, -) (baseReserveDelta sdk.Dec, err error) { - if quoteReserveAmt.IsNegative() { - return sdk.Dec{}, ErrInputQuoteAmtNegative - } - +) (baseReserveDelta sdkmath.Uint, err error) { invariant := amm.QuoteReserve.Mul(amm.BaseReserve) // x * y = k - var quoteReservesAfter sdk.Dec + var quoteReservesAfter sdkmath.Uint if dir == Direction_LONG { quoteReservesAfter = amm.QuoteReserve.Add(quoteReserveAmt) } else { - quoteReservesAfter = amm.QuoteReserve.Sub(quoteReserveAmt) - } + if quoteReserveAmt.GT(amm.QuoteReserve) { + return sdkmath.ZeroUint(), ErrQuoteReserveAtZero.Wrapf( + "quote reserves below zero after trying to swap %s quote reserves. there are only %s quote reserves in the pool", + quoteReserveAmt.String(), amm.QuoteReserve.String(), + ) + } - if !quoteReservesAfter.IsPositive() { - return sdk.Dec{}, ErrQuoteReserveAtZero + quoteReservesAfter = amm.QuoteReserve.Sub(quoteReserveAmt) } baseReservesAfter := invariant.Quo(quoteReservesAfter) - baseReserveDelta = baseReservesAfter.Sub(amm.BaseReserve).Abs() - return baseReserveDelta, nil + if baseReservesAfter.GT(amm.BaseReserve) { + return baseReservesAfter.Sub(amm.BaseReserve), nil + } + + return amm.BaseReserve.Sub(baseReservesAfter), nil } // returns the amount of quote reserve equivalent to the amount of base asset given @@ -112,33 +109,32 @@ func (amm AMM) GetBaseReserveAmt( // // NOTE: quoteReserveDelta is always positive func (amm AMM) GetQuoteReserveAmt( - baseReserveAmt sdk.Dec, + baseReserveAmt sdkmath.Uint, dir Direction, -) (quoteReserveDelta sdk.Dec, err error) { - if baseReserveAmt.IsNegative() { - return sdk.Dec{}, ErrInputBaseAmtNegative - } - +) (quoteReserveDelta sdkmath.Uint, err error) { invariant := amm.QuoteReserve.Mul(amm.BaseReserve) // x * y = k - var baseReservesAfter sdk.Dec + var baseReservesAfter sdkmath.Uint if dir == Direction_LONG { + if baseReserveAmt.GT(amm.BaseReserve) { + return sdkmath.ZeroUint(), ErrBaseReserveAtZero.Wrapf( + "base reserves below zero after trying to swap %s base reserves. there are only %s base reserves in the pool", + baseReserveAmt.String(), amm.BaseReserve.String(), + ) + } + baseReservesAfter = amm.BaseReserve.Sub(baseReserveAmt) } else { baseReservesAfter = amm.BaseReserve.Add(baseReserveAmt) } - if !baseReservesAfter.IsPositive() { - return sdk.Dec{}, ErrBaseReserveAtZero.Wrapf( - "base assets below zero after trying to swap %s base assets", - baseReserveAmt.String(), - ) - } - quoteReservesAfter := invariant.Quo(baseReservesAfter) - quoteReserveDelta = quoteReservesAfter.Sub(amm.QuoteReserve).Abs() - return quoteReserveDelta, nil + if quoteReservesAfter.GT(amm.QuoteReserve) { + return quoteReservesAfter.Sub(amm.QuoteReserve), nil + } + + return amm.QuoteReserve.Sub(quoteReservesAfter), nil } // Returns the instantaneous mark price of the trading pair @@ -148,7 +144,11 @@ func (amm AMM) MarkPrice() sdk.Dec { return sdk.ZeroDec() } - return amm.QuoteReserve.Quo(amm.BaseReserve).Mul(amm.PriceMultiplier) + return amm.PriceMultiplier.MulInt( + sdkmath.NewIntFromUint64( + amm.QuoteReserve.Quo(amm.BaseReserve).Uint64(), + ), + ) } // Returns the sqrt k of the reserves @@ -160,7 +160,7 @@ func (amm AMM) ComputeSqrtDepth() (sqrtDepth sdk.Dec, err error) { return sdk.Dec{}, ErrLiquidityDepthOverflow } - liqDepth := amm.QuoteReserve.Mul(amm.BaseReserve) + liqDepth := sdkmath.LegacyNewDecFromBigInt(amm.QuoteReserve.Mul(amm.BaseReserve).BigInt()) return common.SqrtDec(liqDepth) } @@ -169,12 +169,12 @@ func (amm *AMM) WithPair(pair asset.Pair) *AMM { return amm } -func (amm *AMM) WithBaseReserve(baseReserve sdk.Dec) *AMM { +func (amm *AMM) WithBaseReserve(baseReserve sdkmath.Uint) *AMM { amm.BaseReserve = baseReserve return amm } -func (amm *AMM) WithQuoteReserve(quoteReserve sdk.Dec) *AMM { +func (amm *AMM) WithQuoteReserve(quoteReserve sdkmath.Uint) *AMM { amm.QuoteReserve = quoteReserve return amm } @@ -184,12 +184,12 @@ func (amm *AMM) WithPriceMultiplier(priceMultiplier sdk.Dec) *AMM { return amm } -func (amm *AMM) WithTotalLong(totalLong sdk.Dec) *AMM { +func (amm *AMM) WithTotalLong(totalLong sdkmath.Uint) *AMM { amm.TotalLong = totalLong return amm } -func (amm *AMM) WithTotalShort(totalShort sdk.Dec) *AMM { +func (amm *AMM) WithTotalShort(totalShort sdkmath.Uint) *AMM { amm.TotalShort = totalShort return amm } @@ -211,13 +211,13 @@ func (amm *AMM) WithSqrtDepth(sqrtDepth sdk.Dec) *AMM { // // NOTE: baseAssetDelta is always positive func (amm *AMM) SwapQuoteAsset( - quoteAssetAmt sdk.Dec, // unsigned + quoteAssetAmt sdkmath.Uint, // unsigned dir Direction, -) (baseAssetDelta sdk.Dec, err error) { +) (baseAssetDelta sdkmath.Uint, err error) { quoteReserveAmt := amm.FromQuoteAssetToReserve(quoteAssetAmt) baseReserveDelta, err := amm.GetBaseReserveAmt(quoteReserveAmt, dir) if err != nil { - return sdk.Dec{}, err + return sdkmath.ZeroUint(), err } if dir == Direction_LONG { @@ -244,10 +244,10 @@ func (amm *AMM) SwapQuoteAsset( // - err: error if any // // Note: quoteAssetDelta is always positive -func (amm *AMM) SwapBaseAsset(baseAssetAmt sdk.Dec, dir Direction) (quoteAssetDelta sdk.Dec, err error) { +func (amm *AMM) SwapBaseAsset(baseAssetAmt sdkmath.Uint, dir Direction) (quoteAssetDelta sdkmath.Uint, err error) { quoteReserveDelta, err := amm.GetQuoteReserveAmt(baseAssetAmt, dir) if err != nil { - return sdk.Dec{}, err + return sdkmath.ZeroUint(), err } if dir == Direction_LONG { @@ -267,8 +267,8 @@ func (amm *AMM) SwapBaseAsset(baseAssetAmt sdk.Dec, dir Direction) (quoteAssetDe Bias returns the bias of the market in the base asset. It's the net amount of base assets for longs minus the net amount of base assets for shorts. */ -func (amm *AMM) Bias() (bias sdk.Dec) { - return amm.TotalLong.Sub(amm.TotalShort) +func (amm *AMM) Bias() (bias sdkmath.Int) { + return sdkmath.NewIntFromUint64(amm.TotalLong.Uint64()).Sub(sdkmath.NewIntFromUint64(amm.TotalShort.Uint64())) } /* @@ -292,12 +292,12 @@ func (amm AMM) CalcRepegCost(newPriceMultiplier sdk.Dec) (cost sdkmath.Int, err dir = Direction_LONG } - biasInQuoteReserve, err := amm.GetQuoteReserveAmt(bias.Abs(), dir) + biasInQuoteReserve, err := amm.GetQuoteReserveAmt(sdkmath.NewUintFromBigInt(bias.Abs().BigInt()), dir) if err != nil { return sdkmath.Int{}, err } - costDec := biasInQuoteReserve.Mul(newPriceMultiplier.Sub(amm.PriceMultiplier)) + costDec := (newPriceMultiplier.Sub(amm.PriceMultiplier)).MulInt64(int64(biasInQuoteReserve.Uint64())) if bias.IsNegative() { costDec = costDec.Neg() @@ -309,11 +309,11 @@ func (amm AMM) CalcRepegCost(newPriceMultiplier sdk.Dec) (cost sdkmath.Int, err // returns the amount of quote assets the amm has to pay out if all longs and shorts close out their positions // positive value means the amm has to pay out quote assets // negative value means the amm has to receive quote assets -func (amm AMM) GetMarketValue() (sdk.Dec, error) { +func (amm AMM) GetMarketValue() (sdkmath.Int, error) { bias := amm.Bias() if bias.IsZero() { - return sdk.ZeroDec(), nil + return sdkmath.ZeroInt(), nil } var dir Direction @@ -323,16 +323,18 @@ func (amm AMM) GetMarketValue() (sdk.Dec, error) { dir = Direction_LONG } - marketValueInReserves, err := amm.GetQuoteReserveAmt(bias.Abs(), dir) + marketValueInReserves, err := amm.GetQuoteReserveAmt(sdkmath.NewUintFromBigInt(bias.Abs().BigInt()), dir) if err != nil { - return sdk.Dec{}, err + return sdkmath.ZeroInt(), err } + marketValueInAssets := amm.FromQuoteReserveToAsset(marketValueInReserves) + if bias.IsNegative() { - marketValueInReserves = marketValueInReserves.Neg() + return sdkmath.NewIntFromUint64(marketValueInAssets.Uint64()).Neg(), nil } - return amm.FromQuoteReserveToAsset(marketValueInReserves), nil + return sdkmath.NewIntFromUint64(marketValueInAssets.Uint64()), nil } /* diff --git a/x/perp/v2/types/state.pb.go b/x/perp/v2/types/state.pb.go index 467c3a4dc..0be2303d4 100644 --- a/x/perp/v2/types/state.pb.go +++ b/x/perp/v2/types/state.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" github_com_NibiruChain_nibiru_x_common_asset "github.com/NibiruChain/nibiru/x/common/asset" _ "github.com/cosmos/cosmos-proto" @@ -197,17 +198,17 @@ type AMM struct { // identifies the market this AMM belongs to Pair github_com_NibiruChain_nibiru_x_common_asset.Pair `protobuf:"bytes,1,opt,name=pair,proto3,customtype=github.com/NibiruChain/nibiru/x/common/asset.Pair" json:"pair"` // the amount of base reserves this AMM has - BaseReserve github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=base_reserve,json=baseReserve,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"base_reserve"` + BaseReserve cosmossdk_io_math.Uint `protobuf:"bytes,2,opt,name=base_reserve,json=baseReserve,proto3,customtype=cosmossdk.io/math.Uint" json:"base_reserve"` // the amount of quote reserves this AMM has - QuoteReserve github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=quote_reserve,json=quoteReserve,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"quote_reserve"` + QuoteReserve cosmossdk_io_math.Uint `protobuf:"bytes,3,opt,name=quote_reserve,json=quoteReserve,proto3,customtype=cosmossdk.io/math.Uint" json:"quote_reserve"` // sqrt(k) SqrtDepth github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=sqrt_depth,json=sqrtDepth,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"sqrt_depth"` // the price multiplier of the dynamic AMM PriceMultiplier github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=price_multiplier,json=priceMultiplier,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price_multiplier"` // Total long refers to the sum of long open notional in base. - TotalLong github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=total_long,json=totalLong,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"total_long"` + TotalLong cosmossdk_io_math.Uint `protobuf:"bytes,6,opt,name=total_long,json=totalLong,proto3,customtype=cosmossdk.io/math.Uint" json:"total_long"` // Total short refers to the sum of short open notional in base. - TotalShort github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=total_short,json=totalShort,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"total_short"` + TotalShort cosmossdk_io_math.Uint `protobuf:"bytes,7,opt,name=total_short,json=totalShort,proto3,customtype=cosmossdk.io/math.Uint" json:"total_short"` } func (m *AMM) Reset() { *m = AMM{} } @@ -374,72 +375,74 @@ func init() { func init() { proto.RegisterFile("nibiru/perp/v2/state.proto", fileDescriptor_8f4829f34f7b8040) } var fileDescriptor_8f4829f34f7b8040 = []byte{ - // 1030 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x96, 0xdd, 0x4e, 0xe3, 0x46, - 0x14, 0xc7, 0x09, 0xc9, 0xb2, 0xc9, 0x24, 0x0b, 0x91, 0x81, 0xad, 0x41, 0x55, 0xa0, 0x48, 0xad, - 0xd0, 0x56, 0x6b, 0x0b, 0x7a, 0xb5, 0xea, 0x55, 0xbe, 0xd8, 0x46, 0xca, 0x17, 0x4e, 0x10, 0x6a, - 0x55, 0x69, 0x34, 0xb6, 0x0f, 0xce, 0x14, 0xdb, 0x63, 0x66, 0xc6, 0x81, 0x6d, 0x5f, 0xa2, 0x77, - 0x6d, 0x5f, 0xa8, 0xda, 0xcb, 0xbd, 0xac, 0x7a, 0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 0x70, - 0x5c, 0xb6, 0x16, 0x8f, 0xda, 0x0c, 0xe9, 0x01, 0xa1, 0xa1, 0x84, 0x90, 0x84, 0x0e, 0xe0, 0x80, - 0x70, 0x8f, 0x86, 0x38, 0x29, 0x4b, 0x2f, 0x26, 0xe2, 0x46, 0x26, 0xfe, 0xc5, 0x8a, 0x78, 0x76, - 0x06, 0xe9, 0x9f, 0xe7, 0xc2, 0xbd, 0x36, 0xe5, 0xab, 0x08, 0x84, 0xd1, 0x01, 0xc7, 0x7a, 0xba, - 0xc2, 0x1b, 0x24, 0x38, 0x4b, 0xd1, 0xb4, 0x73, 0x54, 0x0b, 0xc8, 0x1d, 0xf6, 0x61, 0x0e, 0x9c, - 0x78, 0xa0, 0x97, 0x72, 0xd1, 0xab, 0x01, 0xb9, 0xeb, 0x67, 0x08, 0xed, 0x27, 0x74, 0xe4, 0x13, - 0x09, 0x42, 0x62, 0x27, 0x0e, 0x62, 0x9f, 0x48, 0x3a, 0x07, 0x1c, 0x71, 0x08, 0x68, 0x1c, 0xe0, - 0x2b, 0x4e, 0x1c, 0x75, 0xb8, 0xfa, 0xa3, 0x5c, 0x42, 0x07, 0x29, 0xb9, 0xbd, 0x04, 0x8f, 0x53, - 0xee, 0x59, 0x86, 0xd5, 0xbe, 0x47, 0x1a, 0xdc, 0x39, 0x33, 0x12, 0x7a, 0x80, 0xaf, 0x00, 0xb2, - 0x33, 0xdb, 0xc8, 0x25, 0x56, 0x5f, 0x90, 0xce, 0x00, 0xd2, 0xd3, 0xf2, 0x90, 0x0e, 0x0e, 0x13, - 0xaf, 0x84, 0x84, 0x00, 0x5f, 0xc5, 0xa1, 0xbb, 0xa2, 0xf1, 0x38, 0x97, 0xc6, 0xee, 0x92, 0x77, - 0x16, 0x87, 0xee, 0x52, 0xc8, 0x46, 0xbb, 0x3e, 0xbd, 0x89, 0xa9, 0x9b, 0x38, 0x71, 0x45, 0xa5, - 0x9c, 0x4b, 0x65, 0x7b, 0x05, 0xb6, 0xd4,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, 0xa3, 0xf0, 0xf3, 0x43, 0x63, 0xed, - 0xcd, 0x43, 0x63, 0xed, 0x8f, 0x87, 0xc6, 0xda, 0x77, 0xcf, 0xff, 0xcb, 0xf4, 0x8b, 0xef, 0xca, - 0xe4, 0x8d, 0xd9, 0x1b, 0xc9, 0x95, 0xf1, 0xd5, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb9, 0xa7, - 0xb0, 0xdb, 0x76, 0x0a, 0x00, 0x00, + // 1059 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x96, 0x4d, 0x6f, 0xdb, 0x46, + 0x13, 0xc7, 0x2d, 0x4b, 0x71, 0xa4, 0x95, 0xe2, 0x08, 0x9b, 0x38, 0x8f, 0x6c, 0x3c, 0x90, 0x5d, + 0x03, 0x2d, 0x8c, 0x14, 0x21, 0x61, 0xf7, 0x14, 0x14, 0x45, 0xa1, 0x37, 0xa7, 0x02, 0xf4, 0x16, + 0x4a, 0x86, 0xd1, 0xa2, 0xc0, 0x62, 0x49, 0x8e, 0xa9, 0xad, 0x48, 0x2e, 0xcd, 0x5d, 0xca, 0x4e, + 0x7b, 0xef, 0xb9, 0xb7, 0xb6, 0xdf, 0x28, 0xc7, 0x1c, 0x8b, 0x1e, 0xd2, 0xc2, 0xfe, 0x22, 0xc5, + 0x92, 0x2b, 0x45, 0x01, 0x0a, 0x38, 0x10, 0xd2, 0x93, 0xc4, 0x1d, 0xfe, 0x7f, 0xff, 0xe5, 0x70, + 0x66, 0x96, 0x68, 0x2f, 0x64, 0x36, 0x8b, 0x13, 0x33, 0x82, 0x38, 0x32, 0xe7, 0x27, 0xa6, 0x90, + 0x54, 0x82, 0x11, 0xc5, 0x5c, 0x72, 0xbc, 0x9d, 0xc5, 0x0c, 0x15, 0x33, 0xe6, 0x27, 0x7b, 0x8f, + 0x3d, 0xee, 0xf1, 0x34, 0x64, 0xaa, 0x7f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0xf1, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x29, 0x36, 0xc7, 0xe7, 0x36, + 0x0a, 0x00, 0x00, } func (m *Market) Marshal() (dAtA []byte, err error) {