Skip to content

Commit

Permalink
Merge pull request hyperweb-io#272 from osmosis-labs/feat/accepts-imp…
Browse files Browse the repository at this point in the history
…lements-any

Feat/accepts implements any
  • Loading branch information
pyramation authored Dec 18, 2022
2 parents cabeb66 + 46fba0b commit c43fc71
Show file tree
Hide file tree
Showing 514 changed files with 12,314 additions and 19,042 deletions.
4 changes: 2 additions & 2 deletions __fixtures__/chain1/cosmos/gov/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ service Msg {
message MsgSubmitProposal {
option (cosmos.msg.v1.signer) = "proposer";

repeated google.protobuf.Any messages = 1;
repeated google.protobuf.Any messages = 1 [(cosmos_proto.accepts_interface) = "ProposalContentI"];
repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [(gogoproto.nullable) = false];
string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// metadata is any arbitrary metadata attached to the proposal.
Expand All @@ -53,7 +53,7 @@ message MsgExecLegacyContent {
option (cosmos.msg.v1.signer) = "authority";

// content is the proposal's content.
google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "Content"];
google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "ProposalContentI"];
// authority must be the gov module address.
string authority = 2;
}
Expand Down
4 changes: 2 additions & 2 deletions __fixtures__/chain1/cosmos/gov/v1beta1/gov.proto
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ message WeightedVoteOption {
// TextProposal defines a standard text proposal whose changes need to be
// manually updated in case of approval.
message TextProposal {
option (cosmos_proto.implements_interface) = "Content";
option (cosmos_proto.implements_interface) = "ProposalContentI";

option (gogoproto.equal) = true;

Expand All @@ -70,7 +70,7 @@ message Proposal {
option (gogoproto.equal) = true;

uint64 proposal_id = 1;
google.protobuf.Any content = 2 [(cosmos_proto.accepts_interface) = "Content"];
google.protobuf.Any content = 2 [(cosmos_proto.accepts_interface) = "ProposalContentI"];
ProposalStatus status = 3;
// final_tally_result is the final tally result of the proposal. When
// querying a proposal via gRPC, this field is not populated until the
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/chain1/cosmos/gov/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ message MsgSubmitProposal {
option (gogoproto.stringer) = false;
option (gogoproto.goproto_getters) = false;

google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "Content"];
google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "ProposalContentI"];
repeated cosmos.base.v1beta1.Coin initial_deposit = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
Expand Down
2 changes: 2 additions & 0 deletions __fixtures__/chain1/evmos/incentives/v1/incentives.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ message GasMeter {
// RegisterIncentiveProposal is a gov Content type to register an incentive
message RegisterIncentiveProposal {
option (gogoproto.equal) = false;
option (cosmos_proto.implements_interface) = "ProposalContentI";

// title of the proposal
string title = 1;
// proposal description
Expand Down
15 changes: 9 additions & 6 deletions __fixtures__/chain1/ibc/core/client/v1/client.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ syntax = "proto3";

package ibc.core.client.v1;

option go_package = "github.com/cosmos/ibc-go/v2/modules/core/02-client/types";
option go_package = "github.com/cosmos/ibc-go/v6/modules/core/02-client/types";

import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "cosmos/upgrade/v1beta1/upgrade.proto";
import "cosmos_proto/cosmos.proto";

// IdentifiedClientState defines a client state with an additional client
// identifier field.
Expand All @@ -23,7 +24,7 @@ message ConsensusStateWithHeight {
// consensus state height
Height height = 1 [(gogoproto.nullable) = false];
// consensus state
google.protobuf.Any consensus_state = 2 [(gogoproto.moretags) = "yaml\"consensus_state\""];
google.protobuf.Any consensus_state = 2 [(gogoproto.moretags) = "yaml:\"consensus_state\""];
}

// ClientConsensusStates defines all the stored consensus states for a given
Expand All @@ -41,7 +42,8 @@ message ClientConsensusStates {
// handler may fail if the subject and the substitute do not match in client and
// chain parameters (with exception to latest height, frozen height, and chain-id).
message ClientUpdateProposal {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_getters) = false;
option (cosmos_proto.implements_interface) = "ProposalContentI";
// the title of the update proposal
string title = 1;
// the description of the proposal
Expand All @@ -56,9 +58,10 @@ message ClientUpdateProposal {
// UpgradeProposal is a gov Content type for initiating an IBC breaking
// upgrade.
message UpgradeProposal {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;
option (gogoproto.equal) = true;
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;
option (gogoproto.equal) = true;
option (cosmos_proto.implements_interface) = "ProposalContentI";

string title = 1;
string description = 2;
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/chain1/osmosis/epochs/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.com/osmosis-labs/osmosis/v12/x/epochs/types";
option go_package = "github.com/osmosis-labs/osmosis/v13/x/epochs/types";

// EpochInfo is a struct that describes the data going into
// a timer defined by the x/epochs module.
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/chain1/osmosis/epochs/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "osmosis/epochs/genesis.proto";

option go_package = "github.com/osmosis-labs/osmosis/v12/x/epochs/types";
option go_package = "github.com/osmosis-labs/osmosis/v13/x/epochs/types";

// Query defines the gRPC querier service.
service Query {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import "google/protobuf/timestamp.proto";
import "cosmos/auth/v1beta1/auth.proto";
import "cosmos/base/v1beta1/coin.proto";

option go_package = "github.com/osmosis-labs/osmosis/v12/x/gamm/pool-models/balancer";
option go_package = "github.com/osmosis-labs/osmosis/v13/x/gamm/pool-models/balancer";

// Parameters for changing the weights in a balancer pool smoothly from
// a start weight and end weight over a period of time.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package osmosis.gamm.poolmodels.balancer.v1beta1;
import "gogoproto/gogo.proto";
import "osmosis/gamm/pool-models/balancer/balancerPool.proto";

option go_package = "github.com/osmosis-labs/osmosis/v12/x/gamm/pool-models/balancer";
option go_package = "github.com/osmosis-labs/osmosis/v13/x/gamm/pool-models/balancer";

service Msg {
rpc CreateBalancerPool(MsgCreateBalancerPool)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "google/protobuf/timestamp.proto";
import "cosmos/auth/v1beta1/auth.proto";
import "cosmos/base/v1beta1/coin.proto";

option go_package = "github.com/osmosis-labs/osmosis/v12/x/gamm/pool-models/stableswap";
option go_package = "github.com/osmosis-labs/osmosis/v13/x/gamm/pool-models/stableswap";

// PoolParams defined the parameters that will be managed by the pool
// governance in the future. This params are not managed by the chain
Expand Down Expand Up @@ -63,10 +63,11 @@ message Pool {
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];

// for calculation amognst assets with different precisions
repeated uint64 scaling_factor = 7
[ (gogoproto.moretags) = "yaml:\"stableswap_scaling_factor\"" ];
// scaling_factor_governor is the address can adjust pool scaling factors
string scaling_factor_governor = 8
[ (gogoproto.moretags) = "yaml:\"scaling_factor_governor\"" ];
repeated uint64 scaling_factors = 7
[ (gogoproto.moretags) = "yaml:\"stableswap_scaling_factors\"" ];
// scaling_factor_controller is the address can adjust pool scaling factors
string scaling_factor_controller = 8
[ (gogoproto.moretags) = "yaml:\"scaling_factor_controller\"" ];
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "cosmos/base/v1beta1/coin.proto";
import "gogoproto/gogo.proto";
import "osmosis/gamm/pool-models/stableswap/stableswap_pool.proto";

option go_package = "github.com/osmosis-labs/osmosis/v12/x/gamm/pool-models/stableswap";
option go_package = "github.com/osmosis-labs/osmosis/v13/x/gamm/pool-models/stableswap";

service Msg {
rpc CreateStableswapPool(MsgCreateStableswapPool)
Expand All @@ -30,6 +30,9 @@ message MsgCreateStableswapPool {

string future_pool_governor = 5
[ (gogoproto.moretags) = "yaml:\"future_pool_governor\"" ];

string scaling_factor_controller = 6
[ (gogoproto.moretags) = "yaml:\"scaling_factor_controller\"" ];
}

// Returns a poolID with custom poolName.
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/chain1/osmosis/gamm/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ message Params {
];
}

option go_package = "github.com/osmosis-labs/osmosis/v12/x/gamm/types";
option go_package = "github.com/osmosis-labs/osmosis/v13/x/gamm/types";

// GenesisState defines the gamm module's genesis state.
message GenesisState {
Expand Down
104 changes: 102 additions & 2 deletions __fixtures__/chain1/osmosis/gamm/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "google/api/annotations.proto";
import "google/protobuf/any.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/osmosis-labs/osmosis/v12/x/gamm/types";
option go_package = "github.com/osmosis-labs/osmosis/v13/x/gamm/types";

service Query {
rpc Pools(QueryPoolsRequest) returns (QueryPoolsResponse) {
Expand All @@ -26,6 +26,13 @@ service Query {
option (google.api.http).get = "/osmosis/gamm/v1beta1/total_liquidity";
}

// PoolsWithFilter allows you to query specific pools with requested
// parameters
rpc PoolsWithFilter(QueryPoolsWithFilterRequest)
returns (QueryPoolsWithFilterResponse) {
option (google.api.http).get = "/osmosis/gamm/v1beta1/filtered_pools";
}

// Per Pool gRPC Endpoints
rpc Pool(QueryPoolRequest) returns (QueryPoolResponse) {
option (google.api.http).get = "/osmosis/gamm/v1beta1/pools/{pool_id}";
Expand All @@ -38,6 +45,22 @@ service Query {
option (google.api.http).get = "/osmosis/gamm/v1beta1/pool_type/{pool_id}";
}

// Simulates joining pool without a swap. Returns the amount of shares you'd
// get and tokens needed to provide
rpc CalcJoinPoolNoSwapShares(QueryCalcJoinPoolNoSwapSharesRequest)
returns (QueryCalcJoinPoolNoSwapSharesResponse) {}

rpc CalcJoinPoolShares(QueryCalcJoinPoolSharesRequest)
returns (QueryCalcJoinPoolSharesResponse) {
option (google.api.http).get =
"/osmosis/gamm/v1beta1/pools/{pool_id}/join_swap_exact_in";
}
rpc CalcExitPoolCoinsFromShares(QueryCalcExitPoolCoinsFromSharesRequest)
returns (QueryCalcExitPoolCoinsFromSharesResponse) {
option (google.api.http).get =
"/osmosis/gamm/v1beta1/pools/{pool_id}/exit_swap_share_amount_in";
}

rpc PoolParams(QueryPoolParamsRequest) returns (QueryPoolParamsResponse) {
option (google.api.http).get =
"/osmosis/gamm/v1beta1/pools/{pool_id}/params";
Expand All @@ -57,6 +80,7 @@ service Query {
// SpotPrice defines a gRPC query handler that returns the spot price given
// a base denomination and a quote denomination.
rpc SpotPrice(QuerySpotPriceRequest) returns (QuerySpotPriceResponse) {
option deprecated = true;
option (google.api.http).get =
"/osmosis/gamm/v1beta1/pools/{pool_id}/prices";
}
Expand Down Expand Up @@ -110,6 +134,41 @@ message QueryPoolTypeResponse {
string pool_type = 1 [ (gogoproto.moretags) = "yaml:\"pool_type\"" ];
}

//=============================== CalcJoinPoolShares
message QueryCalcJoinPoolSharesRequest {
uint64 pool_id = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ];
repeated cosmos.base.v1beta1.Coin tokens_in = 2 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.nullable) = false
];
}
message QueryCalcJoinPoolSharesResponse {
string share_out_amount = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"share_out_amount\"",
(gogoproto.nullable) = false
];
repeated cosmos.base.v1beta1.Coin tokens_out = 2 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.nullable) = false
];
}

//=============================== CalcExitPoolCoinsFromShares
message QueryCalcExitPoolCoinsFromSharesRequest {
uint64 pool_id = 1;
string share_in_amount = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}
message QueryCalcExitPoolCoinsFromSharesResponse {
repeated cosmos.base.v1beta1.Coin tokens_out = 1 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.nullable) = false
];
}

//=============================== PoolParams
message QueryPoolParamsRequest {
uint64 pool_id = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ];
Expand Down Expand Up @@ -139,10 +198,29 @@ message QueryTotalSharesResponse {
(gogoproto.nullable) = false
];
}

//=============================== CalcJoinPoolNoSwapShares
message QueryCalcJoinPoolNoSwapSharesRequest {
uint64 pool_id = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ];
repeated cosmos.base.v1beta1.Coin tokens_in = 2 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.nullable) = false
];
}
message QueryCalcJoinPoolNoSwapSharesResponse {
repeated cosmos.base.v1beta1.Coin tokens_out = 1 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.moretags) = "yaml:\"tokens_out\"",
(gogoproto.nullable) = false
];
string shares_out = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}
// QuerySpotPriceRequest defines the gRPC request structure for a SpotPrice
// query.
message QuerySpotPriceRequest {
option deprecated = true;
uint64 pool_id = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ];
string base_asset_denom = 2
[ (gogoproto.moretags) = "yaml:\"base_asset_denom\"" ];
Expand All @@ -152,15 +230,36 @@ message QuerySpotPriceRequest {
reserved "withSwapFee";
}

//=============================== PoolsWithFilter

message QueryPoolsWithFilterRequest {
repeated cosmos.base.v1beta1.Coin min_liquidity = 1 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.moretags) = "yaml:\"min_liquidity\"",
(gogoproto.nullable) = false
];
string pool_type = 2;
cosmos.base.query.v1beta1.PageRequest pagination = 3;
}

