-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ref: #2333 ## What is the purpose of the change ## Brief Changelog Proto definitions (and generated protobuf go code) for Streamswap module ## Documentation and Release Note - Does this pull request introduce a new feature or user-facing behavior changes? yes - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? _let's discuss_ - How is the feature or change documented? (not applicable / specification (`x/<module>/spec/`) / [Osmosis docs repo](https://github.com/osmosis-labs/docs) / not documented) not documented
- Loading branch information
1 parent
bd683a3
commit 33b4fe5
Showing
14 changed files
with
8,595 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
syntax = "proto3"; | ||
package osmosis.streamswap.v1; | ||
|
||
import "cosmos/base/v1beta1/coin.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/osmosis-labs/osmosis/v11/x/streamswap/types"; | ||
option (gogoproto.goproto_getters_all) = false; | ||
|
||
message EventCreateSale { | ||
uint64 id = 1; | ||
string creator = 2; | ||
string token_in = 3; | ||
cosmos.base.v1beta1.Coin token_out = 4 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
message EventSubscribe { | ||
string sender = 1; | ||
uint64 sale_id = 2; | ||
string amount = 3; | ||
} | ||
|
||
message EventWithdraw { | ||
string sender = 1; | ||
uint64 sale_id = 2; | ||
// amount of staked token_in withdrawn by user. | ||
string amount = 3; | ||
} | ||
|
||
message EventExit { | ||
string sender = 1; | ||
uint64 sale_id = 2; | ||
// amount of purchased token_out sent to the user | ||
string purchased = 3; | ||
} | ||
|
||
message EventFinalizeSale { | ||
uint64 sale_id = 1; | ||
// amount of earned tokens_in | ||
string income = 3; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
syntax = "proto3"; | ||
package osmosis.streamswap.v1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
import "osmosis/streamswap/v1/state.proto"; | ||
import "osmosis/streamswap/v1/params.proto"; | ||
|
||
option go_package = "github.com/osmosis-labs/osmosis/v11/x/streamswap/types"; | ||
|
||
// GenesisState defines the streamswap module's genesis state. | ||
message GenesisState { | ||
repeated Sale sales = 1 [ (gogoproto.nullable) = false ]; | ||
repeated UserPositionKV user_positions = 2 [ (gogoproto.nullable) = false ]; | ||
uint64 next_sale_id = 3; | ||
Params params = 4 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
// UserPositionKV is a record in genesis representing acc_address user position | ||
// of a sale_id sale. | ||
message UserPositionKV { | ||
// user account address | ||
string acc_address = 1; | ||
uint64 sale_id = 2; | ||
UserPosition user_position = 3 [ (gogoproto.nullable) = false ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
syntax = "proto3"; | ||
package osmosis.streamswap.v1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/protobuf/any.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
|
||
import "google/protobuf/duration.proto"; | ||
|
||
option go_package = "github.com/osmosis-labs/osmosis/v11/x/streamswap/types"; | ||
|
||
// Params holds parameters for the streamswap module | ||
message Params { | ||
// fee charged when creating a new sale. The fee will go to the | ||
// sale_fee_recipient unless it is not defined (empty). | ||
repeated cosmos.base.v1beta1.Coin sale_creation_fee = 1 [ | ||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", | ||
(gogoproto.moretags) = "yaml:\"sale_creation_fee\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
// bech32 address of the fee recipient | ||
string sale_creation_fee_recipient = 2; | ||
|
||
// minimum amount duration of time between the sale creation and the sale | ||
// start time. | ||
google.protobuf.Duration min_duration_until_start_time = 3 | ||
[ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; | ||
|
||
// minimum duration for every new sale. | ||
google.protobuf.Duration min_sale_duration = 4 | ||
[ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
syntax = "proto3"; | ||
package osmosis.streamswap.v1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/api/annotations.proto"; | ||
import "cosmos/base/query/v1beta1/pagination.proto"; | ||
|
||
import "osmosis/streamswap/v1/state.proto"; | ||
|
||
option go_package = "github.com/osmosis-labs/osmosis/v11/x/streamswap/types"; | ||
option (gogoproto.goproto_getters_all) = false; | ||
|
||
// Query defines the gRPC querier service. | ||
service Query { | ||
// Returns list of Sales ordered by the creation time | ||
rpc Sales(QuerySales) returns (QuerySalesResponse) { | ||
option (google.api.http).get = "/cosmos/streamswap/v1/sales"; | ||
} | ||
|
||
// Returns the specific Sale object | ||
rpc Sale(QuerySale) returns (QuerySaleResponse) { | ||
option (google.api.http).get = "/cosmos/streamswap/v1/sales/{sale_id}"; | ||
} | ||
|
||
rpc UserPosition(QueryUserPosition) returns (QueryUserPositionResponse) { | ||
option (google.api.http).get = | ||
"/cosmos/streamswap/v1/sales/{sale_id}/{user}"; | ||
} | ||
} | ||
|
||
message QuerySales { | ||
// pagination defines an pagination for the request. | ||
cosmos.base.query.v1beta1.PageRequest pagination = 1; | ||
} | ||
|
||
message QuerySalesResponse { | ||
repeated osmosis.streamswap.v1.Sale sales = 1 | ||
[ (gogoproto.nullable) = false ]; | ||
cosmos.base.query.v1beta1.PageResponse pagination = 2; | ||
} | ||
|
||
// Request type for Query/Sale | ||
message QuerySale { | ||
// Sale ID | ||
uint64 sale_id = 1; | ||
} | ||
|
||
message QuerySaleResponse { | ||
osmosis.streamswap.v1.Sale sale = 1 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
// Request type for Query/Sale | ||
message QueryUserPosition { | ||
// ID of the Sale | ||
uint64 sale_id = 1; | ||
// user account address | ||
string user = 2; | ||
} | ||
|
||
message QueryUserPositionResponse { | ||
osmosis.streamswap.v1.UserPosition user_position = 1 | ||
[ (gogoproto.nullable) = false ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
syntax = "proto3"; | ||
package osmosis.streamswap.v1; | ||
|
||
import "google/protobuf/timestamp.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/osmosis-labs/osmosis/v11/x/streamswap/types"; | ||
option (gogoproto.goproto_getters_all) = false; | ||
|
||
message Sale { | ||
// Destination for the earned token_in | ||
string treasury = 1; | ||
uint64 id = 2; | ||
|
||
// token_out is a token denom to be bootstraped. May be referred as base | ||
// currency, or a sale token. | ||
string token_out = 3; | ||
// token_in is a token denom used to buy sale tokens (`token_out`). May be | ||
// referred as quote_currency or payment token. | ||
string token_in = 4; | ||
|
||
// total number of `tokens_out` to be sold during the continuous sale. | ||
string token_out_supply = 5 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
// start time when the token emission starts. | ||
google.protobuf.Timestamp start_time = 6 | ||
[ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; | ||
// end time when the token emission ends. Can't be bigger than start + | ||
// 139years (to avoid round overflow) | ||
google.protobuf.Timestamp end_time = 7 | ||
[ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; | ||
|
||
// Round number when the sale was last time updated. | ||
int64 round = 8; | ||
|
||
// Last round of the Sale; | ||
int64 end_round = 9; | ||
|
||
// amout of remaining token_out to sell | ||
string out_remaining = 10 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
// amount of token_out sold | ||
string out_sold = 11 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
// out token per share | ||
string out_per_share = 12 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
// total amount of currently staked coins (token_in) but not spent coins. | ||
string staked = 13 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false | ||
]; | ||
// total amount of earned coins (token_in) | ||
string income = 14 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
// total amount of shares | ||
string shares = 15 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
// Name for the sale. | ||
string name = 20; | ||
// URL with sale and project details. | ||
string url = 21; | ||
} | ||
|
||
// UserPosition represents user account in a sale | ||
message UserPosition { | ||
|
||
string shares = 1 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false | ||
]; | ||
// total number of currently staked tokens | ||
string staked = 2 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
// last token/share ratio | ||
string out_per_share = 3 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
// amount of token_in spent | ||
string spent = 4 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
// Amount of accumulated, not withdrawn, purchased tokens (token_out) | ||
string purchased = 5 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false | ||
]; | ||
} |
Oops, something went wrong.