code.vegaprotocol.io/vega@v0.79.0/datanode/entities/market.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 "encoding/json" 20 "errors" 21 "fmt" 22 "math" 23 "time" 24 25 "code.vegaprotocol.io/vega/libs/num" 26 "code.vegaprotocol.io/vega/libs/ptr" 27 v2 "code.vegaprotocol.io/vega/protos/data-node/api/v2" 28 "code.vegaprotocol.io/vega/protos/vega" 29 30 "github.com/shopspring/decimal" 31 "google.golang.org/protobuf/encoding/protojson" 32 ) 33 34 type _Market struct{} 35 36 type MarketID = ID[_Market] 37 38 func NewMarketIDSlice(ids ...string) []MarketID { 39 res := make([]MarketID, 0, len(ids)) 40 for _, v := range ids { 41 res = append(res, MarketID(v)) 42 } 43 return res 44 } 45 46 type Market struct { 47 ID MarketID 48 TxHash TxHash 49 VegaTime time.Time 50 InstrumentID string 51 TradableInstrument TradableInstrument 52 DecimalPlaces int 53 Fees Fees 54 OpeningAuction AuctionDuration 55 PriceMonitoringSettings PriceMonitoringSettings 56 LiquidityMonitoringParameters LiquidityMonitoringParameters 57 TradingMode MarketTradingMode 58 State MarketState 59 MarketTimestamps MarketTimestamps 60 PositionDecimalPlaces int 61 LpPriceRange string 62 LinearSlippageFactor *decimal.Decimal 63 QuadraticSlippageFactor *decimal.Decimal 64 ParentMarketID MarketID 65 InsurancePoolFraction *decimal.Decimal 66 LiquiditySLAParameters LiquiditySLAParameters 67 // Not saved in the market table, but used when retrieving data from the database. 68 // This will be populated when a market has a successor 69 SuccessorMarketID MarketID 70 LiquidationStrategy LiquidationStrategy 71 MarkPriceConfiguration *CompositePriceConfiguration 72 TickSize *decimal.Decimal 73 EnableTXReordering bool 74 AllowedEmptyAMMLevels uint64 75 AllowedSellers []string 76 } 77 78 func (m *Market) HasCap() (cap *vega.FutureCap, hasCap bool) { 79 if inst := m.TradableInstrument.Instrument; inst != nil { 80 if fut := inst.GetFuture(); fut != nil { 81 if cap := fut.GetCap(); cap != nil { 82 return cap, true 83 } 84 } 85 } 86 87 return nil, false 88 } 89 90 type MarketCursor struct { 91 VegaTime time.Time `json:"vegaTime"` 92 ID MarketID `json:"id"` 93 } 94 95 func (mc MarketCursor) String() string { 96 bs, err := json.Marshal(mc) 97 if err != nil { 98 panic(fmt.Errorf("could not marshal market cursor: %w", err)) 99 } 100 return string(bs) 101 } 102 103 func (mc *MarketCursor) Parse(cursorString string) error { 104 if cursorString == "" { 105 return nil 106 } 107 108 return json.Unmarshal([]byte(cursorString), mc) 109 } 110 111 func NewMarketFromProto(market *vega.Market, txHash TxHash, vegaTime time.Time) (*Market, error) { 112 var ( 113 err error 114 liquidityMonitoringParameters LiquidityMonitoringParameters 115 marketTimestamps MarketTimestamps 116 priceMonitoringSettings PriceMonitoringSettings 117 openingAuction AuctionDuration 118 fees Fees 119 liqStrat LiquidationStrategy 120 tickSize decimal.Decimal 121 ) 122 123 if len(market.TickSize) == 0 { 124 tickSize = num.DecimalOne() 125 } else { 126 tickSize, _ = num.DecimalFromString(market.TickSize) 127 } 128 129 if fees, err = feesFromProto(market.Fees); err != nil { 130 return nil, err 131 } 132 133 if market.OpeningAuction != nil { 134 openingAuction.Duration = market.OpeningAuction.Duration 135 openingAuction.Volume = market.OpeningAuction.Volume 136 } 137 138 if priceMonitoringSettings, err = priceMonitoringSettingsFromProto(market.PriceMonitoringSettings); err != nil { 139 return nil, err 140 } 141 142 if liquidityMonitoringParameters, err = liquidityMonitoringParametersFromProto(market.LiquidityMonitoringParameters); err != nil { 143 return nil, err 144 } 145 146 if marketTimestamps, err = marketTimestampsFromProto(market.MarketTimestamps); err != nil { 147 return nil, err 148 } 149 150 if market.DecimalPlaces > math.MaxInt { 151 return nil, fmt.Errorf("%d is not a valid number for decimal places", market.DecimalPlaces) 152 } 153 154 if market.PositionDecimalPlaces > math.MaxInt { 155 return nil, fmt.Errorf("%d is not a valid number for position decimal places", market.PositionDecimalPlaces) 156 } 157 158 dps := int(market.DecimalPlaces) 159 positionDps := int(market.PositionDecimalPlaces) 160 161 linearSlippageFactor := (*num.Decimal)(nil) 162 if market.LinearSlippageFactor != "" { 163 factor, err := num.DecimalFromString(market.LinearSlippageFactor) 164 if err != nil { 165 return nil, fmt.Errorf("'%v' is not a valid number for linear slippage factor", market.LinearSlippageFactor) 166 } 167 linearSlippageFactor = &factor 168 } 169 170 quadraticSlippageFactor := (*num.Decimal)(nil) 171 if market.QuadraticSlippageFactor != "" { 172 factor, err := num.DecimalFromString(market.QuadraticSlippageFactor) 173 if err != nil { 174 return nil, fmt.Errorf("'%v' is not a valid number for quadratic slippage factor", market.QuadraticSlippageFactor) 175 } 176 quadraticSlippageFactor = &factor 177 } 178 179 parentMarketID := MarketID("") 180 if market.ParentMarketId != nil && *market.ParentMarketId != "" { 181 parent := MarketID(*market.ParentMarketId) 182 parentMarketID = parent 183 } 184 185 var insurancePoolFraction *num.Decimal 186 if market.InsurancePoolFraction != nil && *market.InsurancePoolFraction != "" { 187 insurance, err := num.DecimalFromString(*market.InsurancePoolFraction) 188 if err != nil { 189 return nil, fmt.Errorf("'%v' is not a valid number for insurance pool fraction", market.InsurancePoolFraction) 190 } 191 insurancePoolFraction = &insurance 192 } 193 194 var sla LiquiditySLAParameters 195 if market.LiquiditySlaParams != nil { 196 sla, err = LiquiditySLAParametersFromProto(market.LiquiditySlaParams) 197 if err != nil { 198 return nil, err 199 } 200 } 201 if market.LiquidationStrategy != nil { 202 liqStrat = LiquidationStrategyFromProto(market.LiquidationStrategy) 203 } 204 205 mpc := &CompositePriceConfiguration{market.MarkPriceConfiguration} 206 207 return &Market{ 208 ID: MarketID(market.Id), 209 TxHash: txHash, 210 VegaTime: vegaTime, 211 InstrumentID: market.TradableInstrument.Instrument.Id, 212 TradableInstrument: TradableInstrument{market.TradableInstrument}, 213 DecimalPlaces: dps, 214 Fees: fees, 215 OpeningAuction: openingAuction, 216 PriceMonitoringSettings: priceMonitoringSettings, 217 LiquidityMonitoringParameters: liquidityMonitoringParameters, 218 TradingMode: MarketTradingMode(market.TradingMode), 219 State: MarketState(market.State), 220 MarketTimestamps: marketTimestamps, 221 PositionDecimalPlaces: positionDps, 222 LpPriceRange: market.LpPriceRange, 223 LinearSlippageFactor: linearSlippageFactor, 224 QuadraticSlippageFactor: quadraticSlippageFactor, 225 ParentMarketID: parentMarketID, 226 InsurancePoolFraction: insurancePoolFraction, 227 LiquiditySLAParameters: sla, 228 LiquidationStrategy: liqStrat, 229 MarkPriceConfiguration: mpc, 230 TickSize: &tickSize, 231 EnableTXReordering: market.EnableTransactionReordering, 232 AllowedEmptyAMMLevels: market.AllowedEmptyAmmLevels, 233 AllowedSellers: append([]string{}, market.AllowedSellers...), 234 }, nil 235 } 236 237 func (m Market) ToProto() *vega.Market { 238 linearSlippageFactor := "" 239 if m.LinearSlippageFactor != nil { 240 linearSlippageFactor = m.LinearSlippageFactor.String() 241 } 242 243 quadraticSlippageFactor := "" 244 if m.QuadraticSlippageFactor != nil { 245 quadraticSlippageFactor = m.QuadraticSlippageFactor.String() 246 } 247 248 var parentMarketID, insurancePoolFraction *string 249 250 if m.ParentMarketID != "" { 251 parentMarketID = ptr.From(m.ParentMarketID.String()) 252 } 253 254 if m.InsurancePoolFraction != nil { 255 insurancePoolFraction = ptr.From(m.InsurancePoolFraction.String()) 256 } 257 258 var successorMarketID *string 259 if m.SuccessorMarketID != "" { 260 successorMarketID = ptr.From(m.SuccessorMarketID.String()) 261 } 262 if m.MarkPriceConfiguration == nil { 263 m.MarkPriceConfiguration = &CompositePriceConfiguration{ 264 CompositePriceConfiguration: &vega.CompositePriceConfiguration{ 265 CompositePriceType: vega.CompositePriceType_COMPOSITE_PRICE_TYPE_LAST_TRADE, 266 }, 267 } 268 } else if m.MarkPriceConfiguration.CompositePriceConfiguration == nil { 269 // got to love wrapped types like this 270 m.MarkPriceConfiguration.CompositePriceConfiguration = &vega.CompositePriceConfiguration{ 271 CompositePriceType: vega.CompositePriceType_COMPOSITE_PRICE_TYPE_LAST_TRADE, 272 } 273 } 274 275 return &vega.Market{ 276 Id: m.ID.String(), 277 TradableInstrument: m.TradableInstrument.ToProto(), 278 DecimalPlaces: uint64(m.DecimalPlaces), 279 Fees: m.Fees.ToProto(), 280 OpeningAuction: &vega.AuctionDuration{ 281 Duration: m.OpeningAuction.Duration, 282 Volume: m.OpeningAuction.Volume, 283 }, 284 PriceMonitoringSettings: m.PriceMonitoringSettings.ToProto(), 285 LiquidityMonitoringParameters: m.LiquidityMonitoringParameters.ToProto(), 286 TradingMode: vega.Market_TradingMode(m.TradingMode), 287 State: vega.Market_State(m.State), 288 MarketTimestamps: m.MarketTimestamps.ToProto(), 289 PositionDecimalPlaces: int64(m.PositionDecimalPlaces), 290 LpPriceRange: m.LpPriceRange, 291 LinearSlippageFactor: linearSlippageFactor, 292 QuadraticSlippageFactor: quadraticSlippageFactor, 293 ParentMarketId: parentMarketID, 294 InsurancePoolFraction: insurancePoolFraction, 295 SuccessorMarketId: successorMarketID, 296 LiquiditySlaParams: m.LiquiditySLAParameters.IntoProto(), 297 LiquidationStrategy: m.LiquidationStrategy.IntoProto(), 298 MarkPriceConfiguration: m.MarkPriceConfiguration.CompositePriceConfiguration, 299 TickSize: m.TickSize.String(), 300 EnableTransactionReordering: m.EnableTXReordering, 301 AllowedEmptyAmmLevels: m.AllowedEmptyAMMLevels, 302 AllowedSellers: append([]string{}, m.AllowedSellers...), 303 } 304 } 305 306 func (m Market) Cursor() *Cursor { 307 mc := MarketCursor{ 308 VegaTime: m.VegaTime, 309 ID: m.ID, 310 } 311 return NewCursor(mc.String()) 312 } 313 314 func (m Market) ToProtoEdge(_ ...any) (*v2.MarketEdge, error) { 315 return &v2.MarketEdge{ 316 Node: m.ToProto(), 317 Cursor: m.Cursor().Encode(), 318 }, nil 319 } 320 321 type MarketTimestamps struct { 322 Proposed int64 `json:"proposed,omitempty"` 323 Pending int64 `json:"pending,omitempty"` 324 Open int64 `json:"open,omitempty"` 325 Close int64 `json:"close,omitempty"` 326 } 327 328 func (mt MarketTimestamps) ToProto() *vega.MarketTimestamps { 329 return &vega.MarketTimestamps{ 330 Proposed: mt.Proposed, 331 Pending: mt.Pending, 332 Open: mt.Open, 333 Close: mt.Close, 334 } 335 } 336 337 func marketTimestampsFromProto(ts *vega.MarketTimestamps) (MarketTimestamps, error) { 338 if ts == nil { 339 return MarketTimestamps{}, errors.New("market timestamps cannot be nil") 340 } 341 342 return MarketTimestamps{ 343 Proposed: ts.Proposed, 344 Pending: ts.Pending, 345 Open: ts.Open, 346 Close: ts.Close, 347 }, nil 348 } 349 350 type TargetStakeParameters struct { 351 TimeWindow int64 `json:"timeWindow,omitempty"` 352 ScalingFactors float64 `json:"scalingFactor,omitempty"` 353 } 354 355 func (tsp TargetStakeParameters) ToProto() *vega.TargetStakeParameters { 356 return &vega.TargetStakeParameters{ 357 TimeWindow: tsp.TimeWindow, 358 ScalingFactor: tsp.ScalingFactors, 359 } 360 } 361 362 type LiquidityMonitoringParameters struct { 363 TargetStakeParameters *TargetStakeParameters `json:"targetStakeParameters,omitempty"` 364 } 365 366 type LiquiditySLAParameters struct { 367 PriceRange num.Decimal `json:"priceRange,omitempty"` 368 CommitmentMinTimeFraction num.Decimal `json:"commitmentMinTimeFraction,omitempty"` 369 PerformanceHysteresisEpochs uint64 `json:"performanceHysteresisEpochs,omitempty"` 370 SlaCompetitionFactor num.Decimal `json:"slaCompetitionFactor,omitempty"` 371 } 372 373 type CompositePriceConfiguration struct { 374 *vega.CompositePriceConfiguration 375 } 376 377 func (cpc CompositePriceConfiguration) MarshalJSON() ([]byte, error) { 378 return protojson.Marshal(cpc) 379 } 380 381 func (cpc *CompositePriceConfiguration) UnmarshalJSON(data []byte) error { 382 cpc.CompositePriceConfiguration = &vega.CompositePriceConfiguration{} 383 return protojson.Unmarshal(data, cpc) 384 } 385 386 func (cpc CompositePriceConfiguration) ToProto() *vega.CompositePriceConfiguration { 387 return cpc.CompositePriceConfiguration 388 } 389 390 type LiquidationStrategy struct { 391 DisposalTimeStep time.Duration `json:"disposalTimeStep"` 392 DisposalFraction num.Decimal `json:"disposalFraction"` 393 FullDisposalSize uint64 `json:"fullDisposalSize"` 394 MaxFractionConsumed num.Decimal `json:"maxFractionConsumed"` 395 DisposalSlippage num.Decimal `json:"disposalSlippageRange"` 396 } 397 398 func LiquidationStrategyFromProto(ls *vega.LiquidationStrategy) LiquidationStrategy { 399 if ls == nil { 400 return LiquidationStrategy{} 401 } 402 df, _ := num.DecimalFromString(ls.DisposalFraction) 403 mfc, _ := num.DecimalFromString(ls.MaxFractionConsumed) 404 slip := num.DecimalZero() 405 if len(ls.DisposalSlippageRange) > 0 { 406 slip, _ = num.DecimalFromString(ls.DisposalSlippageRange) 407 } 408 return LiquidationStrategy{ 409 DisposalTimeStep: time.Duration(ls.DisposalTimeStep) * time.Second, 410 FullDisposalSize: ls.FullDisposalSize, 411 DisposalFraction: df, 412 MaxFractionConsumed: mfc, 413 DisposalSlippage: slip, 414 } 415 } 416 417 func (l LiquidationStrategy) IntoProto() *vega.LiquidationStrategy { 418 return &vega.LiquidationStrategy{ 419 DisposalTimeStep: int64(l.DisposalTimeStep / time.Second), 420 DisposalFraction: l.DisposalFraction.String(), 421 FullDisposalSize: l.FullDisposalSize, 422 MaxFractionConsumed: l.MaxFractionConsumed.String(), 423 DisposalSlippageRange: l.DisposalSlippage.String(), 424 } 425 } 426 427 func (lsp LiquiditySLAParameters) IntoProto() *vega.LiquiditySLAParameters { 428 return &vega.LiquiditySLAParameters{ 429 PriceRange: lsp.PriceRange.String(), 430 CommitmentMinTimeFraction: lsp.CommitmentMinTimeFraction.String(), 431 SlaCompetitionFactor: lsp.SlaCompetitionFactor.String(), 432 PerformanceHysteresisEpochs: lsp.PerformanceHysteresisEpochs, 433 } 434 } 435 436 func LiquiditySLAParametersFromProto(sla *vega.LiquiditySLAParameters) (LiquiditySLAParameters, error) { 437 // SLA can be nil for futures for NOW 438 if sla == nil { 439 return LiquiditySLAParameters{}, nil 440 } 441 priceRange, err := num.DecimalFromString(sla.PriceRange) 442 if err != nil { 443 return LiquiditySLAParameters{}, errors.New("invalid price range in liquidity sla parameters") 444 } 445 commitmentMinTimeFraction, err := num.DecimalFromString(sla.CommitmentMinTimeFraction) 446 if err != nil { 447 return LiquiditySLAParameters{}, errors.New("invalid commitment min time fraction in liquidity sla parameters") 448 } 449 slaCompetitionFactor, err := num.DecimalFromString(sla.SlaCompetitionFactor) 450 if err != nil { 451 return LiquiditySLAParameters{}, errors.New("invalid commitment sla competition factor in liquidity sla parameters") 452 } 453 return LiquiditySLAParameters{ 454 PriceRange: priceRange, 455 CommitmentMinTimeFraction: commitmentMinTimeFraction, 456 SlaCompetitionFactor: slaCompetitionFactor, 457 PerformanceHysteresisEpochs: sla.PerformanceHysteresisEpochs, 458 }, nil 459 } 460 461 func (lmp LiquidityMonitoringParameters) ToProto() *vega.LiquidityMonitoringParameters { 462 if lmp.TargetStakeParameters == nil { 463 return nil 464 } 465 return &vega.LiquidityMonitoringParameters{ 466 TargetStakeParameters: lmp.TargetStakeParameters.ToProto(), 467 } 468 } 469 470 func liquidityMonitoringParametersFromProto(lmp *vega.LiquidityMonitoringParameters) (LiquidityMonitoringParameters, error) { 471 if lmp == nil { 472 return LiquidityMonitoringParameters{}, errors.New("liquidity monitoring parameters cannot be Nil") 473 } 474 475 var tsp *TargetStakeParameters 476 477 if lmp.TargetStakeParameters != nil { 478 tsp = &TargetStakeParameters{ 479 TimeWindow: lmp.TargetStakeParameters.TimeWindow, 480 ScalingFactors: lmp.TargetStakeParameters.ScalingFactor, 481 } 482 } 483 484 return LiquidityMonitoringParameters{ 485 TargetStakeParameters: tsp, 486 }, nil 487 } 488 489 type PriceMonitoringParameters struct { 490 Triggers []*PriceMonitoringTrigger `json:"triggers,omitempty"` 491 } 492 493 func priceMonitoringParametersFromProto(pmp *vega.PriceMonitoringParameters) PriceMonitoringParameters { 494 if len(pmp.Triggers) == 0 { 495 return PriceMonitoringParameters{} 496 } 497 498 triggers := make([]*PriceMonitoringTrigger, 0, len(pmp.Triggers)) 499 500 for _, trigger := range pmp.Triggers { 501 probability, _ := decimal.NewFromString(trigger.Probability) 502 triggers = append(triggers, &PriceMonitoringTrigger{ 503 Horizon: uint64(trigger.Horizon), 504 Probability: probability, 505 AuctionExtension: uint64(trigger.AuctionExtension), 506 }) 507 } 508 509 return PriceMonitoringParameters{ 510 Triggers: triggers, 511 } 512 } 513 514 type PriceMonitoringSettings struct { 515 Parameters *PriceMonitoringParameters `json:"priceMonitoringParameters,omitempty"` 516 } 517 518 func (s PriceMonitoringSettings) ToProto() *vega.PriceMonitoringSettings { 519 if s.Parameters == nil { 520 return nil 521 } 522 triggers := make([]*vega.PriceMonitoringTrigger, 0, len(s.Parameters.Triggers)) 523 524 if len(s.Parameters.Triggers) > 0 { 525 for _, trigger := range s.Parameters.Triggers { 526 triggers = append(triggers, trigger.ToProto()) 527 } 528 } 529 530 return &vega.PriceMonitoringSettings{ 531 Parameters: &vega.PriceMonitoringParameters{ 532 Triggers: triggers, 533 }, 534 } 535 } 536 537 func priceMonitoringSettingsFromProto(pms *vega.PriceMonitoringSettings) (PriceMonitoringSettings, error) { 538 if pms == nil { 539 return PriceMonitoringSettings{}, errors.New("price monitoring settings cannot be nil") 540 } 541 542 parameters := priceMonitoringParametersFromProto(pms.Parameters) 543 return PriceMonitoringSettings{ 544 Parameters: ¶meters, 545 }, nil 546 } 547 548 type AuctionDuration struct { 549 Duration int64 `json:"duration,omitempty"` 550 Volume uint64 `json:"volume,omitempty"` 551 } 552 553 type FeeFactors struct { 554 MakerFee string `json:"makerFee,omitempty"` 555 InfrastructureFee string `json:"infrastructureFee,omitempty"` 556 LiquidityFee string `json:"liquidityFee,omitempty"` 557 BuyBackFee string `json:"buyBackFee,omitempty"` 558 TreasuryFee string `json:"treasuryFee,omitempty"` 559 } 560 561 type LiquidityFeeSettings struct { 562 Method LiquidityFeeSettingsMethod `json:"makerFee,omitempty"` 563 FeeConstant *string `json:"feeConstant,omitempty"` 564 } 565 566 type Fees struct { 567 Factors *FeeFactors `json:"factors,omitempty"` 568 LiquidityFeeSettings *LiquidityFeeSettings `json:"liquidityFeeSettings,omitempty"` 569 } 570 571 func (f Fees) ToProto() *vega.Fees { 572 if f.Factors == nil { 573 return nil 574 } 575 576 var liquidityFeeSettings *vega.LiquidityFeeSettings 577 if f.LiquidityFeeSettings != nil { 578 liquidityFeeSettings = &vega.LiquidityFeeSettings{ 579 Method: vega.LiquidityFeeSettings_Method(f.LiquidityFeeSettings.Method), 580 FeeConstant: f.LiquidityFeeSettings.FeeConstant, 581 } 582 } 583 584 return &vega.Fees{ 585 Factors: &vega.FeeFactors{ 586 MakerFee: f.Factors.MakerFee, 587 InfrastructureFee: f.Factors.InfrastructureFee, 588 LiquidityFee: f.Factors.LiquidityFee, 589 BuyBackFee: f.Factors.BuyBackFee, 590 TreasuryFee: f.Factors.TreasuryFee, 591 }, 592 LiquidityFeeSettings: liquidityFeeSettings, 593 } 594 } 595 596 func feesFromProto(fees *vega.Fees) (Fees, error) { 597 if fees == nil { 598 return Fees{}, errors.New("fees cannot be Nil") 599 } 600 601 var liquidityFeeSettings *LiquidityFeeSettings 602 if fees.LiquidityFeeSettings != nil { 603 liquidityFeeSettings = &LiquidityFeeSettings{ 604 Method: LiquidityFeeSettingsMethod(fees.LiquidityFeeSettings.Method), 605 FeeConstant: fees.LiquidityFeeSettings.FeeConstant, 606 } 607 } 608 609 return Fees{ 610 Factors: &FeeFactors{ 611 MakerFee: fees.Factors.MakerFee, 612 InfrastructureFee: fees.Factors.InfrastructureFee, 613 LiquidityFee: fees.Factors.LiquidityFee, 614 BuyBackFee: fees.Factors.BuyBackFee, 615 TreasuryFee: fees.Factors.TreasuryFee, 616 }, 617 LiquidityFeeSettings: liquidityFeeSettings, 618 }, nil 619 }