From 98a2316251551d8ea350f634879149003e96f731 Mon Sep 17 00:00:00 2001 From: Unique Divine <51418232+Unique-Divine@users.noreply.github.com> Date: Sun, 26 Jun 2022 15:25:34 -0500 Subject: [PATCH] feat: Create and test AddOracleProposal. (#615) * feat(pricefeed): Create and test AddOracleProposal * test(common): TestAssetPairs_Contains * refactor: filter for unique oracles in NewGenesisState * Make proposal work for multiple oracles * test(pricefeed): TestMarshalAddOracleProposal * small import fix * refactor: Improve query variable names and remove unnecessary token0, token1 attributes on market --- app/app.go | 7 +- go.mod | 2 +- go.sum | 74 ++++ proto/pricefeed/gov.proto | 13 + proto/pricefeed/query.proto | 29 +- x/common/common.go | 15 +- x/common/common_test.go | 19 + x/pricefeed/client/cli/cli_test.go | 207 ++++++++++- x/pricefeed/client/cli/gov_client.go | 104 ++++++ x/pricefeed/client/cli/query.go | 24 +- x/pricefeed/client/cli/rest.go | 77 ++++ x/pricefeed/handler.go | 35 ++ x/pricefeed/keeper/grpc_query.go | 18 +- x/pricefeed/keeper/grpc_query_test.go | 18 +- x/pricefeed/types/codec.go | 7 + x/pricefeed/types/genesis.go | 8 +- x/pricefeed/types/gov.go | 82 +++++ x/pricefeed/types/gov.pb.go | 483 +++++++++++++++++++++++++ x/pricefeed/types/gov_test.go | 51 +++ x/pricefeed/types/market.go | 19 +- x/pricefeed/types/query.pb.go | 499 ++++++++++---------------- x/pricefeed/types/query.pb.gw.go | 28 +- x/testutil/cli/query.go | 4 +- 23 files changed, 1413 insertions(+), 410 deletions(-) create mode 100644 proto/pricefeed/gov.proto create mode 100644 x/pricefeed/client/cli/gov_client.go create mode 100644 x/pricefeed/client/cli/rest.go create mode 100644 x/pricefeed/types/gov.go create mode 100644 x/pricefeed/types/gov.pb.go create mode 100644 x/pricefeed/types/gov_test.go diff --git a/app/app.go b/app/app.go index 30d319177..44f3e562f 100644 --- a/app/app.go +++ b/app/app.go @@ -8,6 +8,8 @@ import ( "os" "path/filepath" + pricefeedcli "github.com/NibiruChain/nibiru/x/pricefeed/client/cli" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" _ "github.com/cosmos/cosmos-sdk/client/docs/statik" @@ -151,6 +153,8 @@ var ( distrclient.ProposalHandler, upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler, + pricefeedcli.AddOracleProposalHandler, + // pricefeedcli.RemoveOracleProposalHandler, // TODO ibcclientclient.UpdateClientProposalHandler, ibcclientclient.UpgradeProposalHandler, ), @@ -476,7 +480,8 @@ func NewNibiruApp( AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)). AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). - AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) + AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)). + AddRoute(pricefeedtypes.RouterKey, pricefeed.NewPricefeedProposalHandler(app.PricefeedKeeper)) app.TransferKeeper = ibctransferkeeper.NewKeeper( appCodec, diff --git a/go.mod b/go.mod index 997829e72..aec67f3d7 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/NibiruChain/nibiru -go 1.18 +go 1.17 require ( github.com/cosmos/cosmos-sdk v0.45.5 diff --git a/go.sum b/go.sum index 9e99ac736..1e3b4d525 100644 --- a/go.sum +++ b/go.sum @@ -27,13 +27,18 @@ cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aD cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= +cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM= cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= +cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= +cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= +cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= @@ -143,6 +148,7 @@ github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BRcvO8T0UEPu53cnw4IbV63x1bEjildYhO0= github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= @@ -217,6 +223,7 @@ github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfc github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44= github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU= +github.com/cosmos/cosmos-sdk v0.45.1/go.mod h1:XXS/asyCqWNWkx2rW6pSuen+EVcpAFxq6khrhnZgHaQ= github.com/cosmos/cosmos-sdk v0.45.5 h1:GVrZM+lss6y626Pq6loxh/3KLRgK/J6/alTkcKkYmGU= github.com/cosmos/cosmos-sdk v0.45.5/go.mod h1:WOqtDxN3eCCmnYLVla10xG7lEXkFjpTaqm2a2WasgCc= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= @@ -289,10 +296,12 @@ github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= @@ -421,6 +430,7 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -455,8 +465,11 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= +github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= +github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= @@ -494,6 +507,7 @@ github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIv github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= +github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= @@ -505,6 +519,7 @@ github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/S github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -538,6 +553,7 @@ github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOn github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= +github.com/hashicorp/serf v0.9.7/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 h1:uUjLpLt6bVvZ72SQc/B4dXcPBw4Vgd7soowdRl52qEM= github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87/go.mod h1:XGsKKeXxeRr95aEOgipvluMPlgjr7dGlk9ZTWOjcUcg= github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= @@ -549,6 +565,7 @@ github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3 github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/improbable-eng/grpc-web v0.14.1/go.mod h1:zEjGHa8DAlkoOXmswrNvhUGEYQA9UI7DhrGeHR1DMGU= github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= @@ -561,6 +578,7 @@ github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1C github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jhump/protoreflect v1.9.0 h1:npqHz788dryJiR/l6K/RUQAyh2SwV91+d1dnh4RjO9w= +github.com/jhump/protoreflect v1.9.0/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= @@ -611,6 +629,7 @@ github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+ github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.4 h1:SO9z7FRPzA03QhHKJrH5BXA6HU1rS4V2nIVrrNC1iYk= github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= @@ -668,6 +687,7 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= @@ -704,6 +724,7 @@ github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/neilotoole/errgroup v0.1.5/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= @@ -754,6 +775,11 @@ github.com/openzipkin/zipkin-go v0.2.5/go.mod h1:KpXfKdgRDnnhsxw4pNIH9Md5lyFqKUa github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/otiai10/copy v1.6.0 h1:IinKAryFFuPONZ7cm6T6E2QX/vcJwSnlaA5lfoaXIiQ= +github.com/otiai10/copy v1.6.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= +github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= +github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= +github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= +github.com/otiai10/mint v1.3.2/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= @@ -761,6 +787,7 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.0-beta.8 h1:dy81yyLYJDwMTifq24Oi/IslOslRrDSb3jwDggjz3Z0= @@ -813,6 +840,7 @@ github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB8 github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= @@ -854,7 +882,9 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM= +github.com/sagikazarmark/crypt v0.5.0/go.mod h1:l+nzl7KWh51rpzp2h7t4MZWyiEWdhNpOAnclKvg+mdA= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= @@ -884,12 +914,15 @@ github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= +github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= @@ -903,6 +936,8 @@ github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DM github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= +github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= github.com/spf13/viper v1.11.0 h1:7OX/1FS6n7jHD1zGrZTM7WtY13ZELRyosK4k93oPr44= github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUsX7Zk= @@ -989,10 +1024,13 @@ go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/api/v3 v3.5.2/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/pkg/v3 v3.5.2/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs= +go.etcd.io/etcd/client/v2 v2.305.2/go.mod h1:2D7ZejHVMIfog1221iLSYlQRzrtECw3kz4I4VAQm3qI= go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1152,7 +1190,11 @@ golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211208012354-db4efeb81f4b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4= golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1166,12 +1208,16 @@ golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1282,7 +1328,12 @@ golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= @@ -1349,8 +1400,10 @@ golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWc golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= @@ -1374,6 +1427,7 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U= +golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= @@ -1400,6 +1454,7 @@ google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34q google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= @@ -1410,7 +1465,12 @@ google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqiv google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw= google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= +google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= +google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= +google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= +google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1486,8 +1546,20 @@ google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4 h1:myaecH64R0bIEDjNORIel4iXubqzaHU1K2z8ajBwWcM= google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= @@ -1503,6 +1575,7 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= @@ -1521,6 +1594,7 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= diff --git a/proto/pricefeed/gov.proto b/proto/pricefeed/gov.proto new file mode 100644 index 000000000..2f4ef832f --- /dev/null +++ b/proto/pricefeed/gov.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +package nibiru.pricefeed.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/NibiruChain/nibiru/x/pricefeed/types"; + +message AddOracleProposal { + string title = 1; + string description = 2; + repeated string oracles = 3 [(gogoproto.moretags) = "yaml:\"oracles\""]; + repeated string pairs = 4 [(gogoproto.moretags) = "yaml:\"pairs\""]; +} \ No newline at end of file diff --git a/proto/pricefeed/query.proto b/proto/pricefeed/query.proto index af05b7a3c..11be29482 100644 --- a/proto/pricefeed/query.proto +++ b/proto/pricefeed/query.proto @@ -38,9 +38,9 @@ service Query { option (google.api.http).get = "/nibiru/pricefeed/v1beta1/oracles/{pair_id}"; } - // QueryPairs queries all pairs - rpc QueryPairs(QueryPairsRequest) returns (QueryPairsResponse) { - option (google.api.http).get = "/nibiru/pricefeed/v1beta1/pairs"; + // QueryMarkets queries all markets + rpc QueryMarkets(QueryMarketsRequest) returns (QueryMarketsResponse) { + option (google.api.http).get = "/nibiru/pricefeed/v1beta1/markets"; } } @@ -112,15 +112,16 @@ message QueryOraclesResponse { repeated string oracles = 1; } -// QueryPairsRequest is the request type for the Query/Pairs RPC method. -message QueryPairsRequest {} +// QueryMarketsRequest is the request type for the Query/Pairs RPC method. +message QueryMarketsRequest {} -// QueryPairsResponse is the response type for the Query/Pairs RPC method. -message QueryPairsResponse { +// QueryMarketsResponse is the response type for the Query/Pairs RPC method. +message QueryMarketsResponse { option (gogoproto.goproto_getters) = false; - // List of 'PairResponse' - repeated PairResponse pairs = 1 [(gogoproto.castrepeated) = "PairResponses", (gogoproto.nullable) = false]; + repeated Market markets = 1 [ + (gogoproto.castrepeated) = "Markets", + (gogoproto.nullable) = false]; } // PostedPriceResponse defines a price for 'PairID' posted by a specific oracle. @@ -138,11 +139,9 @@ message CurrentPriceResponse { string price = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; } -// PairResponse defines an asset in the pricefeed. -message PairResponse { +// Market defines an asset in the pricefeed. +message Market { string pair_id = 1 [(gogoproto.customname) = "PairID"]; - string token0 = 2; - string token1 = 3; - repeated string oracles = 4; - bool active = 5; + repeated string oracles = 2; + bool active = 3; } diff --git a/x/common/common.go b/x/common/common.go index d4bdad4fe..25e3d53f4 100644 --- a/x/common/common.go +++ b/x/common/common.go @@ -150,13 +150,10 @@ func NewAssetPairs(pairStrings ...string) (pairs AssetPairs) { return pairs } +// Contains checks if a token pair is contained within 'Pairs' func (pairs AssetPairs) Contains(pair AssetPair) bool { - for _, element := range pairs { - if (element.Token0 == pair.Token0) && (element.Token1 == pair.Token1) { - return true - } - } - return false + isContained, _ := pairs.ContainsAtIndex(pair) + return isContained } func (pairs AssetPairs) Strings() []string { @@ -170,7 +167,7 @@ func (pairs AssetPairs) Strings() []string { func (pairs AssetPairs) Validate() error { seenPairs := make(map[string]bool) for _, pair := range pairs { - pairID := SortedPairNameFromDenoms([]string{pair.Token0, pair.Token1}) + pairID := pair.String() if seenPairs[pairID] { return fmt.Errorf("duplicate pair %s", pairID) } @@ -182,7 +179,9 @@ func (pairs AssetPairs) Validate() error { return nil } -// Contains checks if a token pair is contained within 'Pairs' +// ContainsAtIndex checks if a token pair is contained within 'Pairs' and +// a boolean for this condition alongside the corresponding index of 'pair' in +// the slice of pairs. func (pairs AssetPairs) ContainsAtIndex(pair AssetPair) (bool, int) { for idx, element := range pairs { if (element.Token0 == pair.Token0) && (element.Token1 == pair.Token1) { diff --git a/x/common/common_test.go b/x/common/common_test.go index 9a64df41c..d39c8a587 100644 --- a/x/common/common_test.go +++ b/x/common/common_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/NibiruChain/nibiru/x/common" @@ -180,3 +181,21 @@ func TestAssetPair_Marshaling(t *testing.T) { }) } } + +func TestAssetPairs_Contains(t *testing.T) { + pairs := common.AssetPairs{ + common.PairBTCStable, common.PairETHStable, + } + + pair := common.PairGovStable + isContained, atIdx := pairs.ContainsAtIndex(pair) + assert.False(t, isContained) + assert.Equal(t, -1, atIdx) + assert.False(t, pairs.Contains(pair)) + + pair = pairs[0] + isContained, atIdx = pairs.ContainsAtIndex(pair) + assert.True(t, isContained) + assert.Equal(t, 0, atIdx) + assert.True(t, pairs.Contains(pair)) +} diff --git a/x/pricefeed/client/cli/cli_test.go b/x/pricefeed/client/cli/cli_test.go index 110c055d6..6507a2ed6 100644 --- a/x/pricefeed/client/cli/cli_test.go +++ b/x/pricefeed/client/cli/cli_test.go @@ -1,20 +1,28 @@ package cli_test import ( + "context" "fmt" + "io/ioutil" "strconv" "testing" "time" + simappparams "github.com/cosmos/cosmos-sdk/simapp/params" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdktestutil "github.com/cosmos/cosmos-sdk/testutil" sdktestutilcli "github.com/cosmos/cosmos-sdk/testutil/cli" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/gogo/protobuf/proto" "github.com/stretchr/testify/suite" tmcli "github.com/tendermint/tendermint/libs/cli" + govcli "github.com/cosmos/cosmos-sdk/x/gov/client/cli" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/NibiruChain/nibiru/app" "github.com/NibiruChain/nibiru/x/common" "github.com/NibiruChain/nibiru/x/pricefeed/client/cli" @@ -151,7 +159,7 @@ func (s IntegrationTestSuite) TestGetPriceCmd() { tc := tc s.Run(tc.name, func() { - cmd := cli.CmdPrice() + cmd := cli.CmdQueryPrice() queryResp := new(pricefeedtypes.QueryPriceResponse) err := testutilcli.ExecQuery( s.network, cmd, @@ -211,7 +219,7 @@ func (s IntegrationTestSuite) TestGetRawPricesCmd() { tc := tc s.Run(tc.name, func() { - cmd := cli.CmdRawPrices() + cmd := cli.CmdQueryRawPrices() queryResp := new(pricefeedtypes.QueryRawPricesResponse) err := testutilcli.ExecQuery( s.network, cmd, @@ -244,18 +252,18 @@ func (s IntegrationTestSuite) TestPairsCmd() { testCases := []struct { name string - expectedPairs pricefeedtypes.PairResponses - respType proto.Message + expectedMarkets []pricefeedtypes.Market + respType proto.Message }{ { name: "Get current pairs", - expectedPairs: pricefeedtypes.PairResponses{ - pricefeedtypes.NewPairResponse(common.PairGovStable, []sdk.AccAddress{oracle}, true), - pricefeedtypes.NewPairResponse(common.PairCollStable, []sdk.AccAddress{oracle}, true), - pricefeedtypes.NewPairResponse(common.PairBTCStable, []sdk.AccAddress{oracle}, true), - pricefeedtypes.NewPairResponse(common.PairETHStable, []sdk.AccAddress{oracle}, true), + expectedMarkets: []pricefeedtypes.Market{ + pricefeedtypes.NewMarket(common.PairGovStable, []sdk.AccAddress{oracle}, true), + pricefeedtypes.NewMarket(common.PairCollStable, []sdk.AccAddress{oracle}, true), + pricefeedtypes.NewMarket(common.PairBTCStable, []sdk.AccAddress{oracle}, true), + pricefeedtypes.NewMarket(common.PairETHStable, []sdk.AccAddress{oracle}, true), }, - respType: &pricefeedtypes.QueryPairsResponse{}, + respType: &pricefeedtypes.QueryMarketsResponse{}, }, } @@ -263,20 +271,20 @@ func (s IntegrationTestSuite) TestPairsCmd() { tc := tc s.Run(tc.name, func() { - cmd := cli.CmdPairs() + cmd := cli.CmdQueryMarkets() clientCtx := val.ClientCtx.WithOutputFormat("json") out, err := sdktestutilcli.ExecTestCLICmd(clientCtx, cmd, nil) s.Require().NoError(err, out.String()) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) - txResp := tc.respType.(*pricefeedtypes.QueryPairsResponse) + txResp := tc.respType.(*pricefeedtypes.QueryMarketsResponse) err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), txResp) s.Require().NoError(err) - s.Assert().Equal(len(tc.expectedPairs), len(txResp.Pairs)) + s.Assert().Equal(len(tc.expectedMarkets), len(txResp.Markets)) - for _, p := range txResp.Pairs { - s.Assert().Contains(tc.expectedPairs, p) + for _, market := range txResp.Markets { + s.Assert().Contains(tc.expectedMarkets, market) } }) } @@ -304,7 +312,7 @@ func (s IntegrationTestSuite) TestPricesCmd() { tc := tc s.Run(tc.name, func() { - cmd := cli.CmdPrices() + cmd := cli.CmdQueryPrices() clientCtx := val.ClientCtx.WithOutputFormat("json") out, err := sdktestutilcli.ExecTestCLICmd(clientCtx, cmd, nil) @@ -365,7 +373,7 @@ func (s IntegrationTestSuite) TestOraclesCmd() { tc := tc s.Run(tc.name, func() { - cmd := cli.CmdOracles() + cmd := cli.CmdQueryOracles() clientCtx := val.ClientCtx.WithOutputFormat("json") out, err := sdktestutilcli.ExecTestCLICmd(clientCtx, cmd, tc.args) @@ -544,6 +552,171 @@ func (s IntegrationTestSuite) TestGetParamsCmd() { } } +func (s IntegrationTestSuite) TestX_CmdAddOracleProposalAndVote() { + s.T().Log("Create oracle account") + s.Require().Len(s.network.Validators, 1) + val := s.network.Validators[0] + clientCtx := val.ClientCtx.WithOutputFormat("json") + oracleKeyringInfo, _, err := val.ClientCtx.Keyring.NewMnemonic( + /* uid */ "delphi-oracle", + /* language */ keyring.English, + /* hdPath */ sdk.FullFundraiserPath, + /* bip39Passphrase */ "", + /* algo */ hd.Secp256k1, + ) + s.Require().NoError(err) + + s.T().Log("Fill oracle wallet to pay gas on post price") + gasTokens := sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 100_000_000)) + oracle := sdk.AccAddress(oracleKeyringInfo.GetPubKey().Address()) + _, err = testutilcli.FillWalletFromValidator(oracle, gasTokens, val, s.cfg.BondDenom) + s.Require().NoError(err) + + s.T().Log("load example json as bytes") + proposal := &pricefeedtypes.AddOracleProposal{ + Title: "Cataclysm-004", + Description: "Whitelists Delphi to post prices for OHM and BTC", + Oracles: []string{oracle.String()}, + Pairs: []string{"ohm:usd", "btc:usd"}, + } + proposalJSONString := fmt.Sprintf(` + { + "title": "%v", + "description": "%v", + "oracles": ["%v"], + "pairs": ["%v", "%v"] + } + `, proposal.Title, proposal.Description, proposal.Oracles[0], + proposal.Pairs[0], proposal.Pairs[1], + ) + proposalJSON := sdktestutil.WriteToNewTempFile( + s.T(), proposalJSONString, + ) + contents, err := ioutil.ReadFile(proposalJSON.Name()) + s.Assert().NoError(err) + + s.T().Log("Unmarshal json bytes into proposal object; check validity") + encodingConfig := simappparams.MakeTestEncodingConfig() + proposal = &pricefeedtypes.AddOracleProposal{} + err = encodingConfig.Marshaler.UnmarshalJSON(contents, proposal) + s.Assert().NoError(err) + s.Require().NoError(proposal.Validate()) + + s.T().Log("Submit proposal and unmarshal tx response") + args := []string{ + proposalJSON.Name(), + fmt.Sprintf("--%s=1000unibi", govcli.FlagDeposit), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=test", flags.FlagKeyringBackend), + fmt.Sprintf("--from=%s", val.Address.String()), + } + cmd := cli.CmdAddOracleProposal() + flags.AddTxFlagsToCmd(cmd) + out, err := sdktestutilcli.ExecTestCLICmd(clientCtx, cmd, args) + s.Require().NoError(err) + s.Assert().NotContains(out.String(), "fail") + var txRespProtoMessage proto.Message = &sdk.TxResponse{} + s.Assert().NoError( + clientCtx.Codec.UnmarshalJSON(out.Bytes(), txRespProtoMessage), + out.String()) + txResp := txRespProtoMessage.(*sdk.TxResponse) + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), txResp) + s.Assert().NoError(err) + s.Assert().EqualValues(0, txResp.Code, out.String()) + + s.T().Log(`Check that proposal was correctly submitted with gov client + $ nibid query gov proposal 1`) + // the proposal tx won't be included until next block + s.Assert().NoError(s.network.WaitForNextBlock()) + govQueryClient := govtypes.NewQueryClient(clientCtx) + proposalsQueryResponse, err := govQueryClient.Proposals( + context.Background(), &govtypes.QueryProposalsRequest{}, + ) + s.Require().NoError(err) + s.Assert().NotEmpty(proposalsQueryResponse.Proposals) + s.Assert().EqualValues(1, proposalsQueryResponse.Proposals[0].ProposalId, + "first proposal should have proposal ID of 1") + s.Assert().Equalf( + govtypes.StatusDepositPeriod, + proposalsQueryResponse.Proposals[0].Status, + "proposal should be in deposit period as it hasn't passed min deposit") + s.Assert().EqualValues( + sdk.NewCoins(sdk.NewInt64Coin("unibi", 1_000)), + proposalsQueryResponse.Proposals[0].TotalDeposit, + ) + + s.T().Log(`Move proposal to vote status by meeting min deposit + $ nibid tx gov deposit [proposal-id] [deposit] [flags]`) + govDepositParams, err := govQueryClient.Params( + context.Background(), &govtypes.QueryParamsRequest{ParamsType: govtypes.ParamDeposit}) + s.Assert().NoError(err) + args = []string{ + /*proposal-id=*/ "1", + /*deposit=*/ govDepositParams.DepositParams.MinDeposit.String(), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=test", flags.FlagKeyringBackend), + fmt.Sprintf("--from=%s", val.Address.String()), + } + _, err = sdktestutilcli.ExecTestCLICmd(clientCtx, govcli.NewCmdDeposit(), args) + s.Assert().NoError(err) + + s.Assert().NoError(s.network.WaitForNextBlock()) + govQueryClient = govtypes.NewQueryClient(clientCtx) + proposalsQueryResponse, err = govQueryClient.Proposals( + context.Background(), &govtypes.QueryProposalsRequest{}) + s.Require().NoError(err) + s.Assert().Equalf( + govtypes.StatusVotingPeriod, + proposalsQueryResponse.Proposals[0].Status, + "proposal should be in voting period since min deposit has been met") + + s.T().Log(`Vote on the proposal. + $ nibid tx gov vote [proposal-id] [option] [flags] + e.g. $ nibid tx gov vote 1 yes`) + args = []string{ + /*proposal-id=*/ "1", + /*option=*/ "yes", + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=test", flags.FlagKeyringBackend), + fmt.Sprintf("--from=%s", val.Address.String()), + } + _, err = sdktestutilcli.ExecTestCLICmd(clientCtx, govcli.NewCmdVote(), args) + s.Assert().NoError(err) + txResp = &sdk.TxResponse{} + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), txResp) + s.Assert().NoError(err) + s.Assert().EqualValues(0, txResp.Code, out.String()) + + s.Assert().NoError(s.network.WaitForNextBlock()) + s.Require().Eventuallyf(func() bool { + proposalsQueryResponse, err = govQueryClient.Proposals( + context.Background(), &govtypes.QueryProposalsRequest{}) + s.Require().NoError(err) + return govtypes.StatusPassed == proposalsQueryResponse.Proposals[0].Status + }, 20*time.Second, 2*time.Second, + "proposal should pass after voting period") + + s.T().Log("verify that the new proposed pairs have been added to the params") + cmd = cli.CmdQueryParams() + args = []string{} + queryResp := &pricefeedtypes.QueryParamsResponse{} + s.Require().NoError(testutilcli.ExecQuery(s.network, cmd, args, queryResp)) + proposalPairs := common.NewAssetPairs(proposal.Pairs...) + expectedPairs := append(pricefeedtypes.DefaultPairs, proposalPairs...) + s.Assert().EqualValues(expectedPairs, queryResp.Params.Pairs) + + s.T().Log("verify that the oracle was whitelisted with a query") + cmd = cli.CmdQueryOracles() + for _, pair := range proposalPairs { + args = []string{pair.String()} + queryResp := &pricefeedtypes.QueryOraclesResponse{} + s.Assert().NoError(testutilcli.ExecQuery(s.network, cmd, args, queryResp)) + for _, proposalOracle := range proposal.Oracles { + s.Assert().Contains(queryResp.Oracles, proposalOracle) + } + } +} + func TestIntegrationTestSuite(t *testing.T) { suite.Run(t, new(IntegrationTestSuite)) } diff --git a/x/pricefeed/client/cli/gov_client.go b/x/pricefeed/client/cli/gov_client.go new file mode 100644 index 000000000..cc0494cff --- /dev/null +++ b/x/pricefeed/client/cli/gov_client.go @@ -0,0 +1,104 @@ +package cli + +import ( + "fmt" + "io/ioutil" + "strings" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/version" + govclient "github.com/cosmos/cosmos-sdk/x/gov/client" + govcli "github.com/cosmos/cosmos-sdk/x/gov/client/cli" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/NibiruChain/nibiru/x/pricefeed/types" + + "github.com/spf13/cobra" +) + +var ( + AddOracleProposalHandler = govclient.NewProposalHandler( + /* govclient.CLIHandlerFn */ CmdAddOracleProposal, + /* govclient.RESTHandlerFn */ AddOracleProposalRESTHandler) +) + +// CmdAddOracleProposal implements the client command to submit a governance +// proposal to whitelist an oracle for specified asset pairs. +func CmdAddOracleProposal() *cobra.Command { + cmd := &cobra.Command{ + Use: "add-oracle [proposal-json] --deposit=[deposit]", + Args: cobra.ExactArgs(1), + Short: "Submit a proposal to whitelist an oracle", + Example: strings.TrimSpace(fmt.Sprintf(` + Example: + $ %s tx gov submit-proposal add-oracle --deposit="1000unibi" --from= + `, version.AppName)), + Long: strings.TrimSpace( + `Submits a proposal to whitelist an oracle on specified pairs + + A proposal.json for 'AddOracleProposal' contains: + { + "title": "Cataclysm-004", + "description": "Whitelists Delphi to post prices for OHM", + "oracles": ["nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl"], + "pairs": ["uohm:uusd"] + } + `), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + from := clientCtx.GetFromAddress() + + proposal := &types.AddOracleProposal{} + contents, err := ioutil.ReadFile(args[0]) + if err != nil { + return err + } + + // marshals the contents into the proto.Message to which 'proposal' points. + if err = clientCtx.Codec.UnmarshalJSON(contents, proposal); err != nil { + return err + } + + depositStr, err := cmd.Flags().GetString(govcli.FlagDeposit) + if err != nil { + return err + } + deposit, err := sdk.ParseCoinsNormalized(depositStr) + if err != nil { + return err + } + + content := types.NewAddOracleProposal( + proposal.Title, + proposal.Description, + proposal.Oracles, + proposal.Pairs, + ) + msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from) + if err != nil { + return err + } + if err = msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + cmd.Flags().String( + /*name=*/ govcli.FlagDeposit, + /*defaultValue=*/ "", + /*usage=*/ "governance deposit for proposal") + if err := cmd.MarkFlagRequired(govcli.FlagDeposit); err != nil { + panic(err) + } + + return cmd +} diff --git a/x/pricefeed/client/cli/query.go b/x/pricefeed/client/cli/query.go index 0ca434542..49fbe357e 100644 --- a/x/pricefeed/client/cli/query.go +++ b/x/pricefeed/client/cli/query.go @@ -25,17 +25,17 @@ func GetQueryCmd() *cobra.Command { queryCmd.AddCommand( CmdQueryParams(), - CmdPrice(), - CmdPrices(), - CmdRawPrices(), - CmdOracles(), - CmdPairs(), + CmdQueryPrice(), + CmdQueryPrices(), + CmdQueryRawPrices(), + CmdQueryOracles(), + CmdQueryMarkets(), ) return queryCmd } -func CmdPrice() *cobra.Command { +func CmdQueryPrice() *cobra.Command { cmd := &cobra.Command{ Use: "price [pair-id]", Short: "Display current price for the given pair", @@ -69,7 +69,7 @@ func CmdPrice() *cobra.Command { return cmd } -func CmdPrices() *cobra.Command { +func CmdQueryPrices() *cobra.Command { cmd := &cobra.Command{ Use: "prices", Short: "Display current prices for all pairs", @@ -98,7 +98,7 @@ func CmdPrices() *cobra.Command { return cmd } -func CmdPairs() *cobra.Command { +func CmdQueryMarkets() *cobra.Command { cmd := &cobra.Command{ Use: "markets", Short: "Query markets", @@ -111,9 +111,9 @@ func CmdPairs() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) - request := &types.QueryPairsRequest{} + request := &types.QueryMarketsRequest{} - res, err := queryClient.QueryPairs(cmd.Context(), request) + res, err := queryClient.QueryMarkets(cmd.Context(), request) if err != nil { return err } @@ -127,7 +127,7 @@ func CmdPairs() *cobra.Command { return cmd } -func CmdOracles() *cobra.Command { +func CmdQueryOracles() *cobra.Command { cmd := &cobra.Command{ Use: "oracles [pair]", Short: "Query oracles", @@ -188,7 +188,7 @@ func CmdQueryParams() *cobra.Command { return cmd } -func CmdRawPrices() *cobra.Command { +func CmdQueryRawPrices() *cobra.Command { cmd := &cobra.Command{ Use: "raw-prices [market-id]", Short: "Query RawPrices", diff --git a/x/pricefeed/client/cli/rest.go b/x/pricefeed/client/cli/rest.go new file mode 100644 index 000000000..3ce56cc80 --- /dev/null +++ b/x/pricefeed/client/cli/rest.go @@ -0,0 +1,77 @@ +package cli + +import ( + "net/http" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/rest" + govclientrest "github.com/cosmos/cosmos-sdk/x/gov/client/rest" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/NibiruChain/nibiru/x/pricefeed/types" +) + +/* AddOracleProposalRESTHandler defines a REST handler an 'AddOracleProposal'. +The sub-route is mounted on the governance REST handler. +*/ +func AddOracleProposalRESTHandler(clientCtx client.Context) govclientrest.ProposalRESTHandler { + /* restHandlerFnAddOracleProposal is an HTTP handler for an 'AddOracleProposal'. + A 'HandlerFunc' type is an adapter to allow the use of ordinary functions as HTTP + handlers. If f is a function with the appropriate signature, HandlerFunc(f) + is a Handler that calls f. + */ + restHandlerFnAddOracleProposal := func(clientCtx client.Context) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req AddOracleProposalHttpRequest + if !rest.ReadRESTReq(w, r, clientCtx.LegacyAmino, &req) { + return + } + + req.BaseReq = req.BaseReq.Sanitize() + if !req.BaseReq.ValidateBasic(w) { + return + } + + content := types.NewAddOracleProposal( + req.Title, + req.Description, + req.Oracles, + req.Pairs, + ) + + fromAddr, err := sdk.AccAddressFromBech32(req.BaseReq.From) + if rest.CheckBadRequestError(w, err) { + return + } + + msg, err := govtypes.NewMsgSubmitProposal(content, req.Deposit, fromAddr) + if rest.CheckBadRequestError(w, err) { + return + } + if rest.CheckBadRequestError(w, msg.ValidateBasic()) { + return + } + + tx.WriteGeneratedTxResponse(clientCtx, w, req.BaseReq, msg) + } + } + + return govclientrest.ProposalRESTHandler{ + SubRoute: "add_oracle", + Handler: restHandlerFnAddOracleProposal(clientCtx), + } +} + +type ( + AddOracleProposalHttpRequest struct { + BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` + + Title string `json:"title" yaml:"title"` + Description string `json:"description" yaml:"description"` + Oracles []string `json:"oracle" yaml:"oracles"` + Pairs []string `json:"pairs" yaml:"pairs"` + Deposit sdk.Coins `json:"deposit" yaml:"deposit"` + } +) diff --git a/x/pricefeed/handler.go b/x/pricefeed/handler.go index 76cb1a54b..3a95dd24d 100644 --- a/x/pricefeed/handler.go +++ b/x/pricefeed/handler.go @@ -6,6 +6,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/NibiruChain/nibiru/x/common" "github.com/NibiruChain/nibiru/x/pricefeed/keeper" "github.com/NibiruChain/nibiru/x/pricefeed/types" ) @@ -27,3 +30,35 @@ func NewHandler(k keeper.Keeper) sdk.Handler { } } } + +/* NewPricefeedPropsalHandler defines a function that handles a proposal after it has +passed the governance process */ +func NewPricefeedProposalHandler(k keeper.Keeper) govtypes.Handler { + return func(ctx sdk.Context, content govtypes.Content) error { + switch contentType := content.(type) { + case *types.AddOracleProposal: + return handleAddOracleProposal(ctx, k, contentType) + default: + return sdkerrors.Wrapf( + sdkerrors.ErrUnknownRequest, + "unrecognized %s proposal content type: %T", types.ModuleName, contentType) + } + } +} + +func handleAddOracleProposal( + ctx sdk.Context, k keeper.Keeper, proposal *types.AddOracleProposal) error { + if err := proposal.Validate(); err != nil { + return err + } + oracles := common.StringsToAddrs(proposal.Oracles...) + + k.WhitelistOraclesForPairs( + ctx, + /*oracles=*/ oracles, + /*assetPairs=*/ common.NewAssetPairs(proposal.Pairs...), + ) + + // TODO Emit typed event for when oracles get added + return nil +} diff --git a/x/pricefeed/keeper/grpc_query.go b/x/pricefeed/keeper/grpc_query.go index 457f0139f..cd07a9077 100644 --- a/x/pricefeed/keeper/grpc_query.go +++ b/x/pricefeed/keeper/grpc_query.go @@ -117,7 +117,8 @@ func (k Keeper) QueryOracles(goCtx context.Context, req *types.QueryOraclesReque }, nil } -func (k Keeper) QueryParams(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) QueryParams(c context.Context, req *types.QueryParamsRequest, +) (*types.QueryParamsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -126,32 +127,29 @@ func (k Keeper) QueryParams(c context.Context, req *types.QueryParamsRequest) (* return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil } -func (k Keeper) QueryPairs(goCtx context.Context, req *types.QueryPairsRequest, -) (*types.QueryPairsResponse, error) { +func (k Keeper) QueryMarkets(goCtx context.Context, req *types.QueryMarketsRequest, +) (*types.QueryMarketsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } ctx := sdk.UnwrapSDKContext(goCtx) - var responses types.PairResponses + var markets types.Markets for _, pair := range k.GetParams(ctx).Pairs { var oracleStrings []string for _, oracle := range k.OraclesStore().Get(ctx, pair) { oracleStrings = append(oracleStrings, oracle.String()) } - responses = append(responses, types.PairResponse{ + markets = append(markets, types.Market{ PairID: pair.String(), - Token0: pair.Token0, - Token1: pair.Token1, Oracles: oracleStrings, Active: k.IsActivePair(ctx, pair.String()), }) } - // TODO improve these variable names. PairResponse is confusing on field "Pairs" - return &types.QueryPairsResponse{ - Pairs: responses, + return &types.QueryMarketsResponse{ + Markets: markets, }, nil } diff --git a/x/pricefeed/keeper/grpc_query_test.go b/x/pricefeed/keeper/grpc_query_test.go index 6d2bced71..e703a1671 100644 --- a/x/pricefeed/keeper/grpc_query_test.go +++ b/x/pricefeed/keeper/grpc_query_test.go @@ -77,41 +77,33 @@ func TestMarketsQuery(t *testing.T) { keeper.ActivePairsStore().SetMany(ctx, pairs[:3], true) keeper.ActivePairsStore().SetMany(ctx, common.AssetPairs{pairs[3]}, false) - response, err := keeper.QueryPairs(wctx, &types.QueryPairsRequest{}) + queryResp, err := keeper.QueryMarkets(wctx, &types.QueryMarketsRequest{}) require.NoError(t, err) - expectedResponse := &types.QueryPairsResponse{ - Pairs: []types.PairResponse{ + wantQueryResponse := &types.QueryMarketsResponse{ + Markets: []types.Market{ { PairID: pairs[0].String(), - Token0: pairs[0].Token0, - Token1: pairs[0].Token1, Oracles: []string(nil), Active: true, }, { PairID: pairs[1].String(), - Token0: pairs[1].Token0, - Token1: pairs[1].Token1, Oracles: []string(nil), Active: true, }, { PairID: pairs[2].String(), - Token0: pairs[2].Token0, - Token1: pairs[2].Token1, Oracles: []string{oracle2.String()}, Active: true, }, { PairID: pairs[3].String(), - Token0: pairs[3].Token0, - Token1: pairs[3].Token1, Oracles: []string{oracle3.String()}, Active: false, }, }, } - for idx, pairResponse := range expectedResponse.Pairs { - assert.EqualValues(t, pairResponse, response.Pairs[idx]) + for idx, wantMarket := range wantQueryResponse.Markets { + assert.EqualValues(t, wantMarket, queryResp.Markets[idx]) } } diff --git a/x/pricefeed/types/codec.go b/x/pricefeed/types/codec.go index 254330fd8..8ddfda756 100644 --- a/x/pricefeed/types/codec.go +++ b/x/pricefeed/types/codec.go @@ -5,6 +5,7 @@ import ( cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) func RegisterCodec(cdc *codec.LegacyAmino) { @@ -16,6 +17,12 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { /* interface */ (*sdk.Msg)(nil), &MsgPostPrice{}, ) + registry.RegisterImplementations( + /* interface */ + (*govtypes.Content)(nil), + &AddOracleProposal{}, + // &types.RemoveOracleProposal{}, + ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/pricefeed/types/genesis.go b/x/pricefeed/types/genesis.go index 140b24ae2..e9493e75a 100644 --- a/x/pricefeed/types/genesis.go +++ b/x/pricefeed/types/genesis.go @@ -22,9 +22,15 @@ func DefaultGenesis() *GenesisState { // NewGenesisState creates a new genesis state for the pricefeed module func NewGenesisState(p Params, postedPrices []PostedPrice) *GenesisState { var oracles []string + seenOracles := make(map[string]bool) for _, postedPrice := range postedPrices { oracle := sdk.MustAccAddressFromBech32(postedPrice.Oracle) - oracles = append(oracles, oracle.String()) + if seenOracles[oracle.String()] { + continue + } else { + oracles = append(oracles, oracle.String()) + } + seenOracles[oracle.String()] = true } return &GenesisState{ Params: p, diff --git a/x/pricefeed/types/gov.go b/x/pricefeed/types/gov.go new file mode 100644 index 000000000..25e84acd0 --- /dev/null +++ b/x/pricefeed/types/gov.go @@ -0,0 +1,82 @@ +package types + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/NibiruChain/nibiru/x/common" +) + +const ( + ProposalTypeAddOracle = "AddOracle" +) + +var _ govtypes.Content = &AddOracleProposal{} + +func init() { + govtypes.RegisterProposalType(ProposalTypeAddOracle) + govtypes.RegisterProposalTypeCodec(&AddOracleProposal{}, "nibiru/AddOracleProposal") +} + +func NewAddOracleProposal( + title string, description string, oracles []string, pairs []string, +) *AddOracleProposal { + proposal := &AddOracleProposal{ + Title: title, + Description: description, + Oracles: oracles, + Pairs: pairs, + } + + if err := proposal.Validate(); err != nil { + panic(err) + } + + return proposal +} + +func (m *AddOracleProposal) ProposalRoute() string { + return RouterKey +} + +func (m *AddOracleProposal) ProposalType() string { + return ProposalTypeAddOracle +} + +func (m *AddOracleProposal) ValidateBasic() error { + if err := govtypes.ValidateAbstract(m); err != nil { + return err + } + + if len(m.Pairs) == 0 { + return fmt.Errorf("can't whitelist an oracle address without pairs") + } + + return nil +} + +func (m *AddOracleProposal) Validate() error { + seenOracles := make(map[string]bool) + for _, oracleStr := range m.Oracles { + _, err := sdk.AccAddressFromBech32(oracleStr) + if err != nil { + return err + } + + if seenOracles[oracleStr] { + continue + } + seenOracles[oracleStr] = true + } + + for _, pairStr := range m.Pairs { + _, err := common.NewAssetPair(pairStr) + if err != nil { + return err + } + } + + return nil +} diff --git a/x/pricefeed/types/gov.pb.go b/x/pricefeed/types/gov.pb.go new file mode 100644 index 000000000..c758889bb --- /dev/null +++ b/x/pricefeed/types/gov.pb.go @@ -0,0 +1,483 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pricefeed/gov.proto + +package types + +import ( + fmt "fmt" + _ "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 AddOracleProposal struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Oracles []string `protobuf:"bytes,3,rep,name=oracles,proto3" json:"oracles,omitempty" yaml:"oracles"` + Pairs []string `protobuf:"bytes,4,rep,name=pairs,proto3" json:"pairs,omitempty" yaml:"pairs"` +} + +func (m *AddOracleProposal) Reset() { *m = AddOracleProposal{} } +func (m *AddOracleProposal) String() string { return proto.CompactTextString(m) } +func (*AddOracleProposal) ProtoMessage() {} +func (*AddOracleProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_93b5d0eeea70f3f6, []int{0} +} +func (m *AddOracleProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AddOracleProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AddOracleProposal.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 *AddOracleProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddOracleProposal.Merge(m, src) +} +func (m *AddOracleProposal) XXX_Size() int { + return m.Size() +} +func (m *AddOracleProposal) XXX_DiscardUnknown() { + xxx_messageInfo_AddOracleProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_AddOracleProposal proto.InternalMessageInfo + +func (m *AddOracleProposal) GetTitle() string { + if m != nil { + return m.Title + } + return "" +} + +func (m *AddOracleProposal) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *AddOracleProposal) GetOracles() []string { + if m != nil { + return m.Oracles + } + return nil +} + +func (m *AddOracleProposal) GetPairs() []string { + if m != nil { + return m.Pairs + } + return nil +} + +func init() { + proto.RegisterType((*AddOracleProposal)(nil), "nibiru.pricefeed.v1.AddOracleProposal") +} + +func init() { proto.RegisterFile("pricefeed/gov.proto", fileDescriptor_93b5d0eeea70f3f6) } + +var fileDescriptor_93b5d0eeea70f3f6 = []byte{ + // 258 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0x28, 0xca, 0x4c, + 0x4e, 0x4d, 0x4b, 0x4d, 0x4d, 0xd1, 0x4f, 0xcf, 0x2f, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0x12, 0xce, 0xcb, 0x4c, 0xca, 0x2c, 0x2a, 0xd5, 0x83, 0xcb, 0xe9, 0x95, 0x19, 0x4a, 0x89, 0xa4, + 0xe7, 0xa7, 0xe7, 0x83, 0xe5, 0xf5, 0x41, 0x2c, 0x88, 0x52, 0xa5, 0x85, 0x8c, 0x5c, 0x82, 0x8e, + 0x29, 0x29, 0xfe, 0x45, 0x89, 0xc9, 0x39, 0xa9, 0x01, 0x45, 0xf9, 0x05, 0xf9, 0xc5, 0x89, 0x39, + 0x42, 0x22, 0x5c, 0xac, 0x25, 0x99, 0x25, 0x39, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, + 0x10, 0x8e, 0x90, 0x02, 0x17, 0x77, 0x4a, 0x6a, 0x71, 0x72, 0x51, 0x66, 0x41, 0x49, 0x66, 0x7e, + 0x9e, 0x04, 0x13, 0x58, 0x0e, 0x59, 0x48, 0x48, 0x87, 0x8b, 0x3d, 0x1f, 0x6c, 0x52, 0xb1, 0x04, + 0xb3, 0x02, 0xb3, 0x06, 0xa7, 0x93, 0xd0, 0xa7, 0x7b, 0xf2, 0x7c, 0x95, 0x89, 0xb9, 0x39, 0x56, + 0x4a, 0x50, 0x09, 0xa5, 0x20, 0x98, 0x12, 0x21, 0x35, 0x2e, 0xd6, 0x82, 0xc4, 0xcc, 0xa2, 0x62, + 0x09, 0x16, 0xb0, 0x5a, 0x81, 0x4f, 0xf7, 0xe4, 0x79, 0x20, 0x6a, 0xc1, 0xc2, 0x4a, 0x41, 0x10, + 0x69, 0x27, 0xcf, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, + 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xd2, 0x4f, 0xcf, + 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0xf7, 0x03, 0xfb, 0xd9, 0x39, 0x23, 0x31, + 0x33, 0x4f, 0x1f, 0xe2, 0x7f, 0xfd, 0x0a, 0x7d, 0x44, 0xe8, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, + 0xb1, 0x81, 0x7d, 0x6d, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xb1, 0xab, 0x16, 0x50, 0x37, 0x01, + 0x00, 0x00, +} + +func (m *AddOracleProposal) 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 *AddOracleProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AddOracleProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Pairs) > 0 { + for iNdEx := len(m.Pairs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Pairs[iNdEx]) + copy(dAtA[i:], m.Pairs[iNdEx]) + i = encodeVarintGov(dAtA, i, uint64(len(m.Pairs[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if len(m.Oracles) > 0 { + for iNdEx := len(m.Oracles) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Oracles[iNdEx]) + copy(dAtA[i:], m.Oracles[iNdEx]) + i = encodeVarintGov(dAtA, i, uint64(len(m.Oracles[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintGov(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintGov(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGov(dAtA []byte, offset int, v uint64) int { + offset -= sovGov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *AddOracleProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if len(m.Oracles) > 0 { + for _, s := range m.Oracles { + l = len(s) + n += 1 + l + sovGov(uint64(l)) + } + } + if len(m.Pairs) > 0 { + for _, s := range m.Pairs { + l = len(s) + n += 1 + l + sovGov(uint64(l)) + } + } + return n +} + +func sovGov(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGov(x uint64) (n int) { + return sovGov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *AddOracleProposal) 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 ErrIntOverflowGov + } + 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: AddOracleProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AddOracleProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Oracles", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Oracles = append(m.Oracles, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pairs", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pairs = append(m.Pairs, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGov(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, ErrIntOverflowGov + } + 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, ErrIntOverflowGov + } + 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, ErrIntOverflowGov + } + 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, ErrInvalidLengthGov + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGov + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGov + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGov = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGov = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGov = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/pricefeed/types/gov_test.go b/x/pricefeed/types/gov_test.go new file mode 100644 index 000000000..cde604304 --- /dev/null +++ b/x/pricefeed/types/gov_test.go @@ -0,0 +1,51 @@ +package types + +import ( + "fmt" + "io/ioutil" + "testing" + + sdktestutil "github.com/cosmos/cosmos-sdk/testutil" + simappparams "github.com/cosmos/ibc-go/v3/testing/simapp/params" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/NibiruChain/nibiru/x/common" + "github.com/NibiruChain/nibiru/x/testutil/sample" +) + +func TestMarshalAddOracleProposal(t *testing.T) { + t.Log("load example json as bytes") + _, oracles := sample.PrivKeyAddressPairs(4) + proposal := AddOracleProposal{ + Title: "Cataclysm-004", + Description: "Whitelists Delphi to post prices for OHM and BTC", + Oracles: common.AddrsToStrings(oracles...), + Pairs: []string{"ohm:usd", "btc:usd"}, + } + + oraclesJSONValue := fmt.Sprintf(`["%s", "%s", "%s", "%s"]`, + oracles[0], oracles[1], oracles[2], oracles[3]) + proposalJSONString := fmt.Sprintf(` + { + "title": "%v", + "description": "%v", + "oracles": %v, + "pairs": ["%v", "%v"] + } + `, proposal.Title, proposal.Description, oraclesJSONValue, + proposal.Pairs[0], proposal.Pairs[1], + ) + proposalJSON := sdktestutil.WriteToNewTempFile( + t, proposalJSONString, + ) + contents, err := ioutil.ReadFile(proposalJSON.Name()) + assert.NoError(t, err) + + t.Log("Unmarshal json bytes into proposal object; check validity") + encodingConfig := simappparams.MakeTestEncodingConfig() + proposal = AddOracleProposal{} + err = encodingConfig.Marshaler.UnmarshalJSON(contents, &proposal) + assert.NoError(t, err) + require.NoError(t, proposal.Validate()) +} diff --git a/x/pricefeed/types/market.go b/x/pricefeed/types/market.go index c3fe2db7f..23652825c 100644 --- a/x/pricefeed/types/market.go +++ b/x/pricefeed/types/market.go @@ -11,8 +11,10 @@ import ( "github.com/NibiruChain/nibiru/x/common" ) -// NewPairResponse returns a new PairResponse -func NewPairResponse(pair common.AssetPair, oracles []sdk.AccAddress, active bool) PairResponse { +// Required for gogoproto.castrepeated = "Markets" +type Markets []Market + +func NewMarket(pair common.AssetPair, oracles []sdk.AccAddress, active bool) Market { if err := pair.Validate(); err != nil { panic(err) } @@ -20,18 +22,19 @@ func NewPairResponse(pair common.AssetPair, oracles []sdk.AccAddress, active boo for _, oracle := range oracles { strOracles = append(strOracles, oracle.String()) } - - return PairResponse{ + return Market{ PairID: pair.String(), - Token1: pair.Token1, - Token0: pair.Token0, Oracles: strOracles, Active: active, } } -// PairResponses is a slice of PairResponse -type PairResponses []PairResponse +// NewQueryMarketsResponse returns a new QueryMarketsResponse +func NewQueryMarketsResponse(pair common.AssetPair, oracles []sdk.AccAddress, active bool) QueryMarketsResponse { + return QueryMarketsResponse{ + Markets: []Market{NewMarket(pair, oracles, active)}, + } +} /* NewCurrentPrice returns an instance of CurrentPrice diff --git a/x/pricefeed/types/query.pb.go b/x/pricefeed/types/query.pb.go index f9c283c9a..e63a6e450 100644 --- a/x/pricefeed/types/query.pb.go +++ b/x/pricefeed/types/query.pb.go @@ -416,22 +416,22 @@ func (m *QueryOraclesResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryOraclesResponse proto.InternalMessageInfo -// QueryPairsRequest is the request type for the Query/Pairs RPC method. -type QueryPairsRequest struct { +// QueryMarketsRequest is the request type for the Query/Pairs RPC method. +type QueryMarketsRequest struct { } -func (m *QueryPairsRequest) Reset() { *m = QueryPairsRequest{} } -func (m *QueryPairsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryPairsRequest) ProtoMessage() {} -func (*QueryPairsRequest) Descriptor() ([]byte, []int) { +func (m *QueryMarketsRequest) Reset() { *m = QueryMarketsRequest{} } +func (m *QueryMarketsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryMarketsRequest) ProtoMessage() {} +func (*QueryMarketsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_d96dcacfb6f84073, []int{10} } -func (m *QueryPairsRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryMarketsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryPairsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryMarketsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryPairsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryMarketsRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -441,36 +441,35 @@ func (m *QueryPairsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *QueryPairsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPairsRequest.Merge(m, src) +func (m *QueryMarketsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMarketsRequest.Merge(m, src) } -func (m *QueryPairsRequest) XXX_Size() int { +func (m *QueryMarketsRequest) XXX_Size() int { return m.Size() } -func (m *QueryPairsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPairsRequest.DiscardUnknown(m) +func (m *QueryMarketsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMarketsRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryPairsRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryMarketsRequest proto.InternalMessageInfo -// QueryPairsResponse is the response type for the Query/Pairs RPC method. -type QueryPairsResponse struct { - // List of 'PairResponse' - Pairs PairResponses `protobuf:"bytes,1,rep,name=pairs,proto3,castrepeated=PairResponses" json:"pairs"` +// QueryMarketsResponse is the response type for the Query/Pairs RPC method. +type QueryMarketsResponse struct { + Markets Markets `protobuf:"bytes,1,rep,name=markets,proto3,castrepeated=Markets" json:"markets"` } -func (m *QueryPairsResponse) Reset() { *m = QueryPairsResponse{} } -func (m *QueryPairsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryPairsResponse) ProtoMessage() {} -func (*QueryPairsResponse) Descriptor() ([]byte, []int) { +func (m *QueryMarketsResponse) Reset() { *m = QueryMarketsResponse{} } +func (m *QueryMarketsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryMarketsResponse) ProtoMessage() {} +func (*QueryMarketsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_d96dcacfb6f84073, []int{11} } -func (m *QueryPairsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryMarketsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryPairsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryMarketsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryPairsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryMarketsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -480,17 +479,17 @@ func (m *QueryPairsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryPairsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPairsResponse.Merge(m, src) +func (m *QueryMarketsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMarketsResponse.Merge(m, src) } -func (m *QueryPairsResponse) XXX_Size() int { +func (m *QueryMarketsResponse) XXX_Size() int { return m.Size() } -func (m *QueryPairsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPairsResponse.DiscardUnknown(m) +func (m *QueryMarketsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMarketsResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryPairsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryMarketsResponse proto.InternalMessageInfo // PostedPriceResponse defines a price for 'PairID' posted by a specific oracle. type PostedPriceResponse struct { @@ -601,27 +600,25 @@ func (m *CurrentPriceResponse) GetPairID() string { return "" } -// PairResponse defines an asset in the pricefeed. -type PairResponse struct { +// Market defines an asset in the pricefeed. +type Market struct { PairID string `protobuf:"bytes,1,opt,name=pair_id,json=pairId,proto3" json:"pair_id,omitempty"` - Token0 string `protobuf:"bytes,2,opt,name=token0,proto3" json:"token0,omitempty"` - Token1 string `protobuf:"bytes,3,opt,name=token1,proto3" json:"token1,omitempty"` - Oracles []string `protobuf:"bytes,4,rep,name=oracles,proto3" json:"oracles,omitempty"` - Active bool `protobuf:"varint,5,opt,name=active,proto3" json:"active,omitempty"` + Oracles []string `protobuf:"bytes,2,rep,name=oracles,proto3" json:"oracles,omitempty"` + Active bool `protobuf:"varint,3,opt,name=active,proto3" json:"active,omitempty"` } -func (m *PairResponse) Reset() { *m = PairResponse{} } -func (m *PairResponse) String() string { return proto.CompactTextString(m) } -func (*PairResponse) ProtoMessage() {} -func (*PairResponse) Descriptor() ([]byte, []int) { +func (m *Market) Reset() { *m = Market{} } +func (m *Market) String() string { return proto.CompactTextString(m) } +func (*Market) ProtoMessage() {} +func (*Market) Descriptor() ([]byte, []int) { return fileDescriptor_d96dcacfb6f84073, []int{14} } -func (m *PairResponse) XXX_Unmarshal(b []byte) error { +func (m *Market) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *PairResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Market) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_PairResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_Market.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -631,47 +628,33 @@ func (m *PairResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *PairResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_PairResponse.Merge(m, src) +func (m *Market) XXX_Merge(src proto.Message) { + xxx_messageInfo_Market.Merge(m, src) } -func (m *PairResponse) XXX_Size() int { +func (m *Market) XXX_Size() int { return m.Size() } -func (m *PairResponse) XXX_DiscardUnknown() { - xxx_messageInfo_PairResponse.DiscardUnknown(m) +func (m *Market) XXX_DiscardUnknown() { + xxx_messageInfo_Market.DiscardUnknown(m) } -var xxx_messageInfo_PairResponse proto.InternalMessageInfo +var xxx_messageInfo_Market proto.InternalMessageInfo -func (m *PairResponse) GetPairID() string { +func (m *Market) GetPairID() string { if m != nil { return m.PairID } return "" } -func (m *PairResponse) GetToken0() string { - if m != nil { - return m.Token0 - } - return "" -} - -func (m *PairResponse) GetToken1() string { - if m != nil { - return m.Token1 - } - return "" -} - -func (m *PairResponse) GetOracles() []string { +func (m *Market) GetOracles() []string { if m != nil { return m.Oracles } return nil } -func (m *PairResponse) GetActive() bool { +func (m *Market) GetActive() bool { if m != nil { return m.Active } @@ -689,72 +672,70 @@ func init() { proto.RegisterType((*QueryRawPricesResponse)(nil), "nibiru.pricefeed.v1.QueryRawPricesResponse") proto.RegisterType((*QueryOraclesRequest)(nil), "nibiru.pricefeed.v1.QueryOraclesRequest") proto.RegisterType((*QueryOraclesResponse)(nil), "nibiru.pricefeed.v1.QueryOraclesResponse") - proto.RegisterType((*QueryPairsRequest)(nil), "nibiru.pricefeed.v1.QueryPairsRequest") - proto.RegisterType((*QueryPairsResponse)(nil), "nibiru.pricefeed.v1.QueryPairsResponse") + proto.RegisterType((*QueryMarketsRequest)(nil), "nibiru.pricefeed.v1.QueryMarketsRequest") + proto.RegisterType((*QueryMarketsResponse)(nil), "nibiru.pricefeed.v1.QueryMarketsResponse") proto.RegisterType((*PostedPriceResponse)(nil), "nibiru.pricefeed.v1.PostedPriceResponse") proto.RegisterType((*CurrentPriceResponse)(nil), "nibiru.pricefeed.v1.CurrentPriceResponse") - proto.RegisterType((*PairResponse)(nil), "nibiru.pricefeed.v1.PairResponse") + proto.RegisterType((*Market)(nil), "nibiru.pricefeed.v1.Market") } func init() { proto.RegisterFile("pricefeed/query.proto", fileDescriptor_d96dcacfb6f84073) } var fileDescriptor_d96dcacfb6f84073 = []byte{ - // 869 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0x3d, 0xa9, 0xed, 0x36, 0xd3, 0x1f, 0x12, 0x63, 0x3b, 0x58, 0xa6, 0xec, 0xa6, 0x8b, - 0x68, 0xdc, 0x96, 0xec, 0x62, 0x17, 0x2a, 0x81, 0xb8, 0xe0, 0x86, 0x43, 0x2f, 0x85, 0xae, 0x10, - 0x07, 0x2e, 0x61, 0x6c, 0x4f, 0xdd, 0xa1, 0xf5, 0xee, 0x66, 0x66, 0x9d, 0x1f, 0x42, 0x39, 0x80, - 0x04, 0x42, 0x9c, 0x82, 0x10, 0x12, 0xc7, 0x1c, 0x11, 0x7f, 0x49, 0x8e, 0x91, 0xb8, 0x20, 0x0e, - 0x49, 0x70, 0xe0, 0xbf, 0xe0, 0x80, 0x76, 0xe6, 0xed, 0x66, 0x37, 0x59, 0xff, 0x40, 0x3d, 0x25, - 0xfb, 0x66, 0xde, 0xfb, 0x7e, 0xde, 0x9b, 0xe7, 0x2f, 0xae, 0x05, 0x82, 0xf7, 0xd8, 0x53, 0xc6, - 0xfa, 0xce, 0xc6, 0x88, 0x89, 0x1d, 0x3b, 0x10, 0x7e, 0xe8, 0x93, 0x8a, 0xc7, 0xbb, 0x5c, 0x8c, - 0xec, 0xe4, 0xd4, 0xde, 0x6c, 0x35, 0xaa, 0x03, 0x7f, 0xe0, 0xab, 0x73, 0x27, 0xfa, 0x4f, 0x5f, - 0x6d, 0xdc, 0x1c, 0xf8, 0xfe, 0xe0, 0x05, 0x73, 0x68, 0xc0, 0x1d, 0xea, 0x79, 0x7e, 0x48, 0x43, - 0xee, 0x7b, 0x12, 0x4e, 0x4d, 0x38, 0x55, 0x5f, 0xdd, 0xd1, 0x53, 0x27, 0xe4, 0x43, 0x26, 0x43, - 0x3a, 0x0c, 0xe0, 0xc2, 0xd2, 0x19, 0x40, 0x40, 0x05, 0x1d, 0x42, 0xa2, 0x55, 0xc5, 0xe4, 0x49, - 0x04, 0xf4, 0x89, 0x0a, 0xba, 0x6c, 0x63, 0xc4, 0x64, 0x68, 0x7d, 0x86, 0x2b, 0x99, 0xa8, 0x0c, - 0x7c, 0x4f, 0x32, 0xf2, 0x1e, 0x2e, 0xeb, 0xe4, 0x3a, 0x5a, 0x46, 0xcd, 0xab, 0xed, 0xd7, 0xec, - 0x1c, 0x7e, 0x5b, 0x27, 0x75, 0x8a, 0x07, 0x47, 0x66, 0xc1, 0x85, 0x84, 0xf7, 0x8b, 0xdf, 0xef, - 0x9b, 0x05, 0xab, 0x8d, 0x5f, 0xd1, 0x75, 0xa3, 0xfb, 0x20, 0x46, 0x5e, 0xc5, 0x97, 0x03, 0xca, - 0xc5, 0x3a, 0xef, 0xab, 0xb2, 0x8b, 0x51, 0x0e, 0x17, 0x8f, 0xfa, 0x90, 0x43, 0x63, 0x42, 0x9d, - 0x03, 0x28, 0x1f, 0xe1, 0x92, 0x12, 0x05, 0x92, 0x3b, 0xb9, 0x24, 0x0f, 0x47, 0x42, 0x30, 0x2f, - 0xcc, 0x64, 0x02, 0x97, 0xce, 0x06, 0x89, 0x6a, 0x5a, 0x22, 0x19, 0xc2, 0x6e, 0x3c, 0x04, 0x88, - 0x82, 0xf2, 0x17, 0xb8, 0xac, 0x72, 0xa3, 0x21, 0x5c, 0xfa, 0x7f, 0xd2, 0xaf, 0x47, 0xd2, 0xbf, - 0x1d, 0x9b, 0xb5, 0xbc, 0x53, 0xe9, 0x42, 0x5d, 0x80, 0x7a, 0x80, 0x6b, 0x4a, 0xde, 0xa5, 0x5b, - 0x19, 0xae, 0x59, 0xf3, 0xfa, 0x16, 0xe1, 0xa5, 0xf3, 0x89, 0x80, 0xce, 0x30, 0x16, 0x74, 0x6b, - 0x3d, 0x83, 0xdf, 0xcc, 0x7f, 0x43, 0x5f, 0x86, 0xac, 0x9f, 0xa5, 0xbf, 0x09, 0xf4, 0xd5, 0x9c, - 0x43, 0xe9, 0x2e, 0x8a, 0x58, 0x0e, 0x38, 0xde, 0x81, 0xf1, 0x7d, 0x2c, 0x68, 0xef, 0xc5, 0xdc, - 0xf4, 0x0f, 0x70, 0x35, 0x9b, 0x05, 0xe8, 0x75, 0x7c, 0xd9, 0xd7, 0x21, 0xc5, 0xbd, 0xe8, 0xc6, - 0x9f, 0x90, 0x57, 0x89, 0x37, 0x8b, 0x72, 0x91, 0xbc, 0xe0, 0x97, 0xc9, 0x72, 0xab, 0x20, 0x94, - 0x7a, 0x8c, 0x4b, 0x91, 0x64, 0x3c, 0x80, 0x5b, 0x13, 0x96, 0x98, 0x8b, 0xa4, 0xf3, 0x1a, 0x74, - 0x7e, 0x3d, 0x1d, 0x95, 0xae, 0x2e, 0x03, 0x00, 0xff, 0x20, 0x5c, 0xc9, 0x19, 0x0c, 0x79, 0xe3, - 0x5c, 0xbf, 0x1d, 0x3c, 0x3e, 0x32, 0xcb, 0x51, 0xa1, 0x47, 0x6b, 0x71, 0xef, 0xe4, 0x4d, 0x7c, - 0x43, 0xb7, 0xb3, 0x4e, 0xfb, 0x7d, 0xc1, 0xa4, 0xac, 0x2f, 0xa8, 0xd9, 0x5c, 0xd7, 0xd1, 0x0f, - 0x75, 0x90, 0xac, 0xc5, 0x4b, 0x7f, 0x49, 0x55, 0xb2, 0x23, 0xac, 0x3f, 0x8f, 0xcc, 0xdb, 0x03, - 0x1e, 0x3e, 0x1b, 0x75, 0xed, 0x9e, 0x3f, 0x74, 0x7a, 0xbe, 0x1c, 0xfa, 0x12, 0xfe, 0xac, 0xca, - 0xfe, 0x73, 0x27, 0xdc, 0x09, 0x98, 0xb4, 0xd7, 0x58, 0x0f, 0x76, 0x9e, 0x7c, 0x80, 0xcb, 0x6c, - 0x3b, 0xe0, 0x62, 0xa7, 0x5e, 0x54, 0xbf, 0x9d, 0x86, 0xad, 0xcd, 0xc3, 0x8e, 0xcd, 0xc3, 0xfe, - 0x34, 0x36, 0x8f, 0xce, 0x95, 0x48, 0x62, 0xef, 0xd8, 0x44, 0x2e, 0xe4, 0x58, 0x5f, 0x23, 0x5c, - 0xcd, 0x5b, 0xdf, 0xf9, 0x1a, 0x4d, 0x3a, 0x58, 0x78, 0x89, 0x0e, 0xac, 0x9f, 0x11, 0xbe, 0x96, - 0x7e, 0x8a, 0xf9, 0xb4, 0x97, 0x70, 0x39, 0xf4, 0x9f, 0x33, 0xef, 0x6d, 0x18, 0x2e, 0x7c, 0x25, - 0xf1, 0x96, 0x1e, 0x2b, 0xc4, 0x5b, 0xe9, 0x95, 0x2b, 0x66, 0x56, 0x2e, 0xca, 0xa0, 0xbd, 0x90, - 0x6f, 0xb2, 0x7a, 0x69, 0x19, 0x35, 0xaf, 0xb8, 0xf0, 0xd5, 0xfe, 0xb7, 0x8c, 0x4b, 0x6a, 0xe1, - 0xc8, 0x0f, 0x08, 0x5f, 0x4d, 0x39, 0x28, 0x59, 0xc9, 0x5d, 0xb2, 0x8b, 0xce, 0xdb, 0x68, 0xce, - 0xbe, 0xa8, 0x7b, 0xb6, 0x9a, 0xdf, 0xfc, 0xfe, 0xf7, 0x4f, 0x0b, 0x16, 0x59, 0x76, 0x74, 0x86, - 0x73, 0xe6, 0xf0, 0x9b, 0xad, 0x2e, 0x0b, 0x69, 0x0b, 0x9c, 0x9e, 0xfc, 0x88, 0x30, 0x3e, 0x73, - 0x32, 0x72, 0x7b, 0x8a, 0x44, 0xca, 0x97, 0x1b, 0x2b, 0x33, 0xef, 0x01, 0x49, 0x5b, 0x91, 0xbc, - 0x45, 0xee, 0x4e, 0x21, 0x51, 0xce, 0xe0, 0x7c, 0x05, 0xaf, 0xb4, 0x9b, 0x1a, 0x90, 0x3a, 0x21, - 0xb3, 0xc4, 0xe6, 0x1a, 0x50, 0xc6, 0xed, 0xe6, 0x1a, 0x90, 0x16, 0xdf, 0x47, 0xf8, 0x46, 0xd6, - 0x32, 0xc9, 0xdd, 0xc9, 0x32, 0xe7, 0x0d, 0xb9, 0x71, 0x6f, 0xae, 0xbb, 0x40, 0xf5, 0xae, 0xa2, - 0x72, 0xc8, 0xea, 0x64, 0x2a, 0x41, 0xb7, 0x2e, 0xcc, 0xeb, 0x17, 0x84, 0xaf, 0xa5, 0x8d, 0x91, - 0x4c, 0x99, 0x43, 0xd6, 0x71, 0x1b, 0x77, 0xe6, 0xb8, 0x09, 0x70, 0xf7, 0x15, 0xdc, 0x2a, 0xb9, - 0x37, 0x19, 0x0e, 0x7e, 0x03, 0x29, 0xb4, 0xef, 0x92, 0xf5, 0x8a, 0xec, 0x70, 0xea, 0x7a, 0xa5, - 0xcc, 0x79, 0xea, 0x7a, 0xa5, 0xfd, 0xda, 0x5a, 0x51, 0x50, 0xb7, 0x88, 0x39, 0x6d, 0xd1, 0xb9, - 0x90, 0x9d, 0x27, 0x27, 0x7f, 0x19, 0xe8, 0xd7, 0xb1, 0x81, 0x0e, 0xc6, 0x06, 0x3a, 0x1c, 0x1b, - 0xe8, 0x64, 0x6c, 0xa0, 0xbd, 0x53, 0xa3, 0x70, 0x78, 0x6a, 0x14, 0xfe, 0x38, 0x35, 0x0a, 0x9f, - 0x3b, 0x29, 0x9f, 0x79, 0xac, 0x8a, 0x3d, 0x7c, 0x46, 0xb9, 0x17, 0x17, 0xde, 0x4e, 0x95, 0x56, - 0xa6, 0xd3, 0x2d, 0x2b, 0x4f, 0xbc, 0xff, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x03, 0xac, - 0x64, 0xc0, 0x09, 0x00, 0x00, + // 843 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0x4f, 0x4f, 0x1b, 0x47, + 0x18, 0xc6, 0xbd, 0x06, 0x6c, 0x18, 0x5a, 0xaa, 0x0e, 0x36, 0xb5, 0x5c, 0xba, 0xa6, 0x8b, 0x0a, + 0x06, 0xca, 0xae, 0x30, 0x2d, 0x52, 0xab, 0x5e, 0x6a, 0x68, 0xa5, 0x1e, 0x9a, 0xc0, 0x2a, 0xca, + 0x21, 0x17, 0x67, 0xec, 0x1d, 0xcc, 0x0a, 0xec, 0x5d, 0x66, 0xd7, 0xfc, 0x51, 0xc4, 0x21, 0x51, + 0x22, 0x45, 0x39, 0x44, 0x44, 0xb9, 0xe4, 0xc8, 0x31, 0xca, 0x27, 0xe1, 0x88, 0x94, 0x4b, 0x94, + 0x03, 0x10, 0x93, 0x7c, 0x8f, 0x68, 0x67, 0xde, 0x35, 0xbb, 0x66, 0xfd, 0x27, 0xca, 0xc9, 0xde, + 0x99, 0x79, 0xde, 0xe7, 0x37, 0xef, 0xbe, 0xfb, 0xa0, 0xb4, 0xcd, 0xcc, 0x0a, 0xdd, 0xa4, 0xd4, + 0xd0, 0x76, 0x1b, 0x94, 0x1d, 0xaa, 0x36, 0xb3, 0x5c, 0x0b, 0x8f, 0xd7, 0xcd, 0xb2, 0xc9, 0x1a, + 0x6a, 0x6b, 0x57, 0xdd, 0x5b, 0xca, 0xa6, 0xaa, 0x56, 0xd5, 0xe2, 0xfb, 0x9a, 0xf7, 0x4f, 0x1c, + 0xcd, 0x4e, 0x56, 0x2d, 0xab, 0xba, 0x43, 0x35, 0x62, 0x9b, 0x1a, 0xa9, 0xd7, 0x2d, 0x97, 0xb8, + 0xa6, 0x55, 0x77, 0x60, 0x37, 0x07, 0xbb, 0xfc, 0xa9, 0xdc, 0xd8, 0xd4, 0x5c, 0xb3, 0x46, 0x1d, + 0x97, 0xd4, 0x6c, 0x38, 0x30, 0x71, 0x0d, 0x60, 0x13, 0x46, 0x6a, 0x20, 0x54, 0x52, 0x08, 0x6f, + 0x78, 0x40, 0xeb, 0x7c, 0x51, 0xa7, 0xbb, 0x0d, 0xea, 0xb8, 0xca, 0x5d, 0x34, 0x1e, 0x5a, 0x75, + 0x6c, 0xab, 0xee, 0x50, 0xfc, 0x07, 0x4a, 0x08, 0x71, 0x46, 0x9a, 0x92, 0xf2, 0xa3, 0x85, 0x1f, + 0xd5, 0x08, 0x7e, 0x55, 0x88, 0x8a, 0x83, 0xa7, 0xe7, 0xb9, 0x98, 0x0e, 0x82, 0x3f, 0x07, 0x9f, + 0x9e, 0xe4, 0x62, 0x4a, 0x01, 0x7d, 0x2f, 0xea, 0x7a, 0xe7, 0xc1, 0x0c, 0xff, 0x80, 0x92, 0x36, + 0x31, 0x59, 0xc9, 0x34, 0x78, 0xd9, 0x11, 0x4f, 0x63, 0xb2, 0xff, 0x0c, 0xd0, 0x10, 0x9f, 0x50, + 0x68, 0x00, 0xe5, 0x1f, 0x34, 0xc4, 0x4d, 0x81, 0x64, 0x2e, 0x92, 0x64, 0xb5, 0xc1, 0x18, 0xad, + 0xbb, 0x21, 0x25, 0x70, 0x09, 0x35, 0x58, 0xa4, 0x82, 0x16, 0xad, 0x26, 0x1c, 0xf9, 0x4d, 0x80, + 0x55, 0x70, 0xbe, 0x8f, 0x12, 0x5c, 0xeb, 0x35, 0x61, 0xe0, 0xcb, 0xac, 0x7f, 0xf2, 0xac, 0xdf, + 0x5c, 0xe4, 0xd2, 0x51, 0xbb, 0x8e, 0x0e, 0x75, 0x01, 0x6a, 0x05, 0xa5, 0xb9, 0xbd, 0x4e, 0xf6, + 0x43, 0x5c, 0xbd, 0xfa, 0xf5, 0x44, 0x42, 0x13, 0xed, 0x42, 0x40, 0xa7, 0x08, 0x31, 0xb2, 0x5f, + 0x0a, 0xe1, 0xe7, 0xa3, 0xdf, 0xa1, 0xe5, 0xb8, 0xd4, 0x08, 0xd3, 0x4f, 0x02, 0x7d, 0x2a, 0x62, + 0xd3, 0xd1, 0x47, 0x98, 0x6f, 0x07, 0x1c, 0xbf, 0x41, 0xfb, 0x6e, 0x33, 0x52, 0xd9, 0xe9, 0x9b, + 0x7e, 0x05, 0xa5, 0xc2, 0x2a, 0x40, 0xcf, 0xa0, 0xa4, 0x25, 0x96, 0x38, 0xf7, 0x88, 0xee, 0x3f, + 0x82, 0x2e, 0x0d, 0x6e, 0xff, 0x13, 0xb6, 0x4d, 0xdd, 0xd6, 0x3b, 0x34, 0xa0, 0x5c, 0x6b, 0x19, + 0xca, 0xfd, 0x8b, 0x92, 0x35, 0xb1, 0x04, 0x6d, 0x88, 0x1e, 0x65, 0x21, 0x2b, 0x7e, 0x07, 0x37, + 0x4f, 0xfa, 0x65, 0x7c, 0x31, 0x98, 0x7f, 0x92, 0xd0, 0x78, 0x44, 0x53, 0xf0, 0x74, 0xdb, 0x5d, + 0x8b, 0xa8, 0x79, 0x9e, 0x4b, 0xac, 0x7b, 0xf7, 0x5d, 0xf3, 0xef, 0x8d, 0x7f, 0x41, 0x63, 0xe2, + 0x2a, 0x25, 0x62, 0x18, 0x8c, 0x3a, 0x4e, 0x26, 0xce, 0xfb, 0xf2, 0xad, 0x58, 0xfd, 0x5b, 0x2c, + 0xe2, 0x35, 0x7f, 0xe0, 0x07, 0x78, 0x25, 0xd5, 0x43, 0x7a, 0x7f, 0x9e, 0x9b, 0xa9, 0x9a, 0xee, + 0x56, 0xa3, 0xac, 0x56, 0xac, 0x9a, 0x56, 0xb1, 0x9c, 0x9a, 0xe5, 0xc0, 0xcf, 0xa2, 0x63, 0x6c, + 0x6b, 0xee, 0xa1, 0x4d, 0x1d, 0x75, 0x8d, 0x56, 0x60, 0xde, 0xf1, 0x5f, 0x28, 0x41, 0x0f, 0x6c, + 0x93, 0x1d, 0x66, 0x06, 0xf9, 0x77, 0x93, 0x55, 0x45, 0x70, 0xa8, 0x7e, 0x70, 0xa8, 0x77, 0xfc, + 0xe0, 0x28, 0x0e, 0x7b, 0x16, 0xc7, 0x17, 0x39, 0x49, 0x07, 0x8d, 0xf2, 0x50, 0x42, 0xa9, 0xa8, + 0xd1, 0xed, 0xef, 0xa2, 0xad, 0x1b, 0xc4, 0xbf, 0xe2, 0x06, 0x4a, 0x09, 0x25, 0xc4, 0x5b, 0xe8, + 0xcf, 0x34, 0x30, 0x37, 0xf1, 0xd0, 0xdc, 0xe0, 0x09, 0x94, 0x20, 0x15, 0xd7, 0xdc, 0x13, 0x1d, + 0x1d, 0xd6, 0xe1, 0xa9, 0xf0, 0x38, 0x89, 0x86, 0xf8, 0xcc, 0xe0, 0x67, 0x12, 0x1a, 0x0d, 0xc4, + 0x20, 0x9e, 0x8d, 0x9c, 0x91, 0x9b, 0xf1, 0x99, 0xcd, 0xf7, 0x3e, 0x28, 0x1a, 0xa7, 0xe4, 0x1f, + 0xbd, 0xfd, 0xf8, 0x32, 0xae, 0xe0, 0x29, 0x4d, 0x28, 0xb4, 0xeb, 0x98, 0xde, 0x5b, 0x2a, 0x53, + 0x97, 0x2c, 0x41, 0x5c, 0xe3, 0x17, 0x12, 0x42, 0xd7, 0x71, 0x84, 0x67, 0xba, 0x58, 0x04, 0xc2, + 0x35, 0x3b, 0xdb, 0xf3, 0x1c, 0x90, 0x14, 0x38, 0xc9, 0xaf, 0x78, 0xbe, 0x0b, 0x09, 0xff, 0xbc, + 0xb5, 0x07, 0xd0, 0xf5, 0xa3, 0x40, 0x83, 0xf8, 0x0e, 0xee, 0x65, 0xd6, 0x57, 0x83, 0x42, 0x91, + 0xd5, 0x57, 0x83, 0x84, 0xf9, 0x89, 0x84, 0xc6, 0xc2, 0xb9, 0x87, 0xe7, 0x3b, 0xdb, 0xb4, 0xa7, + 0x6a, 0x76, 0xa1, 0xaf, 0xb3, 0x40, 0xf5, 0x3b, 0xa7, 0xd2, 0xf0, 0x62, 0x67, 0x2a, 0x46, 0xf6, + 0x6f, 0xf4, 0xeb, 0x95, 0x84, 0xbe, 0x09, 0xa6, 0x1b, 0xee, 0xd2, 0x87, 0x70, 0x6c, 0x66, 0xe7, + 0xfa, 0x38, 0x09, 0x70, 0xcb, 0x1c, 0x6e, 0x11, 0x2f, 0x74, 0x86, 0x83, 0x6f, 0x20, 0x80, 0xf6, + 0xdc, 0x47, 0x83, 0x88, 0xeb, 0x86, 0x16, 0xce, 0xd8, 0x6e, 0x68, 0x6d, 0xb1, 0xab, 0xcc, 0x71, + 0xb4, 0x69, 0xfc, 0x73, 0x67, 0x34, 0x48, 0xd6, 0xe2, 0xc6, 0xe5, 0x07, 0x59, 0x7a, 0xdd, 0x94, + 0xa5, 0xd3, 0xa6, 0x2c, 0x9d, 0x35, 0x65, 0xe9, 0xb2, 0x29, 0x4b, 0xc7, 0x57, 0x72, 0xec, 0xec, + 0x4a, 0x8e, 0xbd, 0xbb, 0x92, 0x63, 0xf7, 0xb4, 0x40, 0x70, 0xdc, 0xe2, 0xe5, 0x56, 0xb7, 0x88, + 0x59, 0xf7, 0x4b, 0x1f, 0x04, 0x8a, 0xf3, 0x14, 0x29, 0x27, 0x78, 0xc8, 0x2d, 0x7f, 0x0e, 0x00, + 0x00, 0xff, 0xff, 0x3a, 0x8f, 0x28, 0x79, 0x8d, 0x09, 0x00, 0x00, } func (this *QueryParamsRequest) VerboseEqual(that interface{}) error { @@ -1315,7 +1296,7 @@ func (this *QueryOraclesResponse) Equal(that interface{}) bool { } return true } -func (this *QueryPairsRequest) VerboseEqual(that interface{}) error { +func (this *QueryMarketsRequest) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil @@ -1323,33 +1304,33 @@ func (this *QueryPairsRequest) VerboseEqual(that interface{}) error { return fmt.Errorf("that == nil && this != nil") } - that1, ok := that.(*QueryPairsRequest) + that1, ok := that.(*QueryMarketsRequest) if !ok { - that2, ok := that.(QueryPairsRequest) + that2, ok := that.(QueryMarketsRequest) if ok { that1 = &that2 } else { - return fmt.Errorf("that is not of type *QueryPairsRequest") + return fmt.Errorf("that is not of type *QueryMarketsRequest") } } if that1 == nil { if this == nil { return nil } - return fmt.Errorf("that is type *QueryPairsRequest but is nil && this != nil") + return fmt.Errorf("that is type *QueryMarketsRequest but is nil && this != nil") } else if this == nil { - return fmt.Errorf("that is type *QueryPairsRequest but is not nil && this == nil") + return fmt.Errorf("that is type *QueryMarketsRequest but is not nil && this == nil") } return nil } -func (this *QueryPairsRequest) Equal(that interface{}) bool { +func (this *QueryMarketsRequest) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*QueryPairsRequest) + that1, ok := that.(*QueryMarketsRequest) if !ok { - that2, ok := that.(QueryPairsRequest) + that2, ok := that.(QueryMarketsRequest) if ok { that1 = &that2 } else { @@ -1363,7 +1344,7 @@ func (this *QueryPairsRequest) Equal(that interface{}) bool { } return true } -func (this *QueryPairsResponse) VerboseEqual(that interface{}) error { +func (this *QueryMarketsResponse) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil @@ -1371,41 +1352,41 @@ func (this *QueryPairsResponse) VerboseEqual(that interface{}) error { return fmt.Errorf("that == nil && this != nil") } - that1, ok := that.(*QueryPairsResponse) + that1, ok := that.(*QueryMarketsResponse) if !ok { - that2, ok := that.(QueryPairsResponse) + that2, ok := that.(QueryMarketsResponse) if ok { that1 = &that2 } else { - return fmt.Errorf("that is not of type *QueryPairsResponse") + return fmt.Errorf("that is not of type *QueryMarketsResponse") } } if that1 == nil { if this == nil { return nil } - return fmt.Errorf("that is type *QueryPairsResponse but is nil && this != nil") + return fmt.Errorf("that is type *QueryMarketsResponse but is nil && this != nil") } else if this == nil { - return fmt.Errorf("that is type *QueryPairsResponse but is not nil && this == nil") + return fmt.Errorf("that is type *QueryMarketsResponse but is not nil && this == nil") } - if len(this.Pairs) != len(that1.Pairs) { - return fmt.Errorf("Pairs this(%v) Not Equal that(%v)", len(this.Pairs), len(that1.Pairs)) + if len(this.Markets) != len(that1.Markets) { + return fmt.Errorf("Markets this(%v) Not Equal that(%v)", len(this.Markets), len(that1.Markets)) } - for i := range this.Pairs { - if !this.Pairs[i].Equal(&that1.Pairs[i]) { - return fmt.Errorf("Pairs this[%v](%v) Not Equal that[%v](%v)", i, this.Pairs[i], i, that1.Pairs[i]) + for i := range this.Markets { + if !this.Markets[i].Equal(&that1.Markets[i]) { + return fmt.Errorf("Markets this[%v](%v) Not Equal that[%v](%v)", i, this.Markets[i], i, that1.Markets[i]) } } return nil } -func (this *QueryPairsResponse) Equal(that interface{}) bool { +func (this *QueryMarketsResponse) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*QueryPairsResponse) + that1, ok := that.(*QueryMarketsResponse) if !ok { - that2, ok := that.(QueryPairsResponse) + that2, ok := that.(QueryMarketsResponse) if ok { that1 = &that2 } else { @@ -1417,11 +1398,11 @@ func (this *QueryPairsResponse) Equal(that interface{}) bool { } else if this == nil { return false } - if len(this.Pairs) != len(that1.Pairs) { + if len(this.Markets) != len(that1.Markets) { return false } - for i := range this.Pairs { - if !this.Pairs[i].Equal(&that1.Pairs[i]) { + for i := range this.Markets { + if !this.Markets[i].Equal(&that1.Markets[i]) { return false } } @@ -1559,7 +1540,7 @@ func (this *CurrentPriceResponse) Equal(that interface{}) bool { } return true } -func (this *PairResponse) VerboseEqual(that interface{}) error { +func (this *Market) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil @@ -1567,32 +1548,26 @@ func (this *PairResponse) VerboseEqual(that interface{}) error { return fmt.Errorf("that == nil && this != nil") } - that1, ok := that.(*PairResponse) + that1, ok := that.(*Market) if !ok { - that2, ok := that.(PairResponse) + that2, ok := that.(Market) if ok { that1 = &that2 } else { - return fmt.Errorf("that is not of type *PairResponse") + return fmt.Errorf("that is not of type *Market") } } if that1 == nil { if this == nil { return nil } - return fmt.Errorf("that is type *PairResponse but is nil && this != nil") + return fmt.Errorf("that is type *Market but is nil && this != nil") } else if this == nil { - return fmt.Errorf("that is type *PairResponse but is not nil && this == nil") + return fmt.Errorf("that is type *Market but is not nil && this == nil") } if this.PairID != that1.PairID { return fmt.Errorf("PairID this(%v) Not Equal that(%v)", this.PairID, that1.PairID) } - if this.Token0 != that1.Token0 { - return fmt.Errorf("Token0 this(%v) Not Equal that(%v)", this.Token0, that1.Token0) - } - if this.Token1 != that1.Token1 { - return fmt.Errorf("Token1 this(%v) Not Equal that(%v)", this.Token1, that1.Token1) - } if len(this.Oracles) != len(that1.Oracles) { return fmt.Errorf("Oracles this(%v) Not Equal that(%v)", len(this.Oracles), len(that1.Oracles)) } @@ -1606,14 +1581,14 @@ func (this *PairResponse) VerboseEqual(that interface{}) error { } return nil } -func (this *PairResponse) Equal(that interface{}) bool { +func (this *Market) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*PairResponse) + that1, ok := that.(*Market) if !ok { - that2, ok := that.(PairResponse) + that2, ok := that.(Market) if ok { that1 = &that2 } else { @@ -1628,12 +1603,6 @@ func (this *PairResponse) Equal(that interface{}) bool { if this.PairID != that1.PairID { return false } - if this.Token0 != that1.Token0 { - return false - } - if this.Token1 != that1.Token1 { - return false - } if len(this.Oracles) != len(that1.Oracles) { return false } @@ -1670,8 +1639,8 @@ type QueryClient interface { QueryRawPrices(ctx context.Context, in *QueryRawPricesRequest, opts ...grpc.CallOption) (*QueryRawPricesResponse, error) // QueryOracles queries all oracles for an asset pair QueryOracles(ctx context.Context, in *QueryOraclesRequest, opts ...grpc.CallOption) (*QueryOraclesResponse, error) - // QueryPairs queries all pairs - QueryPairs(ctx context.Context, in *QueryPairsRequest, opts ...grpc.CallOption) (*QueryPairsResponse, error) + // QueryMarkets queries all markets + QueryMarkets(ctx context.Context, in *QueryMarketsRequest, opts ...grpc.CallOption) (*QueryMarketsResponse, error) } type queryClient struct { @@ -1727,9 +1696,9 @@ func (c *queryClient) QueryOracles(ctx context.Context, in *QueryOraclesRequest, return out, nil } -func (c *queryClient) QueryPairs(ctx context.Context, in *QueryPairsRequest, opts ...grpc.CallOption) (*QueryPairsResponse, error) { - out := new(QueryPairsResponse) - err := c.cc.Invoke(ctx, "/nibiru.pricefeed.v1.Query/QueryPairs", in, out, opts...) +func (c *queryClient) QueryMarkets(ctx context.Context, in *QueryMarketsRequest, opts ...grpc.CallOption) (*QueryMarketsResponse, error) { + out := new(QueryMarketsResponse) + err := c.cc.Invoke(ctx, "/nibiru.pricefeed.v1.Query/QueryMarkets", in, out, opts...) if err != nil { return nil, err } @@ -1748,8 +1717,8 @@ type QueryServer interface { QueryRawPrices(context.Context, *QueryRawPricesRequest) (*QueryRawPricesResponse, error) // QueryOracles queries all oracles for an asset pair QueryOracles(context.Context, *QueryOraclesRequest) (*QueryOraclesResponse, error) - // QueryPairs queries all pairs - QueryPairs(context.Context, *QueryPairsRequest) (*QueryPairsResponse, error) + // QueryMarkets queries all markets + QueryMarkets(context.Context, *QueryMarketsRequest) (*QueryMarketsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1771,8 +1740,8 @@ func (*UnimplementedQueryServer) QueryRawPrices(ctx context.Context, req *QueryR func (*UnimplementedQueryServer) QueryOracles(ctx context.Context, req *QueryOraclesRequest) (*QueryOraclesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryOracles not implemented") } -func (*UnimplementedQueryServer) QueryPairs(ctx context.Context, req *QueryPairsRequest) (*QueryPairsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryPairs not implemented") +func (*UnimplementedQueryServer) QueryMarkets(ctx context.Context, req *QueryMarketsRequest) (*QueryMarketsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryMarkets not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { @@ -1869,20 +1838,20 @@ func _Query_QueryOracles_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } -func _Query_QueryPairs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryPairsRequest) +func _Query_QueryMarkets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryMarketsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).QueryPairs(ctx, in) + return srv.(QueryServer).QueryMarkets(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/nibiru.pricefeed.v1.Query/QueryPairs", + FullMethod: "/nibiru.pricefeed.v1.Query/QueryMarkets", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryPairs(ctx, req.(*QueryPairsRequest)) + return srv.(QueryServer).QueryMarkets(ctx, req.(*QueryMarketsRequest)) } return interceptor(ctx, in, info, handler) } @@ -1912,8 +1881,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_QueryOracles_Handler, }, { - MethodName: "QueryPairs", - Handler: _Query_QueryPairs_Handler, + MethodName: "QueryMarkets", + Handler: _Query_QueryMarkets_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -2228,7 +2197,7 @@ func (m *QueryOraclesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryPairsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryMarketsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2238,12 +2207,12 @@ func (m *QueryPairsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryPairsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryMarketsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPairsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryMarketsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2251,7 +2220,7 @@ func (m *QueryPairsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryPairsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryMarketsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2261,20 +2230,20 @@ func (m *QueryPairsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryPairsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryMarketsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPairsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryMarketsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Pairs) > 0 { - for iNdEx := len(m.Pairs) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Markets) > 0 { + for iNdEx := len(m.Markets) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Pairs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Markets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2383,7 +2352,7 @@ func (m *CurrentPriceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *PairResponse) Marshal() (dAtA []byte, err error) { +func (m *Market) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2393,12 +2362,12 @@ func (m *PairResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PairResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *Market) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PairResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Market) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2411,7 +2380,7 @@ func (m *PairResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0 } i-- - dAtA[i] = 0x28 + dAtA[i] = 0x18 } if len(m.Oracles) > 0 { for iNdEx := len(m.Oracles) - 1; iNdEx >= 0; iNdEx-- { @@ -2419,23 +2388,9 @@ func (m *PairResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Oracles[iNdEx]) i = encodeVarintQuery(dAtA, i, uint64(len(m.Oracles[iNdEx]))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x12 } } - if len(m.Token1) > 0 { - i -= len(m.Token1) - copy(dAtA[i:], m.Token1) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Token1))) - i-- - dAtA[i] = 0x1a - } - if len(m.Token0) > 0 { - i -= len(m.Token0) - copy(dAtA[i:], m.Token0) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Token0))) - i-- - dAtA[i] = 0x12 - } if len(m.PairID) > 0 { i -= len(m.PairID) copy(dAtA[i:], m.PairID) @@ -2581,7 +2536,7 @@ func (m *QueryOraclesResponse) Size() (n int) { return n } -func (m *QueryPairsRequest) Size() (n int) { +func (m *QueryMarketsRequest) Size() (n int) { if m == nil { return 0 } @@ -2590,14 +2545,14 @@ func (m *QueryPairsRequest) Size() (n int) { return n } -func (m *QueryPairsResponse) Size() (n int) { +func (m *QueryMarketsResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Pairs) > 0 { - for _, e := range m.Pairs { + if len(m.Markets) > 0 { + for _, e := range m.Markets { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -2641,7 +2596,7 @@ func (m *CurrentPriceResponse) Size() (n int) { return n } -func (m *PairResponse) Size() (n int) { +func (m *Market) Size() (n int) { if m == nil { return 0 } @@ -2651,14 +2606,6 @@ func (m *PairResponse) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - l = len(m.Token0) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Token1) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } if len(m.Oracles) > 0 { for _, s := range m.Oracles { l = len(s) @@ -3439,7 +3386,7 @@ func (m *QueryOraclesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryPairsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryMarketsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3462,10 +3409,10 @@ func (m *QueryPairsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryPairsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryMarketsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPairsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryMarketsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3489,7 +3436,7 @@ func (m *QueryPairsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryPairsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryMarketsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3512,15 +3459,15 @@ func (m *QueryPairsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryPairsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryMarketsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPairsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryMarketsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pairs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Markets", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3547,8 +3494,8 @@ func (m *QueryPairsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Pairs = append(m.Pairs, PairResponse{}) - if err := m.Pairs[len(m.Pairs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Markets = append(m.Markets, Market{}) + if err := m.Markets[len(m.Markets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3870,7 +3817,7 @@ func (m *CurrentPriceResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *PairResponse) Unmarshal(dAtA []byte) error { +func (m *Market) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3893,10 +3840,10 @@ func (m *PairResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PairResponse: wiretype end group for non-group") + return fmt.Errorf("proto: Market: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PairResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Market: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3932,70 +3879,6 @@ func (m *PairResponse) Unmarshal(dAtA []byte) error { m.PairID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token0", 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.Token0 = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token1", 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.Token1 = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Oracles", wireType) } @@ -4027,7 +3910,7 @@ func (m *PairResponse) Unmarshal(dAtA []byte) error { } m.Oracles = append(m.Oracles, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 5: + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Active", wireType) } diff --git a/x/pricefeed/types/query.pb.gw.go b/x/pricefeed/types/query.pb.gw.go index 941f3d8f9..6dc549e15 100644 --- a/x/pricefeed/types/query.pb.gw.go +++ b/x/pricefeed/types/query.pb.gw.go @@ -229,20 +229,20 @@ func local_request_Query_QueryOracles_0(ctx context.Context, marshaler runtime.M } -func request_Query_QueryPairs_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPairsRequest +func request_Query_QueryMarkets_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMarketsRequest var metadata runtime.ServerMetadata - msg, err := client.QueryPairs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.QueryMarkets(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_QueryPairs_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPairsRequest +func local_request_Query_QueryMarkets_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMarketsRequest var metadata runtime.ServerMetadata - msg, err := server.QueryPairs(ctx, &protoReq) + msg, err := server.QueryMarkets(ctx, &protoReq) return msg, metadata, err } @@ -353,7 +353,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_QueryPairs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryMarkets_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) @@ -362,14 +362,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryPairs_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QueryMarkets_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_QueryPairs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryMarkets_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -514,7 +514,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_QueryPairs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryMarkets_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) @@ -523,14 +523,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryPairs_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QueryMarkets_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_QueryPairs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryMarkets_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -548,7 +548,7 @@ var ( pattern_Query_QueryOracles_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"nibiru", "pricefeed", "v1beta1", "oracles", "pair_id"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QueryPairs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"nibiru", "pricefeed", "v1beta1", "pairs"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryMarkets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"nibiru", "pricefeed", "v1beta1", "markets"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -562,5 +562,5 @@ var ( forward_Query_QueryOracles_0 = runtime.ForwardResponseMessage - forward_Query_QueryPairs_0 = runtime.ForwardResponseMessage + forward_Query_QueryMarkets_0 = runtime.ForwardResponseMessage ) diff --git a/x/testutil/cli/query.go b/x/testutil/cli/query.go index ca1fcdd6d..4e024cc2d 100644 --- a/x/testutil/cli/query.go +++ b/x/testutil/cli/query.go @@ -138,7 +138,7 @@ func QueryTraderPosition(ctx client.Context, pair common.AssetPair, trader sdk.A func QueryPrice(ctx client.Context, pairID string) (pricefeedtypes.QueryPriceResponse, error) { out, err := clitestutil.ExecTestCLICmd( ctx, - pricefeedcli.CmdPrice(), + pricefeedcli.CmdQueryPrice(), []string{pairID, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, ) if err != nil { @@ -157,7 +157,7 @@ func QueryPrice(ctx client.Context, pairID string) (pricefeedtypes.QueryPriceRes func QueryRawPrice(ctx client.Context, pairID string) (pricefeedtypes.QueryRawPricesResponse, error) { out, err := clitestutil.ExecTestCLICmd( ctx, - pricefeedcli.CmdRawPrices(), + pricefeedcli.CmdQueryRawPrices(), []string{pairID, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, ) if err != nil {