code.vegaprotocol.io/vega@v0.79.0/datanode/gateway/graphql/proposal_detail_resolver.go (about) 1 // Copyright (C) 2023 Gobalsky Labs Limited 2 // 3 // This program is free software: you can redistribute it and/or modify 4 // it under the terms of the GNU Affero General Public License as 5 // published by the Free Software Foundation, either version 3 of the 6 // License, or (at your option) any later version. 7 // 8 // This program is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU Affero General Public License for more details. 12 // 13 // You should have received a copy of the GNU Affero General Public License 14 // along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16 package gql 17 18 import ( 19 "context" 20 21 types "code.vegaprotocol.io/vega/protos/vega" 22 vega "code.vegaprotocol.io/vega/protos/vega" 23 ) 24 25 type proposalDetailResolver VegaResolverRoot 26 27 func (r *proposalDetailResolver) Party(ctx context.Context, obj *vega.Proposal) (*vega.Party, error) { 28 p, err := getParty(ctx, r.log, r.tradingDataClientV2, obj.PartyId) 29 if p == nil && err == nil { 30 // the api could return an nil party in some cases 31 // e.g: when a party does not exists in the stores 32 // this is not an error, but here we are not checking 33 // if a party exists or not, but what party did propose 34 p = &types.Party{Id: obj.PartyId} 35 } 36 return p, err 37 } 38 39 func (r *proposalDetailResolver) Datetime(ctx context.Context, obj *vega.Proposal) (int64, error) { 40 return obj.Timestamp, nil 41 } 42 43 func (r *proposalDetailResolver) RejectionReason(ctx context.Context, obj *vega.Proposal) (*vega.ProposalError, error) { 44 return obj.Reason, nil 45 } 46 47 func (r *proposalDetailResolver) RequiredLpMajority(ctx context.Context, obj *vega.Proposal) (*string, error) { 48 return obj.RequiredLiquidityProviderMajority, nil 49 } 50 51 func (r *proposalDetailResolver) RequiredLpParticipation(ctx context.Context, obj *vega.Proposal) (*string, error) { 52 return obj.RequiredLiquidityProviderParticipation, nil 53 }