diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml index 27b5586..56188ca 100644 --- a/.github/workflows/actions.yaml +++ b/.github/workflows/actions.yaml @@ -10,7 +10,7 @@ jobs: - run: go mod download - run: go build ./cmd/cosmos-exporter - run: go build ./cmd/kuji-cosmos-exporter -# - run: go build ./cmd/sei-cosmos-exporter + - run: go build ./cmd/sei-cosmos-exporter - run: go build ./cmd/inj-cosmos-exporter go-vet: runs-on: ubuntu-latest diff --git a/.golangci.yml b/.golangci.yml index 1024e07..f42de34 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -59,7 +59,7 @@ linters-settings: - prefix(github.com/cosmos/cosmos-sdk) - prefix(github.com/cometbft/cometbft) - prefix(github.com/cosmos/ibc-go) - - prefix(github.com/solarlabsteam/cosmos-exporter) + - prefix(github.com/pfc-developer/cosmos-exporter) custom-order: true revive: enable-all-rules: true diff --git a/.goreleaser.yml b/.goreleaser.yml index 6ed5a8f..c1ab4d6 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -33,15 +33,15 @@ builds: - linux - windows - darwin -# - main: ./cmd/sei-cosmos-exporter -# id: "sei-cosmos-exporter" -# binary: "sei-cosmos-exporter" -# env: -# - CGO_ENABLED=0 -# goos: -# - linux -# - windows -# - darwin + - main: ./cmd/sei-cosmos-exporter + id: "sei-cosmos-exporter" + binary: "sei-cosmos-exporter" + env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin - main: ./cmd/inj-cosmos-exporter id: "inj-cosmos-exporter" binary: "inj-cosmos-exporter" diff --git a/cmd/cosmos-exporter/main.go b/cmd/cosmos-exporter/main.go index 3fae1d0..8f862af 100644 --- a/cmd/cosmos-exporter/main.go +++ b/cmd/cosmos-exporter/main.go @@ -5,13 +5,14 @@ import ( "net/http" "os" - "github.com/pfc-developer/cosmos-exporter/pkg/exporter" "github.com/rs/zerolog" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/spf13/viper" sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pfc-developer/cosmos-exporter/pkg/exporter" ) var ( diff --git a/cmd/inj-cosmos-exporter/Injective.go b/cmd/inj-cosmos-exporter/Injective.go index ced56c6..9e4a1a2 100644 --- a/cmd/inj-cosmos-exporter/Injective.go +++ b/cmd/inj-cosmos-exporter/Injective.go @@ -16,7 +16,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/solarlabsteam/cosmos-exporter/pkg/exporter" + "github.com/pfc-developer/cosmos-exporter/pkg/exporter" ) /* diff --git a/cmd/inj-cosmos-exporter/main.go b/cmd/inj-cosmos-exporter/main.go index 4e4b2fb..46e50e3 100644 --- a/cmd/inj-cosmos-exporter/main.go +++ b/cmd/inj-cosmos-exporter/main.go @@ -12,7 +12,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/solarlabsteam/cosmos-exporter/pkg/exporter" + "github.com/pfc-developer/cosmos-exporter/pkg/exporter" ) var ( diff --git a/cmd/inj-cosmos-exporter/single.go b/cmd/inj-cosmos-exporter/single.go index d13a450..00de906 100644 --- a/cmd/inj-cosmos-exporter/single.go +++ b/cmd/inj-cosmos-exporter/single.go @@ -11,7 +11,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/solarlabsteam/cosmos-exporter/pkg/exporter" + "github.com/pfc-developer/cosmos-exporter/pkg/exporter" ) func InjSingleHandler(w http.ResponseWriter, r *http.Request, s *exporter.Service) { diff --git a/cmd/kuji-cosmos-exporter/kuji.go b/cmd/kuji-cosmos-exporter/kuji.go index 99c0194..c5a98b1 100644 --- a/cmd/kuji-cosmos-exporter/kuji.go +++ b/cmd/kuji-cosmos-exporter/kuji.go @@ -9,12 +9,13 @@ import ( oracletypes "github.com/Team-Kujira/core/x/oracle/types" "github.com/google/uuid" - "github.com/pfc-developer/cosmos-exporter/pkg/exporter" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/rs/zerolog" sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pfc-developer/cosmos-exporter/pkg/exporter" ) /* diff --git a/cmd/kuji-cosmos-exporter/main.go b/cmd/kuji-cosmos-exporter/main.go index 8c6ceb0..39ad7b2 100644 --- a/cmd/kuji-cosmos-exporter/main.go +++ b/cmd/kuji-cosmos-exporter/main.go @@ -5,13 +5,14 @@ import ( "net/http" "os" - "github.com/pfc-developer/cosmos-exporter/pkg/exporter" "github.com/rs/zerolog" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/spf13/viper" sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pfc-developer/cosmos-exporter/pkg/exporter" ) var ( diff --git a/cmd/kuji-cosmos-exporter/single.go b/cmd/kuji-cosmos-exporter/single.go index e94511c..d9526b5 100644 --- a/cmd/kuji-cosmos-exporter/single.go +++ b/cmd/kuji-cosmos-exporter/single.go @@ -6,11 +6,12 @@ import ( "time" "github.com/google/uuid" - "github.com/pfc-developer/cosmos-exporter/pkg/exporter" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pfc-developer/cosmos-exporter/pkg/exporter" ) func KujiSingleHandler(w http.ResponseWriter, r *http.Request, s *exporter.Service) { diff --git a/cmd/sei-cosmos-exporter/events.go.X b/cmd/sei-cosmos-exporter/events.go.X new file mode 100644 index 0000000..c93b103 --- /dev/null +++ b/cmd/sei-cosmos-exporter/events.go.X @@ -0,0 +1,184 @@ +package main + +import ( + "context" + "fmt" + "main/pkg/exporter" + "net/http" + "regexp" + "strconv" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/google/uuid" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" + "github.com/rs/zerolog" + tmrpcclient "github.com/tendermint/tendermint/rpc/client" + //tmrpceventstream "github.com/tendermint/tendermint/rpc/client/eventstream" + rpchttp "github.com/tendermint/tendermint/rpc/client/http" + //"github.com/tendermint/tendermint/rpc/coretypes" + tmjsonclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" + tmtypes "github.com/tendermint/tendermint/types" +) + +var ( + queryEventBankTransfer = fmt.Sprintf( + "%s='%s' AND %s='%s'", + tmtypes.EventTypeKey, + tmtypes.EventTxValue, + "message.action", + "/cosmos.bank.v1beta1.MsgSend", + ) +) + +type EventCollector struct { + rpcClient tmrpcclient.Client + logger zerolog.Logger + gauge *prometheus.GaugeVec + BankTransferThreshold float64 +} + +func NewEventCollector(tmRPC string, logger zerolog.Logger, bankTransferThreshold float64, config *exporter.ServiceConfig) (*EventCollector, error) { + httpClient, err := tmjsonclient.DefaultHTTPClient(tmRPC) + if err != nil { + return nil, err + } + // no timeout because we will continue fetching events continuously + rpcClient, err := rpchttp.NewWithClient(tmRPC, "/", httpClient) + if err != nil { + return nil, err + } + transfersValueGauge := prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Name: "cosmos_bank_transfer_amount", + Help: "Number of tokens transferred in a transfer message", + ConstLabels: config.ConstLabels, + }, + []string{"denom", "sender", "recipient"}, + ) + return &EventCollector{ + rpcClient: rpcClient, + logger: logger, + gauge: transfersValueGauge, + BankTransferThreshold: bankTransferThreshold, + }, nil +} + +func (s EventCollector) Start( + ctx context.Context, +) error { + if err := s.rpcClient.Start( /*ctx*/ ); err != nil { + return err + } + s.logger.Info().Msg("Starting StreamCollector") + go s.RunBankTransferEventStream(ctx) + + return nil +} + +func (s EventCollector) RunBankTransferEventStream(ctx context.Context) { + eventStream := tmrpceventstream.New(s.rpcClient, queryEventBankTransfer, &tmrpceventstream.StreamOptions{ + WaitTime: 300 * time.Millisecond, + }) + streamEventErr := make(chan error, 1) + go func() { + streamEventErr <- eventStream.Run(ctx, s.HandleBankTransferEvent) + }() + for { + // try recovering forever if only missed items errors + err := <-streamEventErr + if _, ok := err.(*tmrpceventstream.MissedItemsError); ok { + //fallen behind, restart + s.logger.Err(err).Msg("Error in eventstream") + // reset + run again + eventStream.Reset() + go func() { + streamEventErr <- eventStream.Run(ctx, s.HandleBankTransferEvent) + }() + } else { + panic(err) // panic so we trigger `up` alerting + } + } +} + +func (s EventCollector) HandleBankTransferEvent(eventItem *coretypes.EventItem) error { + eventData, err := tmtypes.TryUnmarshalEventData(eventItem.Data) + if err != nil { + s.logger.Err(err).Msg("Failed to unmarshal event data") + return nil + } + eventDataTx, ok := eventData.(tmtypes.EventDataTx) + if !ok { + s.logger.Err(err).Msg("Failed to parse event from eventDataNewBlockHeader") + return nil + } else { + events := eventDataTx.Result.Events + for _, event := range events { + if event.Type == banktypes.EventTypeTransfer { + // check the balance + var amount float64 + var denom string + var sender string + var recipient string + for _, attr := range event.Attributes { + attrKey := string(attr.Key) + switch attrKey { + case sdk.AttributeKeyAmount: + amountStr := string(attr.Value) + // separate the denom + re := regexp.MustCompile(`\d+|\D+`) + res := re.FindAllString(amountStr, -1) + + denom = res[1] + amount, err = strconv.ParseFloat(res[0], 64) + if err != nil { + s.logger.Err(err).Msg("") + } + case banktypes.AttributeKeyRecipient: + recipient = string(attr.Value) + case banktypes.AttributeKeySender: + sender = string(attr.Value) + } + } + if amount > s.BankTransferThreshold { + s.gauge.With(prometheus.Labels{ + "denom": denom, + "sender": sender, + "recipient": recipient, + }).Set(amount) + // Expire the metrics after 5 minutes + go func() { + time.Sleep(5 * time.Minute) + s.gauge.Delete(prometheus.Labels{ + "denom": denom, + "sender": sender, + "recipient": recipient, + }) + }() + } + } + } + } + return nil +} + +func (s EventCollector) StreamHandler(w http.ResponseWriter, r *http.Request) { + requestStart := time.Now() + + sublogger := log.With(). + Str("request-id", uuid.New().String()). + Logger() + + registry := prometheus.NewRegistry() + registry.MustRegister(s.gauge) + + h := promhttp.HandlerFor(registry, promhttp.HandlerOpts{}) + h.ServeHTTP(w, r) + sublogger.Info(). + Str("method", "GET"). + Str("endpoint", "/metrics/event"). + Float64("request-time", time.Since(requestStart).Seconds()). + Msg("Request processed") +} diff --git a/cmd/sei-cosmos-exporter/main.go b/cmd/sei-cosmos-exporter/main.go new file mode 100644 index 0000000..b63019e --- /dev/null +++ b/cmd/sei-cosmos-exporter/main.go @@ -0,0 +1,151 @@ +package main + +import ( + "fmt" + "net/http" + "os" + + "github.com/rs/zerolog" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + "github.com/spf13/viper" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pfc-developer/cosmos-exporter/pkg/exporter" +) + +var ( + config exporter.ServiceConfig + log = zerolog.New(zerolog.ConsoleWriter{Out: os.Stdout}).With().Timestamp().Logger() +) + +var rootCmd = &cobra.Command{ + Use: "sei-cosmos-exporter", + Long: "Scrape the data about the validators set, specific validators or wallets in the Cosmos network.", + PersistentPreRunE: func(cmd *cobra.Command, args []string) error { + if config.ConfigPath == "" { + config.SetBechPrefixes(cmd) + + return nil + } + + viper.SetConfigFile(config.ConfigPath) + if err := viper.ReadInConfig(); err != nil { + if _, ok := err.(viper.ConfigFileNotFoundError); !ok { + log.Info().Err(err).Msg("Error reading config file") + return err + } + } + + // Credits to https://carolynvanslyck.com/blog/2020/08/sting-of-the-viper/ + cmd.Flags().VisitAll(func(f *pflag.Flag) { + if !f.Changed && viper.IsSet(f.Name) { + val := viper.Get(f.Name) + if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil { + log.Fatal().Err(err).Msg("Could not set flag") + } + } + }) + config.SetBechPrefixes(cmd) + + return nil + }, + Run: Execute, +} + +func Execute(_ *cobra.Command, _ []string) { + logLevel, err := zerolog.ParseLevel(config.LogLevel) + if err != nil { + log.Fatal().Err(err).Msg("Could not parse log level") + } + + if config.JSONOutput { + log = zerolog.New(os.Stdout).With().Timestamp().Logger() + } + + zerolog.SetGlobalLevel(logLevel) + config.LogConfig(log.Info()). + Str("--oracle", fmt.Sprintf("%t", config.Oracle)). + // Float64("bank-transfer-threshold", config.BankTransferThreshold). + Msg("Started with following parameters") + + sdkconfig := sdk.GetConfig() + sdkconfig.SetBech32PrefixForAccount(config.AccountPrefix, config.AccountPubkeyPrefix) + sdkconfig.SetBech32PrefixForValidator(config.ValidatorPrefix, config.ValidatorPubkeyPrefix) + sdkconfig.SetBech32PrefixForConsensusNode(config.ConsensusNodePrefix, config.ConsensusNodePubkeyPrefix) + sdkconfig.Seal() + + s := &exporter.Service{} + s.Log = log + err = s.Connect(&config) + + if err != nil { + log.Fatal().Err(err).Msg("Could not connect to service") + } + defer func(service *exporter.Service) { + err := service.Close() + if err != nil { + s.Log.Fatal().Err(err).Msg("Could not close service client") + } + }(s) + + s.SetChainID(&config) + s.SetDenom(&config) + + s.Params = config.Params + s.Wallets = config.Wallets + s.Validators = config.Validators + s.Proposals = config.Proposals + s.Oracle = config.Oracle + s.Params = config.Params + s.Upgrades = config.Upgrades + s.Config = &config + /* + eventCollector, err := NewEventCollector(config.TendermintRPC, log, config.BankTransferThreshold, s.Config) + if err != nil { + panic(err) + } + eventCollector.Start(cmd.Context()) + */ + if config.SingleReq { + log.Info().Msg("Starting Single Mode") + http.HandleFunc("/metrics", func(w http.ResponseWriter, r *http.Request) { SeiSingleHandler(w, r, s) }) + } + http.HandleFunc("/metrics/wallet", s.WalletHandler) + http.HandleFunc("/metrics/validator", s.ValidatorHandler) + http.HandleFunc("/metrics/validators", s.ValidatorsHandler) + http.HandleFunc("/metrics/params", s.ParamsHandler) + http.HandleFunc("/metrics/general", s.GeneralHandler) + + http.HandleFunc("/metrics/delegator", s.DelegatorHandler) + http.HandleFunc("/metrics/proposals", s.ProposalsHandler) + http.HandleFunc("/metrics/upgrade", s.UpgradeHandler) + + if config.Prefix == "sei" { + http.HandleFunc("/metrics/sei", func(w http.ResponseWriter, r *http.Request) { + OracleMetricHandler(w, r, s, s.Config) + }) + } + /* + http.HandleFunc("/metrics/event", func(w http.ResponseWriter, r *http.Request) { + eventCollector.StreamHandler(w, r) + }) + */ + log.Info().Str("address", config.ListenAddress).Msg("Listening") + err = http.ListenAndServe(config.ListenAddress, nil) + if err != nil { + log.Fatal().Err(err).Msg("Could not start application") + } +} + +func main() { + config.SetCommonParameters(rootCmd) + + rootCmd.PersistentFlags().BoolVar(&config.Oracle, "oracle", false, "serve oracle info in the single call to /metrics") + // rootCmd.PersistentFlags().Float64Var(&config.BankTransferThreshold, "bank-transfer-threshold", 1e13, "The threshold for which to track bank transfers") + + if err := rootCmd.Execute(); err != nil { + log.Fatal().Err(err).Msg("Could not start application") + } +} diff --git a/cmd/sei-cosmos-exporter/sei.go b/cmd/sei-cosmos-exporter/sei.go new file mode 100644 index 0000000..4641de2 --- /dev/null +++ b/cmd/sei-cosmos-exporter/sei.go @@ -0,0 +1,112 @@ +// original here - https://gist.github.com/jumanzii/031cfea1b2aa3c2a43b63aa62a919285 +package main + +import ( + "context" + "net/http" + "sync" + "time" + + "github.com/google/uuid" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" + "github.com/rs/zerolog" + + sdk "github.com/cosmos/cosmos-sdk/types" + + oracletypes "github.com/pfc-developer/cosmos-exporter/cmd/sei-cosmos-exporter/types" + "github.com/pfc-developer/cosmos-exporter/pkg/exporter" +) + +/* + type votePenaltyCounter struct { + MissCount string `json:"miss_count"` + AbstainCount string `json:"abstain_count"` + SuccessCount string `json:"success_count"` + } +*/ +type SeiMetrics struct { + votePenaltyCount *prometheus.CounterVec +} + +func NewSeiMetrics(reg prometheus.Registerer, config *exporter.ServiceConfig) *SeiMetrics { + m := &SeiMetrics{ + votePenaltyCount: prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "cosmos_sei_oracle_vote_penalty_count", + Help: "Vote penalty miss count", + ConstLabels: config.ConstLabels, + }, + []string{"type", "validator"}, + ), + } + + reg.MustRegister(m.votePenaltyCount) + + return m +} + +func getSeiMetrics(wg *sync.WaitGroup, sublogger *zerolog.Logger, metrics *SeiMetrics, s *exporter.Service, _ *exporter.ServiceConfig, validatorAddress sdk.ValAddress) { + wg.Add(1) + + go func() { + defer wg.Done() + sublogger.Debug().Msg("Started querying oracle feeder metrics") + queryStart := time.Now() + + oracleClient := oracletypes.NewQueryClient(s.GrpcConn) + response, err := oracleClient.VotePenaltyCounter(context.Background(), &oracletypes.QueryVotePenaltyCounterRequest{ValidatorAddr: validatorAddress.String()}) + if err != nil { + sublogger.Error(). + Err(err). + Msg("Could not get oracle feeder metrics") + return + } + + sublogger.Debug(). + Float64("request-time", time.Since(queryStart).Seconds()). + Msg("Finished querying oracle feeder metrics") + + missCount := float64(response.VotePenaltyCounter.MissCount) + abstainCount := float64(response.VotePenaltyCounter.AbstainCount) + successCount := float64(response.VotePenaltyCounter.SuccessCount) + + metrics.votePenaltyCount.WithLabelValues("miss", validatorAddress.String()).Add(missCount) + metrics.votePenaltyCount.WithLabelValues("abstain", validatorAddress.String()).Add(abstainCount) + metrics.votePenaltyCount.WithLabelValues("success", validatorAddress.String()).Add(successCount) + }() +} + +func OracleMetricHandler(w http.ResponseWriter, r *http.Request, s *exporter.Service, _ *exporter.ServiceConfig) { + requestStart := time.Now() + + sublogger := s.Log.With(). + Str("request-id", uuid.New().String()). + Logger() + + address := r.URL.Query().Get("address") + myAddress, err := sdk.ValAddressFromBech32(address) + if err != nil { + sublogger.Error(). + Str("address", address). + Err(err). + Msg("Could not get address") + return + } + + registry := prometheus.NewRegistry() + seiMetrics := NewSeiMetrics(registry, s.Config) + + var wg sync.WaitGroup + getSeiMetrics(&wg, &sublogger, seiMetrics, s, s.Config, myAddress) + + wg.Wait() + + h := promhttp.HandlerFor(registry, promhttp.HandlerOpts{}) + h.ServeHTTP(w, r) + sublogger.Info(). + Str("method", "GET"). + Str("endpoint", "/metrics/sei"). + Float64("request-time", time.Since(requestStart).Seconds()). + Msg("Request processed") +} diff --git a/cmd/sei-cosmos-exporter/sei_main.go.X b/cmd/sei-cosmos-exporter/sei_main.go.X new file mode 100644 index 0000000..6ddc5d7 --- /dev/null +++ b/cmd/sei-cosmos-exporter/sei_main.go.X @@ -0,0 +1,380 @@ +package main + +import ( + "context" + "fmt" + "math" + "net/http" + "os" + "strings" + + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/rs/zerolog" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + "github.com/spf13/viper" + tmrpc "github.com/tendermint/tendermint/rpc/client/http" + "google.golang.org/grpc" +) + +var ( + ConfigPath string + + Denom string + ListenAddress string + NodeAddress string + TendermintRPC string + LogLevel string + JSONOutput bool + Limit uint64 + + Prefix string + AccountPrefix string + AccountPubkeyPrefix string + ValidatorPrefix string + ValidatorPubkeyPrefix string + ConsensusNodePrefix string + ConsensusNodePubkeyPrefix string + + BankTransferThreshold float64 + + ChainID string + ConstLabels map[string]string + DenomCoefficient float64 + DenomExponent uint64 + + // SingleReq bundle up multiple requests into a single /metrics + SingleReq bool + Wallets []string + Validators []string + Oracle bool + Upgrades bool + Proposals bool + Params bool + TokenPrice bool +) + +type service struct { + grpcConn *grpc.ClientConn + tmRPC *tmrpc.HTTP + Wallets []string + Validators []string + Oracle bool + Upgrades bool + Proposals bool + Params bool +} + +var log = zerolog.New(zerolog.ConsoleWriter{Out: os.Stdout}).With().Timestamp().Logger() + +var rootCmd = &cobra.Command{ + Use: "cosmos-exporter", + Long: "Scrape the data about the validators set, specific validators or wallets in the Cosmos network.", + PersistentPreRunE: func(cmd *cobra.Command, args []string) error { + if ConfigPath == "" { + setBechPrefixes(cmd) + return nil + } + + viper.SetConfigFile(ConfigPath) + if err := viper.ReadInConfig(); err != nil { + if _, ok := err.(viper.ConfigFileNotFoundError); !ok { + log.Info().Err(err).Msg("Error reading config file") + return err + } + } + + // Credits to https://carolynvanslyck.com/blog/2020/08/sting-of-the-viper/ + cmd.Flags().VisitAll(func(f *pflag.Flag) { + if !f.Changed && viper.IsSet(f.Name) { + val := viper.Get(f.Name) + if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil { + log.Fatal().Err(err).Msg("Could not set flag") + } + } + }) + + setBechPrefixes(cmd) + + return nil + }, + Run: Execute, +} + +func setBechPrefixes(cmd *cobra.Command) { + if flag, err := cmd.Flags().GetString("bech-account-prefix"); flag != "" && err == nil { + AccountPrefix = flag + } else { + AccountPrefix = Prefix + } + + if flag, err := cmd.Flags().GetString("bech-account-pubkey-prefix"); flag != "" && err == nil { + AccountPubkeyPrefix = flag + } else { + AccountPubkeyPrefix = Prefix + "pub" + } + + if flag, err := cmd.Flags().GetString("bech-validator-prefix"); flag != "" && err == nil { + ValidatorPrefix = flag + } else { + ValidatorPrefix = Prefix + "valoper" + } + + if flag, err := cmd.Flags().GetString("bech-validator-pubkey-prefix"); flag != "" && err == nil { + ValidatorPubkeyPrefix = flag + } else { + ValidatorPubkeyPrefix = Prefix + "valoperpub" + } + + if flag, err := cmd.Flags().GetString("bech-consensus-node-prefix"); flag != "" && err == nil { + ConsensusNodePrefix = flag + } else { + ConsensusNodePrefix = Prefix + "valcons" + } + + if flag, err := cmd.Flags().GetString("bech-consensus-node-pubkey-prefix"); flag != "" && err == nil { + ConsensusNodePubkeyPrefix = flag + } else { + ConsensusNodePubkeyPrefix = Prefix + "valconspub" + } +} + +func Execute(_ *cobra.Command, _ []string) { + logLevel, err := zerolog.ParseLevel(LogLevel) + if err != nil { + log.Fatal().Err(err).Msg("Could not parse log level") + } + + if JSONOutput { + log = zerolog.New(os.Stdout).With().Timestamp().Logger() + } + + zerolog.SetGlobalLevel(logLevel) + + log.Info(). + Str("--bech-account-prefix", AccountPrefix). + Str("--bech-account-pubkey-prefix", AccountPubkeyPrefix). + Str("--bech-validator-prefix", ValidatorPrefix). + Str("--bech-validator-pubkey-prefix", ValidatorPubkeyPrefix). + Str("--bech-consensus-node-prefix", ConsensusNodePrefix). + Str("--bech-consensus-node-pubkey-prefix", ConsensusNodePubkeyPrefix). + Str("--denom", Denom). + Str("--denom-cofficient", fmt.Sprintf("%f", DenomCoefficient)). + Str("--denom-exponent", fmt.Sprintf("%d", DenomExponent)). + Str("--listen-address", ListenAddress). + Str("--node", NodeAddress). + Str("--log-level", LogLevel). + Str("--single", fmt.Sprintf("%t", SingleReq)). + Str("--wallets", strings.Join(Wallets[:], ",")). + Str("--validators", strings.Join(Validators[:], ",")). + Str("--oracle", fmt.Sprintf("%t", Oracle)). + Str("--proposals", fmt.Sprintf("%t", Proposals)). + Str("--params", fmt.Sprintf("%t", Params)). + Str("--upgrades", fmt.Sprintf("%t", Upgrades)). + Str("--price", fmt.Sprintf("%t", TokenPrice)). + Msg("Started with following parameters") + + config := sdk.GetConfig() + config.SetBech32PrefixForAccount(AccountPrefix, AccountPubkeyPrefix) + config.SetBech32PrefixForValidator(ValidatorPrefix, ValidatorPubkeyPrefix) + config.SetBech32PrefixForConsensusNode(ConsensusNodePrefix, ConsensusNodePubkeyPrefix) + config.Seal() + + s := &service{} + + // Setup gRPC connection + s.grpcConn, err = grpc.Dial( + NodeAddress, + grpc.WithInsecure(), + ) + if err != nil { + log.Fatal().Err(err).Msg("Could not connect to gRPC node") + } + defer func(grpcConn *grpc.ClientConn) { + err := grpcConn.Close() + if err != nil { + log.Fatal().Err(err).Msg("Could not close gRPC client") + } + }(s.grpcConn) + + // Setup Tendermint RPC connection + s.tmRPC, err = tmrpc.New(TendermintRPC, "/websocket") + if err != nil { + log.Fatal().Err(err).Msg("Could not create Tendermint client") + } + s.setChainID() + s.setDenom() + /* + eventCollector, err := NewEventCollector(TendermintRPC, log, BankTransferThreshold) + if err != nil { + panic(err) + } + eventCollector.Start(cmd.Context()) + */ + s.Params = Params + s.Wallets = Wallets + s.Validators = Validators + s.Proposals = Proposals + s.Oracle = Oracle + s.Params = Params + s.Upgrades = Upgrades + + if SingleReq { + log.Info().Msg("Starting Single Mode") + http.HandleFunc("/metrics", s.SingleHandler) + } + http.HandleFunc("/metrics/wallet", s.WalletHandler) + http.HandleFunc("/metrics/validator", s.ValidatorHandler) + http.HandleFunc("/metrics/validators", s.ValidatorsHandler) + http.HandleFunc("/metrics/params", s.ParamsHandler) + http.HandleFunc("/metrics/general", s.GeneralHandler) + if Prefix == "kujira" { + http.HandleFunc("/metrics/kujira", s.KujiraMetricHandler) + } + http.HandleFunc("/metrics/delegator", s.DelegatorHandler) + http.HandleFunc("/metrics/proposals", s.ProposalsHandler) + http.HandleFunc("/metrics/upgrade", s.UpgradeHandler) + /* + if Prefix == "sei" { + http.HandleFunc("/metrics/sei", func(w http.ResponseWriter, r *http.Request) { + OracleMetricHandler(w, r, s.grpcConn) + }) + } + + */ + /* + http.HandleFunc("/metrics/event", func(w http.ResponseWriter, r *http.Request) { + eventCollector.StreamHandler(w, r) + }) + */ + log.Info().Str("address", ListenAddress).Msg("Listening") + err = http.ListenAndServe(ListenAddress, nil) + if err != nil { + log.Fatal().Err(err).Msg("Could not start application") + } +} + +func (s *service) setChainID() { + status, err := s.tmRPC.Status(context.Background()) + if err != nil { + log.Fatal().Err(err).Msg("Could not query Tendermint status") + } + + log.Info().Str("network", status.NodeInfo.Network).Msg("Got network status from Tendermint") + ChainID = status.NodeInfo.Network + ConstLabels = map[string]string{ + "chain_id": ChainID, + } +} + +func (s *service) setDenom() { + // if --denom and (--denom-coefficient or --denom-exponent) are provided, use them + // instead of fetching them via gRPC. Can be useful for networks like osmosis. + if isUserProvidedAndHandled := checkAndHandleDenomInfoProvidedByUser(); isUserProvidedAndHandled { + return + } + + bankClient := banktypes.NewQueryClient(s.grpcConn) + denoms, err := bankClient.DenomsMetadata( + context.Background(), + &banktypes.QueryDenomsMetadataRequest{}, + ) + if err != nil { + log.Fatal().Err(err).Msg("Error querying denom") + } + + if len(denoms.Metadatas) == 0 { + log.Fatal().Msg("No denom infos. Try running the binary with --denom and --denom-coefficient to set them manually.") + } + + metadata := denoms.Metadatas[0] // always using the first one + if Denom == "" { // using display currency + Denom = metadata.Display + } + + for _, unit := range metadata.DenomUnits { + log.Debug(). + Str("denom", unit.Denom). + Uint32("exponent", unit.Exponent). + Msg("Denom info") + if unit.Denom == Denom { + DenomCoefficient = math.Pow10(int(unit.Exponent)) + log.Info(). + Str("denom", Denom). + Float64("coefficient", DenomCoefficient). + Msg("Got denom info") + return + } + } + + log.Fatal().Msg("Could not find the denom info") +} + +func checkAndHandleDenomInfoProvidedByUser() bool { + + if Denom != "" { + if DenomCoefficient != 1 && DenomExponent != 0 { + log.Fatal().Msg("denom-coefficient and denom-exponent are both provided. Must provide only one") + } + + if DenomCoefficient != 1 { + log.Info(). + Str("denom", Denom). + Float64("coefficient", DenomCoefficient). + Msg("Using provided denom and coefficient.") + return true + } + + if DenomExponent != 0 { + DenomCoefficient = math.Pow10(int(DenomExponent)) + log.Info(). + Str("denom", Denom). + Uint64("exponent", DenomExponent). + Float64("calculated coefficient", DenomCoefficient). + Msg("Using provided denom and denom exponent and calculating coefficient.") + return true + } + + return false + } + + return false + +} + +func main() { + rootCmd.PersistentFlags().StringVar(&ConfigPath, "config", "", "Config file path") + rootCmd.PersistentFlags().StringVar(&Denom, "denom", "", "Cosmos coin denom") + rootCmd.PersistentFlags().Float64Var(&DenomCoefficient, "denom-coefficient", 1, "Denom coefficient") + rootCmd.PersistentFlags().Uint64Var(&DenomExponent, "denom-exponent", 0, "Denom exponent") + rootCmd.PersistentFlags().StringVar(&ListenAddress, "listen-address", ":9300", "The address this exporter would listen on") + rootCmd.PersistentFlags().StringVar(&NodeAddress, "node", "localhost:9090", "RPC node address") + rootCmd.PersistentFlags().StringVar(&LogLevel, "log-level", "info", "Logging level") + rootCmd.PersistentFlags().Uint64Var(&Limit, "limit", 1000, "Pagination limit for gRPC requests") + rootCmd.PersistentFlags().StringVar(&TendermintRPC, "tendermint-rpc", "http://localhost:26657", "Tendermint RPC address") + rootCmd.PersistentFlags().BoolVar(&JSONOutput, "json", false, "Output logs as JSON") + + // some networks, like Iris, have the different prefixes for address, validator and consensus node + rootCmd.PersistentFlags().StringVar(&Prefix, "bech-prefix", "persistence", "Bech32 global prefix") + rootCmd.PersistentFlags().StringVar(&AccountPrefix, "bech-account-prefix", "", "Bech32 account prefix") + rootCmd.PersistentFlags().StringVar(&AccountPubkeyPrefix, "bech-account-pubkey-prefix", "", "Bech32 pubkey account prefix") + rootCmd.PersistentFlags().StringVar(&ValidatorPrefix, "bech-validator-prefix", "", "Bech32 validator prefix") + rootCmd.PersistentFlags().StringVar(&ValidatorPubkeyPrefix, "bech-validator-pubkey-prefix", "", "Bech32 pubkey validator prefix") + rootCmd.PersistentFlags().StringVar(&ConsensusNodePrefix, "bech-consensus-node-prefix", "", "Bech32 consensus node prefix") + rootCmd.PersistentFlags().StringVar(&ConsensusNodePubkeyPrefix, "bech-consensus-node-pubkey-prefix", "", "Bech32 pubkey consensus node prefix") + rootCmd.PersistentFlags().BoolVar(&SingleReq, "single", false, "serve info in a single call to /metrics") + rootCmd.PersistentFlags().BoolVar(&Oracle, "oracle", false, "serve oracle info in the single call to /metrics") + rootCmd.PersistentFlags().BoolVar(&Upgrades, "upgrades", false, "serve upgrade info in the single call to /metrics") + rootCmd.PersistentFlags().BoolVar(&Proposals, "proposals", false, "serve active proposal info in the single call to /metrics") + rootCmd.PersistentFlags().BoolVar(&Params, "params", false, "serve chain params info in the single call to /metrics") + rootCmd.PersistentFlags().BoolVar(&TokenPrice, "price", true, "fetch token price") + rootCmd.PersistentFlags().StringSliceVar(&Wallets, "wallets", nil, "serve info about passed wallets") + rootCmd.PersistentFlags().StringSliceVar(&Validators, "validators", nil, "serve info about passed validators") + + rootCmd.PersistentFlags().Float64Var(&BankTransferThreshold, "bank-transfer-threshold", 1e13, "The threshold for which to track bank transfers") + + if err := rootCmd.Execute(); err != nil { + log.Fatal().Err(err).Msg("Could not start application") + } +} diff --git a/cmd/sei-cosmos-exporter/single.go b/cmd/sei-cosmos-exporter/single.go new file mode 100644 index 0000000..d98a182 --- /dev/null +++ b/cmd/sei-cosmos-exporter/single.go @@ -0,0 +1,175 @@ +package main + +import ( + "net/http" + "sync" + "time" + + "github.com/google/uuid" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pfc-developer/cosmos-exporter/pkg/exporter" +) + +func SeiSingleHandler(w http.ResponseWriter, r *http.Request, s *exporter.Service) { + requestStart := time.Now() + + sublogger := log.With(). + Str("request-id", uuid.New().String()). + Logger() + + registry := prometheus.NewRegistry() + generalMetrics := exporter.NewGeneralMetrics(registry, s.Config) + var validatorMetrics *exporter.ValidatorMetrics + var paramsMetrics *exporter.ParamsMetrics + var upgradeMetrics *exporter.UpgradeMetrics + var walletMetrics *exporter.WalletMetrics + var seiMetrics *SeiMetrics + + var proposalMetrics *exporter.ProposalsMetrics + var validatorVotingMetrics *exporter.ValidatorVotingMetrics + + if len(s.Validators) > 0 { + validatorMetrics = exporter.NewValidatorMetrics(registry, s.Config) + } + if len(s.Wallets) > 0 { + walletMetrics = exporter.NewWalletMetrics(registry, s.Config) + } + if s.Params { + paramsMetrics = exporter.NewParamsMetrics(registry, s.Config) + } + if s.Upgrades { + upgradeMetrics = exporter.NewUpgradeMetrics(registry, s.Config) + } + if s.Proposals { + proposalMetrics = exporter.NewProposalsMetrics(registry, s.Config) + } + if s.Oracle { + seiMetrics = NewSeiMetrics(registry, s.Config) + } + if s.Config.Votes && len(s.Validators) > 0 { + validatorVotingMetrics = exporter.NewValidatorVotingMetrics(registry, s.Config) + } + var wg sync.WaitGroup + + exporter.GetGeneralMetrics(&wg, &sublogger, generalMetrics, s, s.Config) + if paramsMetrics != nil { + exporter.GetParamsMetrics(&wg, &sublogger, paramsMetrics, s, s.Config) + } + if upgradeMetrics != nil { + exporter.DoUpgradeMetrics(&wg, &sublogger, upgradeMetrics, s, s.Config) + } + if len(s.Validators) > 0 { + // use 2 groups. + // the first group "val_wg" allows us to batch the initial validator call to get the moniker + // the 'BasicMetrics' will then add a request to the outer wait 'wg'. + // we ensure that all the requests are added by waiting for the 'val_wg' to finish before waiting on the 'wg' + var val_wg sync.WaitGroup + for _, validator := range s.Validators { + valAddress, err := sdk.ValAddressFromBech32(validator) + + if err != nil { + sublogger.Error(). + Str("address", validator). + Err(err). + Msg("Could not get validator address") + } else { + val_wg.Add(1) + go func() { + defer val_wg.Done() + sublogger.Debug().Str("address", validator).Msg("Fetching validator details") + + exporter.GetValidatorBasicMetrics(&wg, &sublogger, validatorMetrics, s, s.Config, valAddress) + }() + + if s.Oracle { + sublogger.Debug().Str("address", validator).Msg("Fetching SEI details") + getSeiMetrics(&wg, &sublogger, seiMetrics, s, s.Config, valAddress) + } + } + } + val_wg.Wait() + } + if len(s.Wallets) > 0 { + for _, wallet := range s.Wallets { + accAddress, err := sdk.AccAddressFromBech32(wallet) + if err != nil { + sublogger.Error(). + Str("address", wallet). + Err(err). + Msg("Could not get wallet address") + } else { + exporter.GetWalletMetrics(&wg, &sublogger, walletMetrics, s, s.Config, accAddress, false) + } + } + } + if s.Proposals { + exporter.GetProposalsMetrics(&wg, &sublogger, proposalMetrics, s, s.Config, true) + } + if s.Config.Votes && len(s.Validators) > 0 { + // use 2 groups. + // the first group "prop_wg" allows us to batch the call to get the active props + // the 'BasicMetrics' will then add a request to the outer wait 'wg'. + // we ensure that all the requests are added by waiting for the 'val_wg' to finish before waiting on the 'wg' + var prop_wg sync.WaitGroup + prop_wg.Add(1) + var activeProps []uint64 + + go func() { + defer prop_wg.Done() + var err error + if s.Config.PropV1 { + activeProps, err = s.GetActiveProposalsV1(&sublogger) + if err != nil { + sublogger.Error(). + Err(err). + Msg("Could not get active proposals V1 (sei)") + } + } else { + activeProps, err = s.GetActiveProposals(&sublogger) + if err != nil { + sublogger.Error(). + Err(err). + Msg("Could not get active proposals (sei)") + } + } + }() + + prop_wg.Wait() + + for _, validator := range s.Validators { + valAddress, err := sdk.ValAddressFromBech32(validator) + if err != nil { + sublogger.Error(). + Str("address", validator). + Err(err). + Msg("Could not get validator address") + } else { + var accAddress sdk.AccAddress + err := accAddress.Unmarshal(valAddress.Bytes()) + if err != nil { + sublogger.Error(). + Str("address", validator). + Err(err). + Msg("Could not get acc address") + } + for _, propId := range activeProps { + exporter.GetProposalsVoteMetrics(&wg, &sublogger, validatorVotingMetrics, s, s.Config, propId, valAddress, accAddress) + } + } + } + } + wg.Wait() + + h := promhttp.HandlerFor(registry, promhttp.HandlerOpts{}) + h.ServeHTTP(w, r) + sublogger.Info(). + Str("method", "GET"). + Str("endpoint", "/metrics"). + Str("type", "sei"). + Float64("request-time", time.Since(requestStart).Seconds()). + Msg("Request processed") +} diff --git a/cmd/sei-cosmos-exporter/types/ballot.go b/cmd/sei-cosmos-exporter/types/ballot.go new file mode 100644 index 0000000..e09eb35 --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/ballot.go @@ -0,0 +1,187 @@ +package types + +import ( + "fmt" + "math" + "sort" + "strconv" + + cosmos_math "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// NOTE: we don't need to implement proto interface on this file +// these are not used in store or rpc response + +// VoteForTally is a convenience wrapper to reduce redundant lookup cost +type VoteForTally struct { + Denom string + ExchangeRate cosmos_math.LegacyDec + Voter sdk.ValAddress + Power int64 +} + +// NewVoteForTally returns a new VoteForTally instance +func NewVoteForTally(rate cosmos_math.LegacyDec, denom string, voter sdk.ValAddress, power int64) VoteForTally { + return VoteForTally{ + ExchangeRate: rate, + Denom: denom, + Voter: voter, + Power: power, + } +} + +// ExchangeRateBallot is a convenience wrapper around a ExchangeRateVote slice +type ExchangeRateBallot []VoteForTally + +// ToMap return organized exchange rate map by validator +func (pb ExchangeRateBallot) ToMap() map[string]cosmos_math.LegacyDec { + exchangeRateMap := make(map[string]cosmos_math.LegacyDec) + for _, vote := range pb { + if vote.ExchangeRate.IsPositive() { + exchangeRateMap[string(vote.Voter)] = vote.ExchangeRate + } + } + + return exchangeRateMap +} + +// ToCrossRate return cross_rate(base/exchange_rate) ballot +func (pb ExchangeRateBallot) ToCrossRate(bases map[string]cosmos_math.LegacyDec) (cb ExchangeRateBallot) { + for i := range pb { + vote := pb[i] + + if exchangeRateRT, ok := bases[string(vote.Voter)]; ok && vote.ExchangeRate.IsPositive() { + vote.ExchangeRate = exchangeRateRT.Quo(vote.ExchangeRate) + } else { + // If we can't get reference Sei exchange rate, we just convert the vote as abstain vote + vote.ExchangeRate = cosmos_math.LegacyZeroDec() + vote.Power = 0 + } + + cb = append(cb, vote) + } + + return +} + +// ToCrossRateWithSort return cross_rate(base/exchange_rate) ballot +func (pb ExchangeRateBallot) ToCrossRateWithSort(bases map[string]cosmos_math.LegacyDec) (cb ExchangeRateBallot) { + cb = pb.ToCrossRate(bases) + sort.Sort(cb) + return +} + +// Power returns the total amount of voting power in the ballot +func (pb ExchangeRateBallot) Power() int64 { + totalPower := int64(0) + for _, vote := range pb { + totalPower += vote.Power + } + + return totalPower +} + +// WeightedMedian returns the median weighted by the power of the ExchangeRateVote. +// CONTRACT: ballot must be sorted +func (pb ExchangeRateBallot) WeightedMedian() cosmos_math.LegacyDec { + totalPower := pb.Power() + if pb.Len() > 0 { + pivot := int64(0) + for _, v := range pb { + votePower := v.Power + + pivot += votePower + if pivot >= (totalPower / 2) { + return v.ExchangeRate + } + } + } + return cosmos_math.LegacyZeroDec() +} + +// WeightedMedianWithAssertion returns the median weighted by the power of the ExchangeRateVote. +// CONTRACT: ballot must be sorted +func (pb ExchangeRateBallot) WeightedMedianWithAssertion() cosmos_math.LegacyDec { + if !sort.IsSorted(pb) { + panic("ballot must be sorted") + } + + totalPower := pb.Power() + if pb.Len() > 0 { + pivot := int64(0) + for _, v := range pb { + votePower := v.Power + + pivot += votePower + if pivot >= (totalPower / 2) { + return v.ExchangeRate + } + } + } + return cosmos_math.LegacyZeroDec() +} + +// StandardDeviation returns the standard deviation by the power of the ExchangeRateVote. +func (pb ExchangeRateBallot) StandardDeviation(median cosmos_math.LegacyDec) (standardDeviation cosmos_math.LegacyDec) { + if len(pb) == 0 { + return cosmos_math.LegacyZeroDec() + } + + defer func() { + if e := recover(); e != nil { + standardDeviation = cosmos_math.LegacyZeroDec() + } + }() + + sum := cosmos_math.LegacyZeroDec() + for _, v := range pb { + deviation := v.ExchangeRate.Sub(median) + sum = sum.Add(deviation.Mul(deviation)) + } + + variance := sum.QuoInt64(int64(len(pb))) + + floatNum, _ := strconv.ParseFloat(variance.String(), 64) + floatNum = math.Sqrt(floatNum) + standardDeviation, _ = cosmos_math.LegacyNewDecFromStr(fmt.Sprintf("%f", floatNum)) + + return +} + +// Len implements sort.Interface +func (pb ExchangeRateBallot) Len() int { + return len(pb) +} + +// Less reports whether the element with +// index i should sort before the element with index j. +func (pb ExchangeRateBallot) Less(i, j int) bool { + return pb[i].ExchangeRate.LT(pb[j].ExchangeRate) +} + +// Swap implements sort.Interface. +func (pb ExchangeRateBallot) Swap(i, j int) { + pb[i], pb[j] = pb[j], pb[i] +} + +// Claim is an interface that directs its rewards to an attached bank account. +type Claim struct { + Power int64 + Weight int64 + WinCount int64 + DidVote bool + Recipient sdk.ValAddress +} + +// NewClaim generates a Claim instance. +func NewClaim(power, weight, winCount int64, recipient sdk.ValAddress, didVote bool) Claim { + return Claim{ + Power: power, + Weight: weight, + WinCount: winCount, + DidVote: didVote, + Recipient: recipient, + } +} diff --git a/cmd/sei-cosmos-exporter/types/codec.go b/cmd/sei-cosmos-exporter/types/codec.go new file mode 100755 index 0000000..f0feaf2 --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/codec.go @@ -0,0 +1,29 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgAggregateExchangeRateVote{}, "oracle/MsgAggregateExchangeRateVote", nil) + cdc.RegisterConcrete(&MsgDelegateFeedConsent{}, "oracle/MsgDelegateFeedConsent", nil) +} + +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgAggregateExchangeRateVote{}, + ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgDelegateFeedConsent{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + Amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) +) diff --git a/cmd/sei-cosmos-exporter/types/denom.go b/cmd/sei-cosmos-exporter/types/denom.go new file mode 100755 index 0000000..0e1ee8d --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/denom.go @@ -0,0 +1,38 @@ +package types + +import ( + "strings" + + "gopkg.in/yaml.v2" +) + +// String implements fmt.Stringer interface +func (d Denom) String() string { + out, _ := yaml.Marshal(d) + return string(out) +} + +// Equal implements equal interface +func (d Denom) Equal(d1 *Denom) bool { + return d.Name == d1.Name +} + +// DenomList is array of Denom +type DenomList []Denom + +func (dl DenomList) Contains(denom string) bool { + for _, d := range dl { + if d.Name == denom { + return true + } + } + return false +} + +// String implements fmt.Stringer interface +func (dl DenomList) String() (out string) { + for _, d := range dl { + out += d.String() + "\n" + } + return strings.TrimSpace(out) +} diff --git a/cmd/sei-cosmos-exporter/types/errors.go b/cmd/sei-cosmos-exporter/types/errors.go new file mode 100755 index 0000000..db63651 --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/errors.go @@ -0,0 +1,32 @@ +package types + +import ( + "fmt" + + "cosmossdk.io/errors" +) + +const TruncatedSize = 20 + +// Oracle Errors +var ( + ErrInvalidExchangeRate = errors.Register(ModuleName, 2, "invalid exchange rate") + ErrNoVote = errors.Register(ModuleName, 4, "no vote") + ErrNoVotingPermission = errors.Register(ModuleName, 5, "unauthorized voter") + ErrInvalidHash = errors.Register(ModuleName, 6, "invalid hash") + ErrInvalidHashLength = errors.Register(ModuleName, 7, fmt.Sprintf("invalid hash length; should equal %d", TruncatedSize)) + ErrVerificationFailed = errors.Register(ModuleName, 8, "hash verification failed") + ErrNoAggregateVote = errors.Register(ModuleName, 12, "no aggregate vote") + ErrNoVoteTarget = errors.Register(ModuleName, 13, "no vote target") + ErrUnknownDenom = errors.Register(ModuleName, 14, "unknown denom") + ErrNoLatestPriceSnapshot = errors.Register(ModuleName, 15, "no latest snapshot") + ErrInvalidTwapLookback = errors.Register(ModuleName, 16, "Twap lookback seconds is greater than max lookback duration or less than or equal to 0") + ErrNoTwapData = errors.Register(ModuleName, 17, "No data for the twap calculation") + ErrParsingOracleQuery = errors.Register(ModuleName, 18, "Error parsing SeiOracleQuery") + ErrGettingExchangeRates = errors.Register(ModuleName, 19, "Error while getting Exchange Rates") + ErrEncodingExchangeRates = errors.Register(ModuleName, 20, "Error encoding exchange rates as JSON") + ErrGettingOracleTwaps = errors.Register(ModuleName, 21, "Error while getting Oracle Twaps in wasmd") + ErrEncodingOracleTwaps = errors.Register(ModuleName, 22, "Error encoding oracle twaps as JSON") + ErrUnknownSeiOracleQuery = errors.Register(ModuleName, 23, "Error unknown sei oracle query") + ErrAggregateVoteExist = errors.Register(ModuleName, 24, "aggregate vote still present in current voting window") +) diff --git a/cmd/sei-cosmos-exporter/types/events.go b/cmd/sei-cosmos-exporter/types/events.go new file mode 100755 index 0000000..7786429 --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/events.go @@ -0,0 +1,23 @@ +package types + +// Oracle module event types +const ( + EventTypeExchangeRateUpdate = "exchange_rate_update" + EventTypeVote = "vote" + EventTypeFeedDelegate = "feed_delegate" + EventTypeAggregateVote = "aggregate_vote" + EventTypeEndSlashWindow = "end_slash_window" + + AttributeKeyDenom = "denom" + AttributeKeyVoter = "voter" + AttributeKeyExchangeRate = "exchange_rate" + AttributeKeyExchangeRates = "exchange_rates" + AttributeKeyOperator = "operator" + AttributeKeyFeeder = "feeder" + AttributeKeyMissCount = "miss_count" + AttributeKeyAbstainCount = "abstain_count" + AttributeKeyWinCount = "win_count" + AttributeKeySuccessCount = "success_count" + + AttributeValueCategory = ModuleName +) diff --git a/cmd/sei-cosmos-exporter/types/expected_keeper.go b/cmd/sei-cosmos-exporter/types/expected_keeper.go new file mode 100644 index 0000000..400290a --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/expected_keeper.go @@ -0,0 +1,49 @@ +package types + +import ( + "cosmossdk.io/core/store" + cosmos_math "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +// StakingKeeper is expected keeper for staking module +type StakingKeeper interface { + Validator(ctx sdk.Context, address sdk.ValAddress) stakingtypes.ValidatorI // get validator by operator address; nil when validator not found + TotalBondedTokens(sdk.Context) cosmos_math.Int // total bonded tokens within the validator set + Slash(sdk.Context, sdk.ConsAddress, int64, int64, cosmos_math.LegacyDec) // slash the validator and delegators of the validator, specifying offence height, offence power, and slash fraction + Jail(sdk.Context, sdk.ConsAddress) // jail a validator + ValidatorsPowerStoreIterator(ctx sdk.Context) store.Iterator // an iterator for the current validator power store + MaxValidators(sdk.Context) uint32 // MaxValidators returns the maximum amount of bonded validators + PowerReduction(ctx sdk.Context) (res cosmos_math.Int) +} + +// DistributionKeeper is expected keeper for distribution module +type DistributionKeeper interface { + AllocateTokensToValidator(ctx sdk.Context, val stakingtypes.ValidatorI, tokens sdk.DecCoins) + + // only used for simulation + GetValidatorOutstandingRewardsCoins(ctx sdk.Context, val sdk.ValAddress) sdk.DecCoins +} + +// AccountKeeper is expected keeper for auth module +type AccountKeeper interface { + GetModuleAddress(name string) sdk.AccAddress + GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI + GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI // only used for simulation +} + +// BankKeeper defines the expected interface needed to retrieve account balances. +type BankKeeper interface { + GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SendCoinsFromModuleToModule(ctx sdk.Context, senderModule string, recipientModule string, amt sdk.Coins) error + GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool) + SetDenomMetaData(ctx sdk.Context, denomMetaData banktypes.Metadata) + + // only used for simulation + SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins +} diff --git a/cmd/sei-cosmos-exporter/types/genesis.go b/cmd/sei-cosmos-exporter/types/genesis.go new file mode 100755 index 0000000..83990b6 --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/genesis.go @@ -0,0 +1,53 @@ +package types + +import ( + "encoding/json" + + "github.com/cosmos/cosmos-sdk/codec" +) + +// NewGenesisState creates a new GenesisState object +func NewGenesisState( + params Params, rates []ExchangeRateTuple, + feederDelegations []FeederDelegation, penaltyCounters []PenaltyCounter, + aggregateExchangeRateVotes []AggregateExchangeRateVote, + priceSnapshots []PriceSnapshot, +) *GenesisState { + return &GenesisState{ + Params: params, + ExchangeRates: rates, + FeederDelegations: feederDelegations, + PenaltyCounters: penaltyCounters, + AggregateExchangeRateVotes: aggregateExchangeRateVotes, + PriceSnapshots: priceSnapshots, + } +} + +// DefaultGenesisState - default GenesisState used by columbus-2 +func DefaultGenesisState() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + ExchangeRates: []ExchangeRateTuple{}, + FeederDelegations: []FeederDelegation{}, + PenaltyCounters: []PenaltyCounter{}, + AggregateExchangeRateVotes: []AggregateExchangeRateVote{}, + PriceSnapshots: PriceSnapshots{}, + } +} + +// ValidateGenesis validates the oracle genesis state +func ValidateGenesis(data *GenesisState) error { + return data.Params.Validate() +} + +// GetGenesisStateFromAppState returns x/oracle GenesisState given raw application +// genesis state. +func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) *GenesisState { + var genesisState GenesisState + + if appState[ModuleName] != nil { + cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState) + } + + return &genesisState +} diff --git a/cmd/sei-cosmos-exporter/types/genesis.pb.go b/cmd/sei-cosmos-exporter/types/genesis.pb.go new file mode 100644 index 0000000..d623853 --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/genesis.pb.go @@ -0,0 +1,1102 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: oracle/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + FeederDelegations []FeederDelegation `protobuf:"bytes,2,rep,name=feeder_delegations,json=feederDelegations,proto3" json:"feeder_delegations"` + ExchangeRates ExchangeRateTuples `protobuf:"bytes,3,rep,name=exchange_rates,json=exchangeRates,proto3,castrepeated=ExchangeRateTuples" json:"exchange_rates"` + PenaltyCounters []PenaltyCounter `protobuf:"bytes,4,rep,name=penalty_counters,json=penaltyCounters,proto3" json:"penalty_counters"` + AggregateExchangeRateVotes []AggregateExchangeRateVote `protobuf:"bytes,6,rep,name=aggregate_exchange_rate_votes,json=aggregateExchangeRateVotes,proto3" json:"aggregate_exchange_rate_votes"` + PriceSnapshots PriceSnapshots `protobuf:"bytes,7,rep,name=price_snapshots,json=priceSnapshots,proto3,castrepeated=PriceSnapshots" json:"price_snapshots"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_ce0b3a2b4a184fc3, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetFeederDelegations() []FeederDelegation { + if m != nil { + return m.FeederDelegations + } + return nil +} + +func (m *GenesisState) GetExchangeRates() ExchangeRateTuples { + if m != nil { + return m.ExchangeRates + } + return nil +} + +func (m *GenesisState) GetPenaltyCounters() []PenaltyCounter { + if m != nil { + return m.PenaltyCounters + } + return nil +} + +func (m *GenesisState) GetAggregateExchangeRateVotes() []AggregateExchangeRateVote { + if m != nil { + return m.AggregateExchangeRateVotes + } + return nil +} + +func (m *GenesisState) GetPriceSnapshots() PriceSnapshots { + if m != nil { + return m.PriceSnapshots + } + return nil +} + +type FeederDelegation struct { + FeederAddress string `protobuf:"bytes,1,opt,name=feeder_address,json=feederAddress,proto3" json:"feeder_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` +} + +func (m *FeederDelegation) Reset() { *m = FeederDelegation{} } +func (m *FeederDelegation) String() string { return proto.CompactTextString(m) } +func (*FeederDelegation) ProtoMessage() {} +func (*FeederDelegation) Descriptor() ([]byte, []int) { + return fileDescriptor_ce0b3a2b4a184fc3, []int{1} +} +func (m *FeederDelegation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FeederDelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FeederDelegation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *FeederDelegation) XXX_Merge(src proto.Message) { + xxx_messageInfo_FeederDelegation.Merge(m, src) +} +func (m *FeederDelegation) XXX_Size() int { + return m.Size() +} +func (m *FeederDelegation) XXX_DiscardUnknown() { + xxx_messageInfo_FeederDelegation.DiscardUnknown(m) +} + +var xxx_messageInfo_FeederDelegation proto.InternalMessageInfo + +func (m *FeederDelegation) GetFeederAddress() string { + if m != nil { + return m.FeederAddress + } + return "" +} + +func (m *FeederDelegation) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + +type PenaltyCounter struct { + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + VotePenaltyCounter *VotePenaltyCounter `protobuf:"bytes,2,opt,name=vote_penalty_counter,json=votePenaltyCounter,proto3" json:"vote_penalty_counter,omitempty"` +} + +func (m *PenaltyCounter) Reset() { *m = PenaltyCounter{} } +func (m *PenaltyCounter) String() string { return proto.CompactTextString(m) } +func (*PenaltyCounter) ProtoMessage() {} +func (*PenaltyCounter) Descriptor() ([]byte, []int) { + return fileDescriptor_ce0b3a2b4a184fc3, []int{2} +} +func (m *PenaltyCounter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PenaltyCounter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PenaltyCounter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PenaltyCounter) XXX_Merge(src proto.Message) { + xxx_messageInfo_PenaltyCounter.Merge(m, src) +} +func (m *PenaltyCounter) XXX_Size() int { + return m.Size() +} +func (m *PenaltyCounter) XXX_DiscardUnknown() { + xxx_messageInfo_PenaltyCounter.DiscardUnknown(m) +} + +var xxx_messageInfo_PenaltyCounter proto.InternalMessageInfo + +func (m *PenaltyCounter) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + +func (m *PenaltyCounter) GetVotePenaltyCounter() *VotePenaltyCounter { + if m != nil { + return m.VotePenaltyCounter + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "seiprotocol.seichain.oracle.GenesisState") + proto.RegisterType((*FeederDelegation)(nil), "seiprotocol.seichain.oracle.FeederDelegation") + proto.RegisterType((*PenaltyCounter)(nil), "seiprotocol.seichain.oracle.PenaltyCounter") +} + +func init() { proto.RegisterFile("oracle/genesis.proto", fileDescriptor_ce0b3a2b4a184fc3) } + +var fileDescriptor_ce0b3a2b4a184fc3 = []byte{ + // 521 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0x8d, 0xdb, 0x10, 0x60, 0x43, 0xd3, 0x74, 0x89, 0x50, 0x14, 0x84, 0x5b, 0x05, 0x21, 0x55, + 0x54, 0xb5, 0x69, 0x90, 0xb8, 0x27, 0x7c, 0x49, 0x3d, 0x21, 0x17, 0x71, 0x40, 0x48, 0xd6, 0xda, + 0x9e, 0x38, 0x2b, 0x1c, 0xaf, 0xf1, 0x6c, 0xa2, 0xf6, 0xc4, 0x5f, 0xe0, 0x27, 0x70, 0xe6, 0x97, + 0xf4, 0xd8, 0x23, 0x27, 0x40, 0xc9, 0xbf, 0xe0, 0x84, 0xbc, 0xbb, 0x2d, 0x75, 0xda, 0xfa, 0x94, + 0xdd, 0x37, 0xef, 0xcd, 0xcb, 0x9b, 0x59, 0x93, 0x8e, 0xc8, 0x59, 0x98, 0x80, 0x1b, 0x43, 0x0a, + 0xc8, 0xd1, 0xc9, 0x72, 0x21, 0x05, 0x7d, 0x88, 0xc0, 0xd5, 0x29, 0x14, 0x89, 0x83, 0xc0, 0xc3, + 0x09, 0xe3, 0xa9, 0xa3, 0xa9, 0xbd, 0x4e, 0x2c, 0x62, 0xa1, 0xaa, 0x6e, 0x71, 0xd2, 0x92, 0xde, + 0x7d, 0xd3, 0x48, 0xff, 0x18, 0xd0, 0x0e, 0x05, 0x4e, 0x05, 0xba, 0x01, 0x43, 0x70, 0xe7, 0x07, + 0x01, 0x48, 0x76, 0xe0, 0x86, 0x82, 0xa7, 0xba, 0xde, 0xff, 0x5b, 0x27, 0xf7, 0xde, 0x6a, 0xe7, + 0x23, 0xc9, 0x24, 0xd0, 0x21, 0x69, 0x64, 0x2c, 0x67, 0x53, 0xec, 0x5a, 0x3b, 0xd6, 0x6e, 0x73, + 0xf0, 0xd8, 0xa9, 0xf8, 0x27, 0xce, 0x3b, 0x45, 0x1d, 0xd5, 0x4f, 0x7f, 0x6d, 0xd7, 0x3c, 0x23, + 0xa4, 0x01, 0xa1, 0x63, 0x80, 0x08, 0x72, 0x3f, 0x82, 0x04, 0x62, 0x26, 0xb9, 0x48, 0xb1, 0xbb, + 0xb6, 0xb3, 0xbe, 0xdb, 0x1c, 0xec, 0x57, 0xb6, 0x7b, 0xa3, 0x64, 0xaf, 0x2e, 0x54, 0xa6, 0xf1, + 0xd6, 0x78, 0x05, 0x47, 0xfa, 0x85, 0xb4, 0xe0, 0x38, 0x9c, 0xb0, 0x34, 0x06, 0x3f, 0x67, 0x12, + 0xb0, 0xbb, 0xae, 0xfa, 0x3b, 0x95, 0xfd, 0x5f, 0x1b, 0x89, 0xc7, 0x24, 0xbc, 0x9f, 0x65, 0x09, + 0x8c, 0x7a, 0x85, 0xc1, 0x8f, 0xdf, 0xdb, 0xf4, 0x4a, 0x09, 0xbd, 0x0d, 0xb8, 0x84, 0x21, 0xfd, + 0x44, 0xda, 0x19, 0xa4, 0x2c, 0x91, 0x27, 0x7e, 0x28, 0x66, 0xa9, 0x84, 0x1c, 0xbb, 0x75, 0x65, + 0xba, 0x57, 0x3d, 0x23, 0x2d, 0x7a, 0xa9, 0x35, 0x26, 0xd2, 0x66, 0x56, 0x42, 0x91, 0x7e, 0x25, + 0x8f, 0x58, 0x1c, 0xe7, 0x45, 0x40, 0xf0, 0x4b, 0xd1, 0xfc, 0xb9, 0x28, 0xf2, 0x35, 0x94, 0xd5, + 0x8b, 0x4a, 0xab, 0xe1, 0x79, 0x87, 0xcb, 0x69, 0x3e, 0x08, 0x09, 0xc6, 0xb5, 0xc7, 0x6e, 0x22, + 0x20, 0xfd, 0x4c, 0x36, 0xb3, 0x9c, 0x87, 0xe0, 0x63, 0xca, 0x32, 0x9c, 0x08, 0x89, 0xdd, 0xdb, + 0xca, 0xf2, 0x69, 0x75, 0xba, 0x42, 0x73, 0x64, 0x24, 0xa3, 0x07, 0x66, 0x9c, 0xad, 0x12, 0x8c, + 0x5e, 0x2b, 0x2b, 0xdd, 0x0f, 0xeb, 0x77, 0x6e, 0xb5, 0x1b, 0xfd, 0x31, 0x69, 0xaf, 0x6e, 0x9c, + 0x3e, 0x21, 0x2d, 0xf3, 0x78, 0x58, 0x14, 0xe5, 0x80, 0xfa, 0x1d, 0xde, 0xf5, 0x36, 0x34, 0x3a, + 0xd4, 0x20, 0xdd, 0x23, 0x5b, 0x73, 0x96, 0xf0, 0x88, 0x49, 0xf1, 0x9f, 0xb9, 0xa6, 0x98, 0xed, + 0x8b, 0x82, 0x21, 0xf7, 0xbf, 0x5b, 0xa4, 0x55, 0xde, 0xc2, 0xf5, 0x7a, 0xeb, 0x7a, 0x3d, 0x65, + 0xa4, 0x53, 0xec, 0xc0, 0x5f, 0x59, 0xbf, 0xf2, 0x6b, 0x0e, 0xdc, 0xca, 0xf9, 0x14, 0xc3, 0x2d, + 0x7b, 0x7b, 0x74, 0x7e, 0x05, 0x1b, 0x1d, 0x9e, 0x2e, 0x6c, 0xeb, 0x6c, 0x61, 0x5b, 0x7f, 0x16, + 0xb6, 0xf5, 0x6d, 0x69, 0xd7, 0xce, 0x96, 0x76, 0xed, 0xe7, 0xd2, 0xae, 0x7d, 0x7c, 0x16, 0x73, + 0x39, 0x99, 0x05, 0x4e, 0x28, 0xa6, 0x2e, 0x02, 0xdf, 0x3f, 0x77, 0x52, 0x17, 0x65, 0xe5, 0x1e, + 0x9b, 0x6f, 0xde, 0x95, 0x27, 0x19, 0x60, 0xd0, 0x50, 0x94, 0xe7, 0xff, 0x02, 0x00, 0x00, 0xff, + 0xff, 0x29, 0xe9, 0x57, 0x70, 0x5a, 0x04, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PriceSnapshots) > 0 { + for iNdEx := len(m.PriceSnapshots) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PriceSnapshots[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } + if len(m.AggregateExchangeRateVotes) > 0 { + for iNdEx := len(m.AggregateExchangeRateVotes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AggregateExchangeRateVotes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if len(m.PenaltyCounters) > 0 { + for iNdEx := len(m.PenaltyCounters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PenaltyCounters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.ExchangeRates) > 0 { + for iNdEx := len(m.ExchangeRates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ExchangeRates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.FeederDelegations) > 0 { + for iNdEx := len(m.FeederDelegations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FeederDelegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *FeederDelegation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FeederDelegation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FeederDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.FeederAddress) > 0 { + i -= len(m.FeederAddress) + copy(dAtA[i:], m.FeederAddress) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.FeederAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PenaltyCounter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PenaltyCounter) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PenaltyCounter) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.VotePenaltyCounter != nil { + { + size, err := m.VotePenaltyCounter.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.FeederDelegations) > 0 { + for _, e := range m.FeederDelegations { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.ExchangeRates) > 0 { + for _, e := range m.ExchangeRates { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.PenaltyCounters) > 0 { + for _, e := range m.PenaltyCounters { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.AggregateExchangeRateVotes) > 0 { + for _, e := range m.AggregateExchangeRateVotes { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.PriceSnapshots) > 0 { + for _, e := range m.PriceSnapshots { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func (m *FeederDelegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FeederAddress) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func (m *PenaltyCounter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if m.VotePenaltyCounter != nil { + l = m.VotePenaltyCounter.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeederDelegations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeederDelegations = append(m.FeederDelegations, FeederDelegation{}) + if err := m.FeederDelegations[len(m.FeederDelegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExchangeRates = append(m.ExchangeRates, ExchangeRateTuple{}) + if err := m.ExchangeRates[len(m.ExchangeRates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PenaltyCounters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PenaltyCounters = append(m.PenaltyCounters, PenaltyCounter{}) + if err := m.PenaltyCounters[len(m.PenaltyCounters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AggregateExchangeRateVotes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AggregateExchangeRateVotes = append(m.AggregateExchangeRateVotes, AggregateExchangeRateVote{}) + if err := m.AggregateExchangeRateVotes[len(m.AggregateExchangeRateVotes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PriceSnapshots", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PriceSnapshots = append(m.PriceSnapshots, PriceSnapshot{}) + if err := m.PriceSnapshots[len(m.PriceSnapshots)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FeederDelegation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FeederDelegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FeederDelegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeederAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeederAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PenaltyCounter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PenaltyCounter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PenaltyCounter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotePenaltyCounter", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VotePenaltyCounter == nil { + m.VotePenaltyCounter = &VotePenaltyCounter{} + } + if err := m.VotePenaltyCounter.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/cmd/sei-cosmos-exporter/types/keys.go b/cmd/sei-cosmos-exporter/types/keys.go new file mode 100755 index 0000000..d42dc33 --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/keys.go @@ -0,0 +1,86 @@ +package types + +import ( + "encoding/binary" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" +) + +const ( + // ModuleName is the name of the oracle module + ModuleName = "oracle" + + // StoreKey is the string store representation + StoreKey = ModuleName + + // RouterKey is the msg router key for the oracle module + RouterKey = ModuleName + + // QuerierRoute is the query router key for the oracle module + QuerierRoute = ModuleName +) + +// Keys for oracle store +// Items are stored with the following key: values +// +// - 0x01: sdk.Dec +// +// - 0x02: accAddress +// +// - 0x03: int64 +// +// - 0x04: DEPRECATED: AggregateExchangeRatePrevote +// +// - 0x05: AggregateExchangeRateVote +// +// - 0x06: sdk.Dec +var ( + // Keys for store prefixes + ExchangeRateKey = []byte{0x01} // prefix for each key to a rate + FeederDelegationKey = []byte{0x02} // prefix for each key to a feeder delegation + VotePenaltyCounterKey = []byte{0x03} // prefix for each key to a miss counter + // DEPRECATED AggregateExchangeRatePrevoteKey = []byte{0x04} + AggregateExchangeRateVoteKey = []byte{0x05} // prefix for each key to a aggregate vote + VoteTargetKey = []byte{0x06} // prefix for each key to a vote target + PriceSnapshotKey = []byte{0x07} // key for price snapshots history +) + +// GetExchangeRateKey - stored by *denom* +func GetExchangeRateKey(denom string) []byte { + return append(ExchangeRateKey, []byte(denom)...) +} + +// GetFeederDelegationKey - stored by *Validator* address +func GetFeederDelegationKey(v sdk.ValAddress) []byte { + return append(FeederDelegationKey, address.MustLengthPrefix(v)...) +} + +// GetVotePenaltyCounterKey - stored by *Validator* address +func GetVotePenaltyCounterKey(v sdk.ValAddress) []byte { + return append(VotePenaltyCounterKey, address.MustLengthPrefix(v)...) +} + +// GetAggregateExchangeRateVoteKey - stored by *Validator* address +func GetAggregateExchangeRateVoteKey(v sdk.ValAddress) []byte { + return append(AggregateExchangeRateVoteKey, address.MustLengthPrefix(v)...) +} + +func GetVoteTargetKey(d string) []byte { + return append(VoteTargetKey, []byte(d)...) +} + +func ExtractDenomFromVoteTargetKey(key []byte) (denom string) { + denom = string(key[1:]) + return +} + +func GetKeyForTimestamp(timestamp uint64) []byte { + timestampKey := make([]byte, 8) + binary.BigEndian.PutUint64(timestampKey, timestamp) + return timestampKey +} + +func GetPriceSnapshotKey(timestamp uint64) []byte { + return append(PriceSnapshotKey, GetKeyForTimestamp(timestamp)...) +} diff --git a/cmd/sei-cosmos-exporter/types/msgs.go b/cmd/sei-cosmos-exporter/types/msgs.go new file mode 100644 index 0000000..fb4037d --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/msgs.go @@ -0,0 +1,130 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + cosmos_math "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrortypes "github.com/cosmos/cosmos-sdk/types/errors" +) + +// ensure Msg interface compliance at compile time +var ( + _ sdk.Msg = &MsgDelegateFeedConsent{} + _ sdk.Msg = &MsgAggregateExchangeRateVote{} +) + +// oracle message types +const ( + TypeMsgDelegateFeedConsent = "delegate_feeder" + TypeMsgAggregateExchangeRateVote = "aggregate_exchange_rate_vote" +) + +//------------------------------------------------- +//------------------------------------------------- + +// NewMsgAggregateExchangeRateVote returns MsgAggregateExchangeRateVote instance +func NewMsgAggregateExchangeRateVote(exchangeRates string, feeder sdk.AccAddress, validator sdk.ValAddress) *MsgAggregateExchangeRateVote { + return &MsgAggregateExchangeRateVote{ + ExchangeRates: exchangeRates, + Feeder: feeder.String(), + Validator: validator.String(), + } +} + +// Route implements sdk.Msg +func (msg MsgAggregateExchangeRateVote) Route() string { return RouterKey } + +// Type implements sdk.Msg +func (msg MsgAggregateExchangeRateVote) Type() string { return TypeMsgAggregateExchangeRateVote } + +// GetSignBytes implements sdk.Msg +func (msg MsgAggregateExchangeRateVote) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners implements sdk.Msg +func (msg MsgAggregateExchangeRateVote) GetSigners() []sdk.AccAddress { + feeder, err := sdk.AccAddressFromBech32(msg.Feeder) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{feeder} +} + +// ValidateBasic implements sdk.Msg +func (msg MsgAggregateExchangeRateVote) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Feeder) + if err != nil { + return sdkerrors.Wrapf(sdkerrortypes.ErrInvalidAddress, "Invalid feeder address (%s)", err) + } + + _, err = sdk.ValAddressFromBech32(msg.Validator) + if err != nil { + return sdkerrors.Wrapf(sdkerrortypes.ErrInvalidAddress, "Invalid operator address (%s)", err) + } + + if l := len(msg.ExchangeRates); l == 0 { + return sdkerrors.Wrap(sdkerrortypes.ErrUnknownRequest, "must provide at least one oracle exchange rate") + } else if l > 4096 { + return sdkerrors.Wrap(sdkerrortypes.ErrInvalidRequest, "exchange rates string can not exceed 4096 characters") + } + + exchangeRates, err := ParseExchangeRateTuples(msg.ExchangeRates) + if err != nil { + return sdkerrors.Wrap(sdkerrortypes.ErrInvalidCoins, "failed to parse exchange rates string cause: "+err.Error()) + } + + for _, exchangeRate := range exchangeRates { + // Check overflow bit length + if exchangeRate.ExchangeRate.BigInt().BitLen() > 255+cosmos_math.LegacyDecimalPrecisionBits { + return sdkerrors.Wrap(ErrInvalidExchangeRate, "overflow") + } + } + return nil +} + +// NewMsgDelegateFeedConsent creates a MsgDelegateFeedConsent instance +func NewMsgDelegateFeedConsent(operatorAddress sdk.ValAddress, feederAddress sdk.AccAddress) *MsgDelegateFeedConsent { + return &MsgDelegateFeedConsent{ + Operator: operatorAddress.String(), + Delegate: feederAddress.String(), + } +} + +// Route implements sdk.Msg +func (msg MsgDelegateFeedConsent) Route() string { return RouterKey } + +// Type implements sdk.Msg +func (msg MsgDelegateFeedConsent) Type() string { return TypeMsgDelegateFeedConsent } + +// GetSignBytes implements sdk.Msg +func (msg MsgDelegateFeedConsent) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners implements sdk.Msg +func (msg MsgDelegateFeedConsent) GetSigners() []sdk.AccAddress { + operator, err := sdk.ValAddressFromBech32(msg.Operator) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{sdk.AccAddress(operator)} +} + +// ValidateBasic implements sdk.Msg +func (msg MsgDelegateFeedConsent) ValidateBasic() error { + _, err := sdk.ValAddressFromBech32(msg.Operator) + if err != nil { + return sdkerrors.Wrapf(sdkerrortypes.ErrInvalidAddress, "Invalid operator address (%s)", err) + } + + _, err = sdk.AccAddressFromBech32(msg.Delegate) + if err != nil { + return sdkerrors.Wrapf(sdkerrortypes.ErrInvalidAddress, "Invalid delegate address (%s)", err) + } + + return nil +} diff --git a/cmd/sei-cosmos-exporter/types/oracle.pb.go b/cmd/sei-cosmos-exporter/types/oracle.pb.go new file mode 100644 index 0000000..d5d3e7f --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/oracle.pb.go @@ -0,0 +1,2469 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: oracle/oracle.proto + +package types + +import ( + cosmos_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types" + + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Params struct { + // The number of blocks per voting window, at the end of the vote period, the oracle votes are assessed and exchange rates are calculated. If the vote period is 1 this is equivalent to having oracle votes assessed and exchange rates calculated in each block. + VotePeriod uint64 `protobuf:"varint,1,opt,name=vote_period,json=votePeriod,proto3" json:"vote_period,omitempty" yaml:"vote_period"` + VoteThreshold cosmos_math.LegacyDec `protobuf:"bytes,2,opt,name=vote_threshold,json=voteThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"vote_threshold" yaml:"vote_threshold"` + RewardBand cosmos_math.LegacyDec `protobuf:"bytes,3,opt,name=reward_band,json=rewardBand,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reward_band" yaml:"reward_band"` + Whitelist DenomList `protobuf:"bytes,4,rep,name=whitelist,proto3,castrepeated=DenomList" json:"whitelist" yaml:"whitelist"` + SlashFraction cosmos_math.LegacyDec `protobuf:"bytes,5,opt,name=slash_fraction,json=slashFraction,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"slash_fraction" yaml:"slash_fraction"` + // The interval in blocks at which the oracle module will assess validator penalty counters, and penalize validators with too poor performance. + SlashWindow uint64 `protobuf:"varint,6,opt,name=slash_window,json=slashWindow,proto3" json:"slash_window,omitempty" yaml:"slash_window"` + // The minimum percentage of voting windows for which a validator must have `success`es in order to not be penalized at the end of the slash window. + MinValidPerWindow cosmos_math.LegacyDec `protobuf:"bytes,7,opt,name=min_valid_per_window,json=minValidPerWindow,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_valid_per_window" yaml:"min_valid_per_window"` + LookbackDuration uint64 `protobuf:"varint,9,opt,name=lookback_duration,json=lookbackDuration,proto3" json:"lookback_duration,omitempty" yaml:"lookback_duration"` +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_dc470b50b143d488, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetVotePeriod() uint64 { + if m != nil { + return m.VotePeriod + } + return 0 +} + +func (m *Params) GetWhitelist() DenomList { + if m != nil { + return m.Whitelist + } + return nil +} + +func (m *Params) GetSlashWindow() uint64 { + if m != nil { + return m.SlashWindow + } + return 0 +} + +func (m *Params) GetLookbackDuration() uint64 { + if m != nil { + return m.LookbackDuration + } + return 0 +} + +type Denom struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" yaml:"name"` +} + +func (m *Denom) Reset() { *m = Denom{} } +func (*Denom) ProtoMessage() {} +func (*Denom) Descriptor() ([]byte, []int) { + return fileDescriptor_dc470b50b143d488, []int{1} +} +func (m *Denom) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Denom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Denom.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Denom) XXX_Merge(src proto.Message) { + xxx_messageInfo_Denom.Merge(m, src) +} +func (m *Denom) XXX_Size() int { + return m.Size() +} +func (m *Denom) XXX_DiscardUnknown() { + xxx_messageInfo_Denom.DiscardUnknown(m) +} + +var xxx_messageInfo_Denom proto.InternalMessageInfo + +type AggregateExchangeRateVote struct { + ExchangeRateTuples ExchangeRateTuples `protobuf:"bytes,1,rep,name=exchange_rate_tuples,json=exchangeRateTuples,proto3,castrepeated=ExchangeRateTuples" json:"exchange_rate_tuples" yaml:"exchange_rate_tuples"` + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty" yaml:"voter"` +} + +func (m *AggregateExchangeRateVote) Reset() { *m = AggregateExchangeRateVote{} } +func (*AggregateExchangeRateVote) ProtoMessage() {} +func (*AggregateExchangeRateVote) Descriptor() ([]byte, []int) { + return fileDescriptor_dc470b50b143d488, []int{2} +} +func (m *AggregateExchangeRateVote) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AggregateExchangeRateVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AggregateExchangeRateVote.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AggregateExchangeRateVote) XXX_Merge(src proto.Message) { + xxx_messageInfo_AggregateExchangeRateVote.Merge(m, src) +} +func (m *AggregateExchangeRateVote) XXX_Size() int { + return m.Size() +} +func (m *AggregateExchangeRateVote) XXX_DiscardUnknown() { + xxx_messageInfo_AggregateExchangeRateVote.DiscardUnknown(m) +} + +var xxx_messageInfo_AggregateExchangeRateVote proto.InternalMessageInfo + +type ExchangeRateTuple struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` + ExchangeRate cosmos_math.LegacyDec `protobuf:"bytes,2,opt,name=exchange_rate,json=exchangeRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"exchange_rate" yaml:"exchange_rate"` +} + +func (m *ExchangeRateTuple) Reset() { *m = ExchangeRateTuple{} } +func (*ExchangeRateTuple) ProtoMessage() {} +func (*ExchangeRateTuple) Descriptor() ([]byte, []int) { + return fileDescriptor_dc470b50b143d488, []int{3} +} +func (m *ExchangeRateTuple) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExchangeRateTuple) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExchangeRateTuple.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ExchangeRateTuple) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExchangeRateTuple.Merge(m, src) +} +func (m *ExchangeRateTuple) XXX_Size() int { + return m.Size() +} +func (m *ExchangeRateTuple) XXX_DiscardUnknown() { + xxx_messageInfo_ExchangeRateTuple.DiscardUnknown(m) +} + +var xxx_messageInfo_ExchangeRateTuple proto.InternalMessageInfo + +type OracleExchangeRate struct { + ExchangeRate cosmos_math.LegacyDec `protobuf:"bytes,1,opt,name=exchange_rate,json=exchangeRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"exchange_rate" yaml:"exchange_rate"` + LastUpdate cosmos_math.Int `protobuf:"bytes,2,opt,name=last_update,json=lastUpdate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"last_update" yaml:"last_update"` + LastUpdateTimestamp int64 `protobuf:"varint,3,opt,name=last_update_timestamp,json=lastUpdateTimestamp,proto3" json:"last_update_timestamp,omitempty" yaml:"last_update_timestamp"` +} + +func (m *OracleExchangeRate) Reset() { *m = OracleExchangeRate{} } +func (*OracleExchangeRate) ProtoMessage() {} +func (*OracleExchangeRate) Descriptor() ([]byte, []int) { + return fileDescriptor_dc470b50b143d488, []int{4} +} +func (m *OracleExchangeRate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OracleExchangeRate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OracleExchangeRate.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *OracleExchangeRate) XXX_Merge(src proto.Message) { + xxx_messageInfo_OracleExchangeRate.Merge(m, src) +} +func (m *OracleExchangeRate) XXX_Size() int { + return m.Size() +} +func (m *OracleExchangeRate) XXX_DiscardUnknown() { + xxx_messageInfo_OracleExchangeRate.DiscardUnknown(m) +} + +var xxx_messageInfo_OracleExchangeRate proto.InternalMessageInfo + +type PriceSnapshotItem struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + OracleExchangeRate OracleExchangeRate `protobuf:"bytes,2,opt,name=oracle_exchange_rate,json=oracleExchangeRate,proto3" json:"oracle_exchange_rate"` +} + +func (m *PriceSnapshotItem) Reset() { *m = PriceSnapshotItem{} } +func (m *PriceSnapshotItem) String() string { return proto.CompactTextString(m) } +func (*PriceSnapshotItem) ProtoMessage() {} +func (*PriceSnapshotItem) Descriptor() ([]byte, []int) { + return fileDescriptor_dc470b50b143d488, []int{5} +} +func (m *PriceSnapshotItem) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PriceSnapshotItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PriceSnapshotItem.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PriceSnapshotItem) XXX_Merge(src proto.Message) { + xxx_messageInfo_PriceSnapshotItem.Merge(m, src) +} +func (m *PriceSnapshotItem) XXX_Size() int { + return m.Size() +} +func (m *PriceSnapshotItem) XXX_DiscardUnknown() { + xxx_messageInfo_PriceSnapshotItem.DiscardUnknown(m) +} + +var xxx_messageInfo_PriceSnapshotItem proto.InternalMessageInfo + +func (m *PriceSnapshotItem) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *PriceSnapshotItem) GetOracleExchangeRate() OracleExchangeRate { + if m != nil { + return m.OracleExchangeRate + } + return OracleExchangeRate{} +} + +type PriceSnapshot struct { + SnapshotTimestamp int64 `protobuf:"varint,1,opt,name=snapshot_timestamp,json=snapshotTimestamp,proto3" json:"snapshot_timestamp,omitempty" yaml:"snapshot_timestamp"` + PriceSnapshotItems PriceSnapshotItems `protobuf:"bytes,2,rep,name=price_snapshot_items,json=priceSnapshotItems,proto3,castrepeated=PriceSnapshotItems" json:"price_snapshot_items" yaml:"price_snapshot_items"` +} + +func (m *PriceSnapshot) Reset() { *m = PriceSnapshot{} } +func (m *PriceSnapshot) String() string { return proto.CompactTextString(m) } +func (*PriceSnapshot) ProtoMessage() {} +func (*PriceSnapshot) Descriptor() ([]byte, []int) { + return fileDescriptor_dc470b50b143d488, []int{6} +} +func (m *PriceSnapshot) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PriceSnapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PriceSnapshot.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PriceSnapshot) XXX_Merge(src proto.Message) { + xxx_messageInfo_PriceSnapshot.Merge(m, src) +} +func (m *PriceSnapshot) XXX_Size() int { + return m.Size() +} +func (m *PriceSnapshot) XXX_DiscardUnknown() { + xxx_messageInfo_PriceSnapshot.DiscardUnknown(m) +} + +var xxx_messageInfo_PriceSnapshot proto.InternalMessageInfo + +func (m *PriceSnapshot) GetSnapshotTimestamp() int64 { + if m != nil { + return m.SnapshotTimestamp + } + return 0 +} + +func (m *PriceSnapshot) GetPriceSnapshotItems() PriceSnapshotItems { + if m != nil { + return m.PriceSnapshotItems + } + return nil +} + +type OracleTwap struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Twap cosmos_math.LegacyDec `protobuf:"bytes,2,opt,name=twap,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"twap" yaml:"twap"` + LookbackSeconds int64 `protobuf:"varint,3,opt,name=lookback_seconds,json=lookbackSeconds,proto3" json:"lookback_seconds,omitempty"` +} + +func (m *OracleTwap) Reset() { *m = OracleTwap{} } +func (m *OracleTwap) String() string { return proto.CompactTextString(m) } +func (*OracleTwap) ProtoMessage() {} +func (*OracleTwap) Descriptor() ([]byte, []int) { + return fileDescriptor_dc470b50b143d488, []int{7} +} +func (m *OracleTwap) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OracleTwap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OracleTwap.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *OracleTwap) XXX_Merge(src proto.Message) { + xxx_messageInfo_OracleTwap.Merge(m, src) +} +func (m *OracleTwap) XXX_Size() int { + return m.Size() +} +func (m *OracleTwap) XXX_DiscardUnknown() { + xxx_messageInfo_OracleTwap.DiscardUnknown(m) +} + +var xxx_messageInfo_OracleTwap proto.InternalMessageInfo + +func (m *OracleTwap) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *OracleTwap) GetLookbackSeconds() int64 { + if m != nil { + return m.LookbackSeconds + } + return 0 +} + +type VotePenaltyCounter struct { + MissCount uint64 `protobuf:"varint,1,opt,name=miss_count,json=missCount,proto3" json:"miss_count,omitempty"` + AbstainCount uint64 `protobuf:"varint,2,opt,name=abstain_count,json=abstainCount,proto3" json:"abstain_count,omitempty"` + SuccessCount uint64 `protobuf:"varint,3,opt,name=success_count,json=successCount,proto3" json:"success_count,omitempty"` +} + +func (m *VotePenaltyCounter) Reset() { *m = VotePenaltyCounter{} } +func (m *VotePenaltyCounter) String() string { return proto.CompactTextString(m) } +func (*VotePenaltyCounter) ProtoMessage() {} +func (*VotePenaltyCounter) Descriptor() ([]byte, []int) { + return fileDescriptor_dc470b50b143d488, []int{8} +} +func (m *VotePenaltyCounter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VotePenaltyCounter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VotePenaltyCounter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *VotePenaltyCounter) XXX_Merge(src proto.Message) { + xxx_messageInfo_VotePenaltyCounter.Merge(m, src) +} +func (m *VotePenaltyCounter) XXX_Size() int { + return m.Size() +} +func (m *VotePenaltyCounter) XXX_DiscardUnknown() { + xxx_messageInfo_VotePenaltyCounter.DiscardUnknown(m) +} + +var xxx_messageInfo_VotePenaltyCounter proto.InternalMessageInfo + +func (m *VotePenaltyCounter) GetMissCount() uint64 { + if m != nil { + return m.MissCount + } + return 0 +} + +func (m *VotePenaltyCounter) GetAbstainCount() uint64 { + if m != nil { + return m.AbstainCount + } + return 0 +} + +func (m *VotePenaltyCounter) GetSuccessCount() uint64 { + if m != nil { + return m.SuccessCount + } + return 0 +} + +func init() { + proto.RegisterType((*Params)(nil), "seiprotocol.seichain.oracle.Params") + proto.RegisterType((*Denom)(nil), "seiprotocol.seichain.oracle.Denom") + proto.RegisterType((*AggregateExchangeRateVote)(nil), "seiprotocol.seichain.oracle.AggregateExchangeRateVote") + proto.RegisterType((*ExchangeRateTuple)(nil), "seiprotocol.seichain.oracle.ExchangeRateTuple") + proto.RegisterType((*OracleExchangeRate)(nil), "seiprotocol.seichain.oracle.OracleExchangeRate") + proto.RegisterType((*PriceSnapshotItem)(nil), "seiprotocol.seichain.oracle.PriceSnapshotItem") + proto.RegisterType((*PriceSnapshot)(nil), "seiprotocol.seichain.oracle.PriceSnapshot") + proto.RegisterType((*OracleTwap)(nil), "seiprotocol.seichain.oracle.OracleTwap") + proto.RegisterType((*VotePenaltyCounter)(nil), "seiprotocol.seichain.oracle.VotePenaltyCounter") +} + +func init() { proto.RegisterFile("oracle/oracle.proto", fileDescriptor_dc470b50b143d488) } + +var fileDescriptor_dc470b50b143d488 = []byte{ + // 992 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xbd, 0x6f, 0x23, 0x45, + 0x14, 0xf7, 0xe6, 0x0b, 0x3c, 0xb6, 0xb9, 0x78, 0xe2, 0x03, 0xdf, 0x97, 0x37, 0x9a, 0x13, 0xa7, + 0x50, 0x9c, 0xcd, 0x1d, 0x05, 0xc2, 0x12, 0x05, 0x26, 0x1c, 0x0a, 0x3a, 0x44, 0x98, 0x33, 0x41, + 0xa2, 0x59, 0x8d, 0x77, 0x07, 0x7b, 0x94, 0xdd, 0x9d, 0xd5, 0xce, 0x38, 0xbe, 0x14, 0x50, 0x50, + 0x51, 0x22, 0x2a, 0x24, 0x9a, 0xd4, 0xfc, 0x01, 0xfc, 0x0d, 0x57, 0x50, 0x5c, 0x89, 0x28, 0x16, + 0x94, 0x34, 0x74, 0x48, 0x6e, 0x69, 0xd0, 0x7c, 0xd8, 0xde, 0x64, 0x43, 0x84, 0x85, 0xae, 0xda, + 0x7d, 0xbf, 0xf7, 0xe6, 0x37, 0x6f, 0x7e, 0xef, 0xbd, 0xd1, 0x80, 0x2d, 0x9e, 0x12, 0x3f, 0xa4, + 0x1d, 0xf3, 0x69, 0x27, 0x29, 0x97, 0x1c, 0xde, 0x12, 0x94, 0xe9, 0x3f, 0x9f, 0x87, 0x6d, 0x41, + 0x99, 0x3f, 0x22, 0x2c, 0x6e, 0x9b, 0x90, 0x9b, 0x8d, 0x21, 0x1f, 0x72, 0xed, 0xed, 0xa8, 0x3f, + 0xb3, 0xe4, 0x66, 0xcb, 0xe7, 0x22, 0xe2, 0xa2, 0x33, 0x20, 0x82, 0x76, 0x8e, 0x1e, 0x0c, 0xa8, + 0x24, 0x0f, 0x3a, 0x3e, 0x67, 0xb1, 0xf1, 0xa3, 0x6f, 0x36, 0xc0, 0xc6, 0x3e, 0x49, 0x49, 0x24, + 0xe0, 0xdb, 0xa0, 0x72, 0xc4, 0x25, 0xf5, 0x12, 0x9a, 0x32, 0x1e, 0x34, 0x9d, 0x6d, 0x67, 0x67, + 0xad, 0xf7, 0xea, 0x34, 0x73, 0xe1, 0x31, 0x89, 0xc2, 0x2e, 0xca, 0x39, 0x11, 0x06, 0xca, 0xda, + 0xd7, 0x06, 0x8c, 0xc1, 0x2b, 0xda, 0x27, 0x47, 0x29, 0x15, 0x23, 0x1e, 0x06, 0xcd, 0x95, 0x6d, + 0x67, 0xa7, 0xdc, 0xfb, 0xf0, 0x59, 0xe6, 0x96, 0x7e, 0xcb, 0xdc, 0x7b, 0x43, 0x26, 0x47, 0xe3, + 0x41, 0xdb, 0xe7, 0x51, 0xc7, 0xa6, 0x63, 0x3e, 0xf7, 0x45, 0x70, 0xd8, 0x91, 0xc7, 0x09, 0x15, + 0xed, 0x5d, 0xea, 0x4f, 0x33, 0xf7, 0x7a, 0x6e, 0xa7, 0x39, 0x1b, 0xc2, 0x35, 0x05, 0xf4, 0x67, + 0x36, 0xa4, 0xa0, 0x92, 0xd2, 0x09, 0x49, 0x03, 0x6f, 0x40, 0xe2, 0xa0, 0xb9, 0xaa, 0x37, 0xdb, + 0x5d, 0x7a, 0x33, 0x7b, 0xac, 0x1c, 0x15, 0xc2, 0xc0, 0x58, 0x3d, 0x12, 0x07, 0x70, 0x08, 0xca, + 0x93, 0x11, 0x93, 0x34, 0x64, 0x42, 0x36, 0xd7, 0xb6, 0x57, 0x77, 0x2a, 0x0f, 0x51, 0xfb, 0x8a, + 0x0a, 0xb4, 0x77, 0x69, 0xcc, 0xa3, 0xde, 0xeb, 0x2a, 0x91, 0x69, 0xe6, 0x6e, 0x1a, 0xfa, 0x39, + 0x05, 0xfa, 0xe9, 0x77, 0xb7, 0xac, 0x43, 0x1e, 0x33, 0x21, 0xf1, 0x82, 0x5b, 0xe9, 0x27, 0x42, + 0x22, 0x46, 0xde, 0x97, 0x29, 0xf1, 0x25, 0xe3, 0x71, 0x73, 0xfd, 0xff, 0xe9, 0x77, 0x9e, 0x0d, + 0xe1, 0x9a, 0x06, 0x1e, 0x59, 0x1b, 0x76, 0x41, 0xd5, 0x44, 0x4c, 0x58, 0x1c, 0xf0, 0x49, 0x73, + 0x43, 0x57, 0xfa, 0xb5, 0x69, 0xe6, 0x6e, 0xe5, 0xd7, 0x1b, 0x2f, 0xc2, 0x15, 0x6d, 0x7e, 0xae, + 0x2d, 0xf8, 0x35, 0x68, 0x44, 0x2c, 0xf6, 0x8e, 0x48, 0xc8, 0x02, 0xd5, 0x0c, 0x33, 0x8e, 0x97, + 0x74, 0xc6, 0x1f, 0x2f, 0x9d, 0xf1, 0x2d, 0xb3, 0xe3, 0x65, 0x9c, 0x08, 0xd7, 0x23, 0x16, 0x1f, + 0x28, 0x74, 0x9f, 0xa6, 0x76, 0xff, 0x3d, 0x50, 0x0f, 0x39, 0x3f, 0x1c, 0x10, 0xff, 0xd0, 0x0b, + 0xc6, 0x29, 0xd1, 0x72, 0x95, 0xf5, 0x01, 0x6e, 0x4f, 0x33, 0xb7, 0x69, 0xe8, 0x0a, 0x21, 0x08, + 0x6f, 0xce, 0xb0, 0x5d, 0x0b, 0x75, 0x5f, 0xfe, 0xe1, 0xc4, 0x2d, 0xfd, 0x79, 0xe2, 0x3a, 0xa8, + 0x0b, 0xd6, 0x75, 0x61, 0xe0, 0x5d, 0xb0, 0x16, 0x93, 0x88, 0xea, 0xde, 0x2f, 0xf7, 0xae, 0x4d, + 0x33, 0xb7, 0x62, 0x08, 0x15, 0x8a, 0xb0, 0x76, 0x76, 0xab, 0xdf, 0x9e, 0xb8, 0x25, 0xbb, 0xb6, + 0x84, 0xfe, 0x72, 0xc0, 0x8d, 0xf7, 0x86, 0xc3, 0x94, 0x0e, 0x89, 0xa4, 0x1f, 0x3c, 0xf5, 0x47, + 0x24, 0x1e, 0x52, 0x4c, 0x24, 0x3d, 0xe0, 0x92, 0xc2, 0x1f, 0x1d, 0xd0, 0xa0, 0x16, 0xf4, 0x52, + 0xa2, 0xda, 0x7a, 0x9c, 0x84, 0x54, 0x34, 0x1d, 0xdd, 0x4f, 0xed, 0x2b, 0xfb, 0x29, 0xcf, 0xd6, + 0x57, 0xcb, 0x7a, 0xef, 0xd8, 0xde, 0xb2, 0xaa, 0x5d, 0xc6, 0xac, 0xda, 0x0c, 0x16, 0x56, 0x0a, + 0x0c, 0x69, 0x01, 0x83, 0xf7, 0xc0, 0xba, 0x9a, 0xac, 0xd4, 0xce, 0xeb, 0xe6, 0x34, 0x73, 0xab, + 0x8b, 0x09, 0x4c, 0x11, 0x36, 0xee, 0x0b, 0x27, 0xfe, 0xd9, 0x01, 0xf5, 0xc2, 0x06, 0x8a, 0x2b, + 0x50, 0x1a, 0x5a, 0xed, 0x72, 0x5c, 0x1a, 0x46, 0xd8, 0xb8, 0xe1, 0x21, 0xa8, 0x9d, 0x4b, 0xdb, + 0xee, 0xfd, 0x68, 0xe9, 0xce, 0x69, 0x5c, 0xa2, 0x01, 0xc2, 0xd5, 0xfc, 0x31, 0x2f, 0x24, 0xfe, + 0xcb, 0x0a, 0x80, 0x9f, 0x68, 0x69, 0xf3, 0xe9, 0x17, 0x33, 0x72, 0x5e, 0x5c, 0x46, 0xea, 0xee, + 0x0a, 0x89, 0x90, 0xde, 0x38, 0x09, 0x16, 0x87, 0x5f, 0xe6, 0xee, 0xda, 0x8b, 0xe5, 0xe2, 0xee, + 0xca, 0x51, 0x21, 0x0c, 0x94, 0xf5, 0x99, 0x36, 0x60, 0x1f, 0x5c, 0xcf, 0xf9, 0x3c, 0xc9, 0x22, + 0x2a, 0x24, 0x89, 0x12, 0x7d, 0x59, 0xae, 0xf6, 0xb6, 0xa7, 0x99, 0x7b, 0xbb, 0x40, 0xb1, 0x08, + 0x43, 0x78, 0x6b, 0x41, 0xd6, 0x9f, 0xa1, 0x17, 0xe4, 0xfc, 0xde, 0x01, 0xf5, 0xfd, 0x94, 0xf9, + 0xf4, 0x49, 0x4c, 0x12, 0x31, 0xe2, 0x72, 0x4f, 0xd2, 0x08, 0x36, 0xce, 0xf5, 0xc1, 0xac, 0xea, + 0x43, 0xd0, 0x30, 0x4d, 0xed, 0x15, 0x8b, 0x5f, 0x79, 0xd8, 0xb9, 0x72, 0x0c, 0x8a, 0x25, 0xeb, + 0xad, 0x29, 0xc1, 0x30, 0xe4, 0x05, 0x0f, 0xfa, 0xdb, 0x01, 0xb5, 0x73, 0x49, 0xc1, 0xc7, 0x00, + 0x0a, 0xfb, 0x9f, 0xd3, 0xc1, 0xd1, 0x3a, 0xdc, 0x99, 0x66, 0xee, 0x0d, 0x7b, 0xe7, 0x15, 0x62, + 0x10, 0xae, 0xcf, 0xc0, 0xb9, 0x04, 0x7a, 0xa0, 0x13, 0xc5, 0xef, 0xcd, 0x17, 0x30, 0x49, 0x23, + 0xd1, 0x5c, 0xf9, 0x0f, 0x03, 0x5d, 0x50, 0xeb, 0xe2, 0x40, 0x5f, 0xc6, 0xac, 0x07, 0xba, 0xb0, + 0x52, 0x60, 0x98, 0x14, 0x30, 0x74, 0xe2, 0x00, 0x60, 0xe4, 0xea, 0x4f, 0x48, 0xf2, 0x2f, 0xb5, + 0xf8, 0x14, 0xac, 0xc9, 0x09, 0x49, 0x6c, 0xef, 0xbd, 0xbb, 0x74, 0x9b, 0xdb, 0x2b, 0x51, 0x71, + 0x20, 0xac, 0xa9, 0xe0, 0x1b, 0x60, 0x7e, 0xbd, 0x7a, 0x82, 0xfa, 0x3c, 0x0e, 0x84, 0xe9, 0x34, + 0x7c, 0x6d, 0x86, 0x3f, 0x31, 0x30, 0xfa, 0x0a, 0xc0, 0x03, 0xfd, 0x74, 0x88, 0x49, 0x28, 0x8f, + 0xdf, 0xe7, 0xe3, 0x58, 0xd2, 0x14, 0xde, 0x01, 0x20, 0x62, 0x42, 0x78, 0xbe, 0xb2, 0xcd, 0xd3, + 0x03, 0x97, 0x15, 0xa2, 0x03, 0xe0, 0x5d, 0x50, 0x23, 0x03, 0x21, 0x09, 0x8b, 0x6d, 0xc4, 0x8a, + 0x8e, 0xa8, 0x5a, 0x70, 0x1e, 0x24, 0xc6, 0xbe, 0x4f, 0xe7, 0x34, 0xab, 0x26, 0xc8, 0x82, 0x3a, + 0xa8, 0xf7, 0xd1, 0xb3, 0xd3, 0x96, 0xf3, 0xfc, 0xb4, 0xe5, 0xfc, 0x71, 0xda, 0x72, 0xbe, 0x3b, + 0x6b, 0x95, 0x9e, 0x9f, 0xb5, 0x4a, 0xbf, 0x9e, 0xb5, 0x4a, 0x5f, 0xbc, 0x99, 0x13, 0x40, 0x50, + 0x76, 0x7f, 0x56, 0x45, 0x6d, 0xe8, 0x32, 0x76, 0x9e, 0xda, 0xe7, 0x98, 0x91, 0x63, 0xb0, 0xa1, + 0x43, 0xde, 0xfa, 0x27, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x10, 0x21, 0xd7, 0xac, 0x09, 0x00, 0x00, +} + +func (this *Params) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Params) + if !ok { + that2, ok := that.(Params) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.VotePeriod != that1.VotePeriod { + return false + } + if !this.VoteThreshold.Equal(that1.VoteThreshold) { + return false + } + if !this.RewardBand.Equal(that1.RewardBand) { + return false + } + if len(this.Whitelist) != len(that1.Whitelist) { + return false + } + for i := range this.Whitelist { + if !this.Whitelist[i].Equal(&that1.Whitelist[i]) { + return false + } + } + if !this.SlashFraction.Equal(that1.SlashFraction) { + return false + } + if this.SlashWindow != that1.SlashWindow { + return false + } + if !this.MinValidPerWindow.Equal(that1.MinValidPerWindow) { + return false + } + if this.LookbackDuration != that1.LookbackDuration { + return false + } + return true +} +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LookbackDuration != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.LookbackDuration)) + i-- + dAtA[i] = 0x48 + } + { + size := m.MinValidPerWindow.Size() + i -= size + if _, err := m.MinValidPerWindow.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if m.SlashWindow != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.SlashWindow)) + i-- + dAtA[i] = 0x30 + } + { + size := m.SlashFraction.Size() + i -= size + if _, err := m.SlashFraction.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.Whitelist) > 0 { + for iNdEx := len(m.Whitelist) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Whitelist[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + { + size := m.RewardBand.Size() + i -= size + if _, err := m.RewardBand.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.VoteThreshold.Size() + i -= size + if _, err := m.VoteThreshold.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.VotePeriod != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.VotePeriod)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Denom) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Denom) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Denom) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AggregateExchangeRateVote) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AggregateExchangeRateVote) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AggregateExchangeRateVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 + } + if len(m.ExchangeRateTuples) > 0 { + for iNdEx := len(m.ExchangeRateTuples) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ExchangeRateTuples[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *ExchangeRateTuple) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ExchangeRateTuple) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExchangeRateTuple) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.ExchangeRate.Size() + i -= size + if _, err := m.ExchangeRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *OracleExchangeRate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OracleExchangeRate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OracleExchangeRate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LastUpdateTimestamp != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.LastUpdateTimestamp)) + i-- + dAtA[i] = 0x18 + } + { + size := m.LastUpdate.Size() + i -= size + if _, err := m.LastUpdate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.ExchangeRate.Size() + i -= size + if _, err := m.ExchangeRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PriceSnapshotItem) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PriceSnapshotItem) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PriceSnapshotItem) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.OracleExchangeRate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PriceSnapshot) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PriceSnapshot) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PriceSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PriceSnapshotItems) > 0 { + for iNdEx := len(m.PriceSnapshotItems) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PriceSnapshotItems[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.SnapshotTimestamp != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.SnapshotTimestamp)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *OracleTwap) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OracleTwap) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OracleTwap) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LookbackSeconds != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.LookbackSeconds)) + i-- + dAtA[i] = 0x18 + } + { + size := m.Twap.Size() + i -= size + if _, err := m.Twap.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *VotePenaltyCounter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VotePenaltyCounter) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VotePenaltyCounter) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SuccessCount != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.SuccessCount)) + i-- + dAtA[i] = 0x18 + } + if m.AbstainCount != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.AbstainCount)) + i-- + dAtA[i] = 0x10 + } + if m.MissCount != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.MissCount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintOracle(dAtA []byte, offset int, v uint64) int { + offset -= sovOracle(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.VotePeriod != 0 { + n += 1 + sovOracle(uint64(m.VotePeriod)) + } + l = m.VoteThreshold.Size() + n += 1 + l + sovOracle(uint64(l)) + l = m.RewardBand.Size() + n += 1 + l + sovOracle(uint64(l)) + if len(m.Whitelist) > 0 { + for _, e := range m.Whitelist { + l = e.Size() + n += 1 + l + sovOracle(uint64(l)) + } + } + l = m.SlashFraction.Size() + n += 1 + l + sovOracle(uint64(l)) + if m.SlashWindow != 0 { + n += 1 + sovOracle(uint64(m.SlashWindow)) + } + l = m.MinValidPerWindow.Size() + n += 1 + l + sovOracle(uint64(l)) + if m.LookbackDuration != 0 { + n += 1 + sovOracle(uint64(m.LookbackDuration)) + } + return n +} + +func (m *Denom) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + return n +} + +func (m *AggregateExchangeRateVote) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ExchangeRateTuples) > 0 { + for _, e := range m.ExchangeRateTuples { + l = e.Size() + n += 1 + l + sovOracle(uint64(l)) + } + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + return n +} + +func (m *ExchangeRateTuple) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = m.ExchangeRate.Size() + n += 1 + l + sovOracle(uint64(l)) + return n +} + +func (m *OracleExchangeRate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ExchangeRate.Size() + n += 1 + l + sovOracle(uint64(l)) + l = m.LastUpdate.Size() + n += 1 + l + sovOracle(uint64(l)) + if m.LastUpdateTimestamp != 0 { + n += 1 + sovOracle(uint64(m.LastUpdateTimestamp)) + } + return n +} + +func (m *PriceSnapshotItem) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = m.OracleExchangeRate.Size() + n += 1 + l + sovOracle(uint64(l)) + return n +} + +func (m *PriceSnapshot) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SnapshotTimestamp != 0 { + n += 1 + sovOracle(uint64(m.SnapshotTimestamp)) + } + if len(m.PriceSnapshotItems) > 0 { + for _, e := range m.PriceSnapshotItems { + l = e.Size() + n += 1 + l + sovOracle(uint64(l)) + } + } + return n +} + +func (m *OracleTwap) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = m.Twap.Size() + n += 1 + l + sovOracle(uint64(l)) + if m.LookbackSeconds != 0 { + n += 1 + sovOracle(uint64(m.LookbackSeconds)) + } + return n +} + +func (m *VotePenaltyCounter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MissCount != 0 { + n += 1 + sovOracle(uint64(m.MissCount)) + } + if m.AbstainCount != 0 { + n += 1 + sovOracle(uint64(m.AbstainCount)) + } + if m.SuccessCount != 0 { + n += 1 + sovOracle(uint64(m.SuccessCount)) + } + return n +} + +func sovOracle(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozOracle(x uint64) (n int) { + return sovOracle(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VotePeriod", wireType) + } + m.VotePeriod = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VotePeriod |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VoteThreshold", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.VoteThreshold.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardBand", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RewardBand.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Whitelist", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Whitelist = append(m.Whitelist, Denom{}) + if err := m.Whitelist[len(m.Whitelist)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SlashFraction", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SlashFraction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SlashWindow", wireType) + } + m.SlashWindow = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SlashWindow |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinValidPerWindow", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinValidPerWindow.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LookbackDuration", wireType) + } + m.LookbackDuration = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LookbackDuration |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Denom) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Denom: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Denom: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AggregateExchangeRateVote) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AggregateExchangeRateVote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AggregateExchangeRateVote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRateTuples", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExchangeRateTuples = append(m.ExchangeRateTuples, ExchangeRateTuple{}) + if err := m.ExchangeRateTuples[len(m.ExchangeRateTuples)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ExchangeRateTuple) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ExchangeRateTuple: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExchangeRateTuple: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ExchangeRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OracleExchangeRate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: OracleExchangeRate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OracleExchangeRate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ExchangeRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastUpdate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LastUpdate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastUpdateTimestamp", wireType) + } + m.LastUpdateTimestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastUpdateTimestamp |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PriceSnapshotItem) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PriceSnapshotItem: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PriceSnapshotItem: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleExchangeRate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OracleExchangeRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PriceSnapshot) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PriceSnapshot: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PriceSnapshot: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SnapshotTimestamp", wireType) + } + m.SnapshotTimestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SnapshotTimestamp |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PriceSnapshotItems", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PriceSnapshotItems = append(m.PriceSnapshotItems, PriceSnapshotItem{}) + if err := m.PriceSnapshotItems[len(m.PriceSnapshotItems)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OracleTwap) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: OracleTwap: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OracleTwap: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Twap", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Twap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LookbackSeconds", wireType) + } + m.LookbackSeconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LookbackSeconds |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VotePenaltyCounter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VotePenaltyCounter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VotePenaltyCounter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MissCount", wireType) + } + m.MissCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MissCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AbstainCount", wireType) + } + m.AbstainCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AbstainCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SuccessCount", wireType) + } + m.SuccessCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SuccessCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipOracle(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowOracle + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowOracle + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowOracle + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthOracle + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupOracle + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthOracle + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthOracle = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowOracle = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupOracle = fmt.Errorf("proto: unexpected end of group") +) diff --git a/cmd/sei-cosmos-exporter/types/params.go b/cmd/sei-cosmos-exporter/types/params.go new file mode 100644 index 0000000..6b77df4 --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/params.go @@ -0,0 +1,243 @@ +package types + +import ( + "fmt" + + "gopkg.in/yaml.v2" + + cosmos_math "cosmossdk.io/math" + + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + + "github.com/pfc-developer/cosmos-exporter/cmd/sei-cosmos-exporter/utils" +) + +// Parameter keys +var ( + KeyVotePeriod = []byte("VotePeriod") + KeyVoteThreshold = []byte("VoteThreshold") + KeyRewardBand = []byte("RewardBand") + KeyWhitelist = []byte("Whitelist") + KeySlashFraction = []byte("SlashFraction") + KeySlashWindow = []byte("SlashWindow") + KeyMinValidPerWindow = []byte("MinValidPerWindow") + KeyLookbackDuration = []byte("LookbackDuration") +) + +// Default parameter values +const ( + DefaultVotePeriod = 2 // Voting every other block + DefaultSlashWindow = utils.BlocksPerDay * 2 // 2 days for oracle slashing +) + +// Default parameter values +var ( + DefaultVoteThreshold = cosmos_math.LegacyNewDecWithPrec(667, 3) // 66.7% + DefaultRewardBand = cosmos_math.LegacyNewDecWithPrec(2, 2) // 2% (-1, 1) + DefaultWhitelist = DenomList{ + {Name: utils.MicroAtomDenom}, + // {Name: utils.MicroUsdcDenom}, + // {Name: utils.MicroSeiDenom}, + {Name: utils.MicroEthDenom}, + } + DefaultSlashFraction = cosmos_math.LegacyNewDecWithPrec(0, 4) // 0.00% + DefaultMinValidPerWindow = cosmos_math.LegacyNewDecWithPrec(5, 2) // 5% + DefaultLookbackDuration = uint64(3600) // in seconds +) + +var _ paramstypes.ParamSet = &Params{} + +// DefaultParams creates default oracle module parameters +func DefaultParams() Params { + return Params{ + VotePeriod: DefaultVotePeriod, + VoteThreshold: DefaultVoteThreshold, + RewardBand: DefaultRewardBand, + Whitelist: DefaultWhitelist, + SlashFraction: DefaultSlashFraction, + SlashWindow: DefaultSlashWindow, + MinValidPerWindow: DefaultMinValidPerWindow, + LookbackDuration: DefaultLookbackDuration, + } +} + +// ParamKeyTable returns the parameter key table. +func ParamKeyTable() paramstypes.KeyTable { + return paramstypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs +// pairs of oracle module's parameters. +func (p *Params) ParamSetPairs() paramstypes.ParamSetPairs { + return paramstypes.ParamSetPairs{ + paramstypes.NewParamSetPair(KeyVotePeriod, &p.VotePeriod, validateVotePeriod), + paramstypes.NewParamSetPair(KeyVoteThreshold, &p.VoteThreshold, validateVoteThreshold), + paramstypes.NewParamSetPair(KeyRewardBand, &p.RewardBand, validateRewardBand), + paramstypes.NewParamSetPair(KeyWhitelist, &p.Whitelist, validateWhitelist), + paramstypes.NewParamSetPair(KeySlashFraction, &p.SlashFraction, validateSlashFraction), + paramstypes.NewParamSetPair(KeySlashWindow, &p.SlashWindow, validateSlashWindow), + paramstypes.NewParamSetPair(KeyMinValidPerWindow, &p.MinValidPerWindow, validateMinValidPerWindow), + paramstypes.NewParamSetPair(KeyLookbackDuration, &p.LookbackDuration, validateLookbackDuration), + } +} + +// String implements fmt.Stringer interface +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} + +// Validate performs basic validation on oracle parameters. +func (p Params) Validate() error { + if p.VotePeriod == 0 { + return fmt.Errorf("oracle parameter VotePeriod must be > 0, is %d", p.VotePeriod) + } + if p.VoteThreshold.LTE(cosmos_math.LegacyNewDecWithPrec(33, 2)) { + return fmt.Errorf("oracle parameter VoteThreshold must be greater than 33 percent") + } + + if p.RewardBand.GT(cosmos_math.LegacyOneDec()) || p.RewardBand.IsNegative() { + return fmt.Errorf("oracle parameter RewardBand must be between [0, 1]") + } + + if p.SlashFraction.GT(cosmos_math.LegacyOneDec()) || p.SlashFraction.IsNegative() { + return fmt.Errorf("oracle parameter SlashFraction must be between [0, 1]") + } + + if p.SlashWindow < p.VotePeriod { + return fmt.Errorf("oracle parameter SlashWindow must be greater than or equal with VotePeriod") + } + + if p.SlashWindow%p.VotePeriod != 0 { + return fmt.Errorf("oracle parameter SlashWindow must be divisible by VotePeriod") + } + + if p.MinValidPerWindow.GT(cosmos_math.LegacyOneDec()) || p.MinValidPerWindow.IsNegative() { + return fmt.Errorf("oracle parameter MinValidPerWindow must be between [0, 1]") + } + + for _, denom := range p.Whitelist { + if len(denom.Name) == 0 { + return fmt.Errorf("oracle parameter Whitelist Denom must have name") + } + } + return nil +} + +func validateVotePeriod(i interface{}) error { + v, ok := i.(uint64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v == 0 { + return fmt.Errorf("vote period must be positive: %d", v) + } + + return nil +} + +func validateVoteThreshold(i interface{}) error { + v, ok := i.(cosmos_math.LegacyDec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNegative() { + return fmt.Errorf("vote threshold must be bigger than 0%%: %s", v) + } + + if v.GT(cosmos_math.LegacyOneDec()) { + return fmt.Errorf("vote threshold too large: %s", v) + } + + return nil +} + +func validateRewardBand(i interface{}) error { + v, ok := i.(cosmos_math.LegacyDec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNegative() { + return fmt.Errorf("reward band must be positive: %s", v) + } + + if v.GT(cosmos_math.LegacyOneDec()) { + return fmt.Errorf("reward band is too large: %s", v) + } + + return nil +} + +func validateWhitelist(i interface{}) error { + v, ok := i.(DenomList) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + for _, d := range v { + if len(d.Name) == 0 { + return fmt.Errorf("oracle parameter Whitelist Denom must have name") + } + } + + return nil +} + +func validateSlashFraction(i interface{}) error { + v, ok := i.(cosmos_math.LegacyDec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNegative() { + return fmt.Errorf("slash fraction must be positive: %s", v) + } + + if v.GT(cosmos_math.LegacyOneDec()) { + return fmt.Errorf("slash fraction is too large: %s", v) + } + + return nil +} + +func validateSlashWindow(i interface{}) error { + v, ok := i.(uint64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v == 0 { + return fmt.Errorf("slash window must be positive: %d", v) + } + + return nil +} + +func validateMinValidPerWindow(i interface{}) error { + v, ok := i.(cosmos_math.LegacyDec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNegative() { + return fmt.Errorf("min valid per window must be positive: %s", v) + } + + if v.GT(cosmos_math.LegacyOneDec()) { + return fmt.Errorf("min valid per window is too large: %s", v) + } + + return nil +} + +func validateLookbackDuration(i interface{}) error { + _, ok := i.(uint64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + return nil +} diff --git a/cmd/sei-cosmos-exporter/types/querier.go b/cmd/sei-cosmos-exporter/types/querier.go new file mode 100755 index 0000000..1125092 --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/querier.go @@ -0,0 +1,87 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Defines the prefix of each query path +const ( + QueryParameters = "parameters" + QueryExchangeRate = "exchangeRate" + QueryExchangeRates = "exchangeRates" + QueryPriceSnapshotHistory = "priceSnapshotHistory" + QueryTwaps = "twaps" + QueryActives = "actives" + QueryFeederDelegation = "feederDelegation" + QueryVotePenaltyCounter = "votePenaltyCounter" + QueryAggregateVote = "aggregateVote" + QueryAggregateVotes = "aggregateVotes" + QueryVoteTargets = "voteTargets" +) + +// QueryExchangeRateParams defines the params for the following queries: +// - 'custom/oracle/exchange_rate' +type QueryExchangeRateParams struct { + Denom string +} + +// NewQueryExchangeRateParams returns params for exchange_rate query +func NewQueryExchangeRateParams(denom string) QueryExchangeRateParams { + return QueryExchangeRateParams{denom} +} + +// QueryTwapParams defines the params for the following queries: +// - 'custom/oracle/twap' +type QueryTwapsParams struct { + LookbackSeconds int64 +} + +// NewQueryExchangeRateParams returns params for exchange_rate query +func NewQueryTwapsParams(lookbackSeconds int64) QueryTwapsParams { + return QueryTwapsParams{lookbackSeconds} +} + +// QueryVotesParams defines the params for the following queries: +// - 'custom/oracle/votes' +type QueryVotesParams struct { + Voter sdk.ValAddress + Denom string +} + +// NewQueryVotesParams returns params for exchange_rate votes query +func NewQueryVotesParams(voter sdk.ValAddress, denom string) QueryVotesParams { + return QueryVotesParams{voter, denom} +} + +// QueryFeederDelegationParams defeins the params for the following queries: +// - 'custom/oracle/feederDelegation' +type QueryFeederDelegationParams struct { + Validator sdk.ValAddress +} + +// NewQueryFeederDelegationParams returns params for feeder delegation query +func NewQueryFeederDelegationParams(validator sdk.ValAddress) QueryFeederDelegationParams { + return QueryFeederDelegationParams{validator} +} + +// QueryMissCounterParams defines the params for the following queries: +// - 'custom/oracle/missCounter' +type QueryVotePenaltyCounterParams struct { + Validator sdk.ValAddress +} + +// NewQueryVotePenaltyCounterParams returns params for feeder delegation query +func NewQueryVotePenaltyCounterParams(validator sdk.ValAddress) QueryVotePenaltyCounterParams { + return QueryVotePenaltyCounterParams{validator} +} + +// QueryAggregateVoteParams defines the params for the following queries: +// - 'custom/oracle/aggregateVote' +type QueryAggregateVoteParams struct { + Validator sdk.ValAddress +} + +// NewQueryAggregateVoteParams returns params for feeder delegation query +func NewQueryAggregateVoteParams(validator sdk.ValAddress) QueryAggregateVoteParams { + return QueryAggregateVoteParams{validator} +} diff --git a/cmd/sei-cosmos-exporter/types/query.pb.go b/cmd/sei-cosmos-exporter/types/query.pb.go new file mode 100644 index 0000000..cb5dd19 --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/query.pb.go @@ -0,0 +1,3988 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: oracle/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryExchangeRateRequest is the request type for the Query/ExchangeRate RPC method. +type QueryExchangeRateRequest struct { + // denom defines the denomination to query for. + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *QueryExchangeRateRequest) Reset() { *m = QueryExchangeRateRequest{} } +func (m *QueryExchangeRateRequest) String() string { return proto.CompactTextString(m) } +func (*QueryExchangeRateRequest) ProtoMessage() {} +func (*QueryExchangeRateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{0} +} +func (m *QueryExchangeRateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryExchangeRateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryExchangeRateRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryExchangeRateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryExchangeRateRequest.Merge(m, src) +} +func (m *QueryExchangeRateRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryExchangeRateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryExchangeRateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryExchangeRateRequest proto.InternalMessageInfo + +// QueryExchangeRateResponse is response type for the +// Query/ExchangeRate RPC method. +type QueryExchangeRateResponse struct { + // exchange_rate defines the exchange rate of Sei denominated in various Sei + OracleExchangeRate OracleExchangeRate `protobuf:"bytes,1,opt,name=oracle_exchange_rate,json=oracleExchangeRate,proto3" json:"oracle_exchange_rate"` +} + +func (m *QueryExchangeRateResponse) Reset() { *m = QueryExchangeRateResponse{} } +func (m *QueryExchangeRateResponse) String() string { return proto.CompactTextString(m) } +func (*QueryExchangeRateResponse) ProtoMessage() {} +func (*QueryExchangeRateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{1} +} +func (m *QueryExchangeRateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryExchangeRateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryExchangeRateResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryExchangeRateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryExchangeRateResponse.Merge(m, src) +} +func (m *QueryExchangeRateResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryExchangeRateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryExchangeRateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryExchangeRateResponse proto.InternalMessageInfo + +func (m *QueryExchangeRateResponse) GetOracleExchangeRate() OracleExchangeRate { + if m != nil { + return m.OracleExchangeRate + } + return OracleExchangeRate{} +} + +// QueryExchangeRatesRequest is the request type for the Query/ExchangeRates RPC method. +type QueryExchangeRatesRequest struct { +} + +func (m *QueryExchangeRatesRequest) Reset() { *m = QueryExchangeRatesRequest{} } +func (m *QueryExchangeRatesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryExchangeRatesRequest) ProtoMessage() {} +func (*QueryExchangeRatesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{2} +} +func (m *QueryExchangeRatesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryExchangeRatesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryExchangeRatesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryExchangeRatesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryExchangeRatesRequest.Merge(m, src) +} +func (m *QueryExchangeRatesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryExchangeRatesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryExchangeRatesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryExchangeRatesRequest proto.InternalMessageInfo + +type DenomOracleExchangeRatePair struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + OracleExchangeRate OracleExchangeRate `protobuf:"bytes,2,opt,name=oracle_exchange_rate,json=oracleExchangeRate,proto3" json:"oracle_exchange_rate"` +} + +func (m *DenomOracleExchangeRatePair) Reset() { *m = DenomOracleExchangeRatePair{} } +func (m *DenomOracleExchangeRatePair) String() string { return proto.CompactTextString(m) } +func (*DenomOracleExchangeRatePair) ProtoMessage() {} +func (*DenomOracleExchangeRatePair) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{3} +} +func (m *DenomOracleExchangeRatePair) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DenomOracleExchangeRatePair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DenomOracleExchangeRatePair.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DenomOracleExchangeRatePair) XXX_Merge(src proto.Message) { + xxx_messageInfo_DenomOracleExchangeRatePair.Merge(m, src) +} +func (m *DenomOracleExchangeRatePair) XXX_Size() int { + return m.Size() +} +func (m *DenomOracleExchangeRatePair) XXX_DiscardUnknown() { + xxx_messageInfo_DenomOracleExchangeRatePair.DiscardUnknown(m) +} + +var xxx_messageInfo_DenomOracleExchangeRatePair proto.InternalMessageInfo + +func (m *DenomOracleExchangeRatePair) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *DenomOracleExchangeRatePair) GetOracleExchangeRate() OracleExchangeRate { + if m != nil { + return m.OracleExchangeRate + } + return OracleExchangeRate{} +} + +// QueryExchangeRatesResponse is response type for the +// Query/ExchangeRates RPC method. +type QueryExchangeRatesResponse struct { + // exchange_rates defines a list of the exchange rate for all whitelisted denoms. + DenomOracleExchangeRatePairs DenomOracleExchangeRatePairs `protobuf:"bytes,1,rep,name=denom_oracle_exchange_rate_pairs,json=denomOracleExchangeRatePairs,proto3,castrepeated=DenomOracleExchangeRatePairs" json:"denom_oracle_exchange_rate_pairs"` +} + +func (m *QueryExchangeRatesResponse) Reset() { *m = QueryExchangeRatesResponse{} } +func (m *QueryExchangeRatesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryExchangeRatesResponse) ProtoMessage() {} +func (*QueryExchangeRatesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{4} +} +func (m *QueryExchangeRatesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryExchangeRatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryExchangeRatesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryExchangeRatesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryExchangeRatesResponse.Merge(m, src) +} +func (m *QueryExchangeRatesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryExchangeRatesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryExchangeRatesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryExchangeRatesResponse proto.InternalMessageInfo + +func (m *QueryExchangeRatesResponse) GetDenomOracleExchangeRatePairs() DenomOracleExchangeRatePairs { + if m != nil { + return m.DenomOracleExchangeRatePairs + } + return nil +} + +// QueryActivesRequest is the request type for the Query/Actives RPC method. +type QueryActivesRequest struct { +} + +func (m *QueryActivesRequest) Reset() { *m = QueryActivesRequest{} } +func (m *QueryActivesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryActivesRequest) ProtoMessage() {} +func (*QueryActivesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{5} +} +func (m *QueryActivesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryActivesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryActivesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryActivesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryActivesRequest.Merge(m, src) +} +func (m *QueryActivesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryActivesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryActivesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryActivesRequest proto.InternalMessageInfo + +// QueryActivesResponse is response type for the +// Query/Actives RPC method. +type QueryActivesResponse struct { + // actives defines a list of the denomination which oracle prices aggreed upon. + Actives []string `protobuf:"bytes,1,rep,name=actives,proto3" json:"actives,omitempty"` +} + +func (m *QueryActivesResponse) Reset() { *m = QueryActivesResponse{} } +func (m *QueryActivesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryActivesResponse) ProtoMessage() {} +func (*QueryActivesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{6} +} +func (m *QueryActivesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryActivesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryActivesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryActivesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryActivesResponse.Merge(m, src) +} +func (m *QueryActivesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryActivesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryActivesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryActivesResponse proto.InternalMessageInfo + +func (m *QueryActivesResponse) GetActives() []string { + if m != nil { + return m.Actives + } + return nil +} + +// QueryVoteTargetsRequest is the request type for the Query/VoteTargets RPC method. +type QueryVoteTargetsRequest struct { +} + +func (m *QueryVoteTargetsRequest) Reset() { *m = QueryVoteTargetsRequest{} } +func (m *QueryVoteTargetsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryVoteTargetsRequest) ProtoMessage() {} +func (*QueryVoteTargetsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{7} +} +func (m *QueryVoteTargetsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVoteTargetsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVoteTargetsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryVoteTargetsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVoteTargetsRequest.Merge(m, src) +} +func (m *QueryVoteTargetsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryVoteTargetsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVoteTargetsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVoteTargetsRequest proto.InternalMessageInfo + +// QueryVoteTargetsResponse is response type for the +// Query/VoteTargets RPC method. +type QueryVoteTargetsResponse struct { + // vote_targets defines a list of the denomination in which everyone + // should vote in the current vote period. + VoteTargets []string `protobuf:"bytes,1,rep,name=vote_targets,json=voteTargets,proto3" json:"vote_targets,omitempty"` +} + +func (m *QueryVoteTargetsResponse) Reset() { *m = QueryVoteTargetsResponse{} } +func (m *QueryVoteTargetsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryVoteTargetsResponse) ProtoMessage() {} +func (*QueryVoteTargetsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{8} +} +func (m *QueryVoteTargetsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVoteTargetsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVoteTargetsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryVoteTargetsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVoteTargetsResponse.Merge(m, src) +} +func (m *QueryVoteTargetsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryVoteTargetsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVoteTargetsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVoteTargetsResponse proto.InternalMessageInfo + +func (m *QueryVoteTargetsResponse) GetVoteTargets() []string { + if m != nil { + return m.VoteTargets + } + return nil +} + +// request type for price snapshot history RPC method +type QueryPriceSnapshotHistoryRequest struct { +} + +func (m *QueryPriceSnapshotHistoryRequest) Reset() { *m = QueryPriceSnapshotHistoryRequest{} } +func (m *QueryPriceSnapshotHistoryRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPriceSnapshotHistoryRequest) ProtoMessage() {} +func (*QueryPriceSnapshotHistoryRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{9} +} +func (m *QueryPriceSnapshotHistoryRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPriceSnapshotHistoryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPriceSnapshotHistoryRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryPriceSnapshotHistoryRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPriceSnapshotHistoryRequest.Merge(m, src) +} +func (m *QueryPriceSnapshotHistoryRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPriceSnapshotHistoryRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPriceSnapshotHistoryRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPriceSnapshotHistoryRequest proto.InternalMessageInfo + +type QueryPriceSnapshotHistoryResponse struct { + PriceSnapshots PriceSnapshots `protobuf:"bytes,1,rep,name=price_snapshots,json=priceSnapshots,proto3,castrepeated=PriceSnapshots" json:"price_snapshots"` +} + +func (m *QueryPriceSnapshotHistoryResponse) Reset() { *m = QueryPriceSnapshotHistoryResponse{} } +func (m *QueryPriceSnapshotHistoryResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPriceSnapshotHistoryResponse) ProtoMessage() {} +func (*QueryPriceSnapshotHistoryResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{10} +} +func (m *QueryPriceSnapshotHistoryResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPriceSnapshotHistoryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPriceSnapshotHistoryResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryPriceSnapshotHistoryResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPriceSnapshotHistoryResponse.Merge(m, src) +} +func (m *QueryPriceSnapshotHistoryResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPriceSnapshotHistoryResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPriceSnapshotHistoryResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPriceSnapshotHistoryResponse proto.InternalMessageInfo + +func (m *QueryPriceSnapshotHistoryResponse) GetPriceSnapshots() PriceSnapshots { + if m != nil { + return m.PriceSnapshots + } + return nil +} + +// request type for twap RPC method +type QueryTwapsRequest struct { + LookbackSeconds uint64 `protobuf:"varint,1,opt,name=lookback_seconds,json=lookbackSeconds,proto3" json:"lookback_seconds,omitempty"` +} + +func (m *QueryTwapsRequest) Reset() { *m = QueryTwapsRequest{} } +func (m *QueryTwapsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTwapsRequest) ProtoMessage() {} +func (*QueryTwapsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{11} +} +func (m *QueryTwapsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTwapsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTwapsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTwapsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTwapsRequest.Merge(m, src) +} +func (m *QueryTwapsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTwapsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTwapsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTwapsRequest proto.InternalMessageInfo + +func (m *QueryTwapsRequest) GetLookbackSeconds() uint64 { + if m != nil { + return m.LookbackSeconds + } + return 0 +} + +type QueryTwapsResponse struct { + OracleTwaps OracleTwaps `protobuf:"bytes,1,rep,name=oracle_twaps,json=oracleTwaps,proto3,castrepeated=OracleTwaps" json:"oracle_twaps"` +} + +func (m *QueryTwapsResponse) Reset() { *m = QueryTwapsResponse{} } +func (m *QueryTwapsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTwapsResponse) ProtoMessage() {} +func (*QueryTwapsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{12} +} +func (m *QueryTwapsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTwapsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTwapsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTwapsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTwapsResponse.Merge(m, src) +} +func (m *QueryTwapsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTwapsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTwapsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTwapsResponse proto.InternalMessageInfo + +func (m *QueryTwapsResponse) GetOracleTwaps() OracleTwaps { + if m != nil { + return m.OracleTwaps + } + return nil +} + +// QueryFeederDelegationRequest is the request type for the Query/FeederDelegation RPC method. +type QueryFeederDelegationRequest struct { + // validator defines the validator address to query for. + ValidatorAddr string `protobuf:"bytes,1,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` +} + +func (m *QueryFeederDelegationRequest) Reset() { *m = QueryFeederDelegationRequest{} } +func (m *QueryFeederDelegationRequest) String() string { return proto.CompactTextString(m) } +func (*QueryFeederDelegationRequest) ProtoMessage() {} +func (*QueryFeederDelegationRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{13} +} +func (m *QueryFeederDelegationRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFeederDelegationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFeederDelegationRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryFeederDelegationRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFeederDelegationRequest.Merge(m, src) +} +func (m *QueryFeederDelegationRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryFeederDelegationRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFeederDelegationRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFeederDelegationRequest proto.InternalMessageInfo + +// QueryFeederDelegationResponse is response type for the +// Query/FeederDelegation RPC method. +type QueryFeederDelegationResponse struct { + // feeder_addr defines the feeder delegation of a validator + FeederAddr string `protobuf:"bytes,1,opt,name=feeder_addr,json=feederAddr,proto3" json:"feeder_addr,omitempty"` +} + +func (m *QueryFeederDelegationResponse) Reset() { *m = QueryFeederDelegationResponse{} } +func (m *QueryFeederDelegationResponse) String() string { return proto.CompactTextString(m) } +func (*QueryFeederDelegationResponse) ProtoMessage() {} +func (*QueryFeederDelegationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{14} +} +func (m *QueryFeederDelegationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFeederDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFeederDelegationResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryFeederDelegationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFeederDelegationResponse.Merge(m, src) +} +func (m *QueryFeederDelegationResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryFeederDelegationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFeederDelegationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFeederDelegationResponse proto.InternalMessageInfo + +func (m *QueryFeederDelegationResponse) GetFeederAddr() string { + if m != nil { + return m.FeederAddr + } + return "" +} + +// QueryVotePenaltyCounterRequest is the request type for the Query/MissCounter RPC method. +type QueryVotePenaltyCounterRequest struct { + // validator defines the validator address to query for. + ValidatorAddr string `protobuf:"bytes,1,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` +} + +func (m *QueryVotePenaltyCounterRequest) Reset() { *m = QueryVotePenaltyCounterRequest{} } +func (m *QueryVotePenaltyCounterRequest) String() string { return proto.CompactTextString(m) } +func (*QueryVotePenaltyCounterRequest) ProtoMessage() {} +func (*QueryVotePenaltyCounterRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{15} +} +func (m *QueryVotePenaltyCounterRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVotePenaltyCounterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVotePenaltyCounterRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryVotePenaltyCounterRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVotePenaltyCounterRequest.Merge(m, src) +} +func (m *QueryVotePenaltyCounterRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryVotePenaltyCounterRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVotePenaltyCounterRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVotePenaltyCounterRequest proto.InternalMessageInfo + +// QueryVotePenaltyCounterResponse is response type for the +// Query/VotePenaltyCounter RPC method. +type QueryVotePenaltyCounterResponse struct { + VotePenaltyCounter *VotePenaltyCounter `protobuf:"bytes,1,opt,name=vote_penalty_counter,json=votePenaltyCounter,proto3" json:"vote_penalty_counter,omitempty"` +} + +func (m *QueryVotePenaltyCounterResponse) Reset() { *m = QueryVotePenaltyCounterResponse{} } +func (m *QueryVotePenaltyCounterResponse) String() string { return proto.CompactTextString(m) } +func (*QueryVotePenaltyCounterResponse) ProtoMessage() {} +func (*QueryVotePenaltyCounterResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{16} +} +func (m *QueryVotePenaltyCounterResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVotePenaltyCounterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVotePenaltyCounterResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryVotePenaltyCounterResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVotePenaltyCounterResponse.Merge(m, src) +} +func (m *QueryVotePenaltyCounterResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryVotePenaltyCounterResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVotePenaltyCounterResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVotePenaltyCounterResponse proto.InternalMessageInfo + +func (m *QueryVotePenaltyCounterResponse) GetVotePenaltyCounter() *VotePenaltyCounter { + if m != nil { + return m.VotePenaltyCounter + } + return nil +} + +// QuerySlashWindow is the request type for the +// Query/SlashWindow RPC method. +type QuerySlashWindowRequest struct { +} + +func (m *QuerySlashWindowRequest) Reset() { *m = QuerySlashWindowRequest{} } +func (m *QuerySlashWindowRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySlashWindowRequest) ProtoMessage() {} +func (*QuerySlashWindowRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{17} +} +func (m *QuerySlashWindowRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySlashWindowRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySlashWindowRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySlashWindowRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySlashWindowRequest.Merge(m, src) +} +func (m *QuerySlashWindowRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySlashWindowRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySlashWindowRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySlashWindowRequest proto.InternalMessageInfo + +// QuerySlashWindowResponse is response type for the +// Query/SlashWindow RPC method. +type QuerySlashWindowResponse struct { + // window_progress defines the number of voting periods + // since the last slashing event would have taken place. + WindowProgress uint64 `protobuf:"varint,1,opt,name=window_progress,json=windowProgress,proto3" json:"window_progress,omitempty"` +} + +func (m *QuerySlashWindowResponse) Reset() { *m = QuerySlashWindowResponse{} } +func (m *QuerySlashWindowResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySlashWindowResponse) ProtoMessage() {} +func (*QuerySlashWindowResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{18} +} +func (m *QuerySlashWindowResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySlashWindowResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySlashWindowResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySlashWindowResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySlashWindowResponse.Merge(m, src) +} +func (m *QuerySlashWindowResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySlashWindowResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySlashWindowResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySlashWindowResponse proto.InternalMessageInfo + +func (m *QuerySlashWindowResponse) GetWindowProgress() uint64 { + if m != nil { + return m.WindowProgress + } + return 0 +} + +// QueryParamsRequest is the request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{19} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is the response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params defines the parameters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{20} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*QueryExchangeRateRequest)(nil), "seiprotocol.seichain.oracle.QueryExchangeRateRequest") + proto.RegisterType((*QueryExchangeRateResponse)(nil), "seiprotocol.seichain.oracle.QueryExchangeRateResponse") + proto.RegisterType((*QueryExchangeRatesRequest)(nil), "seiprotocol.seichain.oracle.QueryExchangeRatesRequest") + proto.RegisterType((*DenomOracleExchangeRatePair)(nil), "seiprotocol.seichain.oracle.DenomOracleExchangeRatePair") + proto.RegisterType((*QueryExchangeRatesResponse)(nil), "seiprotocol.seichain.oracle.QueryExchangeRatesResponse") + proto.RegisterType((*QueryActivesRequest)(nil), "seiprotocol.seichain.oracle.QueryActivesRequest") + proto.RegisterType((*QueryActivesResponse)(nil), "seiprotocol.seichain.oracle.QueryActivesResponse") + proto.RegisterType((*QueryVoteTargetsRequest)(nil), "seiprotocol.seichain.oracle.QueryVoteTargetsRequest") + proto.RegisterType((*QueryVoteTargetsResponse)(nil), "seiprotocol.seichain.oracle.QueryVoteTargetsResponse") + proto.RegisterType((*QueryPriceSnapshotHistoryRequest)(nil), "seiprotocol.seichain.oracle.QueryPriceSnapshotHistoryRequest") + proto.RegisterType((*QueryPriceSnapshotHistoryResponse)(nil), "seiprotocol.seichain.oracle.QueryPriceSnapshotHistoryResponse") + proto.RegisterType((*QueryTwapsRequest)(nil), "seiprotocol.seichain.oracle.QueryTwapsRequest") + proto.RegisterType((*QueryTwapsResponse)(nil), "seiprotocol.seichain.oracle.QueryTwapsResponse") + proto.RegisterType((*QueryFeederDelegationRequest)(nil), "seiprotocol.seichain.oracle.QueryFeederDelegationRequest") + proto.RegisterType((*QueryFeederDelegationResponse)(nil), "seiprotocol.seichain.oracle.QueryFeederDelegationResponse") + proto.RegisterType((*QueryVotePenaltyCounterRequest)(nil), "seiprotocol.seichain.oracle.QueryVotePenaltyCounterRequest") + proto.RegisterType((*QueryVotePenaltyCounterResponse)(nil), "seiprotocol.seichain.oracle.QueryVotePenaltyCounterResponse") + proto.RegisterType((*QuerySlashWindowRequest)(nil), "seiprotocol.seichain.oracle.QuerySlashWindowRequest") + proto.RegisterType((*QuerySlashWindowResponse)(nil), "seiprotocol.seichain.oracle.QuerySlashWindowResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "seiprotocol.seichain.oracle.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "seiprotocol.seichain.oracle.QueryParamsResponse") +} + +func init() { proto.RegisterFile("oracle/query.proto", fileDescriptor_562b782cb9ac197e) } + +var fileDescriptor_562b782cb9ac197e = []byte{ + // 1104 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0x94, 0x26, 0xa5, 0xcf, 0x69, 0x52, 0x26, 0x06, 0xd2, 0x4d, 0xb0, 0xd3, 0x85, 0x2a, + 0x05, 0x14, 0x6f, 0x48, 0x93, 0x02, 0x69, 0x12, 0x35, 0x3f, 0xa8, 0x80, 0x4b, 0x12, 0xa7, 0xa2, + 0x88, 0xcb, 0x6a, 0x62, 0x0f, 0xeb, 0x55, 0x9c, 0x9d, 0xed, 0xce, 0x26, 0x69, 0x14, 0xe5, 0x82, + 0x7a, 0xe0, 0x18, 0x89, 0x1b, 0xe2, 0xd0, 0x0b, 0x1c, 0xb8, 0xc0, 0x89, 0x23, 0x07, 0x24, 0xa4, + 0x1e, 0x2b, 0xc1, 0x01, 0x09, 0x09, 0x50, 0xc2, 0xa1, 0x7f, 0x06, 0xf2, 0xec, 0x5b, 0x67, 0xb7, + 0x59, 0xaf, 0xd7, 0xa1, 0xa7, 0xf5, 0xbc, 0x37, 0xef, 0x9b, 0xef, 0x1b, 0xbf, 0x79, 0x1f, 0x50, + 0xe1, 0xb1, 0x6a, 0x83, 0x1b, 0xf7, 0xb7, 0xb9, 0xb7, 0x57, 0x76, 0x3d, 0xe1, 0x0b, 0x3a, 0x2c, + 0xb9, 0xad, 0x7e, 0x55, 0x45, 0xa3, 0x2c, 0xb9, 0x5d, 0xad, 0x33, 0xdb, 0x29, 0x07, 0x1b, 0xb5, + 0x82, 0x25, 0x2c, 0xa1, 0xb2, 0x46, 0xf3, 0x57, 0x50, 0xa2, 0x8d, 0x58, 0x42, 0x58, 0x0d, 0x6e, + 0x30, 0xd7, 0x36, 0x98, 0xe3, 0x08, 0x9f, 0xf9, 0xb6, 0x70, 0x24, 0x66, 0x07, 0xf1, 0x90, 0xe0, + 0x13, 0x04, 0xf5, 0x19, 0x18, 0x5a, 0x6b, 0x1e, 0xfa, 0xc1, 0x83, 0x6a, 0x9d, 0x39, 0x16, 0xaf, + 0x30, 0x9f, 0x57, 0xf8, 0xfd, 0x6d, 0x2e, 0x7d, 0x5a, 0x80, 0x9e, 0x1a, 0x77, 0xc4, 0xd6, 0x10, + 0x19, 0x25, 0xd7, 0x2f, 0x56, 0x82, 0xc5, 0xcc, 0x8b, 0x5f, 0x3e, 0x2a, 0xe5, 0x9e, 0x3e, 0x2a, + 0xe5, 0xf4, 0x87, 0x04, 0xae, 0x24, 0x14, 0x4b, 0x57, 0x38, 0x92, 0x53, 0x0b, 0x0a, 0xc1, 0x49, + 0x26, 0xc7, 0xb4, 0xe9, 0x31, 0x9f, 0x2b, 0xb0, 0xfc, 0xa4, 0x51, 0x4e, 0x91, 0x57, 0x5e, 0x51, + 0x9f, 0x28, 0xec, 0xe2, 0xf9, 0xc7, 0x7f, 0x95, 0x72, 0x15, 0xbc, 0xa8, 0x68, 0x46, 0x1f, 0x4e, + 0x60, 0x21, 0x51, 0x83, 0xfe, 0x0d, 0x81, 0xe1, 0xe5, 0x26, 0xef, 0xd3, 0x90, 0xab, 0xcc, 0xf6, + 0x92, 0x35, 0xb6, 0xe5, 0x7e, 0xee, 0x79, 0x73, 0xff, 0x95, 0x80, 0x96, 0x44, 0x1e, 0xef, 0xf0, + 0x3b, 0x02, 0xa3, 0x8a, 0x91, 0x99, 0x44, 0xc7, 0x74, 0x99, 0xed, 0xc9, 0x21, 0x32, 0xfa, 0xc2, + 0xf5, 0xfc, 0xe4, 0x7b, 0xa9, 0xa4, 0x52, 0xae, 0x60, 0xf1, 0x8d, 0x26, 0xbb, 0xef, 0xff, 0x2e, + 0x8d, 0xa4, 0x6c, 0x92, 0x95, 0x91, 0x5a, 0x4a, 0x56, 0x7f, 0x19, 0x06, 0x95, 0x8c, 0x85, 0xaa, + 0x6f, 0xef, 0x9c, 0xdc, 0xfe, 0x04, 0x14, 0xe2, 0x61, 0xd4, 0x35, 0x04, 0x17, 0x58, 0x10, 0x52, + 0xec, 0x2f, 0x56, 0xc2, 0xa5, 0x7e, 0x05, 0x5e, 0x55, 0x15, 0x9f, 0x08, 0x9f, 0xdf, 0x65, 0x9e, + 0xc5, 0xfd, 0x16, 0xd8, 0x1c, 0xb6, 0x6a, 0x2c, 0x85, 0x80, 0x57, 0xa1, 0x6f, 0x47, 0xf8, 0xdc, + 0xf4, 0x83, 0x38, 0xa2, 0xe6, 0x77, 0x4e, 0xb6, 0xea, 0x3a, 0x8c, 0xaa, 0xf2, 0x55, 0xcf, 0xae, + 0xf2, 0x75, 0x87, 0xb9, 0xb2, 0x2e, 0xfc, 0x0f, 0x6d, 0xe9, 0x0b, 0x6f, 0x2f, 0x3c, 0xe2, 0x90, + 0xc0, 0xd5, 0x94, 0x4d, 0x78, 0xd8, 0x26, 0x0c, 0xb8, 0xcd, 0xbc, 0x29, 0x71, 0x43, 0xf8, 0x1f, + 0xbc, 0x95, 0xfa, 0x1f, 0xc4, 0x30, 0x17, 0x5f, 0xc1, 0x5b, 0xef, 0x8f, 0x85, 0x65, 0xa5, 0xdf, + 0x8d, 0xad, 0xf5, 0x79, 0x78, 0x49, 0x31, 0xba, 0xbb, 0xcb, 0xdc, 0xf0, 0x2a, 0xe8, 0x9b, 0x70, + 0xb9, 0x21, 0xc4, 0xe6, 0x06, 0xab, 0x6e, 0x9a, 0x92, 0x57, 0x85, 0x53, 0x93, 0xaa, 0x81, 0xcf, + 0x57, 0x06, 0xc2, 0xf8, 0x7a, 0x10, 0xd6, 0xb7, 0x81, 0x46, 0xeb, 0x51, 0x82, 0x09, 0x7d, 0xd8, + 0x51, 0x7e, 0x33, 0x8e, 0xfc, 0xc7, 0x32, 0x34, 0x76, 0x13, 0x67, 0x71, 0x10, 0xc9, 0xe7, 0x4f, + 0x62, 0xb2, 0x92, 0x17, 0x27, 0x0b, 0x7d, 0x05, 0x46, 0xd4, 0xb1, 0x77, 0x38, 0xaf, 0x71, 0x6f, + 0x99, 0x37, 0xb8, 0xa5, 0x86, 0x51, 0xa8, 0xe0, 0x1a, 0xf4, 0xef, 0xb0, 0x86, 0x5d, 0x63, 0xbe, + 0xf0, 0x4c, 0x56, 0xab, 0x79, 0xf8, 0x00, 0x2f, 0xb5, 0xa2, 0x0b, 0xb5, 0x9a, 0x17, 0x19, 0x36, + 0xb7, 0xe1, 0xb5, 0x36, 0x80, 0x28, 0xa9, 0x04, 0xf9, 0xcf, 0x55, 0x2e, 0x0a, 0x07, 0x41, 0xa8, + 0x89, 0xa5, 0xaf, 0x41, 0xb1, 0xd5, 0x3f, 0xab, 0xdc, 0x61, 0x0d, 0x7f, 0x6f, 0x49, 0x6c, 0x3b, + 0x3e, 0xf7, 0xce, 0x4c, 0xea, 0x21, 0x81, 0x52, 0x5b, 0x4c, 0xe4, 0xc5, 0xa0, 0xa0, 0x5a, 0xd3, + 0x0d, 0xd2, 0x66, 0x35, 0xc8, 0x67, 0x9a, 0x83, 0x09, 0xb0, 0x74, 0xe7, 0x54, 0xac, 0xf5, 0x68, + 0xd6, 0x1b, 0x4c, 0xd6, 0xef, 0xd9, 0x4e, 0x4d, 0xec, 0x86, 0x1d, 0xbd, 0x84, 0x8f, 0x26, 0x96, + 0x42, 0x66, 0x63, 0x30, 0xb0, 0xab, 0x22, 0xa6, 0xeb, 0x09, 0xcb, 0xe3, 0x32, 0x6c, 0xa2, 0xfe, + 0x20, 0xbc, 0x8a, 0x51, 0xbd, 0x80, 0x3d, 0xb4, 0xca, 0x3c, 0xb6, 0xd5, 0x7a, 0x8f, 0x9f, 0xe2, + 0x9b, 0x0f, 0xa3, 0x88, 0xba, 0x00, 0xbd, 0xae, 0x8a, 0xa0, 0xc2, 0xd7, 0xd3, 0x1f, 0x85, 0xda, + 0x8a, 0x13, 0x12, 0x0b, 0x27, 0x0f, 0x07, 0xa0, 0x47, 0x41, 0xd3, 0x5f, 0x08, 0xf4, 0x45, 0xa7, + 0x0d, 0x9d, 0x4e, 0x45, 0x6b, 0x67, 0x65, 0xda, 0xcd, 0x6e, 0xcb, 0x02, 0x31, 0xfa, 0xd2, 0x17, + 0xbf, 0xfd, 0xfb, 0xd5, 0xb9, 0x39, 0x7a, 0xcb, 0x90, 0xdc, 0x1e, 0x0f, 0x01, 0xd4, 0x42, 0x21, + 0xa0, 0x99, 0x1a, 0x6a, 0x38, 0x4a, 0x63, 0x5f, 0x7d, 0x0f, 0x8c, 0xd8, 0x98, 0xa6, 0x3f, 0x13, + 0xb8, 0x14, 0x9b, 0xef, 0xb4, 0x4b, 0x3a, 0xe1, 0x95, 0x6b, 0xef, 0x76, 0x5d, 0x87, 0x3a, 0x66, + 0x95, 0x8e, 0x9b, 0x74, 0x2a, 0x9b, 0x8e, 0x18, 0x7f, 0x49, 0xbf, 0x25, 0x70, 0x01, 0x47, 0x38, + 0x9d, 0xe8, 0x4c, 0x21, 0x6e, 0x02, 0xda, 0x3b, 0x5d, 0x54, 0x20, 0xdd, 0x69, 0x45, 0xd7, 0xa0, + 0xe3, 0xd9, 0xe8, 0xa2, 0x79, 0xd0, 0x9f, 0x08, 0xe4, 0x23, 0xee, 0x40, 0xa7, 0x3a, 0x9f, 0x7c, + 0xda, 0x67, 0xb4, 0xe9, 0x2e, 0xab, 0x90, 0xf3, 0x8c, 0xe2, 0x3c, 0x45, 0x27, 0xb3, 0x71, 0x8e, + 0xda, 0x15, 0xfd, 0x93, 0x40, 0x21, 0xc9, 0x72, 0xe8, 0x5c, 0x67, 0x2e, 0x29, 0x7e, 0xa6, 0xcd, + 0x9f, 0xb5, 0x1c, 0x35, 0x2d, 0x2b, 0x4d, 0xf3, 0x74, 0x36, 0x9b, 0xa6, 0xb8, 0x2b, 0x9a, 0x75, + 0x14, 0xf1, 0x23, 0x81, 0x1e, 0xe5, 0x0a, 0xb4, 0xdc, 0x99, 0x4f, 0xd4, 0xe7, 0x34, 0x23, 0xf3, + 0x7e, 0x24, 0x7c, 0x47, 0x11, 0xbe, 0x4d, 0xe7, 0xb3, 0x11, 0x56, 0xe6, 0x67, 0xec, 0x3f, 0xeb, + 0xa5, 0x07, 0xf4, 0x77, 0x02, 0x97, 0x9f, 0x75, 0x1a, 0xfa, 0x7e, 0x67, 0x36, 0x6d, 0xec, 0x4e, + 0x9b, 0x39, 0x4b, 0x29, 0x6a, 0xfa, 0x48, 0x69, 0x5a, 0xa2, 0x0b, 0x1d, 0x34, 0xb5, 0x4c, 0x4a, + 0x1a, 0xfb, 0x71, 0x1b, 0x3b, 0x30, 0x02, 0x1b, 0xa4, 0x4f, 0x09, 0xd0, 0xd3, 0x9e, 0x42, 0x6f, + 0x65, 0xeb, 0xf8, 0x44, 0xd3, 0xd4, 0x66, 0xcf, 0x56, 0x8c, 0xe2, 0xee, 0x29, 0x71, 0x6b, 0x74, + 0xe5, 0x7f, 0x88, 0x4b, 0xb2, 0x57, 0xfa, 0x03, 0x81, 0x7c, 0xc4, 0xf4, 0xb2, 0xcc, 0x82, 0xd3, + 0xf6, 0x99, 0x65, 0x16, 0x24, 0x38, 0xab, 0x7e, 0x43, 0xa9, 0x1a, 0xa7, 0x6f, 0x77, 0x50, 0x25, + 0x9b, 0xb5, 0x66, 0xe0, 0xb6, 0xf4, 0x6b, 0x02, 0xbd, 0x81, 0x1d, 0xd2, 0x0c, 0x7d, 0x1f, 0xf3, + 0x62, 0x6d, 0x22, 0x7b, 0x01, 0x52, 0x1c, 0x57, 0x14, 0xc7, 0xe8, 0xb5, 0x0e, 0x14, 0x03, 0x4b, + 0x5e, 0xfc, 0xf8, 0xf1, 0x51, 0x91, 0x3c, 0x39, 0x2a, 0x92, 0x7f, 0x8e, 0x8a, 0xe4, 0xf0, 0xb8, + 0x98, 0x7b, 0x72, 0x5c, 0xcc, 0xfd, 0x71, 0x5c, 0xcc, 0x7d, 0x36, 0x61, 0xd9, 0x7e, 0x7d, 0x7b, + 0xa3, 0x5c, 0x15, 0x5b, 0xed, 0xa0, 0x1e, 0x84, 0x60, 0xfe, 0x9e, 0xcb, 0xe5, 0x46, 0xaf, 0xda, + 0x72, 0xe3, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x58, 0x07, 0x8e, 0x14, 0xf6, 0x0e, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // ExchangeRate returns exchange rate of a denom + ExchangeRate(ctx context.Context, in *QueryExchangeRateRequest, opts ...grpc.CallOption) (*QueryExchangeRateResponse, error) + // ExchangeRates returns exchange rates of all denoms + ExchangeRates(ctx context.Context, in *QueryExchangeRatesRequest, opts ...grpc.CallOption) (*QueryExchangeRatesResponse, error) + // Actives returns all active denoms + Actives(ctx context.Context, in *QueryActivesRequest, opts ...grpc.CallOption) (*QueryActivesResponse, error) + // VoteTargets returns all vote target denoms + VoteTargets(ctx context.Context, in *QueryVoteTargetsRequest, opts ...grpc.CallOption) (*QueryVoteTargetsResponse, error) + // PriceSnapshotHistory returns the history of price snapshots for all assets + PriceSnapshotHistory(ctx context.Context, in *QueryPriceSnapshotHistoryRequest, opts ...grpc.CallOption) (*QueryPriceSnapshotHistoryResponse, error) + Twaps(ctx context.Context, in *QueryTwapsRequest, opts ...grpc.CallOption) (*QueryTwapsResponse, error) + // FeederDelegation returns feeder delegation of a validator + FeederDelegation(ctx context.Context, in *QueryFeederDelegationRequest, opts ...grpc.CallOption) (*QueryFeederDelegationResponse, error) + // MissCounter returns oracle miss counter of a validator + VotePenaltyCounter(ctx context.Context, in *QueryVotePenaltyCounterRequest, opts ...grpc.CallOption) (*QueryVotePenaltyCounterResponse, error) + // SlashWindow returns slash window information + SlashWindow(ctx context.Context, in *QuerySlashWindowRequest, opts ...grpc.CallOption) (*QuerySlashWindowResponse, error) + // Params queries all parameters. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) ExchangeRate(ctx context.Context, in *QueryExchangeRateRequest, opts ...grpc.CallOption) (*QueryExchangeRateResponse, error) { + out := new(QueryExchangeRateResponse) + err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Query/ExchangeRate", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ExchangeRates(ctx context.Context, in *QueryExchangeRatesRequest, opts ...grpc.CallOption) (*QueryExchangeRatesResponse, error) { + out := new(QueryExchangeRatesResponse) + err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Query/ExchangeRates", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Actives(ctx context.Context, in *QueryActivesRequest, opts ...grpc.CallOption) (*QueryActivesResponse, error) { + out := new(QueryActivesResponse) + err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Query/Actives", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) VoteTargets(ctx context.Context, in *QueryVoteTargetsRequest, opts ...grpc.CallOption) (*QueryVoteTargetsResponse, error) { + out := new(QueryVoteTargetsResponse) + err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Query/VoteTargets", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) PriceSnapshotHistory(ctx context.Context, in *QueryPriceSnapshotHistoryRequest, opts ...grpc.CallOption) (*QueryPriceSnapshotHistoryResponse, error) { + out := new(QueryPriceSnapshotHistoryResponse) + err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Query/PriceSnapshotHistory", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Twaps(ctx context.Context, in *QueryTwapsRequest, opts ...grpc.CallOption) (*QueryTwapsResponse, error) { + out := new(QueryTwapsResponse) + err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Query/Twaps", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) FeederDelegation(ctx context.Context, in *QueryFeederDelegationRequest, opts ...grpc.CallOption) (*QueryFeederDelegationResponse, error) { + out := new(QueryFeederDelegationResponse) + err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Query/FeederDelegation", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) VotePenaltyCounter(ctx context.Context, in *QueryVotePenaltyCounterRequest, opts ...grpc.CallOption) (*QueryVotePenaltyCounterResponse, error) { + out := new(QueryVotePenaltyCounterResponse) + err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Query/VotePenaltyCounter", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) SlashWindow(ctx context.Context, in *QuerySlashWindowRequest, opts ...grpc.CallOption) (*QuerySlashWindowResponse, error) { + out := new(QuerySlashWindowResponse) + err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Query/SlashWindow", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // ExchangeRate returns exchange rate of a denom + ExchangeRate(context.Context, *QueryExchangeRateRequest) (*QueryExchangeRateResponse, error) + // ExchangeRates returns exchange rates of all denoms + ExchangeRates(context.Context, *QueryExchangeRatesRequest) (*QueryExchangeRatesResponse, error) + // Actives returns all active denoms + Actives(context.Context, *QueryActivesRequest) (*QueryActivesResponse, error) + // VoteTargets returns all vote target denoms + VoteTargets(context.Context, *QueryVoteTargetsRequest) (*QueryVoteTargetsResponse, error) + // PriceSnapshotHistory returns the history of price snapshots for all assets + PriceSnapshotHistory(context.Context, *QueryPriceSnapshotHistoryRequest) (*QueryPriceSnapshotHistoryResponse, error) + Twaps(context.Context, *QueryTwapsRequest) (*QueryTwapsResponse, error) + // FeederDelegation returns feeder delegation of a validator + FeederDelegation(context.Context, *QueryFeederDelegationRequest) (*QueryFeederDelegationResponse, error) + // MissCounter returns oracle miss counter of a validator + VotePenaltyCounter(context.Context, *QueryVotePenaltyCounterRequest) (*QueryVotePenaltyCounterResponse, error) + // SlashWindow returns slash window information + SlashWindow(context.Context, *QuerySlashWindowRequest) (*QuerySlashWindowResponse, error) + // Params queries all parameters. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) ExchangeRate(ctx context.Context, req *QueryExchangeRateRequest) (*QueryExchangeRateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ExchangeRate not implemented") +} +func (*UnimplementedQueryServer) ExchangeRates(ctx context.Context, req *QueryExchangeRatesRequest) (*QueryExchangeRatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ExchangeRates not implemented") +} +func (*UnimplementedQueryServer) Actives(ctx context.Context, req *QueryActivesRequest) (*QueryActivesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Actives not implemented") +} +func (*UnimplementedQueryServer) VoteTargets(ctx context.Context, req *QueryVoteTargetsRequest) (*QueryVoteTargetsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method VoteTargets not implemented") +} +func (*UnimplementedQueryServer) PriceSnapshotHistory(ctx context.Context, req *QueryPriceSnapshotHistoryRequest) (*QueryPriceSnapshotHistoryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PriceSnapshotHistory not implemented") +} +func (*UnimplementedQueryServer) Twaps(ctx context.Context, req *QueryTwapsRequest) (*QueryTwapsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Twaps not implemented") +} +func (*UnimplementedQueryServer) FeederDelegation(ctx context.Context, req *QueryFeederDelegationRequest) (*QueryFeederDelegationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FeederDelegation not implemented") +} +func (*UnimplementedQueryServer) VotePenaltyCounter(ctx context.Context, req *QueryVotePenaltyCounterRequest) (*QueryVotePenaltyCounterResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method VotePenaltyCounter not implemented") +} +func (*UnimplementedQueryServer) SlashWindow(ctx context.Context, req *QuerySlashWindowRequest) (*QuerySlashWindowResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SlashWindow not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_ExchangeRate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryExchangeRateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ExchangeRate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/seiprotocol.seichain.oracle.Query/ExchangeRate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ExchangeRate(ctx, req.(*QueryExchangeRateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ExchangeRates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryExchangeRatesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ExchangeRates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/seiprotocol.seichain.oracle.Query/ExchangeRates", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ExchangeRates(ctx, req.(*QueryExchangeRatesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Actives_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryActivesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Actives(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/seiprotocol.seichain.oracle.Query/Actives", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Actives(ctx, req.(*QueryActivesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_VoteTargets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVoteTargetsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).VoteTargets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/seiprotocol.seichain.oracle.Query/VoteTargets", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).VoteTargets(ctx, req.(*QueryVoteTargetsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_PriceSnapshotHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPriceSnapshotHistoryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).PriceSnapshotHistory(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/seiprotocol.seichain.oracle.Query/PriceSnapshotHistory", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).PriceSnapshotHistory(ctx, req.(*QueryPriceSnapshotHistoryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Twaps_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTwapsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Twaps(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/seiprotocol.seichain.oracle.Query/Twaps", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Twaps(ctx, req.(*QueryTwapsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_FeederDelegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryFeederDelegationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).FeederDelegation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/seiprotocol.seichain.oracle.Query/FeederDelegation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).FeederDelegation(ctx, req.(*QueryFeederDelegationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_VotePenaltyCounter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVotePenaltyCounterRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).VotePenaltyCounter(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/seiprotocol.seichain.oracle.Query/VotePenaltyCounter", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).VotePenaltyCounter(ctx, req.(*QueryVotePenaltyCounterRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_SlashWindow_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySlashWindowRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).SlashWindow(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/seiprotocol.seichain.oracle.Query/SlashWindow", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).SlashWindow(ctx, req.(*QuerySlashWindowRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/seiprotocol.seichain.oracle.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "seiprotocol.seichain.oracle.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ExchangeRate", + Handler: _Query_ExchangeRate_Handler, + }, + { + MethodName: "ExchangeRates", + Handler: _Query_ExchangeRates_Handler, + }, + { + MethodName: "Actives", + Handler: _Query_Actives_Handler, + }, + { + MethodName: "VoteTargets", + Handler: _Query_VoteTargets_Handler, + }, + { + MethodName: "PriceSnapshotHistory", + Handler: _Query_PriceSnapshotHistory_Handler, + }, + { + MethodName: "Twaps", + Handler: _Query_Twaps_Handler, + }, + { + MethodName: "FeederDelegation", + Handler: _Query_FeederDelegation_Handler, + }, + { + MethodName: "VotePenaltyCounter", + Handler: _Query_VotePenaltyCounter_Handler, + }, + { + MethodName: "SlashWindow", + Handler: _Query_SlashWindow_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "oracle/query.proto", +} + +func (m *QueryExchangeRateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryExchangeRateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryExchangeRateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryExchangeRateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryExchangeRateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryExchangeRateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.OracleExchangeRate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryExchangeRatesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryExchangeRatesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryExchangeRatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *DenomOracleExchangeRatePair) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DenomOracleExchangeRatePair) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DenomOracleExchangeRatePair) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.OracleExchangeRate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryExchangeRatesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryExchangeRatesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryExchangeRatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DenomOracleExchangeRatePairs) > 0 { + for iNdEx := len(m.DenomOracleExchangeRatePairs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DenomOracleExchangeRatePairs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryActivesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryActivesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryActivesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryActivesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryActivesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryActivesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Actives) > 0 { + for iNdEx := len(m.Actives) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Actives[iNdEx]) + copy(dAtA[i:], m.Actives[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Actives[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryVoteTargetsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryVoteTargetsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVoteTargetsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryVoteTargetsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryVoteTargetsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVoteTargetsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.VoteTargets) > 0 { + for iNdEx := len(m.VoteTargets) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.VoteTargets[iNdEx]) + copy(dAtA[i:], m.VoteTargets[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.VoteTargets[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryPriceSnapshotHistoryRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryPriceSnapshotHistoryRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPriceSnapshotHistoryRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryPriceSnapshotHistoryResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryPriceSnapshotHistoryResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPriceSnapshotHistoryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PriceSnapshots) > 0 { + for iNdEx := len(m.PriceSnapshots) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PriceSnapshots[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryTwapsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTwapsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTwapsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LookbackSeconds != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.LookbackSeconds)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryTwapsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTwapsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTwapsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OracleTwaps) > 0 { + for iNdEx := len(m.OracleTwaps) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.OracleTwaps[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryFeederDelegationRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryFeederDelegationRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFeederDelegationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddr) > 0 { + i -= len(m.ValidatorAddr) + copy(dAtA[i:], m.ValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryFeederDelegationResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryFeederDelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFeederDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FeederAddr) > 0 { + i -= len(m.FeederAddr) + copy(dAtA[i:], m.FeederAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.FeederAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryVotePenaltyCounterRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryVotePenaltyCounterRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVotePenaltyCounterRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddr) > 0 { + i -= len(m.ValidatorAddr) + copy(dAtA[i:], m.ValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryVotePenaltyCounterResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryVotePenaltyCounterResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVotePenaltyCounterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.VotePenaltyCounter != nil { + { + size, err := m.VotePenaltyCounter.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySlashWindowRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuerySlashWindowRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySlashWindowRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QuerySlashWindowResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuerySlashWindowResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySlashWindowResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.WindowProgress != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.WindowProgress)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryExchangeRateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryExchangeRateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.OracleExchangeRate.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryExchangeRatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *DenomOracleExchangeRatePair) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = m.OracleExchangeRate.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryExchangeRatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.DenomOracleExchangeRatePairs) > 0 { + for _, e := range m.DenomOracleExchangeRatePairs { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryActivesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryActivesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Actives) > 0 { + for _, s := range m.Actives { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryVoteTargetsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryVoteTargetsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.VoteTargets) > 0 { + for _, s := range m.VoteTargets { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryPriceSnapshotHistoryRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryPriceSnapshotHistoryResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.PriceSnapshots) > 0 { + for _, e := range m.PriceSnapshots { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryTwapsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.LookbackSeconds != 0 { + n += 1 + sovQuery(uint64(m.LookbackSeconds)) + } + return n +} + +func (m *QueryTwapsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.OracleTwaps) > 0 { + for _, e := range m.OracleTwaps { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryFeederDelegationRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryFeederDelegationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FeederAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVotePenaltyCounterRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVotePenaltyCounterResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.VotePenaltyCounter != nil { + l = m.VotePenaltyCounter.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySlashWindowRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QuerySlashWindowResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.WindowProgress != 0 { + n += 1 + sovQuery(uint64(m.WindowProgress)) + } + return n +} + +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryExchangeRateRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryExchangeRateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryExchangeRateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryExchangeRateResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryExchangeRateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryExchangeRateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleExchangeRate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OracleExchangeRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryExchangeRatesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryExchangeRatesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryExchangeRatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DenomOracleExchangeRatePair) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DenomOracleExchangeRatePair: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DenomOracleExchangeRatePair: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleExchangeRate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OracleExchangeRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryExchangeRatesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryExchangeRatesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryExchangeRatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomOracleExchangeRatePairs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DenomOracleExchangeRatePairs = append(m.DenomOracleExchangeRatePairs, DenomOracleExchangeRatePair{}) + if err := m.DenomOracleExchangeRatePairs[len(m.DenomOracleExchangeRatePairs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryActivesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryActivesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryActivesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryActivesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryActivesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryActivesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Actives", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Actives = append(m.Actives, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVoteTargetsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryVoteTargetsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVoteTargetsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVoteTargetsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryVoteTargetsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVoteTargetsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VoteTargets", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VoteTargets = append(m.VoteTargets, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryPriceSnapshotHistoryRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryPriceSnapshotHistoryRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPriceSnapshotHistoryRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryPriceSnapshotHistoryResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryPriceSnapshotHistoryResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPriceSnapshotHistoryResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PriceSnapshots", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PriceSnapshots = append(m.PriceSnapshots, PriceSnapshot{}) + if err := m.PriceSnapshots[len(m.PriceSnapshots)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTwapsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTwapsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTwapsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LookbackSeconds", wireType) + } + m.LookbackSeconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LookbackSeconds |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTwapsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTwapsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTwapsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleTwaps", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OracleTwaps = append(m.OracleTwaps, OracleTwap{}) + if err := m.OracleTwaps[len(m.OracleTwaps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryFeederDelegationRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryFeederDelegationRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFeederDelegationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryFeederDelegationResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryFeederDelegationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFeederDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeederAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeederAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVotePenaltyCounterRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryVotePenaltyCounterRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVotePenaltyCounterRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVotePenaltyCounterResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryVotePenaltyCounterResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVotePenaltyCounterResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotePenaltyCounter", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VotePenaltyCounter == nil { + m.VotePenaltyCounter = &VotePenaltyCounter{} + } + if err := m.VotePenaltyCounter.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySlashWindowRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySlashWindowRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySlashWindowRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySlashWindowResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySlashWindowResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySlashWindowResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field WindowProgress", wireType) + } + m.WindowProgress = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.WindowProgress |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/cmd/sei-cosmos-exporter/types/query.pb.gw.go b/cmd/sei-cosmos-exporter/types/query.pb.gw.go new file mode 100644 index 0000000..72c1783 --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/query.pb.gw.go @@ -0,0 +1,882 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: oracle/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_ExchangeRate_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryExchangeRateRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := client.ExchangeRate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ExchangeRate_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryExchangeRateRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := server.ExchangeRate(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_ExchangeRates_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryExchangeRatesRequest + var metadata runtime.ServerMetadata + + msg, err := client.ExchangeRates(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ExchangeRates_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryExchangeRatesRequest + var metadata runtime.ServerMetadata + + msg, err := server.ExchangeRates(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Actives_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryActivesRequest + var metadata runtime.ServerMetadata + + msg, err := client.Actives(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Actives_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryActivesRequest + var metadata runtime.ServerMetadata + + msg, err := server.Actives(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_VoteTargets_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVoteTargetsRequest + var metadata runtime.ServerMetadata + + msg, err := client.VoteTargets(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_VoteTargets_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVoteTargetsRequest + var metadata runtime.ServerMetadata + + msg, err := server.VoteTargets(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_PriceSnapshotHistory_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPriceSnapshotHistoryRequest + var metadata runtime.ServerMetadata + + msg, err := client.PriceSnapshotHistory(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_PriceSnapshotHistory_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPriceSnapshotHistoryRequest + var metadata runtime.ServerMetadata + + msg, err := server.PriceSnapshotHistory(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Twaps_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTwapsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["lookback_seconds"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "lookback_seconds") + } + + protoReq.LookbackSeconds, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "lookback_seconds", err) + } + + msg, err := client.Twaps(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Twaps_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTwapsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["lookback_seconds"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "lookback_seconds") + } + + protoReq.LookbackSeconds, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "lookback_seconds", err) + } + + msg, err := server.Twaps(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_FeederDelegation_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFeederDelegationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["validator_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "validator_addr") + } + + protoReq.ValidatorAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "validator_addr", err) + } + + msg, err := client.FeederDelegation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_FeederDelegation_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFeederDelegationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["validator_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "validator_addr") + } + + protoReq.ValidatorAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "validator_addr", err) + } + + msg, err := server.FeederDelegation(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_VotePenaltyCounter_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVotePenaltyCounterRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["validator_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "validator_addr") + } + + protoReq.ValidatorAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "validator_addr", err) + } + + msg, err := client.VotePenaltyCounter(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_VotePenaltyCounter_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVotePenaltyCounterRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["validator_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "validator_addr") + } + + protoReq.ValidatorAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "validator_addr", err) + } + + msg, err := server.VotePenaltyCounter(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_SlashWindow_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySlashWindowRequest + var metadata runtime.ServerMetadata + + msg, err := client.SlashWindow(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_SlashWindow_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySlashWindowRequest + var metadata runtime.ServerMetadata + + msg, err := server.SlashWindow(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_ExchangeRate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ExchangeRate_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ExchangeRate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ExchangeRates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ExchangeRates_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ExchangeRates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Actives_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Actives_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Actives_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_VoteTargets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_VoteTargets_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_VoteTargets_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_PriceSnapshotHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_PriceSnapshotHistory_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_PriceSnapshotHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Twaps_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Twaps_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Twaps_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_FeederDelegation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_FeederDelegation_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_FeederDelegation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_VotePenaltyCounter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_VotePenaltyCounter_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_VotePenaltyCounter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SlashWindow_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_SlashWindow_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SlashWindow_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_ExchangeRate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_ExchangeRate_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ExchangeRate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ExchangeRates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_ExchangeRates_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ExchangeRates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Actives_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Actives_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Actives_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_VoteTargets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_VoteTargets_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_VoteTargets_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_PriceSnapshotHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_PriceSnapshotHistory_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_PriceSnapshotHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Twaps_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Twaps_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Twaps_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_FeederDelegation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_FeederDelegation_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_FeederDelegation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_VotePenaltyCounter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_VotePenaltyCounter_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_VotePenaltyCounter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SlashWindow_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_SlashWindow_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SlashWindow_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_ExchangeRate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"sei-protocol", "sei-chain", "oracle", "denoms", "denom", "exchange_rate"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_ExchangeRates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"sei-protocol", "sei-chain", "oracle", "denoms", "exchange_rates"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Actives_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"sei-protocol", "sei-chain", "oracle", "denoms", "actives"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_VoteTargets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"sei-protocol", "sei-chain", "oracle", "denoms", "vote_targets"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_PriceSnapshotHistory_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"sei-protocol", "sei-chain", "oracle", "denoms", "price_snapshot_history"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Twaps_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"sei-protocol", "sei-chain", "oracle", "denoms", "twaps", "lookback_seconds"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_FeederDelegation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"sei-protocol", "sei-chain", "oracle", "validators", "validator_addr", "feeder"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_VotePenaltyCounter_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"sei-protocol", "sei-chain", "oracle", "validators", "validator_addr", "vote_penalty_counter"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_SlashWindow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"sei-protocol", "sei-chain", "oracle", "slash_window"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"sei-protocol", "sei-chain", "oracle", "params"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_ExchangeRate_0 = runtime.ForwardResponseMessage + + forward_Query_ExchangeRates_0 = runtime.ForwardResponseMessage + + forward_Query_Actives_0 = runtime.ForwardResponseMessage + + forward_Query_VoteTargets_0 = runtime.ForwardResponseMessage + + forward_Query_PriceSnapshotHistory_0 = runtime.ForwardResponseMessage + + forward_Query_Twaps_0 = runtime.ForwardResponseMessage + + forward_Query_FeederDelegation_0 = runtime.ForwardResponseMessage + + forward_Query_VotePenaltyCounter_0 = runtime.ForwardResponseMessage + + forward_Query_SlashWindow_0 = runtime.ForwardResponseMessage + + forward_Query_Params_0 = runtime.ForwardResponseMessage +) diff --git a/cmd/sei-cosmos-exporter/types/snapshots.go b/cmd/sei-cosmos-exporter/types/snapshots.go new file mode 100644 index 0000000..06a39b5 --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/snapshots.go @@ -0,0 +1,39 @@ +package types + +import ( + "gopkg.in/yaml.v2" +) + +// OracleExchangeRates - array of OracleExchangeRate +type PriceSnapshots []PriceSnapshot + +type ( + PriceSnapshotItems []PriceSnapshotItem + OracleTwaps []OracleTwap +) + +// String implements fmt.Stringer interface +func (snapshots PriceSnapshots) String() string { + out, _ := yaml.Marshal(snapshots) + return string(out) +} + +// String implements fmt.Stringer interface +func (items PriceSnapshotItems) String() string { + out, _ := yaml.Marshal(items) + return string(out) +} + +func NewPriceSnapshotItem(denom string, exchangeRate OracleExchangeRate) PriceSnapshotItem { + return PriceSnapshotItem{ + Denom: denom, + OracleExchangeRate: exchangeRate, + } +} + +func NewPriceSnapshot(priceSnapshotItems PriceSnapshotItems, snapshotTimestamp int64) PriceSnapshot { + return PriceSnapshot{ + SnapshotTimestamp: snapshotTimestamp, + PriceSnapshotItems: priceSnapshotItems, + } +} diff --git a/cmd/sei-cosmos-exporter/types/tx.pb.go b/cmd/sei-cosmos-exporter/types/tx.pb.go new file mode 100644 index 0000000..441abe5 --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/tx.pb.go @@ -0,0 +1,992 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: oracle/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgAggregateExchangeRateVote represents a message to submit +// aggregate exchange rate vote. +type MsgAggregateExchangeRateVote struct { + // 1 reserved from old field `salt` + ExchangeRates string `protobuf:"bytes,2,opt,name=exchange_rates,json=exchangeRates,proto3" json:"exchange_rates,omitempty" yaml:"exchange_rates"` + Feeder string `protobuf:"bytes,3,opt,name=feeder,proto3" json:"feeder,omitempty" yaml:"feeder"` + Validator string `protobuf:"bytes,4,opt,name=validator,proto3" json:"validator,omitempty" yaml:"validator"` +} + +func (m *MsgAggregateExchangeRateVote) Reset() { *m = MsgAggregateExchangeRateVote{} } +func (m *MsgAggregateExchangeRateVote) String() string { return proto.CompactTextString(m) } +func (*MsgAggregateExchangeRateVote) ProtoMessage() {} +func (*MsgAggregateExchangeRateVote) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5390096518ffda, []int{0} +} +func (m *MsgAggregateExchangeRateVote) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAggregateExchangeRateVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAggregateExchangeRateVote.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAggregateExchangeRateVote) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAggregateExchangeRateVote.Merge(m, src) +} +func (m *MsgAggregateExchangeRateVote) XXX_Size() int { + return m.Size() +} +func (m *MsgAggregateExchangeRateVote) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAggregateExchangeRateVote.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAggregateExchangeRateVote proto.InternalMessageInfo + +// MsgAggregateExchangeRateVoteResponse defines the Msg/AggregateExchangeRateVote response type. +type MsgAggregateExchangeRateVoteResponse struct { +} + +func (m *MsgAggregateExchangeRateVoteResponse) Reset() { *m = MsgAggregateExchangeRateVoteResponse{} } +func (m *MsgAggregateExchangeRateVoteResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAggregateExchangeRateVoteResponse) ProtoMessage() {} +func (*MsgAggregateExchangeRateVoteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5390096518ffda, []int{1} +} +func (m *MsgAggregateExchangeRateVoteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAggregateExchangeRateVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAggregateExchangeRateVoteResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAggregateExchangeRateVoteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAggregateExchangeRateVoteResponse.Merge(m, src) +} +func (m *MsgAggregateExchangeRateVoteResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAggregateExchangeRateVoteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAggregateExchangeRateVoteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAggregateExchangeRateVoteResponse proto.InternalMessageInfo + +// MsgDelegateFeedConsent represents a message to +// delegate oracle voting rights to another address. +type MsgDelegateFeedConsent struct { + Operator string `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty" yaml:"operator"` + Delegate string `protobuf:"bytes,2,opt,name=delegate,proto3" json:"delegate,omitempty" yaml:"delegate"` +} + +func (m *MsgDelegateFeedConsent) Reset() { *m = MsgDelegateFeedConsent{} } +func (m *MsgDelegateFeedConsent) String() string { return proto.CompactTextString(m) } +func (*MsgDelegateFeedConsent) ProtoMessage() {} +func (*MsgDelegateFeedConsent) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5390096518ffda, []int{2} +} +func (m *MsgDelegateFeedConsent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDelegateFeedConsent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDelegateFeedConsent.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDelegateFeedConsent) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDelegateFeedConsent.Merge(m, src) +} +func (m *MsgDelegateFeedConsent) XXX_Size() int { + return m.Size() +} +func (m *MsgDelegateFeedConsent) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDelegateFeedConsent.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDelegateFeedConsent proto.InternalMessageInfo + +// MsgDelegateFeedConsentResponse defines the Msg/DelegateFeedConsent response type. +type MsgDelegateFeedConsentResponse struct { +} + +func (m *MsgDelegateFeedConsentResponse) Reset() { *m = MsgDelegateFeedConsentResponse{} } +func (m *MsgDelegateFeedConsentResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDelegateFeedConsentResponse) ProtoMessage() {} +func (*MsgDelegateFeedConsentResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5390096518ffda, []int{3} +} +func (m *MsgDelegateFeedConsentResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDelegateFeedConsentResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDelegateFeedConsentResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDelegateFeedConsentResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDelegateFeedConsentResponse.Merge(m, src) +} +func (m *MsgDelegateFeedConsentResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDelegateFeedConsentResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDelegateFeedConsentResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDelegateFeedConsentResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgAggregateExchangeRateVote)(nil), "seiprotocol.seichain.oracle.MsgAggregateExchangeRateVote") + proto.RegisterType((*MsgAggregateExchangeRateVoteResponse)(nil), "seiprotocol.seichain.oracle.MsgAggregateExchangeRateVoteResponse") + proto.RegisterType((*MsgDelegateFeedConsent)(nil), "seiprotocol.seichain.oracle.MsgDelegateFeedConsent") + proto.RegisterType((*MsgDelegateFeedConsentResponse)(nil), "seiprotocol.seichain.oracle.MsgDelegateFeedConsentResponse") +} + +func init() { proto.RegisterFile("oracle/tx.proto", fileDescriptor_cb5390096518ffda) } + +var fileDescriptor_cb5390096518ffda = []byte{ + // 417 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xbf, 0xcf, 0xd2, 0x40, + 0x1c, 0xc6, 0x7b, 0x60, 0x08, 0x5c, 0x82, 0x68, 0x41, 0x03, 0x68, 0x5a, 0x72, 0x31, 0x46, 0x07, + 0x5b, 0x03, 0x93, 0xb8, 0x08, 0xfe, 0x18, 0x4c, 0x58, 0x3a, 0x38, 0xb8, 0x98, 0xa3, 0xfd, 0x7a, + 0x34, 0x29, 0xbd, 0xa6, 0x77, 0x1a, 0xd8, 0x4d, 0x74, 0x74, 0x75, 0x63, 0xf7, 0x1f, 0xd1, 0x8d, + 0xd1, 0xa9, 0x31, 0xb0, 0x38, 0xf7, 0x2f, 0x30, 0x5c, 0x5b, 0x5e, 0xde, 0x84, 0x97, 0x37, 0x61, + 0x3b, 0xee, 0xf9, 0x3c, 0xdf, 0xe7, 0xe1, 0x7b, 0x29, 0x6e, 0xf0, 0x98, 0xba, 0x01, 0xd8, 0x72, + 0x61, 0x45, 0x31, 0x97, 0x5c, 0xbf, 0x27, 0xc0, 0x57, 0x27, 0x97, 0x07, 0x96, 0x00, 0xdf, 0x9d, + 0x51, 0x3f, 0xb4, 0x32, 0xaa, 0xdb, 0x62, 0x9c, 0x71, 0xa5, 0xda, 0xbb, 0x53, 0x66, 0x21, 0xbf, + 0x11, 0xbe, 0x3f, 0x11, 0x6c, 0xc4, 0x58, 0x0c, 0x8c, 0x4a, 0x78, 0xbd, 0x70, 0x67, 0x34, 0x64, + 0xe0, 0x50, 0x09, 0xef, 0xb8, 0x04, 0xfd, 0x05, 0xbe, 0x09, 0xf9, 0xdd, 0x87, 0x98, 0x4a, 0x10, + 0xed, 0x52, 0x0f, 0x3d, 0xaa, 0x8d, 0x3b, 0x69, 0x62, 0xde, 0x59, 0xd2, 0x79, 0x30, 0x24, 0x97, + 0x75, 0xe2, 0xd4, 0xe1, 0x60, 0x88, 0xd0, 0x1f, 0xe3, 0xca, 0x47, 0x00, 0x0f, 0xe2, 0x76, 0x59, + 0x39, 0x6f, 0xa7, 0x89, 0x59, 0xcf, 0x9c, 0xd9, 0x3d, 0x71, 0x72, 0x40, 0xef, 0xe3, 0xda, 0x67, + 0x1a, 0xf8, 0x1e, 0x95, 0x3c, 0x6e, 0xdf, 0x50, 0x74, 0x2b, 0x4d, 0xcc, 0x5b, 0x19, 0xbd, 0x97, + 0x88, 0x73, 0x81, 0x0d, 0xab, 0xdf, 0x56, 0xa6, 0xf6, 0x6f, 0x65, 0x6a, 0xe4, 0x21, 0x7e, 0x70, + 0xea, 0xaf, 0x38, 0x20, 0x22, 0x1e, 0x0a, 0x20, 0x5f, 0x10, 0xbe, 0x3b, 0x11, 0xec, 0x15, 0x04, + 0x8a, 0x7b, 0x03, 0xe0, 0xbd, 0xdc, 0x09, 0xa1, 0xd4, 0x6d, 0x5c, 0xe5, 0x11, 0xc4, 0x2a, 0x1f, + 0xa9, 0xfc, 0x66, 0x9a, 0x98, 0x8d, 0x2c, 0xbf, 0x50, 0x88, 0xb3, 0x87, 0x76, 0x06, 0x2f, 0x9f, + 0x93, 0x2f, 0xe6, 0xc0, 0x50, 0x28, 0xc4, 0xd9, 0x43, 0x07, 0x75, 0x7b, 0xd8, 0x38, 0xde, 0xa2, + 0x28, 0xda, 0xff, 0x59, 0xc2, 0xe5, 0x89, 0x60, 0xfa, 0x0f, 0x84, 0x3b, 0x57, 0xbf, 0xd0, 0x33, + 0xeb, 0xc4, 0xb3, 0x5b, 0xa7, 0x36, 0xd2, 0x1d, 0x9d, 0x6d, 0x2d, 0x3a, 0xea, 0x5f, 0x11, 0x6e, + 0x1e, 0xdb, 0xe4, 0xe0, 0xba, 0xd1, 0x47, 0x4c, 0xdd, 0xe7, 0x67, 0x98, 0x8a, 0x26, 0xe3, 0xb7, + 0xbf, 0x36, 0x06, 0x5a, 0x6f, 0x0c, 0xf4, 0x77, 0x63, 0xa0, 0xef, 0x5b, 0x43, 0x5b, 0x6f, 0x0d, + 0xed, 0xcf, 0xd6, 0xd0, 0xde, 0x3f, 0x65, 0xbe, 0x9c, 0x7d, 0x9a, 0x5a, 0x2e, 0x9f, 0xdb, 0x02, + 0xfc, 0x27, 0x45, 0x82, 0xfa, 0xa1, 0x22, 0xec, 0x85, 0x5d, 0x7c, 0x4c, 0xcb, 0x08, 0xc4, 0xb4, + 0xa2, 0x90, 0xc1, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4a, 0xa4, 0x0e, 0xd3, 0x63, 0x03, 0x00, + 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // AggregateExchangeRateVote defines a method for submitting + // aggregate exchange rate vote + AggregateExchangeRateVote(ctx context.Context, in *MsgAggregateExchangeRateVote, opts ...grpc.CallOption) (*MsgAggregateExchangeRateVoteResponse, error) + // DelegateFeedConsent defines a method for setting the feeder delegation + DelegateFeedConsent(ctx context.Context, in *MsgDelegateFeedConsent, opts ...grpc.CallOption) (*MsgDelegateFeedConsentResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) AggregateExchangeRateVote(ctx context.Context, in *MsgAggregateExchangeRateVote, opts ...grpc.CallOption) (*MsgAggregateExchangeRateVoteResponse, error) { + out := new(MsgAggregateExchangeRateVoteResponse) + err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Msg/AggregateExchangeRateVote", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DelegateFeedConsent(ctx context.Context, in *MsgDelegateFeedConsent, opts ...grpc.CallOption) (*MsgDelegateFeedConsentResponse, error) { + out := new(MsgDelegateFeedConsentResponse) + err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Msg/DelegateFeedConsent", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // AggregateExchangeRateVote defines a method for submitting + // aggregate exchange rate vote + AggregateExchangeRateVote(context.Context, *MsgAggregateExchangeRateVote) (*MsgAggregateExchangeRateVoteResponse, error) + // DelegateFeedConsent defines a method for setting the feeder delegation + DelegateFeedConsent(context.Context, *MsgDelegateFeedConsent) (*MsgDelegateFeedConsentResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) AggregateExchangeRateVote(ctx context.Context, req *MsgAggregateExchangeRateVote) (*MsgAggregateExchangeRateVoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AggregateExchangeRateVote not implemented") +} +func (*UnimplementedMsgServer) DelegateFeedConsent(ctx context.Context, req *MsgDelegateFeedConsent) (*MsgDelegateFeedConsentResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegateFeedConsent not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_AggregateExchangeRateVote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAggregateExchangeRateVote) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AggregateExchangeRateVote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/seiprotocol.seichain.oracle.Msg/AggregateExchangeRateVote", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AggregateExchangeRateVote(ctx, req.(*MsgAggregateExchangeRateVote)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DelegateFeedConsent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDelegateFeedConsent) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DelegateFeedConsent(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/seiprotocol.seichain.oracle.Msg/DelegateFeedConsent", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DelegateFeedConsent(ctx, req.(*MsgDelegateFeedConsent)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "seiprotocol.seichain.oracle.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AggregateExchangeRateVote", + Handler: _Msg_AggregateExchangeRateVote_Handler, + }, + { + MethodName: "DelegateFeedConsent", + Handler: _Msg_DelegateFeedConsent_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "oracle/tx.proto", +} + +func (m *MsgAggregateExchangeRateVote) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgAggregateExchangeRateVote) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAggregateExchangeRateVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Validator) > 0 { + i -= len(m.Validator) + copy(dAtA[i:], m.Validator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Validator))) + i-- + dAtA[i] = 0x22 + } + if len(m.Feeder) > 0 { + i -= len(m.Feeder) + copy(dAtA[i:], m.Feeder) + i = encodeVarintTx(dAtA, i, uint64(len(m.Feeder))) + i-- + dAtA[i] = 0x1a + } + if len(m.ExchangeRates) > 0 { + i -= len(m.ExchangeRates) + copy(dAtA[i:], m.ExchangeRates) + i = encodeVarintTx(dAtA, i, uint64(len(m.ExchangeRates))) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} + +func (m *MsgAggregateExchangeRateVoteResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgAggregateExchangeRateVoteResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAggregateExchangeRateVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDelegateFeedConsent) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDelegateFeedConsent) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDelegateFeedConsent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Delegate) > 0 { + i -= len(m.Delegate) + copy(dAtA[i:], m.Delegate) + i = encodeVarintTx(dAtA, i, uint64(len(m.Delegate))) + i-- + dAtA[i] = 0x12 + } + if len(m.Operator) > 0 { + i -= len(m.Operator) + copy(dAtA[i:], m.Operator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Operator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDelegateFeedConsentResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDelegateFeedConsentResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDelegateFeedConsentResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgAggregateExchangeRateVote) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ExchangeRates) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Feeder) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Validator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgAggregateExchangeRateVoteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDelegateFeedConsent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Operator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Delegate) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgDelegateFeedConsentResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgAggregateExchangeRateVote) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAggregateExchangeRateVote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAggregateExchangeRateVote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRates", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExchangeRates = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Feeder", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Feeder = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Validator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAggregateExchangeRateVoteResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAggregateExchangeRateVoteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAggregateExchangeRateVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDelegateFeedConsent) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDelegateFeedConsent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDelegateFeedConsent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Operator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Delegate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDelegateFeedConsentResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDelegateFeedConsentResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDelegateFeedConsentResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/cmd/sei-cosmos-exporter/types/vote.go b/cmd/sei-cosmos-exporter/types/vote.go new file mode 100644 index 0000000..f98c440 --- /dev/null +++ b/cmd/sei-cosmos-exporter/types/vote.go @@ -0,0 +1,109 @@ +package types + +import ( + "fmt" + "strings" + + "gopkg.in/yaml.v2" + + cosmos_math "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// NewAggregateExchangeRateVote creates a AggregateExchangeRateVote instance +func NewAggregateExchangeRateVote(exchangeRateTuples ExchangeRateTuples, voter sdk.ValAddress) AggregateExchangeRateVote { + return AggregateExchangeRateVote{ + ExchangeRateTuples: exchangeRateTuples, + Voter: voter.String(), + } +} + +// String implement stringify +func (v AggregateExchangeRateVote) String() string { + out, _ := yaml.Marshal(v) + return string(out) +} + +// NewExchangeRateTuple creates a ExchangeRateTuple instance +func NewExchangeRateTuple(denom string, exchangeRate cosmos_math.LegacyDec) ExchangeRateTuple { + return ExchangeRateTuple{ + denom, + exchangeRate, + } +} + +// String implement stringify +func (v ExchangeRateTuple) String() string { + out, _ := yaml.Marshal(v) + return string(out) +} + +// ExchangeRateTuples - array of ExchangeRateTuple +type ExchangeRateTuples []ExchangeRateTuple + +// String implements fmt.Stringer interface +func (tuples ExchangeRateTuples) String() string { + out, _ := yaml.Marshal(tuples) + return string(out) +} + +// ParseExchangeRateTuples ExchangeRateTuple parser +func ParseExchangeRateTuples(tuplesStr string) (ExchangeRateTuples, error) { + tuplesStr = strings.TrimSpace(tuplesStr) + if len(tuplesStr) == 0 { + return nil, nil + } + + tupleStrs := strings.Split(tuplesStr, ",") + tuples := make(ExchangeRateTuples, len(tupleStrs)) + duplicateCheckMap := make(map[string]bool) + for i, tupleStr := range tupleStrs { + decCoin, err := sdk.ParseDecCoin(tupleStr) + if err != nil { + return nil, err + } + + tuples[i] = ExchangeRateTuple{ + Denom: decCoin.Denom, + ExchangeRate: decCoin.Amount, + } + + if _, ok := duplicateCheckMap[decCoin.Denom]; ok { + return nil, fmt.Errorf("duplicated denom %s", decCoin.Denom) + } + + duplicateCheckMap[decCoin.Denom] = true + } + + return tuples, nil +} + +// String implement stringify +func (ex OracleExchangeRate) String() string { + out, _ := yaml.Marshal(ex) + return string(out) +} + +// OracleExchangeRates - array of OracleExchangeRate +type DenomOracleExchangeRatePairs []DenomOracleExchangeRatePair + +// String implements fmt.Stringer interface +func (rates DenomOracleExchangeRatePairs) String() string { + out, _ := yaml.Marshal(rates) + return string(out) +} + +func NewDenomOracleExchangeRatePair(denom string, exchangeRate cosmos_math.LegacyDec, lastUpdate cosmos_math.Int, lastUpdateTimestamp int64) DenomOracleExchangeRatePair { + return DenomOracleExchangeRatePair{ + Denom: denom, + OracleExchangeRate: OracleExchangeRate{ + ExchangeRate: exchangeRate, + LastUpdate: lastUpdate, + LastUpdateTimestamp: lastUpdateTimestamp, + }, + } +} + +// VotePenaltyCounter - array of VotePenaltyCounter +type VotePenaltyCounters []VotePenaltyCounter diff --git a/cmd/sei-cosmos-exporter/utils/assets.go b/cmd/sei-cosmos-exporter/utils/assets.go new file mode 100644 index 0000000..0e7af7a --- /dev/null +++ b/cmd/sei-cosmos-exporter/utils/assets.go @@ -0,0 +1,10 @@ +package utils + +const ( + MicroUsdcDenom = "uusdc" + MicroSeiDenom = "usei" + MicroAtomDenom = "uatom" + MicroEthDenom = "ueth" + + MicroUnit = int64(1e6) +) diff --git a/cmd/sei-cosmos-exporter/utils/period.go b/cmd/sei-cosmos-exporter/utils/period.go new file mode 100644 index 0000000..65e3c8a --- /dev/null +++ b/cmd/sei-cosmos-exporter/utils/period.go @@ -0,0 +1,18 @@ +package utils + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + BlocksPerMinute = uint64(75) + BlocksPerHour = BlocksPerMinute * 60 + BlocksPerDay = BlocksPerHour * 24 + BlocksPerWeek = BlocksPerDay * 7 + BlocksPerMonth = BlocksPerDay * 30 + BlocksPerYear = BlocksPerDay * 365 +) + +func IsPeriodLastBlock(ctx sdk.Context, blocksPerPeriod uint64) bool { + return ((uint64)(ctx.BlockHeight())+1)%blocksPerPeriod == 0 +} diff --git a/go.mod b/go.mod index f08922b..a31c760 100644 --- a/go.mod +++ b/go.mod @@ -28,8 +28,6 @@ require ( require ( github.com/Team-Kujira/core v0.9.2-0.20231211132814-115e931f7117 github.com/cometbft/cometbft v0.38.2 - github.com/sei-protocol/sei-chain v0.1.429-bweng-test-1 - github.com/solarlabsteam/cosmos-exporter v0.0.0-00010101000000-000000000000 ) require ( @@ -132,6 +130,7 @@ require ( github.com/sagikazarmark/locafero v0.3.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect + github.com/sei-protocol/sei-chain v0.1.429-bweng-test-1 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.10.0 // indirect github.com/spf13/cast v1.5.1 // indirect @@ -166,4 +165,4 @@ require ( replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 -replace github.com/solarlabsteam/cosmos-exporter => ./ +replace github.com/pfc-developer/cosmos-exporter => ./ diff --git a/pkg/cosmosdirectory/get_test.go b/pkg/cosmosdirectory/get_test.go index 80dabdd..63d0246 100644 --- a/pkg/cosmosdirectory/get_test.go +++ b/pkg/cosmosdirectory/get_test.go @@ -4,8 +4,9 @@ import ( "fmt" "testing" - "github.com/pfc-developer/cosmos-exporter/pkg/cosmosdirectory" "github.com/stretchr/testify/require" + + "github.com/pfc-developer/cosmos-exporter/pkg/cosmosdirectory" ) func TestGetChain(t *testing.T) { diff --git a/pkg/exporter/general.go b/pkg/exporter/general.go index f9cdccf..002d444 100644 --- a/pkg/exporter/general.go +++ b/pkg/exporter/general.go @@ -9,7 +9,6 @@ import ( "time" "github.com/google/uuid" - "github.com/pfc-developer/cosmos-exporter/pkg/cosmosdirectory" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/rs/zerolog" @@ -21,6 +20,8 @@ import ( govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/pfc-developer/cosmos-exporter/pkg/cosmosdirectory" ) type GeneralMetrics struct {