Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: osmosis-labs/osmosis
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e243f375812cfc30106275e9c899fc9cbab8ba6d
Choose a base ref
..
head repository: osmosis-labs/osmosis
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0ab283e9e434e8b1be0585f28fe21f358e17247b
Choose a head ref
42 changes: 42 additions & 0 deletions proto/osmosis/streamswap/v1/event.proto
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/v12/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;
}
27 changes: 27 additions & 0 deletions proto/osmosis/streamswap/v1/genesis.proto
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/v12/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 ];
}
34 changes: 34 additions & 0 deletions proto/osmosis/streamswap/v1/params.proto
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/v12/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 ];
}
63 changes: 63 additions & 0 deletions proto/osmosis/streamswap/v1/query.proto
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/v12/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 ];
}
114 changes: 114 additions & 0 deletions proto/osmosis/streamswap/v1/state.proto
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/v12/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
];
}
Loading