Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update v44 pricefeed addresses to use bytes #1053

Merged
merged 10 commits into from
Nov 16, 2021
7 changes: 1 addition & 6 deletions app/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,10 @@ func TestAppAnteHandler(t *testing.T) {
// TODO Test pricefeed oracles and bep3 deputy txs can always get into the mempool.

func newPricefeedGenStateMulti(cdc codec.JSONCodec, oracles []sdk.AccAddress) app.GenesisState {
var oracleStrs []string
for _, o := range oracles {
oracleStrs = append(oracleStrs, o.String())
}

pfGenesis := pricefeedtypes.GenesisState{
Params: pricefeedtypes.Params{
Markets: []pricefeedtypes.Market{
{MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: oracleStrs, Active: true},
{MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: oracles, Active: true},
},
},
}
Expand Down
99 changes: 78 additions & 21 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,19 @@

- [Query](#kava.kavadist.v1beta1.Query)

- [kava/pricefeed/v1beta1/pricefeed.proto](#kava/pricefeed/v1beta1/pricefeed.proto)
- [kava/pricefeed/v1beta1/store.proto](#kava/pricefeed/v1beta1/store.proto)
- [CurrentPrice](#kava.pricefeed.v1beta1.CurrentPrice)
- [Market](#kava.pricefeed.v1beta1.Market)
- [Params](#kava.pricefeed.v1beta1.Params)
- [PostedPrice](#kava.pricefeed.v1beta1.PostedPrice)

- [kava/pricefeed/v1beta1/genesis.proto](#kava/pricefeed/v1beta1/genesis.proto)
- [GenesisState](#kava.pricefeed.v1beta1.GenesisState)
- [Params](#kava.pricefeed.v1beta1.Params)

- [kava/pricefeed/v1beta1/query.proto](#kava/pricefeed/v1beta1/query.proto)
- [CurrentPriceResponse](#kava.pricefeed.v1beta1.CurrentPriceResponse)
- [MarketResponse](#kava.pricefeed.v1beta1.MarketResponse)
- [PostedPriceResponse](#kava.pricefeed.v1beta1.PostedPriceResponse)
- [QueryMarketsRequest](#kava.pricefeed.v1beta1.QueryMarketsRequest)
- [QueryMarketsResponse](#kava.pricefeed.v1beta1.QueryMarketsResponse)
- [QueryOraclesRequest](#kava.pricefeed.v1beta1.QueryOraclesRequest)
Expand Down Expand Up @@ -662,10 +665,10 @@ Query defines the gRPC querier service.



<a name="kava/pricefeed/v1beta1/pricefeed.proto"></a>
<a name="kava/pricefeed/v1beta1/store.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## kava/pricefeed/v1beta1/pricefeed.proto
## kava/pricefeed/v1beta1/store.proto



Expand Down Expand Up @@ -697,14 +700,29 @@ Market defines an asset in the pricefeed.
| `market_id` | [string](#string) | | |
| `base_asset` | [string](#string) | | |
| `quote_asset` | [string](#string) | | |
| `oracles` | [string](#string) | repeated | |
| `oracles` | [bytes](#bytes) | repeated | |
| `active` | [bool](#bool) | | |






<a name="kava.pricefeed.v1beta1.Params"></a>

### Params
Params defines the parameters for the pricefeed module.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `markets` | [Market](#kava.pricefeed.v1beta1.Market) | repeated | |






<a name="kava.pricefeed.v1beta1.PostedPrice"></a>

### PostedPrice
Expand All @@ -714,7 +732,7 @@ PostedPrice defines a price for market posted by a specific oracle.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `market_id` | [string](#string) | | |
| `oracle_address` | [string](#string) | | |
| `oracle_address` | [bytes](#bytes) | | |
| `price` | [string](#string) | | |
| `expiry` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | |

Expand Down Expand Up @@ -754,35 +772,74 @@ GenesisState defines the pricefeed module's genesis state.



<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="kava/pricefeed/v1beta1/query.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## kava/pricefeed/v1beta1/query.proto

<a name="kava.pricefeed.v1beta1.Params"></a>

### Params
Params defines the parameters for the pricefeed module.

<a name="kava.pricefeed.v1beta1.CurrentPriceResponse"></a>

### CurrentPriceResponse
CurrentPriceResponse defines a current price for a particular market in the pricefeed
module.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `markets` | [Market](#kava.pricefeed.v1beta1.Market) | repeated | |
| `market_id` | [string](#string) | | |
| `price` | [string](#string) | | |





<!-- end messages -->

<!-- end enums -->
<a name="kava.pricefeed.v1beta1.MarketResponse"></a>

<!-- end HasExtensions -->
### MarketResponse
MarketResponse defines an asset in the pricefeed.

<!-- end services -->

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `market_id` | [string](#string) | | |
| `base_asset` | [string](#string) | | |
| `quote_asset` | [string](#string) | | |
| `oracles` | [string](#string) | repeated | |
| `active` | [bool](#bool) | | |






<a name="kava.pricefeed.v1beta1.PostedPriceResponse"></a>

### PostedPriceResponse
PostedPriceResponse defines a price for market posted by a specific oracle.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `market_id` | [string](#string) | | |
| `oracle_address` | [string](#string) | | |
| `price` | [string](#string) | | |
| `expiry` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | |


<a name="kava/pricefeed/v1beta1/query.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## kava/pricefeed/v1beta1/query.proto



Expand All @@ -804,7 +861,7 @@ QueryMarketsResponse is the response type for the Query/Markets RPC method.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `markets` | [Market](#kava.pricefeed.v1beta1.Market) | repeated | List of markets |
| `markets` | [MarketResponse](#kava.pricefeed.v1beta1.MarketResponse) | repeated | List of markets |



Expand Down Expand Up @@ -891,7 +948,7 @@ QueryPriceResponse is the response type for the Query/Prices RPC method.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `price` | [CurrentPrice](#kava.pricefeed.v1beta1.CurrentPrice) | | |
| `price` | [CurrentPriceResponse](#kava.pricefeed.v1beta1.CurrentPriceResponse) | | |



Expand All @@ -916,7 +973,7 @@ QueryPricesResponse is the response type for the Query/Prices RPC method.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `prices` | [CurrentPrice](#kava.pricefeed.v1beta1.CurrentPrice) | repeated | |
| `prices` | [CurrentPriceResponse](#kava.pricefeed.v1beta1.CurrentPriceResponse) | repeated | |



Expand Down Expand Up @@ -947,7 +1004,7 @@ method.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `raw_prices` | [PostedPrice](#kava.pricefeed.v1beta1.PostedPrice) | repeated | |
| `raw_prices` | [PostedPriceResponse](#kava.pricefeed.v1beta1.PostedPriceResponse) | repeated | |



Expand Down
14 changes: 4 additions & 10 deletions proto/kava/pricefeed/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
syntax = "proto3";
package kava.pricefeed.v1beta1;

import "kava/pricefeed/v1beta1/pricefeed.proto";
import "kava/pricefeed/v1beta1/store.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/kava-labs/kava/x/pricefeed/types";
option (gogoproto.equal_all) = true;
option go_package = "github.com/kava-labs/kava/x/pricefeed/types";
option (gogoproto.equal_all) = true;
option (gogoproto.verbose_equal_all) = true;

// GenesisState defines the pricefeed module's genesis state.
message GenesisState {
// params defines all the paramaters of the module.
Params params = 1 [(gogoproto.nullable) = false];

repeated PostedPrice posted_prices = 2 [(gogoproto.nullable) = false];
}

// Params defines the parameters for the pricefeed module.
message Params {
option (gogoproto.goproto_stringer) = false; // false here because we define Stringer method in params.go
repeated Market markets = 1 [(gogoproto.nullable) = false];
repeated PostedPrice posted_prices = 2 [(gogoproto.castrepeated) = "PostedPrices", (gogoproto.nullable) = false];
}
42 changes: 34 additions & 8 deletions proto/kava/pricefeed/v1beta1/query.proto
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
syntax = "proto3";
package kava.pricefeed.v1beta1;

import "kava/pricefeed/v1beta1/genesis.proto";
import "kava/pricefeed/v1beta1/pricefeed.proto";
import "kava/pricefeed/v1beta1/store.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.com/kava-labs/kava/x/pricefeed/types";
option (gogoproto.equal_all) = true;
option go_package = "github.com/kava-labs/kava/x/pricefeed/types";
option (gogoproto.equal_all) = true;
option (gogoproto.verbose_equal_all) = true;

// Query defines the gRPC querier service for pricefeed module
Expand Down Expand Up @@ -66,7 +66,7 @@ message QueryPriceRequest {
message QueryPriceResponse {
option (gogoproto.goproto_getters) = false;

CurrentPrice price = 1 [(gogoproto.nullable) = false];
CurrentPriceResponse price = 1 [(gogoproto.nullable) = false];
}

// QueryPricesRequest is the request type for the Query/Prices RPC method.
Expand All @@ -76,7 +76,8 @@ message QueryPricesRequest {}
message QueryPricesResponse {
option (gogoproto.goproto_getters) = false;

repeated CurrentPrice prices = 1 [(gogoproto.nullable) = false];
repeated CurrentPriceResponse prices = 1
[(gogoproto.castrepeated) = "CurrentPriceResponses", (gogoproto.nullable) = false];
}

// QueryRawPricesRequest is the request type for the Query/RawPrices RPC method.
Expand All @@ -91,7 +92,8 @@ message QueryRawPricesRequest {
message QueryRawPricesResponse {
option (gogoproto.goproto_getters) = false;

repeated PostedPrice raw_prices = 1 [(gogoproto.nullable) = false];
repeated PostedPriceResponse raw_prices = 1
[(gogoproto.castrepeated) = "PostedPriceResponses", (gogoproto.nullable) = false];
}

// QueryOraclesRequest is the request type for the Query/Oracles RPC method.
Expand All @@ -117,5 +119,29 @@ message QueryMarketsResponse {
option (gogoproto.goproto_getters) = false;

// List of markets
repeated Market markets = 1 [(gogoproto.nullable) = false];
repeated MarketResponse markets = 1 [(gogoproto.castrepeated) = "MarketResponses", (gogoproto.nullable) = false];
}

// PostedPriceResponse defines a price for market posted by a specific oracle.
message PostedPriceResponse {
string market_id = 1 [(gogoproto.customname) = "MarketID"];
string oracle_address = 2;
string price = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
google.protobuf.Timestamp expiry = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
}

// CurrentPriceResponse defines a current price for a particular market in the pricefeed
// module.
message CurrentPriceResponse {
string market_id = 1 [(gogoproto.customname) = "MarketID"];
string price = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
}

// MarketResponse defines an asset in the pricefeed.
message MarketResponse {
string market_id = 1 [(gogoproto.customname) = "MarketID"];
string base_asset = 2;
string quote_asset = 3;
repeated string oracles = 4;
bool active = 5;
}
Original file line number Diff line number Diff line change
@@ -1,39 +1,45 @@
syntax = "proto3";
package kava.pricefeed.v1beta1;

import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.com/kava-labs/kava/x/pricefeed/types";
option (gogoproto.equal_all) = true;
option go_package = "github.com/kava-labs/kava/x/pricefeed/types";
option (gogoproto.equal_all) = true;
option (gogoproto.verbose_equal_all) = true;

// Params defines the parameters for the pricefeed module.
message Params {
repeated Market markets = 1 [(gogoproto.castrepeated) = "Markets", (gogoproto.nullable) = false];
}

// Market defines an asset in the pricefeed.
message Market {
option (gogoproto.goproto_stringer) = false;

string market_id = 1 [(gogoproto.customname) = "MarketID"];
string base_asset = 2;
string quote_asset = 3;
repeated string oracles = 4;
bool active = 5;
string market_id = 1 [(gogoproto.customname) = "MarketID"];
string base_asset = 2;
string quote_asset = 3;
repeated bytes oracles = 4 [
(cosmos_proto.scalar) = "cosmos.AddressBytes",
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"
];
bool active = 5;
}

// PostedPrice defines a price for market posted by a specific oracle.
message PostedPrice {
option (gogoproto.goproto_stringer) = false;

string market_id = 1 [(gogoproto.customname) = "MarketID"];
string oracle_address = 2;
bytes oracle_address = 2 [
(cosmos_proto.scalar) = "cosmos.AddressBytes",
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"
];
string price = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
google.protobuf.Timestamp expiry = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
}

// CurrentPrice defines a current price for a particular market in the pricefeed
// module.
message CurrentPrice {
option (gogoproto.goproto_stringer) = false;

string market_id = 1 [(gogoproto.customname) = "MarketID"];
string price = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
}
4 changes: 2 additions & 2 deletions proto/kava/pricefeed/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package kava.pricefeed.v1beta1;
import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.com/kava-labs/kava/x/pricefeed/types";
option (gogoproto.equal_all) = true;
option go_package = "github.com/kava-labs/kava/x/pricefeed/types";
option (gogoproto.equal_all) = true;
option (gogoproto.verbose_equal_all) = true;

// Msg defines the pricefeed Msg service.
Expand Down
1 change: 1 addition & 0 deletions x/pricefeed/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package pricefeed

import (
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/kava-labs/kava/x/pricefeed/keeper"
"github.com/kava-labs/kava/x/pricefeed/types"
)
Expand Down
Loading