message QueryPoolsWithFilterResponse {
repeated google.protobuf.Any pools = 1
[ (cosmos_proto.accepts_interface) = "PoolI" ];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QuerySpotPriceResponse defines the gRPC response structure for a SpotPrice
// query.
message QuerySpotPriceResponse {
option deprecated = true;
// String of the Dec. Ex) 10.203uatom
string spot_price = 1 [ (gogoproto.moretags) = "yaml:\"spot_price\"" ];
}

//=============================== EstimateSwapExactAmountIn
message QuerySwapExactAmountInRequest {
// TODO: CHANGE THIS TO RESERVED IN A PATCH RELEASE
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ];
string token_in = 3 [ (gogoproto.moretags) = "yaml:\"token_in\"" ];
Expand All @@ -180,6 +279,7 @@ message QuerySwapExactAmountInResponse {

//=============================== EstimateSwapExactAmountOut
message QuerySwapExactAmountOutRequest {
// TODO: CHANGE THIS TO RESERVED IN A PATCH RELEASE
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ];
repeated SwapAmountOutRoute routes = 3 [
Expand Down
3 changes: 2 additions & 1 deletion __fixtures__/chain1/osmosis/gamm/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package osmosis.gamm.v1beta1;
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";

option go_package = "github.com/osmosis-labs/osmosis/v12/x/gamm/types";
option go_package = "github.com/osmosis-labs/osmosis/v13/x/gamm/types";

service Msg {
rpc JoinPool(MsgJoinPool) returns (MsgJoinPoolResponse);
Expand All @@ -26,6 +26,7 @@ service Msg {
// ===================== MsgJoinPool
// This is really MsgJoinPoolNoSwap
message MsgJoinPool {

string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ];
string share_out_amount = 3 [
Expand Down
Loading

0 comments on commit c43fc71

Please sign in to comment.