code.vegaprotocol.io/vega@v0.79.0/datanode/entities/fees_stats.go (about) 1 // Copyright (C) 2023 Gobalsky Labs Limited 2 // 3 // This program is free software: you can redistribute it and/or modify 4 // it under the terms of the GNU Affero General Public License as 5 // published by the Free Software Foundation, either version 3 of the 6 // License, or (at your option) any later version. 7 // 8 // This program is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU Affero General Public License for more details. 12 // 13 // You should have received a copy of the GNU Affero General Public License 14 // along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16 package entities 17 18 import ( 19 "time" 20 21 eventspb "code.vegaprotocol.io/vega/protos/vega/events/v1" 22 ) 23 24 type FeesStats struct { 25 MarketID MarketID 26 AssetID AssetID 27 EpochSeq uint64 28 TotalRewardsReceived []*eventspb.PartyAmount 29 ReferrerRewardsGenerated []*eventspb.ReferrerRewardsGenerated 30 RefereesDiscountApplied []*eventspb.PartyAmount 31 VolumeDiscountApplied []*eventspb.PartyAmount 32 TotalMakerFeesReceived []*eventspb.PartyAmount 33 MakerFeesGenerated []*eventspb.MakerFeesGenerated 34 VegaTime time.Time 35 } 36 37 func FeesStatsFromProto(proto *eventspb.FeesStats, vegaTime time.Time) *FeesStats { 38 return &FeesStats{ 39 MarketID: MarketID(proto.Market), 40 AssetID: AssetID(proto.Asset), 41 EpochSeq: proto.EpochSeq, 42 TotalRewardsReceived: proto.TotalRewardsReceived, 43 ReferrerRewardsGenerated: proto.ReferrerRewardsGenerated, 44 RefereesDiscountApplied: proto.RefereesDiscountApplied, 45 VolumeDiscountApplied: proto.VolumeDiscountApplied, 46 TotalMakerFeesReceived: proto.TotalMakerFeesReceived, 47 MakerFeesGenerated: proto.MakerFeesGenerated, 48 VegaTime: vegaTime, 49 } 50 } 51 52 func (stats *FeesStats) ToProto() *eventspb.FeesStats { 53 return &eventspb.FeesStats{ 54 Market: stats.MarketID.String(), 55 Asset: stats.AssetID.String(), 56 EpochSeq: stats.EpochSeq, 57 TotalRewardsReceived: stats.TotalRewardsReceived, 58 ReferrerRewardsGenerated: stats.ReferrerRewardsGenerated, 59 RefereesDiscountApplied: stats.RefereesDiscountApplied, 60 VolumeDiscountApplied: stats.VolumeDiscountApplied, 61 TotalMakerFeesReceived: stats.TotalMakerFeesReceived, 62 MakerFeesGenerated: stats.MakerFeesGenerated, 63 } 64 } 65 66 type FeesStatsForParty struct { 67 AssetID AssetID 68 TotalRewardsReceived string 69 RefereesDiscountApplied string 70 VolumeDiscountApplied string 71 TotalMakerFeesReceived string 72 }