diff --git a/CHANGELOG.md b/CHANGELOG.md index fdf1751265..fd8c749cf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -112,8 +112,10 @@ - [10321](https://github.com/vegaprotocol/vega/issues/10321) - Fix `ListPartyMarginModes` panic. - [10324](https://github.com/vegaprotocol/vega/issues/10324) - Fix `GetMarketHistoryByID` to only return the most recent market data information when no dates are provided. - [10318](https://github.com/vegaprotocol/vega/issues/10318) - Prevent stop orders being placed during opening auction. -- [476](https://github.com/vegaprotocol/core-test-coverage/issues/476) - Add tests for markets expiring in opening auction, fix a bug for future markets. +- [476](https://github.com/vegaprotocol/core-test-coverage/issues/476) - Add tests for markets expiring in opening auction, fix a bug for future markets. - [10354](https://github.com/vegaprotocol/vega/issues/10354) - Renumbered SQL migration scripts 0055-0067 due to 0068 being released as part of a patch without renumbering. +- [476](https://github.com/vegaprotocol/core-test-coverage/issues/476) - Add tests for markets expiring in opening auction, fix a bug for future markets. +- [10339](https://github.com/vegaprotocol/vega/issues/10339) - Fix for GraphQL batch proposals support. ## 0.73.0 diff --git a/datanode/api/trading_data_v2.go b/datanode/api/trading_data_v2.go index 5918c0aa01..62a30ccd16 100644 --- a/datanode/api/trading_data_v2.go +++ b/datanode/api/trading_data_v2.go @@ -2309,6 +2309,10 @@ func (t *TradingDataServiceV2) ListGovernanceData(ctx context.Context, req *v2.L if err != nil { return nil, formatE(ErrGovernanceServiceGetVotes, errors.Wrapf(err, "proposalID: %s", proposalID)) } + + if len(edges[i].Node.Proposals) > 0 { + edges[i].Node.ProposalType = vega.GovernanceData_TYPE_BATCH + } } proposalsConnection := &v2.GovernanceDataConnection{ diff --git a/datanode/gateway/graphql/generated.go b/datanode/gateway/graphql/generated.go index 118af37201..6a09469e75 100644 --- a/datanode/gateway/graphql/generated.go +++ b/datanode/gateway/graphql/generated.go @@ -51,6 +51,8 @@ type ResolverRoot interface { AggregatedLedgerEntry() AggregatedLedgerEntryResolver Asset() AssetResolver AuctionEvent() AuctionEventResolver + BatchProposalTerms() BatchProposalTermsResolver + BatchProposalTermsChange() BatchProposalTermsChangeResolver BenefitTier() BenefitTierResolver CancelTransfer() CancelTransferResolver Candle() CandleResolver @@ -131,6 +133,7 @@ type ResolverRoot interface { PriceLevel() PriceLevelResolver Proposal() ProposalResolver ProposalDetail() ProposalDetailResolver + ProposalEdge() ProposalEdgeResolver ProposalTerms() ProposalTermsResolver ProtocolUpgradeProposal() ProtocolUpgradeProposalResolver QuantumRewardsPerEpoch() QuantumRewardsPerEpochResolver @@ -312,6 +315,33 @@ type ComplexityRoot struct { Trigger func(childComplexity int) int } + BatchProposal struct { + Datetime func(childComplexity int) int + ErrorDetails func(childComplexity int) int + ID func(childComplexity int) int + Party func(childComplexity int) int + Rationale func(childComplexity int) int + Reference func(childComplexity int) int + RejectionReason func(childComplexity int) int + RequiredLpMajority func(childComplexity int) int + RequiredLpParticipation func(childComplexity int) int + RequiredMajority func(childComplexity int) int + RequiredParticipation func(childComplexity int) int + State func(childComplexity int) int + SubProposals func(childComplexity int) int + Votes func(childComplexity int) int + } + + BatchProposalTerms struct { + Changes func(childComplexity int) int + ClosingDatetime func(childComplexity int) int + } + + BatchProposalTermsChange struct { + Change func(childComplexity int) int + EnactmentDatetime func(childComplexity int) int + } + BenefitTier struct { MinimumEpochs func(childComplexity int) int MinimumRunningNotionalTakerVolume func(childComplexity int) int @@ -1148,6 +1178,7 @@ type ComplexityRoot struct { LiquidityProvisions func(childComplexity int, partyID *string, live *bool, pagination *v2.Pagination) int LiquidityProvisionsConnection func(childComplexity int, partyID *string, live *bool, pagination *v2.Pagination) int LiquiditySLAParameters func(childComplexity int) int + MarketProposal func(childComplexity int) int MarketTimestamps func(childComplexity int) int OpeningAuction func(childComplexity int) int OrdersConnection func(childComplexity int, pagination *v2.Pagination, filter *OrderByPartyIdsFilter) int @@ -1884,6 +1915,8 @@ type ComplexityRoot struct { } ProposalDetail struct { + BatchId func(childComplexity int) int + BatchTerms func(childComplexity int) int Datetime func(childComplexity int) int ErrorDetails func(childComplexity int) int Id func(childComplexity int) int @@ -1900,8 +1933,9 @@ type ComplexityRoot struct { } ProposalEdge struct { - Cursor func(childComplexity int) int - Node func(childComplexity int) int + Cursor func(childComplexity int) int + Node func(childComplexity int) int + ProposalNode func(childComplexity int) int } ProposalRationale struct { @@ -2867,6 +2901,13 @@ type AuctionEventResolver interface { AuctionStart(ctx context.Context, obj *v1.AuctionEvent) (int64, error) AuctionEnd(ctx context.Context, obj *v1.AuctionEvent) (int64, error) } +type BatchProposalTermsResolver interface { + ClosingDatetime(ctx context.Context, obj *vega.BatchProposalTerms) (int64, error) +} +type BatchProposalTermsChangeResolver interface { + EnactmentDatetime(ctx context.Context, obj *vega.BatchProposalTermsChange) (*int64, error) + Change(ctx context.Context, obj *vega.BatchProposalTermsChange) (ProposalChange, error) +} type BenefitTierResolver interface { MinimumEpochs(ctx context.Context, obj *vega.BenefitTier) (int, error) } @@ -3068,6 +3109,7 @@ type MarketResolver interface { LiquidityMonitoringParameters(ctx context.Context, obj *vega.Market) (*LiquidityMonitoringParameters, error) Proposal(ctx context.Context, obj *vega.Market) (*vega.GovernanceData, error) + MarketProposal(ctx context.Context, obj *vega.Market) (ProposalNode, error) OrdersConnection(ctx context.Context, obj *vega.Market, pagination *v2.Pagination, filter *OrderByPartyIdsFilter) (*v2.OrderConnection, error) AccountsConnection(ctx context.Context, obj *vega.Market, partyID *string, pagination *v2.Pagination) (*v2.AccountsConnection, error) TradesConnection(ctx context.Context, obj *vega.Market, dateRange *v2.DateRange, pagination *v2.Pagination) (*v2.TradeConnection, error) @@ -3366,6 +3408,9 @@ type ProposalDetailResolver interface { RequiredLpMajority(ctx context.Context, obj *vega.Proposal) (*string, error) RequiredLpParticipation(ctx context.Context, obj *vega.Proposal) (*string, error) } +type ProposalEdgeResolver interface { + ProposalNode(ctx context.Context, obj *v2.GovernanceDataEdge) (ProposalNode, error) +} type ProposalTermsResolver interface { ClosingDatetime(ctx context.Context, obj *vega.ProposalTerms) (int64, error) EnactmentDatetime(ctx context.Context, obj *vega.ProposalTerms) (*int64, error) @@ -3432,7 +3477,7 @@ type QueryResolver interface { PartiesConnection(ctx context.Context, id *string, pagination *v2.Pagination) (*v2.PartyConnection, error) Party(ctx context.Context, id string) (*vega.Party, error) Positions(ctx context.Context, filter *v2.PositionsFilter, pagination *v2.Pagination) (*v2.PositionConnection, error) - Proposal(ctx context.Context, id *string, reference *string) (*vega.GovernanceData, error) + Proposal(ctx context.Context, id *string, reference *string) (ProposalNode, error) ProposalsConnection(ctx context.Context, proposalType *v2.ListGovernanceDataRequest_Type, inState *vega.Proposal_State, pagination *v2.Pagination) (*v2.GovernanceDataConnection, error) ProtocolUpgradeStatus(ctx context.Context) (*ProtocolUpgradeStatus, error) ProtocolUpgradeProposals(ctx context.Context, inState *v1.ProtocolUpgradeProposalStatus, approvedBy *string, pagination *v2.Pagination) (*v2.ProtocolUpgradeProposalConnection, error) @@ -4268,6 +4313,132 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.AuctionEvent.Trigger(childComplexity), true + case "BatchProposal.datetime": + if e.complexity.BatchProposal.Datetime == nil { + break + } + + return e.complexity.BatchProposal.Datetime(childComplexity), true + + case "BatchProposal.errorDetails": + if e.complexity.BatchProposal.ErrorDetails == nil { + break + } + + return e.complexity.BatchProposal.ErrorDetails(childComplexity), true + + case "BatchProposal.id": + if e.complexity.BatchProposal.ID == nil { + break + } + + return e.complexity.BatchProposal.ID(childComplexity), true + + case "BatchProposal.party": + if e.complexity.BatchProposal.Party == nil { + break + } + + return e.complexity.BatchProposal.Party(childComplexity), true + + case "BatchProposal.rationale": + if e.complexity.BatchProposal.Rationale == nil { + break + } + + return e.complexity.BatchProposal.Rationale(childComplexity), true + + case "BatchProposal.reference": + if e.complexity.BatchProposal.Reference == nil { + break + } + + return e.complexity.BatchProposal.Reference(childComplexity), true + + case "BatchProposal.rejectionReason": + if e.complexity.BatchProposal.RejectionReason == nil { + break + } + + return e.complexity.BatchProposal.RejectionReason(childComplexity), true + + case "BatchProposal.requiredLpMajority": + if e.complexity.BatchProposal.RequiredLpMajority == nil { + break + } + + return e.complexity.BatchProposal.RequiredLpMajority(childComplexity), true + + case "BatchProposal.requiredLpParticipation": + if e.complexity.BatchProposal.RequiredLpParticipation == nil { + break + } + + return e.complexity.BatchProposal.RequiredLpParticipation(childComplexity), true + + case "BatchProposal.requiredMajority": + if e.complexity.BatchProposal.RequiredMajority == nil { + break + } + + return e.complexity.BatchProposal.RequiredMajority(childComplexity), true + + case "BatchProposal.requiredParticipation": + if e.complexity.BatchProposal.RequiredParticipation == nil { + break + } + + return e.complexity.BatchProposal.RequiredParticipation(childComplexity), true + + case "BatchProposal.state": + if e.complexity.BatchProposal.State == nil { + break + } + + return e.complexity.BatchProposal.State(childComplexity), true + + case "BatchProposal.subProposals": + if e.complexity.BatchProposal.SubProposals == nil { + break + } + + return e.complexity.BatchProposal.SubProposals(childComplexity), true + + case "BatchProposal.votes": + if e.complexity.BatchProposal.Votes == nil { + break + } + + return e.complexity.BatchProposal.Votes(childComplexity), true + + case "BatchProposalTerms.changes": + if e.complexity.BatchProposalTerms.Changes == nil { + break + } + + return e.complexity.BatchProposalTerms.Changes(childComplexity), true + + case "BatchProposalTerms.closingDatetime": + if e.complexity.BatchProposalTerms.ClosingDatetime == nil { + break + } + + return e.complexity.BatchProposalTerms.ClosingDatetime(childComplexity), true + + case "BatchProposalTermsChange.change": + if e.complexity.BatchProposalTermsChange.Change == nil { + break + } + + return e.complexity.BatchProposalTermsChange.Change(childComplexity), true + + case "BatchProposalTermsChange.enactmentDatetime": + if e.complexity.BatchProposalTermsChange.EnactmentDatetime == nil { + break + } + + return e.complexity.BatchProposalTermsChange.EnactmentDatetime(childComplexity), true + case "BenefitTier.minimumEpochs": if e.complexity.BenefitTier.MinimumEpochs == nil { break @@ -7565,6 +7736,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Market.LiquiditySLAParameters(childComplexity), true + case "Market.marketProposal": + if e.complexity.Market.MarketProposal == nil { + break + } + + return e.complexity.Market.MarketProposal(childComplexity), true + case "Market.marketTimestamps": if e.complexity.Market.MarketTimestamps == nil { break @@ -11031,6 +11209,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Proposal.Votes(childComplexity), true + case "ProposalDetail.batchId": + if e.complexity.ProposalDetail.BatchId == nil { + break + } + + return e.complexity.ProposalDetail.BatchId(childComplexity), true + + case "ProposalDetail.batchTerms": + if e.complexity.ProposalDetail.BatchTerms == nil { + break + } + + return e.complexity.ProposalDetail.BatchTerms(childComplexity), true + case "ProposalDetail.datetime": if e.complexity.ProposalDetail.Datetime == nil { break @@ -11136,6 +11328,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.ProposalEdge.Node(childComplexity), true + case "ProposalEdge.proposalNode": + if e.complexity.ProposalEdge.ProposalNode == nil { + break + } + + return e.complexity.ProposalEdge.ProposalNode(childComplexity), true + case "ProposalRationale.description": if e.complexity.ProposalRationale.Description == nil { break @@ -19008,6 +19207,8 @@ func (ec *executionContext) fieldContext_AccountBalance_market(ctx context.Conte return ec.fieldContext_Market_state(ctx, field) case "proposal": return ec.fieldContext_Market_proposal(ctx, field) + case "marketProposal": + return ec.fieldContext_Market_marketProposal(ctx, field) case "ordersConnection": return ec.fieldContext_Market_ordersConnection(ctx, field) case "accountsConnection": @@ -19624,6 +19825,8 @@ func (ec *executionContext) fieldContext_AccountEvent_market(ctx context.Context return ec.fieldContext_Market_state(ctx, field) case "proposal": return ec.fieldContext_Market_proposal(ctx, field) + case "marketProposal": + return ec.fieldContext_Market_marketProposal(ctx, field) case "ordersConnection": return ec.fieldContext_Market_ordersConnection(ctx, field) case "accountsConnection": @@ -22589,6 +22792,869 @@ func (ec *executionContext) fieldContext_AuctionEvent_extensionTrigger(ctx conte return fc, nil } +func (ec *executionContext) _BatchProposal_id(ctx context.Context, field graphql.CollectedField, obj *BatchProposal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposal_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOID2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposal_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposal", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _BatchProposal_reference(ctx context.Context, field graphql.CollectedField, obj *BatchProposal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposal_reference(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Reference, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposal_reference(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposal", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _BatchProposal_party(ctx context.Context, field graphql.CollectedField, obj *BatchProposal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposal_party(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Party, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*vega.Party) + fc.Result = res + return ec.marshalNParty2ᚖcodeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋvegaᚐParty(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposal_party(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposal", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Party_id(ctx, field) + case "ordersConnection": + return ec.fieldContext_Party_ordersConnection(ctx, field) + case "tradesConnection": + return ec.fieldContext_Party_tradesConnection(ctx, field) + case "accountsConnection": + return ec.fieldContext_Party_accountsConnection(ctx, field) + case "positionsConnection": + return ec.fieldContext_Party_positionsConnection(ctx, field) + case "marginsConnection": + return ec.fieldContext_Party_marginsConnection(ctx, field) + case "proposalsConnection": + return ec.fieldContext_Party_proposalsConnection(ctx, field) + case "votesConnection": + return ec.fieldContext_Party_votesConnection(ctx, field) + case "withdrawalsConnection": + return ec.fieldContext_Party_withdrawalsConnection(ctx, field) + case "depositsConnection": + return ec.fieldContext_Party_depositsConnection(ctx, field) + case "liquidityProvisions": + return ec.fieldContext_Party_liquidityProvisions(ctx, field) + case "liquidityProvisionsConnection": + return ec.fieldContext_Party_liquidityProvisionsConnection(ctx, field) + case "delegationsConnection": + return ec.fieldContext_Party_delegationsConnection(ctx, field) + case "stakingSummary": + return ec.fieldContext_Party_stakingSummary(ctx, field) + case "rewardsConnection": + return ec.fieldContext_Party_rewardsConnection(ctx, field) + case "rewardSummaries": + return ec.fieldContext_Party_rewardSummaries(ctx, field) + case "transfersConnection": + return ec.fieldContext_Party_transfersConnection(ctx, field) + case "activityStreak": + return ec.fieldContext_Party_activityStreak(ctx, field) + case "vestingBalancesSummary": + return ec.fieldContext_Party_vestingBalancesSummary(ctx, field) + case "vestingStats": + return ec.fieldContext_Party_vestingStats(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Party", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _BatchProposal_state(ctx context.Context, field graphql.CollectedField, obj *BatchProposal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposal_state(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.State, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(vega.Proposal_State) + fc.Result = res + return ec.marshalNProposalState2codeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋvegaᚐProposal_State(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposal_state(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposal", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ProposalState does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _BatchProposal_datetime(ctx context.Context, field graphql.CollectedField, obj *BatchProposal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposal_datetime(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Datetime, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int64) + fc.Result = res + return ec.marshalNTimestamp2int64(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposal_datetime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposal", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Timestamp does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _BatchProposal_rationale(ctx context.Context, field graphql.CollectedField, obj *BatchProposal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposal_rationale(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Rationale, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*vega.ProposalRationale) + fc.Result = res + return ec.marshalNProposalRationale2ᚖcodeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋvegaᚐProposalRationale(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposal_rationale(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposal", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "description": + return ec.fieldContext_ProposalRationale_description(ctx, field) + case "title": + return ec.fieldContext_ProposalRationale_title(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ProposalRationale", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _BatchProposal_votes(ctx context.Context, field graphql.CollectedField, obj *BatchProposal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposal_votes(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Votes, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*ProposalVotes) + fc.Result = res + return ec.marshalNProposalVotes2ᚖcodeᚗvegaprotocolᚗioᚋvegaᚋdatanodeᚋgatewayᚋgraphqlᚐProposalVotes(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposal_votes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposal", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "yes": + return ec.fieldContext_ProposalVotes_yes(ctx, field) + case "no": + return ec.fieldContext_ProposalVotes_no(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ProposalVotes", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _BatchProposal_rejectionReason(ctx context.Context, field graphql.CollectedField, obj *BatchProposal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposal_rejectionReason(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RejectionReason, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*vega.ProposalError) + fc.Result = res + return ec.marshalOProposalRejectionReason2ᚖcodeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋvegaᚐProposalError(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposal_rejectionReason(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposal", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ProposalRejectionReason does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _BatchProposal_errorDetails(ctx context.Context, field graphql.CollectedField, obj *BatchProposal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposal_errorDetails(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ErrorDetails, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposal_errorDetails(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposal", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _BatchProposal_requiredMajority(ctx context.Context, field graphql.CollectedField, obj *BatchProposal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposal_requiredMajority(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RequiredMajority, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposal_requiredMajority(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposal", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _BatchProposal_requiredParticipation(ctx context.Context, field graphql.CollectedField, obj *BatchProposal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposal_requiredParticipation(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RequiredParticipation, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposal_requiredParticipation(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposal", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _BatchProposal_requiredLpMajority(ctx context.Context, field graphql.CollectedField, obj *BatchProposal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposal_requiredLpMajority(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RequiredLpMajority, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposal_requiredLpMajority(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposal", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _BatchProposal_requiredLpParticipation(ctx context.Context, field graphql.CollectedField, obj *BatchProposal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposal_requiredLpParticipation(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RequiredLpParticipation, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposal_requiredLpParticipation(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposal", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _BatchProposal_subProposals(ctx context.Context, field graphql.CollectedField, obj *BatchProposal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposal_subProposals(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SubProposals, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*vega.Proposal) + fc.Result = res + return ec.marshalOProposalDetail2ᚕᚖcodeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋvegaᚐProposal(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposal_subProposals(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposal", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_ProposalDetail_id(ctx, field) + case "batchId": + return ec.fieldContext_ProposalDetail_batchId(ctx, field) + case "reference": + return ec.fieldContext_ProposalDetail_reference(ctx, field) + case "party": + return ec.fieldContext_ProposalDetail_party(ctx, field) + case "state": + return ec.fieldContext_ProposalDetail_state(ctx, field) + case "datetime": + return ec.fieldContext_ProposalDetail_datetime(ctx, field) + case "terms": + return ec.fieldContext_ProposalDetail_terms(ctx, field) + case "batchTerms": + return ec.fieldContext_ProposalDetail_batchTerms(ctx, field) + case "rationale": + return ec.fieldContext_ProposalDetail_rationale(ctx, field) + case "rejectionReason": + return ec.fieldContext_ProposalDetail_rejectionReason(ctx, field) + case "errorDetails": + return ec.fieldContext_ProposalDetail_errorDetails(ctx, field) + case "requiredMajority": + return ec.fieldContext_ProposalDetail_requiredMajority(ctx, field) + case "requiredParticipation": + return ec.fieldContext_ProposalDetail_requiredParticipation(ctx, field) + case "requiredLpMajority": + return ec.fieldContext_ProposalDetail_requiredLpMajority(ctx, field) + case "requiredLpParticipation": + return ec.fieldContext_ProposalDetail_requiredLpParticipation(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ProposalDetail", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _BatchProposalTerms_closingDatetime(ctx context.Context, field graphql.CollectedField, obj *vega.BatchProposalTerms) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposalTerms_closingDatetime(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.BatchProposalTerms().ClosingDatetime(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int64) + fc.Result = res + return ec.marshalNTimestamp2int64(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposalTerms_closingDatetime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposalTerms", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Timestamp does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _BatchProposalTerms_changes(ctx context.Context, field graphql.CollectedField, obj *vega.BatchProposalTerms) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposalTerms_changes(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Changes, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*vega.BatchProposalTermsChange) + fc.Result = res + return ec.marshalNBatchProposalTermsChange2ᚕᚖcodeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋvegaᚐBatchProposalTermsChange(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposalTerms_changes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposalTerms", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "enactmentDatetime": + return ec.fieldContext_BatchProposalTermsChange_enactmentDatetime(ctx, field) + case "change": + return ec.fieldContext_BatchProposalTermsChange_change(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type BatchProposalTermsChange", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _BatchProposalTermsChange_enactmentDatetime(ctx context.Context, field graphql.CollectedField, obj *vega.BatchProposalTermsChange) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposalTermsChange_enactmentDatetime(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.BatchProposalTermsChange().EnactmentDatetime(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*int64) + fc.Result = res + return ec.marshalOTimestamp2ᚖint64(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposalTermsChange_enactmentDatetime(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposalTermsChange", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Timestamp does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _BatchProposalTermsChange_change(ctx context.Context, field graphql.CollectedField, obj *vega.BatchProposalTermsChange) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BatchProposalTermsChange_change(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.BatchProposalTermsChange().Change(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(ProposalChange) + fc.Result = res + return ec.marshalNProposalChange2codeᚗvegaprotocolᚗioᚋvegaᚋdatanodeᚋgatewayᚋgraphqlᚐProposalChange(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_BatchProposalTermsChange_change(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "BatchProposalTermsChange", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ProposalChange does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _BenefitTier_minimumEpochs(ctx context.Context, field graphql.CollectedField, obj *vega.BenefitTier) (ret graphql.Marshaler) { fc, err := ec.fieldContext_BenefitTier_minimumEpochs(ctx, field) if err != nil { @@ -29482,6 +30548,8 @@ func (ec *executionContext) fieldContext_Entities_markets(ctx context.Context, f return ec.fieldContext_Market_state(ctx, field) case "proposal": return ec.fieldContext_Market_proposal(ctx, field) + case "marketProposal": + return ec.fieldContext_Market_marketProposal(ctx, field) case "ordersConnection": return ec.fieldContext_Market_ordersConnection(ctx, field) case "accountsConnection": @@ -30038,6 +31106,8 @@ func (ec *executionContext) fieldContext_Entities_proposals(ctx context.Context, switch field.Name { case "id": return ec.fieldContext_ProposalDetail_id(ctx, field) + case "batchId": + return ec.fieldContext_ProposalDetail_batchId(ctx, field) case "reference": return ec.fieldContext_ProposalDetail_reference(ctx, field) case "party": @@ -30048,6 +31118,8 @@ func (ec *executionContext) fieldContext_Entities_proposals(ctx context.Context, return ec.fieldContext_ProposalDetail_datetime(ctx, field) case "terms": return ec.fieldContext_ProposalDetail_terms(ctx, field) + case "batchTerms": + return ec.fieldContext_ProposalDetail_batchTerms(ctx, field) case "rationale": return ec.fieldContext_ProposalDetail_rationale(ctx, field) case "rejectionReason": @@ -40724,6 +41796,8 @@ func (ec *executionContext) fieldContext_LiquidityProvision_market(ctx context.C return ec.fieldContext_Market_state(ctx, field) case "proposal": return ec.fieldContext_Market_proposal(ctx, field) + case "marketProposal": + return ec.fieldContext_Market_marketProposal(ctx, field) case "ordersConnection": return ec.fieldContext_Market_ordersConnection(ctx, field) case "accountsConnection": @@ -43293,6 +44367,8 @@ func (ec *executionContext) fieldContext_MarginLevels_market(ctx context.Context return ec.fieldContext_Market_state(ctx, field) case "proposal": return ec.fieldContext_Market_proposal(ctx, field) + case "marketProposal": + return ec.fieldContext_Market_marketProposal(ctx, field) case "ordersConnection": return ec.fieldContext_Market_ordersConnection(ctx, field) case "accountsConnection": @@ -44875,6 +45951,47 @@ func (ec *executionContext) fieldContext_Market_proposal(ctx context.Context, fi return fc, nil } +func (ec *executionContext) _Market_marketProposal(ctx context.Context, field graphql.CollectedField, obj *vega.Market) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Market_marketProposal(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Market().MarketProposal(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(ProposalNode) + fc.Result = res + return ec.marshalOProposalNode2codeᚗvegaprotocolᚗioᚋvegaᚋdatanodeᚋgatewayᚋgraphqlᚐProposalNode(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Market_marketProposal(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Market", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ProposalNode does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _Market_ordersConnection(ctx context.Context, field graphql.CollectedField, obj *vega.Market) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Market_ordersConnection(ctx, field) if err != nil { @@ -45984,6 +47101,8 @@ func (ec *executionContext) fieldContext_MarketData_market(ctx context.Context, return ec.fieldContext_Market_state(ctx, field) case "proposal": return ec.fieldContext_Market_proposal(ctx, field) + case "marketProposal": + return ec.fieldContext_Market_marketProposal(ctx, field) case "ordersConnection": return ec.fieldContext_Market_ordersConnection(ctx, field) case "accountsConnection": @@ -47955,6 +49074,8 @@ func (ec *executionContext) fieldContext_MarketDepth_market(ctx context.Context, return ec.fieldContext_Market_state(ctx, field) case "proposal": return ec.fieldContext_Market_proposal(ctx, field) + case "marketProposal": + return ec.fieldContext_Market_marketProposal(ctx, field) case "ordersConnection": return ec.fieldContext_Market_ordersConnection(ctx, field) case "accountsConnection": @@ -48404,6 +49525,8 @@ func (ec *executionContext) fieldContext_MarketDepthUpdate_market(ctx context.Co return ec.fieldContext_Market_state(ctx, field) case "proposal": return ec.fieldContext_Market_proposal(ctx, field) + case "marketProposal": + return ec.fieldContext_Market_marketProposal(ctx, field) case "ordersConnection": return ec.fieldContext_Market_ordersConnection(ctx, field) case "accountsConnection": @@ -48692,6 +49815,8 @@ func (ec *executionContext) fieldContext_MarketEdge_node(ctx context.Context, fi return ec.fieldContext_Market_state(ctx, field) case "proposal": return ec.fieldContext_Market_proposal(ctx, field) + case "marketProposal": + return ec.fieldContext_Market_marketProposal(ctx, field) case "ordersConnection": return ec.fieldContext_Market_ordersConnection(ctx, field) case "accountsConnection": @@ -57240,6 +58365,8 @@ func (ec *executionContext) fieldContext_Order_market(ctx context.Context, field return ec.fieldContext_Market_state(ctx, field) case "proposal": return ec.fieldContext_Market_proposal(ctx, field) + case "marketProposal": + return ec.fieldContext_Market_marketProposal(ctx, field) case "ordersConnection": return ec.fieldContext_Market_ordersConnection(ctx, field) case "accountsConnection": @@ -65209,6 +66336,8 @@ func (ec *executionContext) fieldContext_Position_market(ctx context.Context, fi return ec.fieldContext_Market_state(ctx, field) case "proposal": return ec.fieldContext_Market_proposal(ctx, field) + case "marketProposal": + return ec.fieldContext_Market_marketProposal(ctx, field) case "ordersConnection": return ec.fieldContext_Market_ordersConnection(ctx, field) case "accountsConnection": @@ -68032,6 +69161,47 @@ func (ec *executionContext) fieldContext_ProposalDetail_id(ctx context.Context, return fc, nil } +func (ec *executionContext) _ProposalDetail_batchId(ctx context.Context, field graphql.CollectedField, obj *vega.Proposal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ProposalDetail_batchId(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.BatchId, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOID2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ProposalDetail_batchId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ProposalDetail", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _ProposalDetail_reference(ctx context.Context, field graphql.CollectedField, obj *vega.Proposal) (ret graphql.Marshaler) { fc, err := ec.fieldContext_ProposalDetail_reference(ctx, field) if err != nil { @@ -68271,14 +69441,11 @@ func (ec *executionContext) _ProposalDetail_terms(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } res := resTmp.(*vega.ProposalTerms) fc.Result = res - return ec.marshalNProposalTerms2ᚖcodeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋvegaᚐProposalTerms(ctx, field.Selections, res) + return ec.marshalOProposalTerms2ᚖcodeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋvegaᚐProposalTerms(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_ProposalDetail_terms(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -68304,6 +69471,53 @@ func (ec *executionContext) fieldContext_ProposalDetail_terms(ctx context.Contex return fc, nil } +func (ec *executionContext) _ProposalDetail_batchTerms(ctx context.Context, field graphql.CollectedField, obj *vega.Proposal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ProposalDetail_batchTerms(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.BatchTerms, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*vega.BatchProposalTerms) + fc.Result = res + return ec.marshalOBatchProposalTerms2ᚖcodeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋvegaᚐBatchProposalTerms(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ProposalDetail_batchTerms(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ProposalDetail", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "closingDatetime": + return ec.fieldContext_BatchProposalTerms_closingDatetime(ctx, field) + case "changes": + return ec.fieldContext_BatchProposalTerms_changes(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type BatchProposalTerms", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _ProposalDetail_rationale(ctx context.Context, field graphql.CollectedField, obj *vega.Proposal) (ret graphql.Marshaler) { fc, err := ec.fieldContext_ProposalDetail_rationale(ctx, field) if err != nil { @@ -68680,6 +69894,47 @@ func (ec *executionContext) fieldContext_ProposalEdge_node(ctx context.Context, return fc, nil } +func (ec *executionContext) _ProposalEdge_proposalNode(ctx context.Context, field graphql.CollectedField, obj *v2.GovernanceDataEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ProposalEdge_proposalNode(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.ProposalEdge().ProposalNode(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(ProposalNode) + fc.Result = res + return ec.marshalOProposalNode2codeᚗvegaprotocolᚗioᚋvegaᚋdatanodeᚋgatewayᚋgraphqlᚐProposalNode(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ProposalEdge_proposalNode(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ProposalEdge", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ProposalNode does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _ProposalEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *v2.GovernanceDataEdge) (ret graphql.Marshaler) { fc, err := ec.fieldContext_ProposalEdge_cursor(ctx, field) if err != nil { @@ -69658,6 +70913,8 @@ func (ec *executionContext) fieldContext_ProposalsConnection_edges(ctx context.C switch field.Name { case "node": return ec.fieldContext_ProposalEdge_node(ctx, field) + case "proposalNode": + return ec.fieldContext_ProposalEdge_proposalNode(ctx, field) case "cursor": return ec.fieldContext_ProposalEdge_cursor(ctx, field) } @@ -72343,6 +73600,8 @@ func (ec *executionContext) fieldContext_Query_market(ctx context.Context, field return ec.fieldContext_Market_state(ctx, field) case "proposal": return ec.fieldContext_Market_proposal(ctx, field) + case "marketProposal": + return ec.fieldContext_Market_marketProposal(ctx, field) case "ordersConnection": return ec.fieldContext_Market_ordersConnection(ctx, field) case "accountsConnection": @@ -73728,9 +74987,9 @@ func (ec *executionContext) _Query_proposal(ctx context.Context, field graphql.C if resTmp == nil { return graphql.Null } - res := resTmp.(*vega.GovernanceData) + res := resTmp.(ProposalNode) fc.Result = res - return ec.marshalOProposal2ᚖcodeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋvegaᚐGovernanceData(ctx, field.Selections, res) + return ec.marshalOProposalNode2codeᚗvegaprotocolᚗioᚋvegaᚋdatanodeᚋgatewayᚋgraphqlᚐProposalNode(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Query_proposal(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -73740,37 +74999,7 @@ func (ec *executionContext) fieldContext_Query_proposal(ctx context.Context, fie IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Proposal_id(ctx, field) - case "reference": - return ec.fieldContext_Proposal_reference(ctx, field) - case "party": - return ec.fieldContext_Proposal_party(ctx, field) - case "state": - return ec.fieldContext_Proposal_state(ctx, field) - case "datetime": - return ec.fieldContext_Proposal_datetime(ctx, field) - case "rationale": - return ec.fieldContext_Proposal_rationale(ctx, field) - case "terms": - return ec.fieldContext_Proposal_terms(ctx, field) - case "votes": - return ec.fieldContext_Proposal_votes(ctx, field) - case "rejectionReason": - return ec.fieldContext_Proposal_rejectionReason(ctx, field) - case "errorDetails": - return ec.fieldContext_Proposal_errorDetails(ctx, field) - case "requiredMajority": - return ec.fieldContext_Proposal_requiredMajority(ctx, field) - case "requiredParticipation": - return ec.fieldContext_Proposal_requiredParticipation(ctx, field) - case "requiredLpMajority": - return ec.fieldContext_Proposal_requiredLpMajority(ctx, field) - case "requiredLpParticipation": - return ec.fieldContext_Proposal_requiredLpParticipation(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Proposal", field.Name) + return nil, errors.New("field of type ProposalNode does not have child fields") }, } defer func() { @@ -85097,6 +86326,8 @@ func (ec *executionContext) fieldContext_SuccessorMarket_market(ctx context.Cont return ec.fieldContext_Market_state(ctx, field) case "proposal": return ec.fieldContext_Market_proposal(ctx, field) + case "marketProposal": + return ec.fieldContext_Market_marketProposal(ctx, field) case "ordersConnection": return ec.fieldContext_Market_ordersConnection(ctx, field) case "accountsConnection": @@ -88475,6 +89706,8 @@ func (ec *executionContext) fieldContext_Trade_market(ctx context.Context, field return ec.fieldContext_Market_state(ctx, field) case "proposal": return ec.fieldContext_Market_proposal(ctx, field) + case "marketProposal": + return ec.fieldContext_Market_marketProposal(ctx, field) case "ordersConnection": return ec.fieldContext_Market_ordersConnection(ctx, field) case "accountsConnection": @@ -93436,6 +94669,8 @@ func (ec *executionContext) fieldContext_UpdateMarketState_market(ctx context.Co return ec.fieldContext_Market_state(ctx, field) case "proposal": return ec.fieldContext_Market_proposal(ctx, field) + case "marketProposal": + return ec.fieldContext_Market_marketProposal(ctx, field) case "ordersConnection": return ec.fieldContext_Market_ordersConnection(ctx, field) case "accountsConnection": @@ -99670,6 +100905,27 @@ func (ec *executionContext) _ProposalChange(ctx context.Context, sel ast.Selecti } } +func (ec *executionContext) _ProposalNode(ctx context.Context, sel ast.SelectionSet, obj ProposalNode) graphql.Marshaler { + switch obj := (obj).(type) { + case nil: + return graphql.Null + case *vega.GovernanceData: + if obj == nil { + return graphql.Null + } + return ec._Proposal(ctx, sel, obj) + case BatchProposal: + return ec._BatchProposal(ctx, sel, &obj) + case *BatchProposal: + if obj == nil { + return graphql.Null + } + return ec._BatchProposal(ctx, sel, obj) + default: + panic(fmt.Errorf("unexpected type %T", obj)) + } +} + func (ec *executionContext) _RiskModel(ctx context.Context, sel ast.SelectionSet, obj RiskModel) graphql.Marshaler { switch obj := (obj).(type) { case nil: @@ -101002,6 +102258,213 @@ func (ec *executionContext) _AuctionEvent(ctx context.Context, sel ast.Selection return out } +var batchProposalImplementors = []string{"BatchProposal", "ProposalNode"} + +func (ec *executionContext) _BatchProposal(ctx context.Context, sel ast.SelectionSet, obj *BatchProposal) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, batchProposalImplementors) + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("BatchProposal") + case "id": + + out.Values[i] = ec._BatchProposal_id(ctx, field, obj) + + case "reference": + + out.Values[i] = ec._BatchProposal_reference(ctx, field, obj) + + if out.Values[i] == graphql.Null { + invalids++ + } + case "party": + + out.Values[i] = ec._BatchProposal_party(ctx, field, obj) + + if out.Values[i] == graphql.Null { + invalids++ + } + case "state": + + out.Values[i] = ec._BatchProposal_state(ctx, field, obj) + + if out.Values[i] == graphql.Null { + invalids++ + } + case "datetime": + + out.Values[i] = ec._BatchProposal_datetime(ctx, field, obj) + + if out.Values[i] == graphql.Null { + invalids++ + } + case "rationale": + + out.Values[i] = ec._BatchProposal_rationale(ctx, field, obj) + + if out.Values[i] == graphql.Null { + invalids++ + } + case "votes": + + out.Values[i] = ec._BatchProposal_votes(ctx, field, obj) + + if out.Values[i] == graphql.Null { + invalids++ + } + case "rejectionReason": + + out.Values[i] = ec._BatchProposal_rejectionReason(ctx, field, obj) + + case "errorDetails": + + out.Values[i] = ec._BatchProposal_errorDetails(ctx, field, obj) + + case "requiredMajority": + + out.Values[i] = ec._BatchProposal_requiredMajority(ctx, field, obj) + + if out.Values[i] == graphql.Null { + invalids++ + } + case "requiredParticipation": + + out.Values[i] = ec._BatchProposal_requiredParticipation(ctx, field, obj) + + if out.Values[i] == graphql.Null { + invalids++ + } + case "requiredLpMajority": + + out.Values[i] = ec._BatchProposal_requiredLpMajority(ctx, field, obj) + + case "requiredLpParticipation": + + out.Values[i] = ec._BatchProposal_requiredLpParticipation(ctx, field, obj) + + case "subProposals": + + out.Values[i] = ec._BatchProposal_subProposals(ctx, field, obj) + + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var batchProposalTermsImplementors = []string{"BatchProposalTerms"} + +func (ec *executionContext) _BatchProposalTerms(ctx context.Context, sel ast.SelectionSet, obj *vega.BatchProposalTerms) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, batchProposalTermsImplementors) + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("BatchProposalTerms") + case "closingDatetime": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._BatchProposalTerms_closingDatetime(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + } + + out.Concurrently(i, func() graphql.Marshaler { + return innerFunc(ctx) + + }) + case "changes": + + out.Values[i] = ec._BatchProposalTerms_changes(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var batchProposalTermsChangeImplementors = []string{"BatchProposalTermsChange"} + +func (ec *executionContext) _BatchProposalTermsChange(ctx context.Context, sel ast.SelectionSet, obj *vega.BatchProposalTermsChange) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, batchProposalTermsChangeImplementors) + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("BatchProposalTermsChange") + case "enactmentDatetime": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._BatchProposalTermsChange_enactmentDatetime(ctx, field, obj) + return res + } + + out.Concurrently(i, func() graphql.Marshaler { + return innerFunc(ctx) + + }) + case "change": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._BatchProposalTermsChange_change(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + } + + out.Concurrently(i, func() graphql.Marshaler { + return innerFunc(ctx) + + }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + var benefitTierImplementors = []string{"BenefitTier"} func (ec *executionContext) _BenefitTier(ctx context.Context, sel ast.SelectionSet, obj *vega.BenefitTier) graphql.Marshaler { @@ -107764,6 +109227,23 @@ func (ec *executionContext) _Market(ctx context.Context, sel ast.SelectionSet, o return res } + out.Concurrently(i, func() graphql.Marshaler { + return innerFunc(ctx) + + }) + case "marketProposal": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Market_marketProposal(ctx, field, obj) + return res + } + out.Concurrently(i, func() graphql.Marshaler { return innerFunc(ctx) @@ -114543,7 +116023,7 @@ func (ec *executionContext) _PropertyKey(ctx context.Context, sel ast.SelectionS return out } -var proposalImplementors = []string{"Proposal"} +var proposalImplementors = []string{"Proposal", "ProposalNode"} func (ec *executionContext) _Proposal(ctx context.Context, sel ast.SelectionSet, obj *vega.GovernanceData) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, proposalImplementors) @@ -114843,6 +116323,10 @@ func (ec *executionContext) _ProposalDetail(ctx context.Context, sel ast.Selecti out.Values[i] = ec._ProposalDetail_id(ctx, field, obj) + case "batchId": + + out.Values[i] = ec._ProposalDetail_batchId(ctx, field, obj) + case "reference": out.Values[i] = ec._ProposalDetail_reference(ctx, field, obj) @@ -114901,9 +116385,10 @@ func (ec *executionContext) _ProposalDetail(ctx context.Context, sel ast.Selecti out.Values[i] = ec._ProposalDetail_terms(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&invalids, 1) - } + case "batchTerms": + + out.Values[i] = ec._ProposalDetail_batchTerms(ctx, field, obj) + case "rationale": out.Values[i] = ec._ProposalDetail_rationale(ctx, field, obj) @@ -115006,14 +116491,31 @@ func (ec *executionContext) _ProposalEdge(ctx context.Context, sel ast.Selection out.Values[i] = ec._ProposalEdge_node(ctx, field, obj) if out.Values[i] == graphql.Null { - invalids++ + atomic.AddUint32(&invalids, 1) + } + case "proposalNode": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ProposalEdge_proposalNode(ctx, field, obj) + return res } + + out.Concurrently(i, func() graphql.Marshaler { + return innerFunc(ctx) + + }) case "cursor": out.Values[i] = ec._ProposalEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { - invalids++ + atomic.AddUint32(&invalids, 1) } default: panic("unknown field " + strconv.Quote(field.Name)) @@ -124544,6 +126046,44 @@ func (ec *executionContext) marshalNAuctionTrigger2codeᚗvegaprotocolᚗioᚋve return res } +func (ec *executionContext) marshalNBatchProposalTermsChange2ᚕᚖcodeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋvegaᚐBatchProposalTermsChange(ctx context.Context, sel ast.SelectionSet, v []*vega.BatchProposalTermsChange) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOBatchProposalTermsChange2ᚖcodeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋvegaᚐBatchProposalTermsChange(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + func (ec *executionContext) marshalNBenefitTier2ᚕᚖcodeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋvegaᚐBenefitTierᚄ(ctx context.Context, sel ast.SelectionSet, v []*vega.BenefitTier) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup @@ -129719,6 +131259,20 @@ func (ec *executionContext) marshalOAuctionTrigger2codeᚗvegaprotocolᚗioᚋve return res } +func (ec *executionContext) marshalOBatchProposalTerms2ᚖcodeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋvegaᚐBatchProposalTerms(ctx context.Context, sel ast.SelectionSet, v *vega.BatchProposalTerms) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._BatchProposalTerms(ctx, sel, v) +} + +func (ec *executionContext) marshalOBatchProposalTermsChange2ᚖcodeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋvegaᚐBatchProposalTermsChange(ctx context.Context, sel ast.SelectionSet, v *vega.BatchProposalTermsChange) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._BatchProposalTermsChange(ctx, sel, v) +} + func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { res, err := graphql.UnmarshalBoolean(v) return res, graphql.ErrorOnPath(ctx, err) @@ -133569,6 +135123,13 @@ func (ec *executionContext) marshalOProposalEdge2ᚖcodeᚗvegaprotocolᚗioᚋv return ec._ProposalEdge(ctx, sel, v) } +func (ec *executionContext) marshalOProposalNode2codeᚗvegaprotocolᚗioᚋvegaᚋdatanodeᚋgatewayᚋgraphqlᚐProposalNode(ctx context.Context, sel ast.SelectionSet, v ProposalNode) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._ProposalNode(ctx, sel, v) +} + func (ec *executionContext) unmarshalOProposalRejectionReason2ᚖcodeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋvegaᚐProposalError(ctx context.Context, v interface{}) (*vega.ProposalError, error) { if v == nil { return nil, nil @@ -133601,6 +135162,13 @@ func (ec *executionContext) marshalOProposalState2ᚖcodeᚗvegaprotocolᚗioᚋ return res } +func (ec *executionContext) marshalOProposalTerms2ᚖcodeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋvegaᚐProposalTerms(ctx context.Context, sel ast.SelectionSet, v *vega.ProposalTerms) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._ProposalTerms(ctx, sel, v) +} + func (ec *executionContext) unmarshalOProposalType2ᚖcodeᚗvegaprotocolᚗioᚋvegaᚋprotosᚋdataᚑnodeᚋapiᚋv2ᚐListGovernanceDataRequest_Type(ctx context.Context, v interface{}) (*v2.ListGovernanceDataRequest_Type, error) { if v == nil { return nil, nil diff --git a/datanode/gateway/graphql/gqlgen.yml b/datanode/gateway/graphql/gqlgen.yml index a276f14a3b..9dbdfbb72c 100644 --- a/datanode/gateway/graphql/gqlgen.yml +++ b/datanode/gateway/graphql/gqlgen.yml @@ -279,6 +279,10 @@ models: model: code.vegaprotocol.io/vega/protos/vega.ProposalRationale ProposalTerms: model: code.vegaprotocol.io/vega/protos/vega.ProposalTerms + BatchProposalTerms: + model: code.vegaprotocol.io/vega/protos/vega.BatchProposalTerms + BatchProposalTermsChange: + model: code.vegaprotocol.io/vega/protos/vega.BatchProposalTermsChange ProposalDetail: model: code.vegaprotocol.io/vega/protos/vega.Proposal NewMarket: diff --git a/datanode/gateway/graphql/market_resolvers.go b/datanode/gateway/graphql/market_resolvers.go index 2ca1cf84ac..79048e856a 100644 --- a/datanode/gateway/graphql/market_resolvers.go +++ b/datanode/gateway/graphql/market_resolvers.go @@ -248,7 +248,7 @@ func (r *myMarketResolver) LiquidityMonitoringParameters(_ context.Context, obj }, nil } -func (r *myMarketResolver) Proposal(ctx context.Context, obj *types.Market) (*types.GovernanceData, error) { +func (r *myMarketResolver) MarketProposal(ctx context.Context, obj *types.Market) (ProposalNode, error) { resp, err := r.tradingDataClientV2.GetGovernanceData(ctx, &v2.GetGovernanceDataRequest{ ProposalId: &obj.Id, }) @@ -258,6 +258,26 @@ func (r *myMarketResolver) Proposal(ctx context.Context, obj *types.Market) (*ty if err != nil { return nil, nil //nolint:nilerr } + + resolver := (*proposalEdgeResolver)(r) + if resp.GetData().ProposalType == vega.GovernanceData_TYPE_BATCH { + return resolver.BatchProposal(ctx, resp.GetData()) + } + + return resp.Data, nil +} + +func (r *myMarketResolver) Proposal(ctx context.Context, obj *types.Market) (*vega.GovernanceData, error) { + resp, err := r.tradingDataClientV2.GetGovernanceData(ctx, &v2.GetGovernanceDataRequest{ + ProposalId: &obj.Id, + }) + // it's possible to not find a proposal as of now. + // some market are loaded at startup, without + // going through the proposal phase + if err != nil { + return nil, nil //nolint:nilerr + } + return resp.Data, nil } diff --git a/datanode/gateway/graphql/models.go b/datanode/gateway/graphql/models.go index ba25acde8e..33e85c8e65 100644 --- a/datanode/gateway/graphql/models.go +++ b/datanode/gateway/graphql/models.go @@ -62,6 +62,10 @@ type ProposalChange interface { IsProposalChange() } +type ProposalNode interface { + IsProposalNode() +} + type RiskModel interface { IsRiskModel() } @@ -113,6 +117,39 @@ type AuctionDuration struct { Volume int `json:"volume"` } +type BatchProposal struct { + // Proposal ID that is provided by Vega once proposal reaches the network + ID *string `json:"id"` + // A UUID reference to aid tracking proposals on Vega + Reference string `json:"reference"` + // Party that prepared the proposal + Party *vega.Party `json:"party"` + // State of the proposal + State vega.Proposal_State `json:"state"` + // RFC3339Nano time and date when the proposal reached the network + Datetime int64 `json:"datetime"` + // Rationale behind the proposal + Rationale *vega.ProposalRationale `json:"rationale"` + // Votes cast for this proposal + Votes *ProposalVotes `json:"votes"` + // Reason the proposal was rejected + RejectionReason *vega.ProposalError `json:"rejectionReason"` + // Details of the rejection reason + ErrorDetails *string `json:"errorDetails"` + // Required majority for this proposal to succeed + RequiredMajority string `json:"requiredMajority"` + // Required participation for this proposal to succeed + RequiredParticipation string `json:"requiredParticipation"` + // Equity-like share required for a market amendment proposal to be enacted, represented as a fraction that can be converted to a percentage. If not met, the proposal will not be enacted + RequiredLpMajority *string `json:"requiredLpMajority"` + // The market share of LPs' equity-like share that must take part in a market amendment vote for the proposal to pass. This means the votes of LPs that have submitted more liquidity to that market, or have been LPs from the start carry more weight. If it requires 50% of a market's equity-like share for a majority, and the full batch of proposals receives all YES votes but only LPs with 49% of the equity-like share voted, the proposal will not pass + RequiredLpParticipation *string `json:"requiredLpParticipation"` + // Proposals that are part of the batch + SubProposals []*vega.Proposal `json:"subProposals"` +} + +func (BatchProposal) IsProposalNode() {} + // A Vega builtin asset, mostly for testing purpose type BuiltinAsset struct { // Maximum amount that can be requested by a party through the built-in asset faucet at a time diff --git a/datanode/gateway/graphql/proposal_edge_resolver.go b/datanode/gateway/graphql/proposal_edge_resolver.go new file mode 100644 index 0000000000..d047cb7fae --- /dev/null +++ b/datanode/gateway/graphql/proposal_edge_resolver.go @@ -0,0 +1,83 @@ +// Copyright (C) 2023 Gobalsky Labs Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package gql + +import ( + "context" + + v2 "code.vegaprotocol.io/vega/protos/data-node/api/v2" + types "code.vegaprotocol.io/vega/protos/vega" + vega "code.vegaprotocol.io/vega/protos/vega" +) + +type proposalEdgeResolver VegaResolverRoot + +func (r *proposalEdgeResolver) ProposalNode(ctx context.Context, data *v2.GovernanceDataEdge) (ProposalNode, error) { + if data == nil || data.Node == nil || data.Node.Proposal == nil { + return nil, ErrInvalidProposal + } + + if data.GetNode().ProposalType == vega.GovernanceData_TYPE_BATCH { + return r.BatchProposal(ctx, data.Node) + } + + return data.Node, nil +} + +func (r *proposalEdgeResolver) Proposal(ctx context.Context, data *v2.GovernanceDataEdge) (*vega.GovernanceData, error) { + if data == nil || data.Node == nil || data.Node.Proposal == nil { + return nil, ErrInvalidProposal + } + + if data.GetNode().ProposalType == vega.GovernanceData_TYPE_BATCH { + return nil, nil + } + + return data.Node, nil +} + +func (r *proposalEdgeResolver) BatchProposal(ctx context.Context, data *types.GovernanceData) (ProposalNode, error) { + proposal := data.Proposal + + resolver := (*proposalResolver)(r) + + party, err := resolver.Party(ctx, data) + if err != nil { + return nil, err + } + + votes, err := resolver.Votes(ctx, data) + if err != nil { + return nil, err + } + + return BatchProposal{ + ID: &proposal.Id, + Reference: proposal.Reference, + Party: party, + State: proposal.State, + Datetime: proposal.Timestamp, + Rationale: proposal.Rationale, + Votes: votes, + RejectionReason: proposal.Reason, + ErrorDetails: proposal.ErrorDetails, + RequiredMajority: proposal.RequiredMajority, + RequiredParticipation: proposal.RequiredParticipation, + RequiredLpMajority: proposal.RequiredLiquidityProviderMajority, + RequiredLpParticipation: proposal.RequiredLiquidityProviderParticipation, + SubProposals: data.Proposals, + }, nil +} diff --git a/datanode/gateway/graphql/proposal_terms_resolver.go b/datanode/gateway/graphql/proposal_terms_resolver.go index a7fbe4faf5..1f107aaf81 100644 --- a/datanode/gateway/graphql/proposal_terms_resolver.go +++ b/datanode/gateway/graphql/proposal_terms_resolver.go @@ -22,10 +22,62 @@ import ( "code.vegaprotocol.io/vega/libs/ptr" types "code.vegaprotocol.io/vega/protos/vega" + vega "code.vegaprotocol.io/vega/protos/vega" ) var ErrUnsupportedProposalTermsChanges = errors.New("unsupported proposal terms changes") +type batchProposalTermsResolver VegaResolverRoot + +func (r *batchProposalTermsResolver) ClosingDatetime(ctx context.Context, obj *vega.BatchProposalTerms) (int64, error) { + // this is a unix timestamp (specified by users) + // needs to convert to time then UnixNano for the Timestamp resolver to work + return time.Unix(obj.ClosingTimestamp, 0).UnixNano(), nil +} + +type batchProposalTermsChangeResolver VegaResolverRoot + +func (r *batchProposalTermsChangeResolver) EnactmentDatetime(ctx context.Context, obj *vega.BatchProposalTermsChange) (*int64, error) { + var dt *int64 + if obj.EnactmentTimestamp != 0 { + // this is a unix timestamp (specified by users) + // needs to convert to time then UnixNano for the Timestamp resolver to work + dt = ptr.From(time.Unix(obj.EnactmentTimestamp, 0).UnixNano()) + } + return dt, nil +} + +func (r *batchProposalTermsChangeResolver) Change(ctx context.Context, obj *vega.BatchProposalTermsChange) (ProposalChange, error) { + switch obj.Change.(type) { + case *types.BatchProposalTermsChange_UpdateMarket: + return obj.GetUpdateMarket(), nil + case *types.BatchProposalTermsChange_UpdateNetworkParameter: + return obj.GetUpdateNetworkParameter(), nil + case *types.BatchProposalTermsChange_NewMarket: + return obj.GetNewMarket(), nil + case *types.BatchProposalTermsChange_NewFreeform: + return obj.GetNewFreeform(), nil + case *types.BatchProposalTermsChange_UpdateAsset: + return obj.GetUpdateAsset(), nil + case *types.BatchProposalTermsChange_CancelTransfer: + return obj.GetCancelTransfer(), nil + case *types.BatchProposalTermsChange_NewTransfer: + return obj.GetNewTransfer(), nil + case *types.BatchProposalTermsChange_NewSpotMarket: + return obj.GetNewSpotMarket(), nil + case *types.BatchProposalTermsChange_UpdateSpotMarket: + return obj.GetUpdateSpotMarket(), nil + case *types.BatchProposalTermsChange_UpdateMarketState: + return obj.GetUpdateMarketState(), nil + case *types.BatchProposalTermsChange_UpdateReferralProgram: + return obj.GetUpdateReferralProgram(), nil + case *types.BatchProposalTermsChange_UpdateVolumeDiscountProgram: + return obj.GetUpdateVolumeDiscountProgram(), nil + default: + return nil, ErrUnsupportedProposalTermsChanges + } +} + type proposalTermsResolver VegaResolverRoot func (r *proposalTermsResolver) ClosingDatetime(ctx context.Context, obj *types.ProposalTerms) (int64, error) { diff --git a/datanode/gateway/graphql/resolvers.go b/datanode/gateway/graphql/resolvers.go index cfccdc0329..524fb74a3d 100644 --- a/datanode/gateway/graphql/resolvers.go +++ b/datanode/gateway/graphql/resolvers.go @@ -191,6 +191,11 @@ func (r *VegaResolverRoot) Proposal() ProposalResolver { return (*proposalResolver)(r) } +// Proposal returns the proposal resolver. +func (r *VegaResolverRoot) ProposalEdge() ProposalEdgeResolver { + return (*proposalEdgeResolver)(r) +} + // ProposalDetail returns the Proposal detail resolver. func (r *VegaResolverRoot) ProposalDetail() ProposalDetailResolver { return (*proposalDetailResolver)(r) @@ -268,6 +273,14 @@ func (r *VegaResolverRoot) ProposalTerms() ProposalTermsResolver { return (*proposalTermsResolver)(r) } +func (r *VegaResolverRoot) BatchProposalTerms() BatchProposalTermsResolver { + return (*batchProposalTermsResolver)(r) +} + +func (r *VegaResolverRoot) BatchProposalTermsChange() BatchProposalTermsChangeResolver { + return (*batchProposalTermsChangeResolver)(r) +} + func (r *VegaResolverRoot) UpdateMarket() UpdateMarketResolver { return (*updateMarketResolver)(r) } @@ -1413,7 +1426,7 @@ func (r *myQueryResolver) ProposalsConnection(ctx context.Context, proposalType return handleProposalsRequest(ctx, r.tradingDataClientV2, nil, nil, proposalType, inState, pagination) } -func (r *myQueryResolver) Proposal(ctx context.Context, id *string, reference *string) (*vegapb.GovernanceData, error) { +func (r *myQueryResolver) Proposal(ctx context.Context, id *string, reference *string) (ProposalNode, error) { if id != nil { resp, err := r.tradingDataClientV2.GetGovernanceData(ctx, &v2.GetGovernanceDataRequest{ ProposalId: id, @@ -1421,6 +1434,12 @@ func (r *myQueryResolver) Proposal(ctx context.Context, id *string, reference *s if err != nil { return nil, err } + + resolver := (*proposalEdgeResolver)(r) + if resp.GetData().ProposalType == vega.GovernanceData_TYPE_BATCH { + return resolver.BatchProposal(ctx, resp.GetData()) + } + return resp.Data, nil } else if reference != nil { resp, err := r.tradingDataClientV2.GetGovernanceData(ctx, &v2.GetGovernanceDataRequest{ @@ -1429,6 +1448,12 @@ func (r *myQueryResolver) Proposal(ctx context.Context, id *string, reference *s if err != nil { return nil, err } + + resolver := (*proposalEdgeResolver)(r) + if resp.GetData().ProposalType == vega.GovernanceData_TYPE_BATCH { + return resolver.BatchProposal(ctx, resp.GetData()) + } + return resp.Data, nil } diff --git a/datanode/gateway/graphql/resolvers_test.go b/datanode/gateway/graphql/resolvers_test.go index 7aea438440..e79c58ae46 100644 --- a/datanode/gateway/graphql/resolvers_test.go +++ b/datanode/gateway/graphql/resolvers_test.go @@ -671,7 +671,6 @@ func TestNewResolverRoot_Proposals(t *testing.T) { ) var ( - p *protoTypes.GovernanceData terms *protoTypes.ProposalTerms newMarket *protoTypes.ProposalTerms_NewMarket asset *protoTypes.Asset @@ -679,7 +678,8 @@ func TestNewResolverRoot_Proposals(t *testing.T) { err error ) - p, err = root.Query().Proposal(ctx, &id, nil) + pn, err := root.Query().Proposal(ctx, &id, nil) + p := pn.(*protoTypes.GovernanceData) t.Run("Proposal terms should be for a new market", func(t *testing.T) { terms, err = root.Proposal().Terms(ctx, p) @@ -731,7 +731,6 @@ func TestNewResolverRoot_Proposals(t *testing.T) { ) var ( - p *protoTypes.GovernanceData terms *protoTypes.ProposalTerms newMarket *protoTypes.ProposalTerms_NewSpotMarket asset *protoTypes.Asset @@ -739,7 +738,8 @@ func TestNewResolverRoot_Proposals(t *testing.T) { err error ) - p, err = root.Query().Proposal(ctx, &id, nil) + pn, err := root.Query().Proposal(ctx, &id, nil) + p := pn.(*protoTypes.GovernanceData) t.Run("Proposal should be for a new spot market", func(t *testing.T) { terms, err = root.Proposal().Terms(ctx, p) @@ -810,7 +810,6 @@ func TestNewResolverRoot_Proposals(t *testing.T) { ) var ( - p *protoTypes.GovernanceData terms *protoTypes.ProposalTerms newMarket *protoTypes.ProposalTerms_NewMarket asset *protoTypes.Asset @@ -818,7 +817,8 @@ func TestNewResolverRoot_Proposals(t *testing.T) { err error ) - p, err = root.Query().Proposal(ctx, &id, nil) + pn, err := root.Query().Proposal(ctx, &id, nil) + p := pn.(*protoTypes.GovernanceData) t.Run("Proposal terms should be for a new market", func(t *testing.T) { terms, err = root.Proposal().Terms(ctx, p) @@ -870,14 +870,14 @@ func TestNewResolverRoot_Proposals(t *testing.T) { ) var ( - p *protoTypes.GovernanceData terms *protoTypes.ProposalTerms newMarket *protoTypes.ProposalTerms_UpdateMarket product *protoTypes.UpdateInstrumentConfiguration_Future err error ) - p, err = root.Query().Proposal(ctx, &id, nil) + pn, err := root.Query().Proposal(ctx, &id, nil) + p := pn.(*protoTypes.GovernanceData) t.Run("Proposal terms should be to update market", func(t *testing.T) { terms, err = root.Proposal().Terms(ctx, p) @@ -954,13 +954,13 @@ func TestNewResolverRoot_Proposals(t *testing.T) { ) var ( - p *protoTypes.GovernanceData terms *protoTypes.ProposalTerms newMarket *protoTypes.ProposalTerms_UpdateSpotMarket err error ) - p, err = root.Query().Proposal(ctx, &id, nil) + pn, err := root.Query().Proposal(ctx, &id, nil) + p := pn.(*protoTypes.GovernanceData) t.Run("Proposal should be to update a spot market", func(t *testing.T) { terms, err = root.Proposal().Terms(ctx, p) @@ -1019,14 +1019,14 @@ func TestNewResolverRoot_Proposals(t *testing.T) { ) var ( - p *protoTypes.GovernanceData terms *protoTypes.ProposalTerms newMarket *protoTypes.ProposalTerms_UpdateMarket product *protoTypes.UpdateInstrumentConfiguration_Perpetual err error ) - p, err = root.Query().Proposal(ctx, &id, nil) + pn, err := root.Query().Proposal(ctx, &id, nil) + p := pn.(*protoTypes.GovernanceData) t.Run("Proposal terms should be to update market", func(t *testing.T) { // Test the proposal resolver to make sure the terms and underlying changes are correct diff --git a/datanode/gateway/graphql/schema.graphql b/datanode/gateway/graphql/schema.graphql index 57cadad69b..e69583f1e4 100644 --- a/datanode/gateway/graphql/schema.graphql +++ b/datanode/gateway/graphql/schema.graphql @@ -127,9 +127,9 @@ type Subscription { "ID of the party from which you want trades updates" partyId: ID ): [TradeUpdate!] - @deprecated( - reason: "Use tradesStream instead as it allows for filtering multiple markets and/or parties at once" - ) + @deprecated( + reason: "Use tradesStream instead as it allows for filtering multiple markets and/or parties at once" + ) "Subscribe to the trades updates" tradesStream( @@ -230,10 +230,10 @@ type PerpetualData { "Time at which the funding period started" startTime: Timestamp! "The index price used for external VWAP calculation" - indexPrice: String! - "The methodology used to calculated index price for perps" + indexPrice: String! + "The methodology used to calculated index price for perps" indexPriceType: CompositePriceType! - "RFC3339Nano time indicating the next time index price will be calculated for perps where applicable" + "RFC3339Nano time indicating the next time index price will be calculated for perps where applicable" nextIndexPriceCalc: String! } @@ -632,7 +632,7 @@ type Query { "Type of the order" type: OrderType! ): OrderEstimate! - @deprecated(reason: "Use estimateFees and estimatePosition instead") + @deprecated(reason: "Use estimateFees and estimatePosition instead") "Return an estimation of the potential cost for a new order" estimateFees( @@ -922,7 +922,6 @@ type Query { pagination: Pagination ): OrderConnection - "List statistics about paid liquidity fees" paidLiquidityFees( "Optional market ID to filter for." @@ -955,7 +954,7 @@ type Query { id: ID "Optionally, locate proposal by its reference. If ID is set, this parameter is ignored." reference: String - ): Proposal + ): ProposalNode "All governance proposals in the Vega network" proposalsConnection( @@ -1248,7 +1247,7 @@ type Transfer { } union TransferKind = - OneOffTransfer + OneOffTransfer | RecurringTransfer | OneOffGovernanceTransfer | RecurringGovernanceTransfer @@ -2424,7 +2423,10 @@ type Market { state: MarketState! "The proposal that initiated this market" - proposal: Proposal + proposal: Proposal @deprecated(reason: "Use marketProposal") + + "The proposal that initiated this market" + marketProposal: ProposalNode "Orders on a market" ordersConnection( @@ -2448,9 +2450,9 @@ type Market { "Pagination information" pagination: Pagination ): TradeConnection - @deprecated( - reason: "Simplify and consolidate trades query and remove nesting. Use trades query instead" - ) + @deprecated( + reason: "Simplify and consolidate trades query and remove nesting. Use trades query instead" + ) "Current depth on the order book for this market" depth( @@ -2492,7 +2494,7 @@ type Market { "Pagination information" pagination: Pagination ): LiquidityProvisionsConnection - @deprecated(reason: "Use liquidityProvisions instead") + @deprecated(reason: "Use liquidityProvisions instead") "Timestamps for state changes in the market" marketTimestamps: MarketTimestamps! @@ -2505,7 +2507,7 @@ type Market { "Quadratic slippage factor is used to cap the slippage component of maintainence margin - it is applied to the square of the slippage volume" quadraticSlippageFactor: String! - @deprecated(reason: "This field will be removed in a future release") + @deprecated(reason: "This field will be removed in a future release") """ Optional: Parent market ID. A market can be a successor to another market. If this market is a successor to a previous market, @@ -2683,9 +2685,9 @@ type Party { "Pagination information" pagination: Pagination ): TradeConnection - @deprecated( - reason: "Simplify and consolidate trades query and remove nesting. Use trades query instead" - ) + @deprecated( + reason: "Simplify and consolidate trades query and remove nesting. Use trades query instead" + ) "Collateral accounts relating to a party" accountsConnection( @@ -2701,7 +2703,7 @@ type Party { "Trading positions relating to a party" positionsConnection(market: ID, pagination: Pagination): PositionConnection - @deprecated(reason: "Use root positions query instead of sub-query") + @deprecated(reason: "Use root positions query instead of sub-query") "Margin levels for a market" marginsConnection( @@ -2766,7 +2768,7 @@ type Party { "Optional Pagination information" pagination: Pagination ): LiquidityProvisionsConnection - @deprecated(reason: "Use liquidityProvisions instead") + @deprecated(reason: "Use liquidityProvisions instead") # All delegations for a party to a given node if node is specified, or all delegations if not delegationsConnection( @@ -3105,9 +3107,9 @@ type Order { dateRange: DateRange pagination: Pagination ): TradeConnection - @deprecated( - reason: "Simplify and consolidate trades query and remove nesting. Use trades query instead" - ) + @deprecated( + reason: "Simplify and consolidate trades query and remove nesting. Use trades query instead" + ) "The order type" type: OrderType @@ -4508,7 +4510,7 @@ type NewMarket { linearSlippageFactor: String! "Quadratic slippage factor is used to cap the slippage component of maintenance margin - it is applied to the square of the slippage volume" quadraticSlippageFactor: String! - @deprecated(reason: "This field will be removed in a future release") + @deprecated(reason: "This field will be removed in a future release") "Successor market configuration. If this proposed market is meant to succeed a given market, then this needs to be set." successorConfiguration: SuccessorConfiguration "Liquidity SLA Parameters" @@ -4567,7 +4569,7 @@ type UpdateMarketConfiguration { linearSlippageFactor: String! "Quadratic slippage factor is used to cap the slippage component of maintenance margin - it is applied to the square of the slippage volume." quadraticSlippageFactor: String! - @deprecated(reason: "This field will be removed in a future release") + @deprecated(reason: "This field will be removed in a future release") "Liquidity SLA Parameters." liquiditySLAParameters: LiquiditySLAParameters "Specifies how the liquidity fee for the market will be calculated" @@ -4619,7 +4621,7 @@ type UpdatePerpetualProduct { } union UpdateMarketRiskParameters = - UpdateMarketSimpleRiskModel + UpdateMarketSimpleRiskModel | UpdateMarketLogNormalRiskModel type UpdateMarketSimpleRiskModel { @@ -4700,7 +4702,7 @@ type NewTransfer { } union GovernanceTransferKind = - OneOffGovernanceTransfer + OneOffGovernanceTransfer | RecurringGovernanceTransfer "Allows for cancellation of an existing governance transfer" @@ -4861,7 +4863,7 @@ type NetworkParameter { } union ProposalChange = - NewMarket + NewMarket | UpdateMarket | UpdateNetworkParameter | NewAsset @@ -4913,6 +4915,30 @@ type ProposalTerms { change: ProposalChange! } +"Terms for a batch governance proposal" +type BatchProposalTermsChange { + """ + RFC3339Nano time and date when this proposal will be executed, if it passes. + Constrained by "minEnactInSeconds" and "maxEnactInSeconds" network parameters. + """ + enactmentDatetime: Timestamp + + "Actual change being introduced by the proposal - action the proposal triggers if passed and enacted." + change: ProposalChange! +} + +"The rationale for the proposal" +type BatchProposalTerms { + """ + RFC3339Nano time and date when voting closes for this proposal. + Constrained by "minClose" and "maxClose" network parameters. + """ + closingDatetime: Timestamp! + + "Actual changes being introduced by the proposal - actions the proposal triggers if passed and enacted." + changes: [BatchProposalTermsChange]! +} + """ Various proposal types that are supported by Vega """ @@ -5000,9 +5026,42 @@ type Proposal { requiredLpParticipation: String } +type BatchProposal { + "Proposal ID that is provided by Vega once proposal reaches the network" + id: ID + "A UUID reference to aid tracking proposals on Vega" + reference: String! + "Party that prepared the proposal" + party: Party! + "State of the proposal" + state: ProposalState! + "RFC3339Nano time and date when the proposal reached the network" + datetime: Timestamp! + "Rationale behind the proposal" + rationale: ProposalRationale! + "Votes cast for this proposal" + votes: ProposalVotes! + "Reason the proposal was rejected" + rejectionReason: ProposalRejectionReason + "Details of the rejection reason" + errorDetails: String + "Required majority for this proposal to succeed" + requiredMajority: String! + "Required participation for this proposal to succeed" + requiredParticipation: String! + "Equity-like share required for a market amendment proposal to be enacted, represented as a fraction that can be converted to a percentage. If not met, the proposal will not be enacted" + requiredLpMajority: String + "The market share of LPs' equity-like share that must take part in a market amendment vote for the proposal to pass. This means the votes of LPs that have submitted more liquidity to that market, or have been LPs from the start carry more weight. If it requires 50% of a market's equity-like share for a majority, and the full batch of proposals receives all YES votes but only LPs with 49% of the equity-like share voted, the proposal will not pass" + requiredLpParticipation: String + "Proposals that are part of the batch" + subProposals: [ProposalDetail] +} + type ProposalDetail { "Proposal ID that is provided by Vega once proposal reaches the network" id: ID + "Batch proposal ID that is provided by Vega once proposal reaches the network" + batchId: ID "A UUID reference to aid tracking proposals on Vega" reference: String! "Party that prepared the proposal" @@ -5011,8 +5070,10 @@ type ProposalDetail { state: ProposalState! "RFC3339Nano time and date when the proposal reached the Vega network" datetime: Timestamp! - "Terms of the proposal" - terms: ProposalTerms! + "Terms of the proposal for proposal" + terms: ProposalTerms + "Terms of the proposal for a batch proposal" + batchTerms: BatchProposalTerms "Rationale behind the proposal" rationale: ProposalRationale! "Why the proposal was rejected by the core" @@ -5966,10 +6027,14 @@ enum TransferDirection { ToOrFrom } +union ProposalNode = Proposal | BatchProposal + "Edge type containing the proposals and cursor information returned by a ProposalsConnection" type ProposalEdge { "The proposal data" - node: Proposal! + node: Proposal! @deprecated(reason: "Use proposalNode") + "The data of either single or batch proposal" + proposalNode: ProposalNode "Cursor identifying the proposal" cursor: String! } @@ -6243,7 +6308,7 @@ type DataSourceSpecConfigurationTimeTrigger { } union InternalDataSourceKind = - DataSourceSpecConfigurationTime + DataSourceSpecConfigurationTime | DataSourceSpecConfigurationTimeTrigger """ @@ -6265,7 +6330,7 @@ type DataSourceDefinitionExternal { } union DataSourceKind = - DataSourceDefinitionInternal + DataSourceDefinitionInternal | DataSourceDefinitionExternal """ @@ -6967,7 +7032,7 @@ type GamesConnection { } "Connection type for retrieving cursor-based paginated party margin modes information" -type PartyMarginModesConnection { +type PartyMarginModesConnection { "The party margin modes" edges: [PartyMarginModeEdge] "The pagination information" @@ -6981,7 +7046,7 @@ type PartyMarginModeEdge { } "Margin mode selected for the given party and market." -type PartyMarginMode{ +type PartyMarginMode { "Unique ID of the market." marketId: ID! "Unique ID of the party." diff --git a/protos/vega/governance.go b/protos/vega/governance.go index 300bedbc9e..d3bed7b669 100644 --- a/protos/vega/governance.go +++ b/protos/vega/governance.go @@ -4,3 +4,5 @@ type ( ProposalOneOffTermChangeType = isProposalTerms_Change ProposalOneOffTermBatchChangeType = isBatchProposalTermsChange_Change ) + +func (gd *GovernanceData) IsProposalNode() {}