code.vegaprotocol.io/vega@v0.79.0/core/events/margin_mode.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 events 17 18 import ( 19 "context" 20 21 eventspb "code.vegaprotocol.io/vega/protos/vega/events/v1" 22 ) 23 24 type PartyMarginModeUpdated struct { 25 *Base 26 update *eventspb.PartyMarginModeUpdated 27 } 28 29 func (e PartyMarginModeUpdated) Proto() eventspb.PartyMarginModeUpdated { 30 return *e.update 31 } 32 33 func (e *PartyMarginModeUpdated) PartyMarginModeUpdated() *eventspb.PartyMarginModeUpdated { 34 return e.update 35 } 36 37 func (e PartyMarginModeUpdated) StreamMessage() *eventspb.BusEvent { 38 busEvent := newBusEventFromBase(e.Base) 39 busEvent.Event = &eventspb.BusEvent_PartyMarginModeUpdated{ 40 PartyMarginModeUpdated: e.update, 41 } 42 43 return busEvent 44 } 45 46 func NewPartyMarginModeUpdatedEvent(ctx context.Context, update *eventspb.PartyMarginModeUpdated) *PartyMarginModeUpdated { 47 e := &PartyMarginModeUpdated{ 48 Base: newBase(ctx, PartyMarginModeUpdatedEvent), 49 update: update, 50 } 51 return e 52 } 53 54 func PartyMarginModeUpdatedEventFromStream(ctx context.Context, be *eventspb.BusEvent) *PartyMarginModeUpdated { 55 e := &PartyMarginModeUpdated{ 56 Base: newBaseFromBusEvent(ctx, PartyMarginModeUpdatedEvent, be), 57 update: be.GetPartyMarginModeUpdated(), 58 } 59 return e 60 }