diff --git a/app/app.go b/app/app.go index 0c244bd7a..a7ce5aeb8 100644 --- a/app/app.go +++ b/app/app.go @@ -189,6 +189,9 @@ import ( estakingmodule "github.com/elys-network/elys/x/estaking" estakingmodulekeeper "github.com/elys-network/elys/x/estaking/keeper" estakingmoduletypes "github.com/elys-network/elys/x/estaking/types" + launchpadmodule "github.com/elys-network/elys/x/launchpad" + launchpadmodulekeeper "github.com/elys-network/elys/x/launchpad/keeper" + launchpadmoduletypes "github.com/elys-network/elys/x/launchpad/types" masterchefmodule "github.com/elys-network/elys/x/masterchef" masterchefmodulekeeper "github.com/elys-network/elys/x/masterchef/keeper" masterchefmoduletypes "github.com/elys-network/elys/x/masterchef/types" @@ -294,6 +297,7 @@ var ( clockmodule.AppModuleBasic{}, stablestake.AppModuleBasic{}, leveragelpmodule.AppModuleBasic{}, + launchpadmodule.AppModuleBasic{}, masterchefmodule.AppModuleBasic{}, estakingmodule.AppModuleBasic{}, // this line is used by starport scaffolding # stargate/app/moduleBasic @@ -316,6 +320,7 @@ var ( ammmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, wasmmoduletypes.ModuleName: {authtypes.Burner}, stablestaketypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + launchpadmoduletypes.ModuleName: {}, masterchefmoduletypes.ModuleName: {}, // this line is used by starport scaffolding # stargate/app/maccPerms } @@ -403,6 +408,7 @@ type ElysApp struct { LeveragelpKeeper leveragelpmodulekeeper.Keeper + LaunchpadKeeper launchpadmodulekeeper.Keeper MasterchefKeeper masterchefmodulekeeper.Keeper EstakingKeeper estakingmodulekeeper.Keeper @@ -487,6 +493,7 @@ func NewElysApp( clockmoduletypes.StoreKey, stablestaketypes.StoreKey, leveragelpmoduletypes.StoreKey, + launchpadmoduletypes.StoreKey, masterchefmoduletypes.StoreKey, estakingmoduletypes.StoreKey, // this line is used by starport scaffolding # stargate/app/storeKey @@ -1022,6 +1029,19 @@ func NewElysApp( ) leveragelpModule := leveragelpmodule.NewAppModule(appCodec, app.LeveragelpKeeper, app.AccountKeeper, app.BankKeeper) + app.LaunchpadKeeper = *launchpadmodulekeeper.NewKeeper( + appCodec, + keys[launchpadmoduletypes.StoreKey], + keys[launchpadmoduletypes.MemStoreKey], + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + app.BankKeeper, + app.OracleKeeper, + &app.EpochsKeeper, + &app.CommitmentKeeper, + app.AssetprofileKeeper, + ) + launchpadModule := launchpadmodule.NewAppModule(appCodec, app.LaunchpadKeeper, app.AccountKeeper, app.BankKeeper) + // this line is used by starport scaffolding # stargate/app/keeperDefinition /**** IBC Routing ****/ @@ -1144,6 +1164,7 @@ func NewElysApp( clockModule, stablestakeModule, leveragelpModule, + launchpadModule, masterchefModule, estakingModule, // this line is used by starport scaffolding # stargate/app/appModule @@ -1193,6 +1214,7 @@ func NewElysApp( transferhooktypes.ModuleName, clockmoduletypes.ModuleName, leveragelpmoduletypes.ModuleName, + launchpadmoduletypes.ModuleName, masterchefmoduletypes.ModuleName, estakingmoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/beginBlockers @@ -1237,6 +1259,7 @@ func NewElysApp( accountedpoolmoduletypes.ModuleName, transferhooktypes.ModuleName, leveragelpmoduletypes.ModuleName, + launchpadmoduletypes.ModuleName, masterchefmoduletypes.ModuleName, estakingmoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/endBlockers @@ -1285,6 +1308,7 @@ func NewElysApp( transferhooktypes.ModuleName, clockmoduletypes.ModuleName, leveragelpmoduletypes.ModuleName, + launchpadmoduletypes.ModuleName, masterchefmoduletypes.ModuleName, estakingmoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/initGenesis diff --git a/config.yml b/config.yml index 56005f37c..9395d4216 100644 --- a/config.yml +++ b/config.yml @@ -281,6 +281,42 @@ genesis: - amount: "10000" denom: uedenb vesting_tokens: [] + launchpad: + params: + initial_price: "0.75" + total_reserve: "4500000000000" + sold_amount: "0" + withdraw_address: "elys12tzylat4udvjj56uuhu3vj2n4vgp7cf9fwna9w" + # withdrawn_amount: "" + launchpad_starttime: 1710984623 + launchpad_duration: 8640000 + return_duration: 15552000 + max_return_percent: 50 + spending_tokens: + - uusdc + - uatom + - wei + bonus_info: + raise_percents: + - 20 + - 30 + - 40 + - 50 + - 60 + - 70 + - 80 + - 100 + bonus_percents: + - 100 + - 90 + - 80 + - 70 + - 60 + - 50 + - 40 + - 30 + lock_duration: 15552000 + vesting_duration: 31536000 tokenomics: airdropList: - intent: AtomStakers diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 71ce6da73..e969543ab 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -40813,6 +40813,419 @@ paths: type: boolean tags: - Query + /elys-network/elys/launchpad/all_orders: + get: + summary: AllOrders queries all the orders placed + operationId: ElysLaunchpadAllOrders + responses: + '200': + description: A successful response. + schema: + type: object + properties: + purchases: + type: array + items: + type: object + properties: + order_id: + type: string + format: uint64 + order_maker: + type: string + spending_token: + type: string + token_amount: + type: string + elys_amount: + type: string + returned_elys_amount: + type: string + bonus_amount: + type: string + vesting_started: + type: boolean + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Query + /elys-network/elys/launchpad/bonus: + get: + summary: Bonus queries bonus amounts for a user + operationId: ElysLaunchpadBonus + responses: + '200': + description: A successful response. + schema: + type: object + properties: + total_bonus: + type: string + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: user + in: query + required: false + type: string + tags: + - Query + /elys-network/elys/launchpad/buy_elys_estimation: + get: + summary: BuyElysEst queries estimation result for buying elys + operationId: ElysLaunchpadBuyElysEst + responses: + '200': + description: A successful response. + schema: + type: object + properties: + elys_amount: + type: string + bonus_amount: + type: string + orders: + type: array + items: + type: object + properties: + order_id: + type: string + format: uint64 + order_maker: + type: string + spending_token: + type: string + token_amount: + type: string + elys_amount: + type: string + returned_elys_amount: + type: string + bonus_amount: + type: string + vesting_started: + type: boolean + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: spending_token + in: query + required: false + type: string + - name: token_amount + in: query + required: false + type: string + tags: + - Query + /elys-network/elys/launchpad/module_balances: + get: + summary: ModuleBalances queries module balances + operationId: ElysLaunchpadModuleBalances + responses: + '200': + description: A successful response. + schema: + type: object + properties: + coins: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Query + /elys-network/elys/launchpad/orders: + get: + summary: Orders queries orders placed by user + operationId: ElysLaunchpadOrders + responses: + '200': + description: A successful response. + schema: + type: object + properties: + purchases: + type: array + items: + type: object + properties: + order_id: + type: string + format: uint64 + order_maker: + type: string + spending_token: + type: string + token_amount: + type: string + elys_amount: + type: string + returned_elys_amount: + type: string + bonus_amount: + type: string + vesting_started: + type: boolean + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: user + in: query + required: false + type: string + tags: + - Query + /elys-network/elys/launchpad/params: + get: + summary: Parameters queries the parameters of the module. + operationId: ElysLaunchpadParams + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + properties: + initial_price: + type: string + title: 0.75 USDC + total_reserve: + type: string + title: 4.5 million + sold_amount: + type: string + withdraw_address: + type: string + withdrawn_amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + launchpad_starttime: + type: string + format: uint64 + title: May 1st + launchpad_duration: + type: string + format: uint64 + title: 1 week + return_duration: + type: string + format: uint64 + max_return_percent: + type: string + format: uint64 + spending_tokens: + type: array + items: + type: string + title: USDC, ETH, ATOM + bonus_info: + type: object + properties: + raise_percents: + type: array + items: + type: string + format: uint64 + bonus_percents: + type: array + items: + type: string + format: uint64 + lock_duration: + type: string + format: uint64 + title: 6 months + vesting_duration: + type: string + format: uint64 + title: 12 months + title: |- + 0-20% raise 100% bonus + 20-30% raise 90% bonus + 30-40% raise bonus 80% + 40-50% raise bonus 70% + 50-60% raise bonus 60% + 60-70% raise bonus 50% + 70-80% raise bonus 40% + 80-100% raise bonus 30% + description: >- + QueryParamsResponse is response type for the Query/Params RPC + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Query + /elys-network/elys/launchpad/return_elys_estimation: + get: + summary: ReturnElysEst queries estimation result for returning elys + operationId: ElysLaunchpadReturnElysEst + responses: + '200': + description: A successful response. + schema: + type: object + properties: + amount: + type: string + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: order_id + in: query + required: false + type: string + format: uint64 + - name: elys_amount + in: query + required: false + type: string + tags: + - Query /elys-network/elys/leveragelp/is-whitelisted: get: summary: Queries a list of IsWhitelisted items. @@ -86331,23 +86744,339 @@ definitions: format: uint64 rewards_usd: type: string - reward_coins: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + elys.launchpad.Bonus: + type: object + properties: + raise_percents: + type: array + items: + type: string + format: uint64 + bonus_percents: + type: array + items: + type: string + format: uint64 + lock_duration: + type: string + format: uint64 + title: 6 months + vesting_duration: + type: string + format: uint64 + title: 12 months + title: |- + 0-20% raise 100% bonus + 20-30% raise 90% bonus + 30-40% raise bonus 80% + 40-50% raise bonus 70% + 50-60% raise bonus 60% + 60-70% raise bonus 50% + 70-80% raise bonus 40% + 80-100% raise bonus 30% + elys.launchpad.MsgBuyElysResponse: + type: object + properties: + order_ids: + type: array + items: + type: string + format: uint64 + elys.launchpad.MsgDepositElysTokenResponse: + type: object + elys.launchpad.MsgReturnElysResponse: + type: object + elys.launchpad.MsgUpdateParamsResponse: + type: object + elys.launchpad.MsgWithdrawRaisedResponse: + type: object + elys.launchpad.Params: + type: object + properties: + initial_price: + type: string + title: 0.75 USDC + total_reserve: + type: string + title: 4.5 million + sold_amount: + type: string + withdraw_address: + type: string + withdrawn_amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + launchpad_starttime: + type: string + format: uint64 + title: May 1st + launchpad_duration: + type: string + format: uint64 + title: 1 week + return_duration: + type: string + format: uint64 + max_return_percent: + type: string + format: uint64 + spending_tokens: + type: array + items: + type: string + title: USDC, ETH, ATOM + bonus_info: + type: object + properties: + raise_percents: + type: array + items: + type: string + format: uint64 + bonus_percents: + type: array + items: + type: string + format: uint64 + lock_duration: + type: string + format: uint64 + title: 6 months + vesting_duration: + type: string + format: uint64 + title: 12 months + title: |- + 0-20% raise 100% bonus + 20-30% raise 90% bonus + 30-40% raise bonus 80% + 40-50% raise bonus 70% + 50-60% raise bonus 60% + 60-70% raise bonus 50% + 70-80% raise bonus 40% + 80-100% raise bonus 30% + description: Params defines the parameters for the module. + elys.launchpad.Purchase: + type: object + properties: + order_id: + type: string + format: uint64 + order_maker: + type: string + spending_token: + type: string + token_amount: + type: string + elys_amount: + type: string + returned_elys_amount: + type: string + bonus_amount: + type: string + vesting_started: + type: boolean + elys.launchpad.QueryAllOrdersResponse: + type: object + properties: + purchases: + type: array + items: + type: object + properties: + order_id: + type: string + format: uint64 + order_maker: + type: string + spending_token: + type: string + token_amount: + type: string + elys_amount: + type: string + returned_elys_amount: + type: string + bonus_amount: + type: string + vesting_started: + type: boolean + elys.launchpad.QueryBonusResponse: + type: object + properties: + total_bonus: + type: string + elys.launchpad.QueryBuyElysEstResponse: + type: object + properties: + elys_amount: + type: string + bonus_amount: + type: string + orders: + type: array + items: + type: object + properties: + order_id: + type: string + format: uint64 + order_maker: + type: string + spending_token: + type: string + token_amount: + type: string + elys_amount: + type: string + returned_elys_amount: + type: string + bonus_amount: + type: string + vesting_started: + type: boolean + elys.launchpad.QueryModuleBalancesResponse: + type: object + properties: + coins: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + elys.launchpad.QueryOrdersResponse: + type: object + properties: + purchases: + type: array + items: + type: object + properties: + order_id: + type: string + format: uint64 + order_maker: + type: string + spending_token: + type: string + token_amount: + type: string + elys_amount: + type: string + returned_elys_amount: + type: string + bonus_amount: + type: string + vesting_started: + type: boolean + elys.launchpad.QueryParamsResponse: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + properties: + initial_price: + type: string + title: 0.75 USDC + total_reserve: + type: string + title: 4.5 million + sold_amount: + type: string + withdraw_address: + type: string + withdrawn_amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - NOTE: The amount field is an Int which implements the custom - method - signatures required by gogoproto. + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + launchpad_starttime: + type: string + format: uint64 + title: May 1st + launchpad_duration: + type: string + format: uint64 + title: 1 week + return_duration: + type: string + format: uint64 + max_return_percent: + type: string + format: uint64 + spending_tokens: + type: array + items: + type: string + title: USDC, ETH, ATOM + bonus_info: + type: object + properties: + raise_percents: + type: array + items: + type: string + format: uint64 + bonus_percents: + type: array + items: + type: string + format: uint64 + lock_duration: + type: string + format: uint64 + title: 6 months + vesting_duration: + type: string + format: uint64 + title: 12 months + title: |- + 0-20% raise 100% bonus + 20-30% raise 90% bonus + 30-40% raise bonus 80% + 40-50% raise bonus 70% + 50-60% raise bonus 60% + 60-70% raise bonus 50% + 70-80% raise bonus 40% + 80-100% raise bonus 30% + description: QueryParamsResponse is response type for the Query/Params RPC method. + elys.launchpad.QueryReturnElysEstResponse: + type: object + properties: + amount: + type: string elys.leveragelp.IsWhitelistedResponse: type: object properties: diff --git a/proto/elys/launchpad/genesis.proto b/proto/elys/launchpad/genesis.proto new file mode 100644 index 000000000..5f5945453 --- /dev/null +++ b/proto/elys/launchpad/genesis.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package elys.launchpad; + +import "gogoproto/gogo.proto"; +import "elys/launchpad/params.proto"; +import "elys/launchpad/launchpad.proto"; + +option go_package = "github.com/elys-network/elys/x/launchpad/types"; + +// GenesisState defines the launchpad module's genesis state. +message GenesisState { + Params params = 1 [(gogoproto.nullable) = false]; + repeated Purchase purchases = 2 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/elys/launchpad/launchpad.proto b/proto/elys/launchpad/launchpad.proto new file mode 100644 index 000000000..60616fa6e --- /dev/null +++ b/proto/elys/launchpad/launchpad.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; +package elys.launchpad; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/elys-network/elys/x/launchpad/types"; + +// 0-20% raise 100% bonus +// 20-30% raise 90% bonus +// 30-40% raise bonus 80% +// 40-50% raise bonus 70% +// 50-60% raise bonus 60% +// 60-70% raise bonus 50% +// 70-80% raise bonus 40% +// 80-100% raise bonus 30% +message Bonus { + repeated uint64 raise_percents = 1; + repeated uint64 bonus_percents = 2; + uint64 lock_duration = 3; // 6 months + uint64 vesting_duration = 4; // 12 months +} + +message Purchase { + uint64 order_id = 1; + string order_maker = 2; + string spending_token = 3; + string token_amount = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string elys_amount = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string returned_elys_amount = 6 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string bonus_amount = 7 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + bool vesting_started = 8; +} \ No newline at end of file diff --git a/proto/elys/launchpad/params.proto b/proto/elys/launchpad/params.proto new file mode 100644 index 000000000..bc557a2a5 --- /dev/null +++ b/proto/elys/launchpad/params.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; +package elys.launchpad; + +import "gogoproto/gogo.proto"; +import "elys/launchpad/launchpad.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/elys-network/elys/x/launchpad/types"; + +// Params defines the parameters for the module. +message Params { + option (gogoproto.goproto_stringer) = false; + + string initial_price = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // 0.75 USDC + string total_reserve = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; // 4.5 million + string sold_amount = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string withdraw_address = 4; + repeated cosmos.base.v1beta1.Coin withdrawn_amount = 5 [ + (gogoproto.nullable) = false + ]; + uint64 launchpad_starttime = 6; // May 1st + uint64 launchpad_duration = 7; // 1 week + uint64 return_duration = 8; + uint64 max_return_percent = 9; + repeated string spending_tokens = 10; // USDC, ETH, ATOM + Bonus bonus_info = 11 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/elys/launchpad/query.proto b/proto/elys/launchpad/query.proto new file mode 100644 index 000000000..54b078a4f --- /dev/null +++ b/proto/elys/launchpad/query.proto @@ -0,0 +1,110 @@ +syntax = "proto3"; +package elys.launchpad; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "elys/launchpad/params.proto"; +import "elys/launchpad/launchpad.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/elys-network/elys/x/launchpad/types"; + +// Query defines the gRPC querier service. +service Query { + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/elys-network/elys/launchpad/params"; + } + // Bonus queries bonus amounts for a user + rpc Bonus(QueryBonusRequest) returns (QueryBonusResponse) { + option (google.api.http).get = "/elys-network/elys/launchpad/bonus"; + } + // BuyElysEst queries estimation result for buying elys + rpc BuyElysEst(QueryBuyElysEstRequest) returns (QueryBuyElysEstResponse) { + option (google.api.http).get = "/elys-network/elys/launchpad/buy_elys_estimation"; + } + // ReturnElysEst queries estimation result for returning elys + rpc ReturnElysEst(QueryReturnElysEstRequest) returns (QueryReturnElysEstResponse) { + option (google.api.http).get = "/elys-network/elys/launchpad/return_elys_estimation"; + } + // Orders queries orders placed by user + rpc Orders(QueryOrdersRequest) returns (QueryOrdersResponse) { + option (google.api.http).get = "/elys-network/elys/launchpad/orders"; + } + // AllOrders queries all the orders placed + rpc AllOrders(QueryAllOrdersRequest) returns (QueryAllOrdersResponse) { + option (google.api.http).get = "/elys-network/elys/launchpad/all_orders"; + } + // ModuleBalances queries module balances + rpc ModuleBalances(QueryModuleBalancesRequest) returns (QueryModuleBalancesResponse) { + option (google.api.http).get = "/elys-network/elys/launchpad/module_balances"; + } +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 [(gogoproto.nullable) = false]; +} + +message QueryBonusRequest { + string user = 1; +} +message QueryBonusResponse { + string total_bonus = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +message QueryBuyElysEstRequest { + string spending_token = 1; + string token_amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} +message QueryBuyElysEstResponse { + string elys_amount = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string bonus_amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + repeated Purchase orders = 3 [ (gogoproto.nullable) = false ]; +} + +message QueryReturnElysEstRequest { + uint64 order_id = 1; + string elys_amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} +message QueryReturnElysEstResponse { + string amount = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +message QueryOrdersRequest { string user = 1; } +message QueryOrdersResponse { + repeated Purchase purchases = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryAllOrdersRequest {} +message QueryAllOrdersResponse { + repeated Purchase purchases = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryModuleBalancesRequest {} +message QueryModuleBalancesResponse { + repeated cosmos.base.v1beta1.Coin coins = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/elys/launchpad/tx.proto b/proto/elys/launchpad/tx.proto new file mode 100644 index 000000000..e279c4b79 --- /dev/null +++ b/proto/elys/launchpad/tx.proto @@ -0,0 +1,58 @@ +syntax = "proto3"; +package elys.launchpad; + +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "elys/launchpad/params.proto"; + +option go_package = "github.com/elys-network/elys/x/launchpad/types"; + +// Msg defines the Msg service. +service Msg { + rpc BuyElys(MsgBuyElys) returns (MsgBuyElysResponse); + rpc ReturnElys(MsgReturnElys) returns (MsgReturnElysResponse); + rpc DepositElysToken(MsgDepositElysToken) returns (MsgDepositElysTokenResponse); + rpc WithdrawRaised(MsgWithdrawRaised) returns (MsgWithdrawRaisedResponse); + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); +} + +message MsgBuyElys { + string sender = 1; + string spending_token = 2; + string token_amount = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} +message MsgBuyElysResponse { + repeated uint64 order_ids = 1; +} + +message MsgReturnElys { + string sender = 1; + uint64 order_id = 2; + string return_elys_amount = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} +message MsgReturnElysResponse {} + +message MsgWithdrawRaised { + string sender = 1; + repeated cosmos.base.v1beta1.Coin coins = 2 [ (gogoproto.nullable) = false ]; +} +message MsgWithdrawRaisedResponse {} + +message MsgDepositElysToken { + string sender = 1; + cosmos.base.v1beta1.Coin coin = 2 [ (gogoproto.nullable) = false ]; +} +message MsgDepositElysTokenResponse {} + +message MsgUpdateParams { + string authority = 1; + Params params = 2 [ (gogoproto.nullable) = false ]; +} +message MsgUpdateParamsResponse {} diff --git a/scripts/examples/launchpad/launchpad.sh b/scripts/examples/launchpad/launchpad.sh new file mode 100644 index 000000000..297db7ac5 --- /dev/null +++ b/scripts/examples/launchpad/launchpad.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# queries +elysd query launchpad all-orders +elysd query launchpad bonus $(elysd keys show -a treasury --keyring-backend=test) +elysd query launchpad buy-elys-estimation uusdc 1000000 +elysd query launchpad return-elys-estimation 1 50000 +elysd query launchpad orders $(elysd keys show -a treasury --keyring-backend=test) +elysd query launchpad params +elysd query launchpad module-balances + +# Buy Elys +elysd tx launchpad buy-elys uusdc 1000000 --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000 + +# Return Elys +elysd tx launchpad return-elys 1 100000000000 --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000 + +# Deposit Elys token +elysd tx launchpad deposit-elys-token 100000000000uelys --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000 + +# Withdraw raised +elysd tx launchpad withdraw-raised 1000000uusdc --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000 diff --git a/testutil/keeper/launchpad.go b/testutil/keeper/launchpad.go new file mode 100644 index 000000000..1fcab8b02 --- /dev/null +++ b/testutil/keeper/launchpad.go @@ -0,0 +1,52 @@ +package keeper + +import ( + "testing" + + tmdb "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/store" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + "github.com/elys-network/elys/x/launchpad/keeper" + "github.com/elys-network/elys/x/launchpad/types" + "github.com/stretchr/testify/require" +) + +func LaunchpadKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { + storeKey := sdk.NewKVStoreKey(types.StoreKey) + memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) + + db := tmdb.NewMemDB() + stateStore := store.NewCommitMultiStore(db) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) + require.NoError(t, stateStore.LoadLatestVersion()) + + registry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(registry) + + govAddress := sdk.AccAddress(address.Module("gov")) + k := keeper.NewKeeper( + cdc, + storeKey, + memStoreKey, + govAddress.String(), + nil, + nil, + nil, + nil, + nil, + ) + + ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) + + // Initialize params + k.SetParams(ctx, types.DefaultParams()) + + return k, ctx +} diff --git a/wasmbindings/types/types.go b/wasmbindings/types/types.go index f5ee12c60..f06f16904 100644 --- a/wasmbindings/types/types.go +++ b/wasmbindings/types/types.go @@ -28,6 +28,7 @@ import ( estakingtypes "github.com/elys-network/elys/x/estaking/types" incentivekeeper "github.com/elys-network/elys/x/incentive/keeper" incentivetypes "github.com/elys-network/elys/x/incentive/types" + launchpadtypes "github.com/elys-network/elys/x/launchpad/types" leveragelpkeeper "github.com/elys-network/elys/x/leveragelp/keeper" leveragelptypes "github.com/elys-network/elys/x/leveragelp/types" masterchefkeeper "github.com/elys-network/elys/x/masterchef/keeper" @@ -188,6 +189,14 @@ type ElysQuery struct { LeveragelpPools *leveragelptypes.QueryAllPoolRequest `json:"leveragelp_pools,omitempty"` LeveragelpPosition *leveragelptypes.PositionRequest `json:"leveragelp_position,omitempty"` + // launchpad queriers + LaunchpadParams *launchpadtypes.QueryParamsRequest `json:"launchpad_params,omitempty"` + LaunchpadBonus *launchpadtypes.QueryBonusRequest `json:"launchpad_bonus,omitempty"` + LaunchpadBuyElysEst *launchpadtypes.QueryBuyElysEstRequest `json:"launchpad_buy_elys_estimation,omitempty"` + LaunchpadReturnElysEst *launchpadtypes.QueryReturnElysEstRequest `json:"launchpad_return_elys_estimation,omitempty"` + LaunchpadOrders *launchpadtypes.QueryOrdersRequest `json:"launchpad_orders,omitempty"` + LaunchpadAllOrders *launchpadtypes.QueryAllOrdersRequest `json:"launchpad_all_orders,omitempty"` + // perpetual queriers PerpetualParams *perpetualtypes.ParamsRequest `json:"perpetual_params,omitempty"` PerpetualQueryPositions *perpetualtypes.PositionsRequest `json:"perpetual_query_positions,omitempty"` @@ -302,6 +311,10 @@ type ElysMsg struct { LeveragelpOpen *leveragelptypes.MsgOpen `json:"leveragelp_open,omitempty"` LeveragelpClose *leveragelptypes.MsgClose `json:"leveragelp_close,omitempty"` + // launchpad messages + LaunchpadBuyElys *launchpadtypes.MsgBuyElys `json:"launchpad_buy_elys,omitempty"` + LaunchpadReturnElys *launchpadtypes.MsgReturnElys `json:"launchpad_return_elys,omitempty"` + // perpetual messages PerpetualOpen *perpetualtypes.MsgBrokerOpen `json:"perpetual_open,omitempty"` PerpetualClose *perpetualtypes.MsgBrokerClose `json:"perpetual_close,omitempty"` diff --git a/x/launchpad/client/cli/query.go b/x/launchpad/client/cli/query.go new file mode 100644 index 000000000..af2cb56d6 --- /dev/null +++ b/x/launchpad/client/cli/query.go @@ -0,0 +1,37 @@ +package cli + +import ( + "fmt" + // "strings" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + // "github.com/cosmos/cosmos-sdk/client/flags" + // sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/elys-network/elys/x/launchpad/types" +) + +// GetQueryCmd returns the cli query commands for this module +func GetQueryCmd(queryRoute string) *cobra.Command { + // Group launchpad queries under a subcommand + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdQueryParams()) + cmd.AddCommand(CmdQueryBonus()) + cmd.AddCommand(CmdQueryBuyElysEstimation()) + cmd.AddCommand(CmdQueryReturnElysEstimation()) + cmd.AddCommand(CmdQueryOrders()) + cmd.AddCommand(CmdQueryAllOrders()) + cmd.AddCommand(CmdQueryModuleBalances()) + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/launchpad/client/cli/query_bonus.go b/x/launchpad/client/cli/query_bonus.go new file mode 100644 index 000000000..add87dd48 --- /dev/null +++ b/x/launchpad/client/cli/query_bonus.go @@ -0,0 +1,40 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/elys-network/elys/x/launchpad/types" + "github.com/spf13/cobra" +) + +func CmdQueryBonus() *cobra.Command { + cmd := &cobra.Command{ + Use: "bonus [user]", + Short: "Query Bonus", + Example: "elysd q launchpad bonus [user]", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryBonusRequest{ + User: args[0], + } + + res, err := queryClient.Bonus(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/launchpad/client/cli/query_buy_elys_estimation.go b/x/launchpad/client/cli/query_buy_elys_estimation.go new file mode 100644 index 000000000..5397ab0a0 --- /dev/null +++ b/x/launchpad/client/cli/query_buy_elys_estimation.go @@ -0,0 +1,48 @@ +package cli + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/launchpad/types" + "github.com/spf13/cobra" +) + +func CmdQueryBuyElysEstimation() *cobra.Command { + cmd := &cobra.Command{ + Use: "buy-elys-estimation [spendingToken] [amount]", + Short: "Query BuyElys estimation", + Example: "elysd q launchpad buy-elys-estimation [spendingToken] [amount]", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + amount, ok := sdk.NewIntFromString(args[1]) + if !ok { + return fmt.Errorf("invalid spending token amount") + } + + params := &types.QueryBuyElysEstRequest{ + SpendingToken: args[0], + TokenAmount: amount, + } + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.BuyElysEst(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/launchpad/client/cli/query_module_balances.go b/x/launchpad/client/cli/query_module_balances.go new file mode 100644 index 000000000..96275e6ed --- /dev/null +++ b/x/launchpad/client/cli/query_module_balances.go @@ -0,0 +1,38 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/elys-network/elys/x/launchpad/types" + "github.com/spf13/cobra" +) + +func CmdQueryModuleBalances() *cobra.Command { + cmd := &cobra.Command{ + Use: "module-balances", + Short: "Query module balances", + Example: "elysd q launchpad module-balances", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryModuleBalancesRequest{} + + res, err := queryClient.ModuleBalances(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/launchpad/client/cli/query_orders.go b/x/launchpad/client/cli/query_orders.go new file mode 100644 index 000000000..3e2754ad0 --- /dev/null +++ b/x/launchpad/client/cli/query_orders.go @@ -0,0 +1,70 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/elys-network/elys/x/launchpad/types" + "github.com/spf13/cobra" +) + +func CmdQueryOrders() *cobra.Command { + cmd := &cobra.Command{ + Use: "orders [user]", + Short: "Query Orders", + Example: "elysd q launchpad orders [user]", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryOrdersRequest{ + User: args[0], + } + + res, err := queryClient.Orders(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdQueryAllOrders() *cobra.Command { + cmd := &cobra.Command{ + Use: "all-orders", + Short: "Query Orders", + Example: "elysd q launchpad all-orders", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryAllOrdersRequest{} + + res, err := queryClient.AllOrders(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/launchpad/client/cli/query_params.go b/x/launchpad/client/cli/query_params.go new file mode 100644 index 000000000..311796f5f --- /dev/null +++ b/x/launchpad/client/cli/query_params.go @@ -0,0 +1,36 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/elys-network/elys/x/launchpad/types" +) + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/launchpad/client/cli/query_return_elys_estimation.go b/x/launchpad/client/cli/query_return_elys_estimation.go new file mode 100644 index 000000000..a688d073e --- /dev/null +++ b/x/launchpad/client/cli/query_return_elys_estimation.go @@ -0,0 +1,53 @@ +package cli + +import ( + "fmt" + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/launchpad/types" + "github.com/spf13/cobra" +) + +func CmdQueryReturnElysEstimation() *cobra.Command { + cmd := &cobra.Command{ + Use: "return-elys-estimation [orderId] [amount]", + Short: "Query ReturnElys estimation", + Example: "elysd q launchpad return-elys-estimation [orderId] [amount]", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + orderId, err := strconv.Atoi(args[0]) + if err != nil { + return err + } + amount, ok := sdk.NewIntFromString(args[1]) + if !ok { + return fmt.Errorf("invalid spending token amount") + } + + params := &types.QueryReturnElysEstRequest{ + OrderId: uint64(orderId), + ElysAmount: amount, + } + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.ReturnElysEst(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/launchpad/client/cli/tx.go b/x/launchpad/client/cli/tx.go new file mode 100644 index 000000000..cf0e3e86c --- /dev/null +++ b/x/launchpad/client/cli/tx.go @@ -0,0 +1,173 @@ +package cli + +import ( + "fmt" + "strconv" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + + // "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/elys-network/elys/x/launchpad/types" +) + +// GetTxCmd returns the transaction commands for this module +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdBuyElys()) + cmd.AddCommand(CmdReturnElys()) + cmd.AddCommand(CmdDepositElysToken()) + cmd.AddCommand(CmdWithdrawRaised()) + + return cmd +} + +func CmdBuyElys() *cobra.Command { + cmd := &cobra.Command{ + Use: "buy-elys [spendingToken] [amount]", + Short: "Buy elys from launchpad", + Example: `elysd tx launchpad buy-elys uatom 100000000000 --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000`, + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + spendingToken := args[0] + amount, ok := sdk.NewIntFromString(args[1]) + if !ok { + return fmt.Errorf("invalid spending token amount") + } + + msg := types.NewMsgBuyElys( + clientCtx.GetFromAddress().String(), + spendingToken, + amount, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +func CmdReturnElys() *cobra.Command { + cmd := &cobra.Command{ + Use: "return-elys [orderId] [amount]", + Short: "Return elys bought from launchpad", + Example: `elysd tx launchpad return-elys 1 100000000000 --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000`, + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + orderId, err := strconv.Atoi(args[0]) + if err != nil { + return err + } + amount, ok := sdk.NewIntFromString(args[1]) + if !ok { + return fmt.Errorf("invalid spending token amount") + } + + msg := types.NewMsgReturnElys( + clientCtx.GetFromAddress().String(), + uint64(orderId), + amount, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +func CmdDepositElysToken() *cobra.Command { + cmd := &cobra.Command{ + Use: "deposit-elys-token [amount]", + Short: "Deposit elys token for launchpad", + Example: `elysd tx launchpad deposit-elys-token 100000000000uelys --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + amount, err := sdk.ParseCoinNormalized(args[0]) + if err != nil { + return err + } + + msg := types.NewMsgDepositElysToken( + clientCtx.GetFromAddress().String(), + amount, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +func CmdWithdrawRaised() *cobra.Command { + cmd := &cobra.Command{ + Use: "withdraw-raised [amounts]", + Short: "Withdraw raised amount from launchpad", + Example: `elysd tx launchpad withdraw-raised 100000000000uatom --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + amounts, err := sdk.ParseCoinsNormalized(args[0]) + if err != nil { + return err + } + + msg := types.NewMsgWithdrawRaised( + clientCtx.GetFromAddress().String(), + amounts, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/launchpad/client/wasm/messenger.go b/x/launchpad/client/wasm/messenger.go new file mode 100644 index 000000000..c3aa7bbd3 --- /dev/null +++ b/x/launchpad/client/wasm/messenger.go @@ -0,0 +1,36 @@ +package wasm + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + wasmbindingstypes "github.com/elys-network/elys/wasmbindings/types" + "github.com/elys-network/elys/x/launchpad/keeper" + parameterkeeper "github.com/elys-network/elys/x/parameter/keeper" +) + +// Messenger handles messages for the Leverage LP module. +type Messenger struct { + keeper *keeper.Keeper + parameterKeeper *parameterkeeper.Keeper +} + +func NewMessenger( + keeper *keeper.Keeper, + parameterKeeper *parameterkeeper.Keeper, +) *Messenger { + return &Messenger{ + keeper: keeper, + parameterKeeper: parameterKeeper, + } +} + +func (m *Messenger) HandleMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmbindingstypes.ElysMsg) ([]sdk.Event, [][]byte, error) { + switch { + case msg.LaunchpadBuyElys != nil: + return m.msgBuyElys(ctx, contractAddr, msg.LaunchpadBuyElys) + case msg.LaunchpadReturnElys != nil: + return m.msgReturnElys(ctx, contractAddr, msg.LaunchpadReturnElys) + default: + // This handler cannot handle the message + return nil, nil, wasmbindingstypes.ErrCannotHandleMsg + } +} diff --git a/x/launchpad/client/wasm/msg_buy_elys.go b/x/launchpad/client/wasm/msg_buy_elys.go new file mode 100644 index 000000000..6d5ad7ca8 --- /dev/null +++ b/x/launchpad/client/wasm/msg_buy_elys.go @@ -0,0 +1,57 @@ +package wasm + +import ( + "encoding/json" + + errorsmod "cosmossdk.io/errors" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + sdk "github.com/cosmos/cosmos-sdk/types" + launchpadkeeper "github.com/elys-network/elys/x/launchpad/keeper" + launchpadtypes "github.com/elys-network/elys/x/launchpad/types" +) + +func (m *Messenger) msgBuyElys(ctx sdk.Context, contractAddr sdk.AccAddress, msgBuyElys *launchpadtypes.MsgBuyElys) ([]sdk.Event, [][]byte, error) { + if msgBuyElys == nil { + return nil, nil, wasmvmtypes.InvalidRequest{Err: "BuyElys null msg"} + } + + brokerAddress := m.parameterKeeper.GetParams(ctx).BrokerAddress + if msgBuyElys.Sender != contractAddr.String() && contractAddr.String() != brokerAddress { + return nil, nil, wasmvmtypes.InvalidRequest{Err: "BuyElys wrong sender"} + } + + res, err := PerformMsgBuy(m.keeper, ctx, contractAddr, msgBuyElys) + if err != nil { + return nil, nil, errorsmod.Wrap(err, "perform BuyElys") + } + + responseBytes, err := json.Marshal(*res) + if err != nil { + return nil, nil, errorsmod.Wrap(err, "failed to serialize BuyElys response") + } + + resp := [][]byte{responseBytes} + + return nil, resp, nil +} + +func PerformMsgBuy(f *launchpadkeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, msgBuyElys *launchpadtypes.MsgBuyElys) (*launchpadtypes.MsgBuyElysResponse, error) { + if msgBuyElys == nil { + return nil, wasmvmtypes.InvalidRequest{Err: "launchpad buyElys null"} + } + msgServer := launchpadkeeper.NewMsgServerImpl(*f) + + msgMsgBuyElys := launchpadtypes.NewMsgBuyElys(msgBuyElys.Sender, msgBuyElys.SpendingToken, msgBuyElys.TokenAmount) + + if err := msgMsgBuyElys.ValidateBasic(); err != nil { + return nil, errorsmod.Wrap(err, "failed validating MsgBuyElys") + } + + _, err := msgServer.BuyElys(sdk.WrapSDKContext(ctx), msgMsgBuyElys) // Discard the response because it's empty + if err != nil { + return nil, errorsmod.Wrap(err, "launchpad BuyElys msg") + } + + resp := &launchpadtypes.MsgBuyElysResponse{} + return resp, nil +} diff --git a/x/launchpad/client/wasm/msg_return_elys.go b/x/launchpad/client/wasm/msg_return_elys.go new file mode 100644 index 000000000..533550956 --- /dev/null +++ b/x/launchpad/client/wasm/msg_return_elys.go @@ -0,0 +1,57 @@ +package wasm + +import ( + "encoding/json" + + errorsmod "cosmossdk.io/errors" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + sdk "github.com/cosmos/cosmos-sdk/types" + launchpadkeeper "github.com/elys-network/elys/x/launchpad/keeper" + launchpadtypes "github.com/elys-network/elys/x/launchpad/types" +) + +func (m *Messenger) msgReturnElys(ctx sdk.Context, contractAddr sdk.AccAddress, msgReturnElys *launchpadtypes.MsgReturnElys) ([]sdk.Event, [][]byte, error) { + if msgReturnElys == nil { + return nil, nil, wasmvmtypes.InvalidRequest{Err: "launchpad ReturnElys null msg"} + } + + brokerAddress := m.parameterKeeper.GetParams(ctx).BrokerAddress + if msgReturnElys.Sender != contractAddr.String() && contractAddr.String() != brokerAddress { + return nil, nil, wasmvmtypes.InvalidRequest{Err: "launchpad ReturnElys wrong sender"} + } + + res, err := PerformMsgReturn(m.keeper, ctx, contractAddr, msgReturnElys) + if err != nil { + return nil, nil, errorsmod.Wrap(err, "perform launchpad ReturnElys") + } + + responseBytes, err := json.Marshal(*res) + if err != nil { + return nil, nil, errorsmod.Wrap(err, "failed to serialize launchpad ReturnElys response") + } + + resp := [][]byte{responseBytes} + + return nil, resp, nil +} + +func PerformMsgReturn(f *launchpadkeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, msgReturnElys *launchpadtypes.MsgReturnElys) (*launchpadtypes.MsgReturnElysResponse, error) { + if msgReturnElys == nil { + return nil, wasmvmtypes.InvalidRequest{Err: "launchpad ReturnElys"} + } + msgServer := launchpadkeeper.NewMsgServerImpl(*f) + + msgMsgReturnElys := launchpadtypes.NewMsgReturnElys(msgReturnElys.Sender, msgReturnElys.OrderId, msgReturnElys.ReturnElysAmount) + + if err := msgMsgReturnElys.ValidateBasic(); err != nil { + return nil, errorsmod.Wrap(err, "failed validating msgMsgClose") + } + + _, err := msgServer.ReturnElys(sdk.WrapSDKContext(ctx), msgMsgReturnElys) // Discard the response because it's empty + if err != nil { + return nil, errorsmod.Wrap(err, "launchpad ReturnElys msg") + } + + resp := &launchpadtypes.MsgReturnElysResponse{} + return resp, nil +} diff --git a/x/launchpad/client/wasm/querier.go b/x/launchpad/client/wasm/querier.go new file mode 100644 index 000000000..5235dd296 --- /dev/null +++ b/x/launchpad/client/wasm/querier.go @@ -0,0 +1,38 @@ +package wasm + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + wasmbindingstypes "github.com/elys-network/elys/wasmbindings/types" + "github.com/elys-network/elys/x/launchpad/keeper" +) + +// Querier handles queries for the Leverage LP module. +type Querier struct { + keeper *keeper.Keeper +} + +func NewQuerier(keeper *keeper.Keeper) *Querier { + return &Querier{ + keeper: keeper, + } +} + +func (oq *Querier) HandleQuery(ctx sdk.Context, query wasmbindingstypes.ElysQuery) ([]byte, error) { + switch { + case query.LaunchpadParams != nil: + return oq.queryParams(ctx, query.LaunchpadParams) + case query.LaunchpadBonus != nil: + return oq.queryBonus(ctx, query.LaunchpadBonus) + case query.LaunchpadBuyElysEst != nil: + return oq.queryBuyElysEst(ctx, query.LaunchpadBuyElysEst) + case query.LaunchpadReturnElysEst != nil: + return oq.queryReturnElysEst(ctx, query.LaunchpadReturnElysEst) + case query.LaunchpadOrders != nil: + return oq.queryOrders(ctx, query.LaunchpadOrders) + case query.LaunchpadAllOrders != nil: + return oq.queryAllOrders(ctx, query.LaunchpadAllOrders) + default: + // This handler cannot handle the query + return nil, wasmbindingstypes.ErrCannotHandleQuery + } +} diff --git a/x/launchpad/client/wasm/query_all_orders.go b/x/launchpad/client/wasm/query_all_orders.go new file mode 100644 index 000000000..a5d9f30cf --- /dev/null +++ b/x/launchpad/client/wasm/query_all_orders.go @@ -0,0 +1,21 @@ +package wasm + +import ( + "encoding/json" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/launchpad/types" +) + +func (oq *Querier) queryAllOrders(ctx sdk.Context, query *types.QueryAllOrdersRequest) ([]byte, error) { + orders := oq.keeper.GetAllOrders(ctx) + res := types.QueryAllOrdersResponse{ + Purchases: orders, + } + responseBytes, err := json.Marshal(res) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to serialize all orders") + } + return responseBytes, nil +} diff --git a/x/launchpad/client/wasm/query_bonus.go b/x/launchpad/client/wasm/query_bonus.go new file mode 100644 index 000000000..4f6dc994e --- /dev/null +++ b/x/launchpad/client/wasm/query_bonus.go @@ -0,0 +1,21 @@ +package wasm + +import ( + "encoding/json" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/launchpad/types" +) + +func (oq *Querier) queryBonus(ctx sdk.Context, query *types.QueryBonusRequest) ([]byte, error) { + res, err := oq.keeper.Bonus(ctx, query) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to get user bonus") + } + responseBytes, err := json.Marshal(res) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to serialize user bonus") + } + return responseBytes, nil +} diff --git a/x/launchpad/client/wasm/query_buy_elys_estimation.go b/x/launchpad/client/wasm/query_buy_elys_estimation.go new file mode 100644 index 000000000..bc5b87db7 --- /dev/null +++ b/x/launchpad/client/wasm/query_buy_elys_estimation.go @@ -0,0 +1,21 @@ +package wasm + +import ( + "encoding/json" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/launchpad/types" +) + +func (oq *Querier) queryBuyElysEst(ctx sdk.Context, query *types.QueryBuyElysEstRequest) ([]byte, error) { + res, err := oq.keeper.BuyElysEst(ctx, query) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to get user bonus") + } + responseBytes, err := json.Marshal(res) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to serialize user bonus") + } + return responseBytes, nil +} diff --git a/x/launchpad/client/wasm/query_orders.go b/x/launchpad/client/wasm/query_orders.go new file mode 100644 index 000000000..ca6094ac0 --- /dev/null +++ b/x/launchpad/client/wasm/query_orders.go @@ -0,0 +1,21 @@ +package wasm + +import ( + "encoding/json" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/launchpad/types" +) + +func (oq *Querier) queryOrders(ctx sdk.Context, query *types.QueryOrdersRequest) ([]byte, error) { + res, err := oq.keeper.Orders(ctx, query) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to get user orders") + } + responseBytes, err := json.Marshal(res) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to serialize user orders") + } + return responseBytes, nil +} diff --git a/x/launchpad/client/wasm/query_params.go b/x/launchpad/client/wasm/query_params.go new file mode 100644 index 000000000..73fd00a60 --- /dev/null +++ b/x/launchpad/client/wasm/query_params.go @@ -0,0 +1,21 @@ +package wasm + +import ( + "encoding/json" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/launchpad/types" +) + +func (oq *Querier) queryParams(ctx sdk.Context, query *types.QueryParamsRequest) ([]byte, error) { + res, err := oq.keeper.Params(ctx, query) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to get launchpad params") + } + responseBytes, err := json.Marshal(res) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to serialize launchpad params") + } + return responseBytes, nil +} diff --git a/x/launchpad/client/wasm/query_return_elys_estimation.go b/x/launchpad/client/wasm/query_return_elys_estimation.go new file mode 100644 index 000000000..9a43d13b1 --- /dev/null +++ b/x/launchpad/client/wasm/query_return_elys_estimation.go @@ -0,0 +1,21 @@ +package wasm + +import ( + "encoding/json" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/launchpad/types" +) + +func (oq *Querier) queryReturnElysEst(ctx sdk.Context, query *types.QueryReturnElysEstRequest) ([]byte, error) { + res, err := oq.keeper.ReturnElysEst(ctx, query) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to get user bonus") + } + responseBytes, err := json.Marshal(res) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to serialize user bonus") + } + return responseBytes, nil +} diff --git a/x/launchpad/genesis.go b/x/launchpad/genesis.go new file mode 100644 index 000000000..f2031736c --- /dev/null +++ b/x/launchpad/genesis.go @@ -0,0 +1,24 @@ +package launchpad + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/launchpad/keeper" + "github.com/elys-network/elys/x/launchpad/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + k.SetParams(ctx, genState.Params) + for _, order := range genState.Purchases { + k.SetOrder(ctx, order) + } +} + +// ExportGenesis returns the module's exported genesis +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + genesis.Purchases = k.GetAllOrders(ctx) + + return genesis +} diff --git a/x/launchpad/genesis_test.go b/x/launchpad/genesis_test.go new file mode 100644 index 000000000..8def2c275 --- /dev/null +++ b/x/launchpad/genesis_test.go @@ -0,0 +1,29 @@ +package launchpad_test + +import ( + "testing" + + keepertest "github.com/elys-network/elys/testutil/keeper" + "github.com/elys-network/elys/testutil/nullify" + "github.com/elys-network/elys/x/launchpad" + "github.com/elys-network/elys/x/launchpad/types" + "github.com/stretchr/testify/require" +) + +func TestGenesis(t *testing.T) { + genesisState := types.GenesisState{ + Params: types.DefaultParams(), + + // this line is used by starport scaffolding # genesis/test/state + } + + k, ctx := keepertest.LaunchpadKeeper(t) + launchpad.InitGenesis(ctx, *k, genesisState) + got := launchpad.ExportGenesis(ctx, *k) + require.NotNil(t, got) + + nullify.Fill(&genesisState) + nullify.Fill(got) + + // this line is used by starport scaffolding # genesis/test/assert +} diff --git a/x/launchpad/keeper/abci.go b/x/launchpad/keeper/abci.go new file mode 100644 index 000000000..c90dec034 --- /dev/null +++ b/x/launchpad/keeper/abci.go @@ -0,0 +1,88 @@ +package keeper + +import ( + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + commitmenttypes "github.com/elys-network/elys/x/commitment/types" + epochtypes "github.com/elys-network/elys/x/epochs/types" + "github.com/elys-network/elys/x/launchpad/types" + ptypes "github.com/elys-network/elys/x/parameter/types" +) + +func (k Keeper) SetEpochInfo(ctx sdk.Context) { + _, found := k.epochKeeper.GetEpochInfo(ctx, "day") + if found { + return + } + + k.epochKeeper.SetEpochInfo(ctx, epochtypes.EpochInfo{ + Identifier: "day", + StartTime: ctx.BlockTime(), + Duration: time.Hour * 24, + CurrentEpoch: 0, + CurrentEpochStartTime: time.Time{}, + EpochCountingStarted: false, + CurrentEpochStartHeight: 0, + }) +} + +func (k Keeper) SetElysVestingInfo(ctx sdk.Context) { + params := k.GetParams(ctx) + commParams := k.commitmentKeeper.GetParams(ctx) + for _, vi := range commParams.VestingInfos { + if vi.BaseDenom == ptypes.Elys { + return + } + } + + // TODO: should consider params.BonusInfo.LockDuration + + commParams.VestingInfos = append(commParams.VestingInfos, &commitmenttypes.VestingInfo{ + BaseDenom: ptypes.Elys, + EpochIdentifier: "day", + NumEpochs: int64(params.BonusInfo.VestingDuration / 86400), + NumMaxVestings: 10000, + VestNowFactor: sdk.ZeroInt(), + VestingDenom: ptypes.Elys, + }) + k.commitmentKeeper.SetParams(ctx, commParams) +} + +func (k Keeper) BeginBlocker(ctx sdk.Context) { + // start vesting after return end time gone + params := k.GetParams(ctx) + returnEndTime := params.LaunchpadStarttime + params.LaunchpadDuration + params.ReturnDuration + if returnEndTime > uint64(ctx.BlockTime().Unix()) { + return + } + + k.SetEpochInfo(ctx) + k.SetElysVestingInfo(ctx) + + allOrders := k.GetAllOrders(ctx) + for _, order := range allOrders { + if order.VestingStarted { + continue + } + cacheCtx, write := ctx.CacheContext() + coins := sdk.Coins{sdk.NewCoin(ptypes.Elys, order.BonusAmount)} + if err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sdk.MustAccAddressFromBech32(order.OrderMaker), coins); err != nil { + ctx.Logger().Error("failed to send bonus coins to order maker", "err", err) + continue + } + + if err := k.commitmentKeeper.DepositLiquidTokensClaimed(cacheCtx, ptypes.Elys, order.BonusAmount, order.OrderMaker); err != nil { + ctx.Logger().Error("failed to deposit bonus coins to claimed", "err", err) + continue + } + + if err := k.commitmentKeeper.ProcessTokenVesting(cacheCtx, ptypes.Elys, order.BonusAmount, order.OrderMaker); err != nil { + ctx.Logger().Error("failed to process vesting for elys token", "err", err) + continue + } + write() + order.VestingStarted = true + k.SetOrder(ctx, order) + } +} diff --git a/x/launchpad/keeper/abci_test.go b/x/launchpad/keeper/abci_test.go new file mode 100644 index 000000000..f42ee0b51 --- /dev/null +++ b/x/launchpad/keeper/abci_test.go @@ -0,0 +1,117 @@ +package keeper_test + +import ( + "testing" + "time" + + "github.com/cometbft/cometbft/crypto/ed25519" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + sdk "github.com/cosmos/cosmos-sdk/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + simapp "github.com/elys-network/elys/app" + assetprofiletypes "github.com/elys-network/elys/x/assetprofile/types" + "github.com/elys-network/elys/x/launchpad/keeper" + "github.com/elys-network/elys/x/launchpad/types" + ptypes "github.com/elys-network/elys/x/parameter/types" + "github.com/stretchr/testify/require" +) + +func TestSetEpochInfo(t *testing.T) { + app := simapp.InitElysTestApp(true) + ctx := app.BaseApp.NewContext(true, tmproto.Header{}) + k := app.LaunchpadKeeper + + k.SetEpochInfo(ctx) + _, found := app.EpochsKeeper.GetEpochInfo(ctx, "day") + require.True(t, found) +} + +func TestSetElysVestingInfo(t *testing.T) { + app := simapp.InitElysTestApp(true) + ctx := app.BaseApp.NewContext(true, tmproto.Header{}) + k := app.LaunchpadKeeper + + k.SetElysVestingInfo(ctx) + params := k.GetParams(ctx) + vestingInfo, _ := app.CommitmentKeeper.GetVestingInfo(ctx, ptypes.Elys) + require.Equal(t, vestingInfo.BaseDenom, ptypes.Elys) + require.Equal(t, vestingInfo.EpochIdentifier, "day") + require.Equal(t, vestingInfo.NumEpochs, int64(params.BonusInfo.VestingDuration/86400)) + require.Equal(t, vestingInfo.NumMaxVestings, int64(10000)) + require.Equal(t, vestingInfo.VestNowFactor.String(), "0") + require.Equal(t, vestingInfo.VestingDenom, ptypes.Elys) +} + +func TestBeginBlocker(t *testing.T) { + app := simapp.InitElysTestApp(true) + ctx := app.BaseApp.NewContext(true, tmproto.Header{}) + k := app.LaunchpadKeeper + SetupStableCoinPrices(app, ctx) + + coins := sdk.Coins{sdk.NewInt64Coin(ptypes.Elys, 1000_000_000_000_000)} + err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + require.NoError(t, err) + err = app.BankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, types.ModuleName, coins) + require.NoError(t, err) + + buyer := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + admin := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + coins = sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 1100_000_000_000)} + err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + require.NoError(t, err) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, buyer, coins) + require.NoError(t, err) + + now := time.Now() + ctx = ctx.WithBlockTime(now) + params := k.GetParams(ctx) + params.LaunchpadStarttime = uint64(now.Unix()) + params.WithdrawAddress = admin.String() + k.SetParams(ctx, params) + + msgServer := keeper.NewMsgServerImpl(k) + response, err := msgServer.BuyElys(ctx, &types.MsgBuyElys{ + Sender: buyer.String(), + SpendingToken: ptypes.BaseCurrency, + TokenAmount: sdk.NewInt(1000_000), + }) + require.NoError(t, err) + require.Len(t, response.OrderIds, 1) + require.Equal(t, response.OrderIds[0], uint64(1)) + orders := k.GetAllOrders(ctx) + require.Len(t, orders, 1) + require.Equal(t, orders[0].OrderId, uint64(1)) + require.Equal(t, orders[0].OrderMaker, buyer.String()) + require.Equal(t, orders[0].SpendingToken, ptypes.BaseCurrency) + require.Equal(t, orders[0].TokenAmount.String(), "1000000") + require.Equal(t, orders[0].ElysAmount.String(), "1333333") + require.Equal(t, orders[0].ReturnedElysAmount.String(), "0") + + // set elys asset profile + app.AssetprofileKeeper.SetEntry(ctx, assetprofiletypes.Entry{ + BaseDenom: ptypes.Elys, + Denom: ptypes.Elys, + Decimals: 6, + CommitEnabled: true, + WithdrawEnabled: true, + }) + // check vesting not started when the time not pass + k.BeginBlocker(ctx) + orders = k.GetAllOrders(ctx) + require.Len(t, orders, 1) + require.Equal(t, orders[0].VestingStarted, false) + + // check all vesting started when the time pass + ctx = ctx.WithBlockTime(now.Add(time.Second * time.Duration(params.LaunchpadDuration+params.ReturnDuration+1))) + k.BeginBlocker(ctx) + orders = k.GetAllOrders(ctx) + require.Len(t, orders, 1) + require.Equal(t, orders[0].VestingStarted, true) + + commitments := app.CommitmentKeeper.GetCommitments(ctx, buyer.String()) + require.Len(t, commitments.VestingTokens, 1) + require.Equal(t, commitments.VestingTokens[0].Denom, ptypes.Elys) + require.Equal(t, commitments.VestingTokens[0].TotalAmount.String(), "1333333") + require.Equal(t, commitments.VestingTokens[0].UnvestedAmount.String(), "1333333") + require.Equal(t, commitments.VestingTokens[0].VestStartedTimestamp, int64(ctx.BlockTime().Unix())) +} diff --git a/x/launchpad/keeper/keeper.go b/x/launchpad/keeper/keeper.go new file mode 100644 index 000000000..0c84ee49b --- /dev/null +++ b/x/launchpad/keeper/keeper.go @@ -0,0 +1,57 @@ +package keeper + +import ( + "fmt" + + "github.com/cometbft/cometbft/libs/log" + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + commitmentkeeper "github.com/elys-network/elys/x/commitment/keeper" + + epochkeeper "github.com/elys-network/elys/x/epochs/keeper" + "github.com/elys-network/elys/x/launchpad/types" +) + +type ( + Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + memKey storetypes.StoreKey + authority string + + bankKeeper types.BankKeeper + oracleKeeper types.OracleKeeper + epochKeeper *epochkeeper.Keeper + commitmentKeeper *commitmentkeeper.Keeper + assetProfileKeeper types.AssetProfileKeeper + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + storeKey, + memKey storetypes.StoreKey, + authority string, + bankKeeper types.BankKeeper, + oracleKeeper types.OracleKeeper, + epochKeeper *epochkeeper.Keeper, + commitmentKeeper *commitmentkeeper.Keeper, + assetProfileKeeper types.AssetProfileKeeper, +) *Keeper { + return &Keeper{ + cdc: cdc, + storeKey: storeKey, + memKey: memKey, + authority: authority, + bankKeeper: bankKeeper, + oracleKeeper: oracleKeeper, + epochKeeper: epochKeeper, + commitmentKeeper: commitmentKeeper, + assetProfileKeeper: assetProfileKeeper, + } +} + +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/launchpad/keeper/msg_server.go b/x/launchpad/keeper/msg_server.go new file mode 100644 index 000000000..175c2fb82 --- /dev/null +++ b/x/launchpad/keeper/msg_server.go @@ -0,0 +1,296 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + atypes "github.com/elys-network/elys/x/assetprofile/types" + "github.com/elys-network/elys/x/launchpad/types" + oracletypes "github.com/elys-network/elys/x/oracle/types" + ptypes "github.com/elys-network/elys/x/parameter/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +func (k Keeper) IsEnabledToken(ctx sdk.Context, spendingToken string) bool { + params := k.GetParams(ctx) + + for _, token := range params.SpendingTokens { + if token == spendingToken { + return true + } + } + return false +} + +func (k Keeper) GenerateOrder(ctx sdk.Context, orderId uint64, orderMaker string, spendingToken string, elysAmount math.Int, bonusRate sdk.Dec, price sdk.Dec) types.Purchase { + params := k.GetParams(ctx) + order := types.Purchase{} + order.OrderId = orderId + order.OrderMaker = orderMaker + order.SpendingToken = spendingToken + order.ElysAmount = elysAmount + order.BonusAmount = bonusRate.MulInt(elysAmount).TruncateInt() + order.TokenAmount = sdk.NewDecFromInt(elysAmount).Mul(params.InitialPrice).Quo(sdk.NewDec(1000_000)).Quo(price).RoundInt() + order.ReturnedElysAmount = sdk.ZeroInt() + + return order +} + +func (k Keeper) CalcBuyElysResult(ctx sdk.Context, sender string, spendingToken string, tokenAmount math.Int) (math.Int, []types.Purchase, error) { + params := k.GetParams(ctx) + asset, found := k.assetProfileKeeper.GetEntry(ctx, spendingToken) + if !found { + return sdk.ZeroInt(), []types.Purchase{}, errorsmod.Wrapf(atypes.ErrAssetProfileNotFound, "denom: %s", spendingToken) + } + + price := k.oracleKeeper.GetAssetPriceFromDenom(ctx, asset.Denom) + if price.IsZero() { + return sdk.ZeroInt(), []types.Purchase{}, oracletypes.ErrPriceNotSet + } + + elysAmount := price.MulInt(tokenAmount).Mul(sdk.NewDec(1000_000)).Quo(params.InitialPrice).RoundInt() + + soldAmount := params.SoldAmount.Add(elysAmount) + if soldAmount.GT(params.TotalReserve) { + return sdk.ZeroInt(), []types.Purchase{}, types.ErrOverflowTotalReserve + } + + // 0-20% raise 100% bonus + // 20-30% raise 90% bonus + // 30-40% raise bonus 80% + // 40-50% raise bonus 70% + // 50-60% raise bonus 60% + // 60-70% raise bonus 50% + // 70-80% raise bonus 40% + // 80-100% raise bonus 30% + soldSoFar := params.SoldAmount + purchases := []types.Purchase{} + lastOrderId := k.LastOrderId(ctx) + for index, raisePercent := range params.BonusInfo.RaisePercents { + roundMaxRaise := sdk.NewDecWithPrec(int64(raisePercent), 2).Mul(sdk.NewDecFromInt(params.TotalReserve)).RoundInt() + if soldSoFar.LT(roundMaxRaise) { + bonusPercent := params.BonusInfo.BonusPercents[index] + bonusRate := sdk.NewDecWithPrec(int64(bonusPercent), 2) + if roundMaxRaise.GTE(soldAmount) { + roundSellAmount := soldAmount.Sub(soldSoFar) + order := k.GenerateOrder(ctx, lastOrderId+1, sender, spendingToken, roundSellAmount, bonusRate, price) + purchases = append(purchases, order) + lastOrderId++ + break + } else { + roundSellAmount := roundMaxRaise.Sub(soldSoFar) + order := k.GenerateOrder(ctx, lastOrderId+1, sender, spendingToken, roundSellAmount, bonusRate, price) + purchases = append(purchases, order) + soldSoFar = roundMaxRaise + lastOrderId++ + } + } + } + return elysAmount, purchases, nil +} + +func (k msgServer) BuyElys(goCtx context.Context, msg *types.MsgBuyElys) (*types.MsgBuyElysResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + params := k.GetParams(ctx) + if params.LaunchpadStarttime > uint64(ctx.BlockTime().Unix()) { + return nil, types.ErrLaunchpadNotStarted + } + + if params.LaunchpadStarttime+params.LaunchpadDuration < uint64(ctx.BlockTime().Unix()) { + return nil, types.ErrLaunchpadAlreadyFinished + } + + if !k.IsEnabledToken(ctx, msg.SpendingToken) { + return nil, types.ErrNotEnabledSpendingToken + } + + asset, found := k.assetProfileKeeper.GetEntry(ctx, msg.SpendingToken) + if !found { + return nil, errorsmod.Wrapf(atypes.ErrAssetProfileNotFound, "denom: %s", msg.SpendingToken) + } + + addr := sdk.MustAccAddressFromBech32(msg.Sender) + spendingCoins := sdk.Coins{sdk.NewCoin(asset.Denom, msg.TokenAmount)} + err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, spendingCoins) + if err != nil { + return nil, err + } + + elysAmount, orders, err := k.CalcBuyElysResult(ctx, msg.Sender, msg.SpendingToken, msg.TokenAmount) + if err != nil { + return nil, err + } + + // TODO: consider existing order on same bonus period - all should be combined into one + for _, order := range orders { + k.SetOrder(ctx, order) + } + + params.SoldAmount = params.SoldAmount.Add(elysAmount) + k.SetParams(ctx, params) + + elysCoins := sdk.Coins{sdk.NewCoin(ptypes.Elys, elysAmount)} + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, addr, elysCoins) + if err != nil { + return nil, err + } + + orderIds := []uint64{} + for _, order := range orders { + orderIds = append(orderIds, order.OrderId) + } + + return &types.MsgBuyElysResponse{ + OrderIds: orderIds, + }, nil +} + +func (k Keeper) CalcReturnElysResult(ctx sdk.Context, orderId uint64, returnElysAmount math.Int) (math.Int, error) { + params := k.GetParams(ctx) + order := k.GetOrder(ctx, orderId) + if order.OrderId == 0 { + return sdk.ZeroInt(), types.ErrPurchaseOrderNotFound + } + + maxReturnAmount := sdk.NewDecWithPrec(int64(params.MaxReturnPercent), 2).MulInt(order.ElysAmount).RoundInt() + if order.ReturnedElysAmount.Add(returnElysAmount).GT(maxReturnAmount) { + return sdk.ZeroInt(), types.ErrExceedMaxReturnAmount + } + + returnTokenAmount := returnElysAmount.Mul(order.TokenAmount).Quo(order.ElysAmount) + return returnTokenAmount, nil +} + +func (k msgServer) ReturnElys(goCtx context.Context, msg *types.MsgReturnElys) (*types.MsgReturnElysResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + params := k.GetParams(ctx) + launchpadEndTime := params.LaunchpadStarttime + params.LaunchpadDuration + if launchpadEndTime > uint64(ctx.BlockTime().Unix()) { + return nil, types.ErrLaunchpadNotFinished + } + + if params.LaunchpadStarttime+params.ReturnDuration < uint64(ctx.BlockTime().Unix()) { + return nil, types.ErrLaunchpadReturnPeriodFinished + } + + order := k.GetOrder(ctx, msg.OrderId) + if order.OrderId == 0 { + return nil, types.ErrPurchaseOrderNotFound + } + + if order.OrderMaker != msg.Sender { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "expected %s, got %s", order.OrderMaker, msg.Sender) + } + + order.ReturnedElysAmount = order.ReturnedElysAmount.Add(msg.ReturnElysAmount) + k.SetOrder(ctx, order) + + coins := sdk.Coins{sdk.NewCoin(ptypes.Elys, msg.ReturnElysAmount)} + addr := sdk.MustAccAddressFromBech32(msg.Sender) + err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, coins) + if err != nil { + return nil, err + } + + returnTokenAmount, err := k.CalcReturnElysResult(ctx, msg.OrderId, msg.ReturnElysAmount) + if err != nil { + return nil, err + } + + asset, found := k.assetProfileKeeper.GetEntry(ctx, order.SpendingToken) + if !found { + return nil, errorsmod.Wrapf(atypes.ErrAssetProfileNotFound, "denom: %s", order.SpendingToken) + } + + coins = sdk.Coins{sdk.NewCoin(asset.Denom, returnTokenAmount)} + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, addr, coins) + if err != nil { + return nil, err + } + // TODO: might need to check BonusAmount cut + return &types.MsgReturnElysResponse{}, nil +} + +func (k msgServer) DepositElysToken(goCtx context.Context, msg *types.MsgDepositElysToken) (*types.MsgDepositElysTokenResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + sender := sdk.MustAccAddressFromBech32(msg.Sender) + err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, sdk.Coins{msg.Coin}) + if err != nil { + return nil, err + } + + return &types.MsgDepositElysTokenResponse{}, nil +} + +func (k msgServer) WithdrawRaised(goCtx context.Context, msg *types.MsgWithdrawRaised) (*types.MsgWithdrawRaisedResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + params := k.GetParams(ctx) + if params.WithdrawAddress != msg.Sender { + return nil, errorsmod.Wrapf(types.ErrInvalidWithrawAccount, "expected %s, got %s", params.WithdrawAddress, msg.Sender) + } + + // Once return period is over, can withdraw all + returnEndTime := params.LaunchpadStarttime + params.LaunchpadDuration + params.ReturnDuration + if returnEndTime > uint64(ctx.BlockTime().Unix()) { + totalWithdrawAmount := sdk.Coins(params.WithdrawnAmount).Add(msg.Coins...) + maxWithdrawAmount := sdk.Coins{} + orders := k.GetAllOrders(ctx) + for _, order := range orders { + orderWithdrawable := sdk.NewDecWithPrec(int64(100-params.MaxReturnPercent), 2).MulInt(order.TokenAmount).RoundInt() + + asset, found := k.assetProfileKeeper.GetEntry(ctx, order.SpendingToken) + if !found { + return nil, errorsmod.Wrapf(atypes.ErrAssetProfileNotFound, "denom: %s", order.SpendingToken) + } + coin := sdk.NewCoin(asset.Denom, orderWithdrawable) + maxWithdrawAmount = maxWithdrawAmount.Add(coin) + } + + if totalWithdrawAmount.IsAnyGT(maxWithdrawAmount) { + return nil, types.ErrExceedMaxWithdrawableAmount + } + } + + coins := sdk.Coins(msg.Coins) + addr := sdk.MustAccAddressFromBech32(msg.Sender) + err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, addr, coins) + if err != nil { + return nil, err + } + + params.WithdrawnAmount = sdk.Coins(params.WithdrawnAmount).Add(msg.Coins...) + k.SetParams(ctx, params) + + return &types.MsgWithdrawRaisedResponse{}, nil +} + +// Update params through gov proposal +func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if k.authority != msg.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + } + + // store params + k.SetParams(ctx, msg.Params) + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/launchpad/keeper/msg_server_test.go b/x/launchpad/keeper/msg_server_test.go new file mode 100644 index 000000000..a482aeb65 --- /dev/null +++ b/x/launchpad/keeper/msg_server_test.go @@ -0,0 +1,323 @@ +package keeper_test + +import ( + "context" + "testing" + "time" + + "github.com/cometbft/cometbft/crypto/ed25519" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + sdk "github.com/cosmos/cosmos-sdk/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + simapp "github.com/elys-network/elys/app" + keepertest "github.com/elys-network/elys/testutil/keeper" + "github.com/elys-network/elys/x/launchpad/keeper" + "github.com/elys-network/elys/x/launchpad/types" + ptypes "github.com/elys-network/elys/x/parameter/types" + "github.com/stretchr/testify/require" +) + +func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { + k, ctx := keepertest.LaunchpadKeeper(t) + return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) +} + +func TestMsgServer(t *testing.T) { + ms, ctx := setupMsgServer(t) + require.NotNil(t, ms) + require.NotNil(t, ctx) +} + +func TestMsgServerBuyElys(t *testing.T) { + app := simapp.InitElysTestApp(true) + ctx := app.BaseApp.NewContext(true, tmproto.Header{}) + k := app.LaunchpadKeeper + SetupStableCoinPrices(app, ctx) + + coins := sdk.Coins{sdk.NewInt64Coin(ptypes.Elys, 1000_000_000_000_000)} + err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + require.NoError(t, err) + err = app.BankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, types.ModuleName, coins) + require.NoError(t, err) + + buyer := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + coins = sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 1100_000_000_000)} + err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + require.NoError(t, err) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, buyer, coins) + require.NoError(t, err) + + now := time.Now() + ctx = ctx.WithBlockTime(now) + params := k.GetParams(ctx) + params.LaunchpadStarttime = uint64(now.Unix()) + k.SetParams(ctx, params) + + msgServer := keeper.NewMsgServerImpl(k) + cacheCtx, _ := ctx.CacheContext() + response, err := msgServer.BuyElys(cacheCtx, &types.MsgBuyElys{ + Sender: buyer.String(), + SpendingToken: ptypes.BaseCurrency, + TokenAmount: sdk.NewInt(1000_000), + }) + require.NoError(t, err) + require.Len(t, response.OrderIds, 1) + require.Equal(t, response.OrderIds[0], uint64(1)) + orders := k.GetAllOrders(cacheCtx) + require.Len(t, orders, 1) + require.Equal(t, orders[0].OrderId, uint64(1)) + require.Equal(t, orders[0].OrderMaker, buyer.String()) + require.Equal(t, orders[0].SpendingToken, ptypes.BaseCurrency) + require.Equal(t, orders[0].TokenAmount.String(), "1000000") + require.Equal(t, orders[0].ElysAmount.String(), "1333333") + require.Equal(t, orders[0].ReturnedElysAmount.String(), "0") + require.Equal(t, orders[0].BonusAmount.String(), "1333333") + require.Equal(t, orders[0].VestingStarted, false) + + cacheCtx, _ = ctx.CacheContext() + response, err = msgServer.BuyElys(cacheCtx, &types.MsgBuyElys{ + Sender: buyer.String(), + SpendingToken: ptypes.BaseCurrency, + TokenAmount: sdk.NewInt(1000_000_000_000), + }) + require.NoError(t, err) + require.Len(t, response.OrderIds, 2) + require.Equal(t, response.OrderIds[0], uint64(1)) + require.Equal(t, response.OrderIds[1], uint64(2)) + orders = k.GetAllOrders(cacheCtx) + require.Len(t, orders, 2) + require.Equal(t, orders[0].OrderId, uint64(1)) + require.Equal(t, orders[0].OrderMaker, buyer.String()) + require.Equal(t, orders[0].SpendingToken, ptypes.BaseCurrency) + require.Equal(t, orders[0].TokenAmount.String(), "675000000000") + require.Equal(t, orders[0].ElysAmount.String(), "900000000000") + require.Equal(t, orders[0].ReturnedElysAmount.String(), "0") + require.Equal(t, orders[0].BonusAmount.String(), "900000000000") + require.Equal(t, orders[0].VestingStarted, false) + require.Equal(t, orders[1].OrderId, uint64(2)) + require.Equal(t, orders[1].OrderMaker, buyer.String()) + require.Equal(t, orders[1].SpendingToken, ptypes.BaseCurrency) + require.Equal(t, orders[1].TokenAmount.String(), "325000000000") + require.Equal(t, orders[1].ElysAmount.String(), "433333333333") + require.Equal(t, orders[1].ReturnedElysAmount.String(), "0") + require.Equal(t, orders[1].BonusAmount.String(), "389999999999") + require.Equal(t, orders[1].VestingStarted, false) +} + +func TestMsgServerReturnElys(t *testing.T) { + app := simapp.InitElysTestApp(true) + ctx := app.BaseApp.NewContext(true, tmproto.Header{}) + k := app.LaunchpadKeeper + SetupStableCoinPrices(app, ctx) + + coins := sdk.Coins{sdk.NewInt64Coin(ptypes.Elys, 1000_000_000_000_000)} + err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + require.NoError(t, err) + err = app.BankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, types.ModuleName, coins) + require.NoError(t, err) + + buyer := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + coins = sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 1100_000_000_000)} + err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + require.NoError(t, err) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, buyer, coins) + require.NoError(t, err) + + now := time.Now() + ctx = ctx.WithBlockTime(now) + params := k.GetParams(ctx) + params.LaunchpadStarttime = uint64(now.Unix()) + k.SetParams(ctx, params) + + msgServer := keeper.NewMsgServerImpl(k) + response, err := msgServer.BuyElys(ctx, &types.MsgBuyElys{ + Sender: buyer.String(), + SpendingToken: ptypes.BaseCurrency, + TokenAmount: sdk.NewInt(1000_000), + }) + require.NoError(t, err) + require.Len(t, response.OrderIds, 1) + require.Equal(t, response.OrderIds[0], uint64(1)) + orders := k.GetAllOrders(ctx) + require.Len(t, orders, 1) + require.Equal(t, orders[0].OrderId, uint64(1)) + require.Equal(t, orders[0].OrderMaker, buyer.String()) + require.Equal(t, orders[0].SpendingToken, ptypes.BaseCurrency) + require.Equal(t, orders[0].TokenAmount.String(), "1000000") + require.Equal(t, orders[0].ElysAmount.String(), "1333333") + require.Equal(t, orders[0].ReturnedElysAmount.String(), "0") + + buyerOldBalance := app.BankKeeper.GetAllBalances(ctx, buyer) + + // Try returning 25% + msgServer = keeper.NewMsgServerImpl(k) + cacheCtx, _ := ctx.CacheContext() + cacheCtx = cacheCtx.WithBlockTime(now.Add(time.Second * time.Duration(params.LaunchpadDuration+1))) + _, err = msgServer.ReturnElys(cacheCtx, &types.MsgReturnElys{ + Sender: buyer.String(), + OrderId: 1, + ReturnElysAmount: sdk.NewInt(333333), + }) + require.NoError(t, err) + + buyerNewBalance := app.BankKeeper.GetAllBalances(cacheCtx, buyer) + require.Equal(t, buyerOldBalance.AmountOf(ptypes.Elys).String(), buyerNewBalance.AmountOf(ptypes.Elys).Add(sdk.NewInt(333333)).String()) + require.Equal(t, buyerNewBalance.AmountOf(ptypes.BaseCurrency).String(), buyerOldBalance.AmountOf(ptypes.BaseCurrency).Add(sdk.NewInt(249999)).String()) + + // check orders change + orders = k.GetAllOrders(cacheCtx) + require.Len(t, orders, 1) + require.Equal(t, orders[0].OrderId, uint64(1)) + require.Equal(t, orders[0].OrderMaker, buyer.String()) + require.Equal(t, orders[0].SpendingToken, ptypes.BaseCurrency) + require.Equal(t, orders[0].TokenAmount.String(), "1000000") + require.Equal(t, orders[0].ElysAmount.String(), "1333333") + require.Equal(t, orders[0].ReturnedElysAmount.String(), "333333") + + // Try returning more than half including previous one + _, err = msgServer.ReturnElys(cacheCtx, &types.MsgReturnElys{ + Sender: buyer.String(), + OrderId: 1, + ReturnElysAmount: sdk.NewInt(433333), + }) + require.Error(t, err) +} + +func TestIsEnabledToken(t *testing.T) { + app := simapp.InitElysTestApp(true) + ctx := app.BaseApp.NewContext(true, tmproto.Header{}) + k := app.LaunchpadKeeper + + params := k.GetParams(ctx) + require.Len(t, params.SpendingTokens, 3) + require.Equal(t, params.SpendingTokens[0], ptypes.BaseCurrency) + + isEnabled := k.IsEnabledToken(ctx, ptypes.BaseCurrency) + require.Equal(t, isEnabled, true) + + isEnabled = k.IsEnabledToken(ctx, ptypes.Elys) + require.Equal(t, isEnabled, false) + + isEnabled = k.IsEnabledToken(ctx, "uatom") + require.Equal(t, isEnabled, true) +} + +func TestMsgServerDepositElysToken(t *testing.T) { + app := simapp.InitElysTestApp(true) + ctx := app.BaseApp.NewContext(true, tmproto.Header{}) + k := app.LaunchpadKeeper + SetupStableCoinPrices(app, ctx) + + admin := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + coins := sdk.Coins{sdk.NewInt64Coin(ptypes.Elys, 1000_000_000_000_000)} + err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + require.NoError(t, err) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, admin, coins) + require.NoError(t, err) + + msgServer := keeper.NewMsgServerImpl(k) + cacheCtx, _ := ctx.CacheContext() + _, err = msgServer.DepositElysToken(cacheCtx, &types.MsgDepositElysToken{ + Sender: admin.String(), + Coin: sdk.NewInt64Coin(ptypes.Elys, 1000_000), + }) + require.NoError(t, err) + + resp, err := k.ModuleBalances(cacheCtx, &types.QueryModuleBalancesRequest{}) + require.NoError(t, err) + require.Equal(t, sdk.Coins(resp.Coins).String(), sdk.NewInt64Coin(ptypes.Elys, 1000_000).String()) +} + +func TestMsgServerWithdrawRaised(t *testing.T) { + app := simapp.InitElysTestApp(true) + ctx := app.BaseApp.NewContext(true, tmproto.Header{}) + k := app.LaunchpadKeeper + SetupStableCoinPrices(app, ctx) + + coins := sdk.Coins{sdk.NewInt64Coin(ptypes.Elys, 1000_000_000_000_000)} + err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + require.NoError(t, err) + err = app.BankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, types.ModuleName, coins) + require.NoError(t, err) + + buyer := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + admin := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + coins = sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 1100_000_000_000)} + err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + require.NoError(t, err) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, buyer, coins) + require.NoError(t, err) + + now := time.Now() + ctx = ctx.WithBlockTime(now) + params := k.GetParams(ctx) + params.LaunchpadStarttime = uint64(now.Unix()) + params.WithdrawAddress = admin.String() + k.SetParams(ctx, params) + + msgServer := keeper.NewMsgServerImpl(k) + response, err := msgServer.BuyElys(ctx, &types.MsgBuyElys{ + Sender: buyer.String(), + SpendingToken: ptypes.BaseCurrency, + TokenAmount: sdk.NewInt(1000_000), + }) + require.NoError(t, err) + require.Len(t, response.OrderIds, 1) + require.Equal(t, response.OrderIds[0], uint64(1)) + orders := k.GetAllOrders(ctx) + require.Len(t, orders, 1) + require.Equal(t, orders[0].OrderId, uint64(1)) + require.Equal(t, orders[0].OrderMaker, buyer.String()) + require.Equal(t, orders[0].SpendingToken, ptypes.BaseCurrency) + require.Equal(t, orders[0].TokenAmount.String(), "1000000") + require.Equal(t, orders[0].ElysAmount.String(), "1333333") + require.Equal(t, orders[0].ReturnedElysAmount.String(), "0") + + adminOldBalance := app.BankKeeper.GetAllBalances(ctx, admin) + + // Try withdrawing 10% with invalid account + msgServer = keeper.NewMsgServerImpl(k) + cacheCtx, _ := ctx.CacheContext() + cacheCtx = cacheCtx.WithBlockTime(now.Add(time.Second * time.Duration(params.LaunchpadDuration+1))) + _, err = msgServer.WithdrawRaised(cacheCtx, &types.MsgWithdrawRaised{ + Sender: buyer.String(), + Coins: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 100_000)}, + }) + require.Error(t, err) + + // Try withdrawing 10% with admin account + msgServer = keeper.NewMsgServerImpl(k) + cacheCtx, _ = ctx.CacheContext() + cacheCtx = cacheCtx.WithBlockTime(now.Add(time.Second * time.Duration(params.LaunchpadDuration+1))) + _, err = msgServer.WithdrawRaised(cacheCtx, &types.MsgWithdrawRaised{ + Sender: admin.String(), + Coins: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 100_000)}, + }) + require.NoError(t, err) + + adminNewBalance := app.BankKeeper.GetAllBalances(cacheCtx, admin) + require.Equal(t, adminNewBalance.AmountOf(ptypes.BaseCurrency).String(), adminOldBalance.AmountOf(ptypes.BaseCurrency).Add(sdk.NewInt(100_000)).String()) + + // check params withdrawn amount change + params = k.GetParams(cacheCtx) + require.Len(t, orders, 1) + require.Equal(t, sdk.Coins(params.WithdrawnAmount).String(), sdk.NewInt64Coin(ptypes.BaseCurrency, 100_000).String()) + + // Try withdrawing more than half including previous one + _, err = msgServer.WithdrawRaised(cacheCtx, &types.MsgWithdrawRaised{ + Sender: admin.String(), + Coins: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 500_000)}, + }) + require.Error(t, err) + + // Withdraw full after return period is over + cacheCtx = cacheCtx.WithBlockTime(now.Add(time.Second * time.Duration(params.LaunchpadDuration+params.ReturnDuration+1))) + _, err = msgServer.WithdrawRaised(cacheCtx, &types.MsgWithdrawRaised{ + Sender: admin.String(), + Coins: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 500_000)}, + }) + require.NoError(t, err) + + adminNewBalance = app.BankKeeper.GetAllBalances(cacheCtx, admin) + require.Equal(t, adminNewBalance.AmountOf(ptypes.BaseCurrency).String(), adminOldBalance.AmountOf(ptypes.BaseCurrency).Add(sdk.NewInt(600_000)).String()) +} diff --git a/x/launchpad/keeper/order.go b/x/launchpad/keeper/order.go new file mode 100644 index 000000000..26e79087a --- /dev/null +++ b/x/launchpad/keeper/order.go @@ -0,0 +1,69 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/launchpad/types" +) + +func (k Keeper) GetOrder(ctx sdk.Context, orderId uint64) types.Purchase { + order := types.Purchase{} + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.PurchasePrefixKey) + bz := store.Get(sdk.Uint64ToBigEndian(orderId)) + if len(bz) == 0 { + return types.Purchase{ + OrderId: 0, + OrderMaker: "", + SpendingToken: "", + TokenAmount: sdk.ZeroInt(), + ElysAmount: sdk.ZeroInt(), + ReturnedElysAmount: sdk.ZeroInt(), + BonusAmount: sdk.ZeroInt(), + } + } + + k.cdc.MustUnmarshal(bz, &order) + return order +} + +func (k Keeper) SetOrder(ctx sdk.Context, order types.Purchase) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.PurchasePrefixKey) + bz := k.cdc.MustMarshal(&order) + store.Set(sdk.Uint64ToBigEndian(order.OrderId), bz) +} + +func (k Keeper) DeleteOrder(ctx sdk.Context, order types.Purchase) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.PurchasePrefixKey) + store.Delete(sdk.Uint64ToBigEndian(order.OrderId)) +} + +func (k Keeper) GetAllOrders(ctx sdk.Context) []types.Purchase { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.PurchasePrefixKey) + + iterator := sdk.KVStorePrefixIterator(store, nil) + defer iterator.Close() + + orders := []types.Purchase{} + for ; iterator.Valid(); iterator.Next() { + order := types.Purchase{} + k.cdc.MustUnmarshal(iterator.Value(), &order) + + orders = append(orders, order) + } + return orders +} + +func (k Keeper) LastOrderId(ctx sdk.Context) uint64 { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.PurchasePrefixKey) + + iterator := sdk.KVStoreReversePrefixIterator(store, nil) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + order := types.Purchase{} + k.cdc.MustUnmarshal(iterator.Value(), &order) + + return order.OrderId + } + return 0 +} diff --git a/x/launchpad/keeper/order_test.go b/x/launchpad/keeper/order_test.go new file mode 100644 index 000000000..2c9a654df --- /dev/null +++ b/x/launchpad/keeper/order_test.go @@ -0,0 +1,83 @@ +package keeper_test + +import ( + "testing" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + sdk "github.com/cosmos/cosmos-sdk/types" + simapp "github.com/elys-network/elys/app" + "github.com/elys-network/elys/x/launchpad/types" + "github.com/stretchr/testify/require" +) + +func TestOrder(t *testing.T) { + app := simapp.InitElysTestApp(true) + ctx := app.BaseApp.NewContext(true, tmproto.Header{}) + k := app.LaunchpadKeeper + + // check query when empty + orderQuery := k.GetOrder(ctx, 1) + require.Equal(t, orderQuery.OrderId, uint64(0)) + + ordersQuery := k.GetAllOrders(ctx) + require.Len(t, ordersQuery, 0) + + lastOrderId := k.LastOrderId(ctx) + require.Equal(t, lastOrderId, uint64(0)) + + orders := []types.Purchase{ + { + OrderId: 1, + OrderMaker: "maker", + SpendingToken: "uusdc", + TokenAmount: sdk.NewInt(1000_000), + ElysAmount: sdk.NewInt(1000_000), + ReturnedElysAmount: sdk.NewInt(500_000), + BonusAmount: sdk.NewInt(500_000), + VestingStarted: false, + }, + { + OrderId: 2, + OrderMaker: "maker", + SpendingToken: "uusdc", + TokenAmount: sdk.NewInt(1000_000), + ElysAmount: sdk.NewInt(1000_000), + ReturnedElysAmount: sdk.NewInt(500_000), + BonusAmount: sdk.NewInt(500_000), + VestingStarted: false, + }, + { + OrderId: 3, + OrderMaker: "maker2", + SpendingToken: "uusdc", + TokenAmount: sdk.NewInt(1000_000), + ElysAmount: sdk.NewInt(1000_000), + ReturnedElysAmount: sdk.NewInt(500_000), + BonusAmount: sdk.NewInt(500_000), + VestingStarted: false, + }, + } + + for _, order := range orders { + k.SetOrder(ctx, order) + } + + // check queries after values are set + for _, order := range orders { + orderQuery := k.GetOrder(ctx, order.OrderId) + require.Equal(t, orderQuery, order) + } + + ordersQuery = k.GetAllOrders(ctx) + require.Len(t, ordersQuery, 3) + + // delete order + k.DeleteOrder(ctx, orders[0]) + + // check queries after deleting an order + ordersQuery = k.GetAllOrders(ctx) + require.Len(t, ordersQuery, 2) + + lastOrderId = k.LastOrderId(ctx) + require.Equal(t, lastOrderId, uint64(3)) +} diff --git a/x/launchpad/keeper/params.go b/x/launchpad/keeper/params.go new file mode 100644 index 000000000..fc022d04e --- /dev/null +++ b/x/launchpad/keeper/params.go @@ -0,0 +1,26 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/launchpad/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + store := ctx.KVStore(k.storeKey) + + b := store.Get([]byte(types.ParamsKey)) + if b == nil { + return + } + + k.cdc.MustUnmarshal(b, ¶ms) + return +} + +// SetParams set the params +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + store := ctx.KVStore(k.storeKey) + b := k.cdc.MustMarshal(¶ms) + store.Set([]byte(types.ParamsKey), b) +} diff --git a/x/launchpad/keeper/params_test.go b/x/launchpad/keeper/params_test.go new file mode 100644 index 000000000..10ed4a0f7 --- /dev/null +++ b/x/launchpad/keeper/params_test.go @@ -0,0 +1,18 @@ +package keeper_test + +import ( + "testing" + + testkeeper "github.com/elys-network/elys/testutil/keeper" + "github.com/elys-network/elys/x/launchpad/types" + "github.com/stretchr/testify/require" +) + +func TestGetParams(t *testing.T) { + k, ctx := testkeeper.LaunchpadKeeper(t) + params := types.DefaultParams() + + k.SetParams(ctx, params) + + require.EqualValues(t, params, k.GetParams(ctx)) +} diff --git a/x/launchpad/keeper/query.go b/x/launchpad/keeper/query.go new file mode 100644 index 000000000..995638d56 --- /dev/null +++ b/x/launchpad/keeper/query.go @@ -0,0 +1,118 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/elys-network/elys/x/launchpad/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +var _ types.QueryServer = Keeper{} + +func (k Keeper) Bonus(goCtx context.Context, req *types.QueryBonusRequest) (*types.QueryBonusResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + allOrders := k.GetAllOrders(ctx) + orders := []types.Purchase{} + // TODO: optimize query speed + for _, order := range allOrders { + if order.OrderMaker == req.User { + orders = append(orders, order) + } + } + bonusAmount := sdk.ZeroInt() + for _, order := range orders { + bonusAmount = bonusAmount.Add(order.BonusAmount) + } + + return &types.QueryBonusResponse{ + TotalBonus: bonusAmount, + }, nil +} + +func (k Keeper) BuyElysEst(goCtx context.Context, req *types.QueryBuyElysEstRequest) (*types.QueryBuyElysEstResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + elysAmount, orders, err := k.CalcBuyElysResult(ctx, "", req.SpendingToken, req.TokenAmount) + if err != nil { + return nil, err + } + bonusAmount := sdk.ZeroInt() + for _, order := range orders { + bonusAmount = bonusAmount.Add(order.BonusAmount) + } + + return &types.QueryBuyElysEstResponse{ + ElysAmount: elysAmount, + BonusAmount: bonusAmount, + Orders: orders, + }, nil +} + +func (k Keeper) ReturnElysEst(goCtx context.Context, req *types.QueryReturnElysEstRequest) (*types.QueryReturnElysEstResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + returnTokenAmount, err := k.CalcReturnElysResult(ctx, req.OrderId, req.ElysAmount) + if err != nil { + return nil, err + } + + return &types.QueryReturnElysEstResponse{ + Amount: returnTokenAmount, + }, nil +} + +func (k Keeper) Orders(goCtx context.Context, req *types.QueryOrdersRequest) (*types.QueryOrdersResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + // TODO: optimize query speed + allOrders := k.GetAllOrders(ctx) + orders := []types.Purchase{} + for _, order := range allOrders { + if order.OrderMaker == req.User { + orders = append(orders, order) + } + } + + return &types.QueryOrdersResponse{ + Purchases: orders, + }, nil +} + +func (k Keeper) AllOrders(goCtx context.Context, req *types.QueryAllOrdersRequest) (*types.QueryAllOrdersResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + allOrders := k.GetAllOrders(ctx) + return &types.QueryAllOrdersResponse{ + Purchases: allOrders, + }, nil +} + +func (k Keeper) ModuleBalances(goCtx context.Context, req *types.QueryModuleBalancesRequest) (*types.QueryModuleBalancesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + moduleAcc := authtypes.NewModuleAddress(types.ModuleName) + balances := k.bankKeeper.GetAllBalances(ctx, moduleAcc) + return &types.QueryModuleBalancesResponse{ + Coins: balances, + }, nil +} diff --git a/x/launchpad/keeper/query_params.go b/x/launchpad/keeper/query_params.go new file mode 100644 index 000000000..311cf6f7e --- /dev/null +++ b/x/launchpad/keeper/query_params.go @@ -0,0 +1,19 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/launchpad/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} diff --git a/x/launchpad/keeper/query_params_test.go b/x/launchpad/keeper/query_params_test.go new file mode 100644 index 000000000..ecb86d54f --- /dev/null +++ b/x/launchpad/keeper/query_params_test.go @@ -0,0 +1,21 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + testkeeper "github.com/elys-network/elys/testutil/keeper" + "github.com/elys-network/elys/x/launchpad/types" + "github.com/stretchr/testify/require" +) + +func TestParamsQuery(t *testing.T) { + keeper, ctx := testkeeper.LaunchpadKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + params := types.DefaultParams() + keeper.SetParams(ctx, params) + + response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsResponse{Params: params}, response) +} diff --git a/x/launchpad/keeper/query_test.go b/x/launchpad/keeper/query_test.go new file mode 100644 index 000000000..b301afb22 --- /dev/null +++ b/x/launchpad/keeper/query_test.go @@ -0,0 +1,258 @@ +package keeper_test + +import ( + "testing" + "time" + + "github.com/cometbft/cometbft/crypto/ed25519" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + sdk "github.com/cosmos/cosmos-sdk/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + simapp "github.com/elys-network/elys/app" + "github.com/elys-network/elys/x/launchpad/keeper" + "github.com/elys-network/elys/x/launchpad/types" + oracletypes "github.com/elys-network/elys/x/oracle/types" + ptypes "github.com/elys-network/elys/x/parameter/types" + "github.com/stretchr/testify/require" +) + +func SetupStableCoinPrices(app *simapp.ElysApp, ctx sdk.Context) { + // prices set for USDT and USDC + provider := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + app.OracleKeeper.SetAssetInfo(ctx, oracletypes.AssetInfo{ + Denom: ptypes.BaseCurrency, + Display: "USDC", + Decimal: 6, + }) + app.OracleKeeper.SetPrice(ctx, oracletypes.Price{ + Asset: "USDC", + Price: sdk.NewDec(1), + Source: "elys", + Provider: provider.String(), + Timestamp: uint64(ctx.BlockTime().Unix()), + }) +} + +func TestBonus(t *testing.T) { + app := simapp.InitElysTestApp(true) + ctx := app.BaseApp.NewContext(true, tmproto.Header{}) + k := app.LaunchpadKeeper + + orders := []types.Purchase{ + { + OrderId: 1, + OrderMaker: "maker", + SpendingToken: "uusdc", + TokenAmount: sdk.NewInt(1000_000), + ElysAmount: sdk.NewInt(1000_000), + ReturnedElysAmount: sdk.NewInt(500_000), + BonusAmount: sdk.NewInt(500_000), + VestingStarted: false, + }, + { + OrderId: 2, + OrderMaker: "maker", + SpendingToken: "uusdc", + TokenAmount: sdk.NewInt(1000_000), + ElysAmount: sdk.NewInt(1000_000), + ReturnedElysAmount: sdk.NewInt(500_000), + BonusAmount: sdk.NewInt(500_000), + VestingStarted: false, + }, + { + OrderId: 3, + OrderMaker: "maker2", + SpendingToken: "uusdc", + TokenAmount: sdk.NewInt(1000_000), + ElysAmount: sdk.NewInt(1000_000), + ReturnedElysAmount: sdk.NewInt(500_000), + BonusAmount: sdk.NewInt(500_000), + VestingStarted: false, + }, + } + + for _, order := range orders { + k.SetOrder(ctx, order) + } + + response, err := k.Bonus(ctx, &types.QueryBonusRequest{User: "maker"}) + require.NoError(t, err) + require.Equal(t, response.TotalBonus.String(), sdk.NewInt(1000_000).String()) +} + +func TestQueryOrders(t *testing.T) { + app := simapp.InitElysTestApp(true) + ctx := app.BaseApp.NewContext(true, tmproto.Header{}) + k := app.LaunchpadKeeper + + orders := []types.Purchase{ + { + OrderId: 1, + OrderMaker: "maker", + SpendingToken: "uusdc", + TokenAmount: sdk.NewInt(1000_000), + ElysAmount: sdk.NewInt(1000_000), + ReturnedElysAmount: sdk.NewInt(500_000), + BonusAmount: sdk.NewInt(500_000), + VestingStarted: false, + }, + { + OrderId: 2, + OrderMaker: "maker", + SpendingToken: "uusdc", + TokenAmount: sdk.NewInt(1000_000), + ElysAmount: sdk.NewInt(1000_000), + ReturnedElysAmount: sdk.NewInt(500_000), + BonusAmount: sdk.NewInt(500_000), + VestingStarted: false, + }, + { + OrderId: 3, + OrderMaker: "maker2", + SpendingToken: "uusdc", + TokenAmount: sdk.NewInt(1000_000), + ElysAmount: sdk.NewInt(1000_000), + ReturnedElysAmount: sdk.NewInt(500_000), + BonusAmount: sdk.NewInt(500_000), + VestingStarted: false, + }, + } + + for _, order := range orders { + k.SetOrder(ctx, order) + } + + response, err := k.Orders(ctx, &types.QueryOrdersRequest{User: "maker"}) + require.NoError(t, err) + require.Len(t, response.Purchases, 2) +} + +func TestQueryModuleBalances(t *testing.T) { + app := simapp.InitElysTestApp(true) + ctx := app.BaseApp.NewContext(true, tmproto.Header{}) + k := app.LaunchpadKeeper + + coins := sdk.Coins{sdk.NewInt64Coin(ptypes.Elys, 1000_000)} + + err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + require.NoError(t, err) + err = app.BankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, types.ModuleName, coins) + require.NoError(t, err) + + response, err := k.ModuleBalances(ctx, &types.QueryModuleBalancesRequest{}) + require.NoError(t, err) + require.Equal(t, sdk.Coins(response.Coins).String(), coins.String()) +} + +func TestBuyElysEst(t *testing.T) { + app := simapp.InitElysTestApp(true) + ctx := app.BaseApp.NewContext(true, tmproto.Header{}) + k := app.LaunchpadKeeper + SetupStableCoinPrices(app, ctx) + + coins := sdk.Coins{sdk.NewInt64Coin(ptypes.Elys, 1000_000)} + + err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + require.NoError(t, err) + err = app.BankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, types.ModuleName, coins) + require.NoError(t, err) + + response, err := k.BuyElysEst(ctx, &types.QueryBuyElysEstRequest{ + SpendingToken: ptypes.BaseCurrency, + TokenAmount: sdk.NewInt(1000_000), + }) + require.NoError(t, err) + require.Equal(t, response.BonusAmount.String(), "1333333") + require.Equal(t, response.ElysAmount.String(), "1333333") + require.Len(t, response.Orders, 1) + require.Equal(t, response.Orders[0].OrderId, uint64(1)) + require.Equal(t, response.Orders[0].OrderMaker, "") + require.Equal(t, response.Orders[0].SpendingToken, ptypes.BaseCurrency) + require.Equal(t, response.Orders[0].TokenAmount.String(), "1000000") + require.Equal(t, response.Orders[0].ElysAmount.String(), "1333333") + require.Equal(t, response.Orders[0].ReturnedElysAmount.String(), "0") + require.Equal(t, response.Orders[0].BonusAmount.String(), "1333333") + require.Equal(t, response.Orders[0].VestingStarted, false) + + response, err = k.BuyElysEst(ctx, &types.QueryBuyElysEstRequest{ + SpendingToken: ptypes.BaseCurrency, + TokenAmount: sdk.NewInt(1000_000_000_000), + }) + require.NoError(t, err) + require.Equal(t, response.BonusAmount.String(), "1289999999999") + require.Equal(t, response.ElysAmount.String(), "1333333333333") + require.Len(t, response.Orders, 2) + require.Equal(t, response.Orders[0].OrderId, uint64(1)) + require.Equal(t, response.Orders[0].OrderMaker, "") + require.Equal(t, response.Orders[0].SpendingToken, ptypes.BaseCurrency) + require.Equal(t, response.Orders[0].TokenAmount.String(), "675000000000") + require.Equal(t, response.Orders[0].ElysAmount.String(), "900000000000") + require.Equal(t, response.Orders[0].ReturnedElysAmount.String(), "0") + require.Equal(t, response.Orders[0].BonusAmount.String(), "900000000000") + require.Equal(t, response.Orders[0].VestingStarted, false) + require.Equal(t, response.Orders[1].OrderId, uint64(2)) + require.Equal(t, response.Orders[1].OrderMaker, "") + require.Equal(t, response.Orders[1].SpendingToken, ptypes.BaseCurrency) + require.Equal(t, response.Orders[1].TokenAmount.String(), "325000000000") + require.Equal(t, response.Orders[1].ElysAmount.String(), "433333333333") + require.Equal(t, response.Orders[1].ReturnedElysAmount.String(), "0") + require.Equal(t, response.Orders[1].BonusAmount.String(), "389999999999") + require.Equal(t, response.Orders[1].VestingStarted, false) +} + +func TestReturnElysEst(t *testing.T) { + app := simapp.InitElysTestApp(true) + ctx := app.BaseApp.NewContext(true, tmproto.Header{}) + k := app.LaunchpadKeeper + SetupStableCoinPrices(app, ctx) + + coins := sdk.Coins{sdk.NewInt64Coin(ptypes.Elys, 1000_000_000_000_000)} + err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + require.NoError(t, err) + err = app.BankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, types.ModuleName, coins) + require.NoError(t, err) + + buyer := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + coins = sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 1100_000_000_000)} + err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + require.NoError(t, err) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, buyer, coins) + require.NoError(t, err) + + now := time.Now() + ctx = ctx.WithBlockTime(now) + params := k.GetParams(ctx) + params.LaunchpadStarttime = uint64(now.Unix()) + k.SetParams(ctx, params) + + msgServer := keeper.NewMsgServerImpl(k) + response, err := msgServer.BuyElys(ctx, &types.MsgBuyElys{ + Sender: buyer.String(), + SpendingToken: ptypes.BaseCurrency, + TokenAmount: sdk.NewInt(1000_000), + }) + require.NoError(t, err) + require.Len(t, response.OrderIds, 1) + require.Equal(t, response.OrderIds[0], uint64(1)) + orders := k.GetAllOrders(ctx) + require.Len(t, orders, 1) + require.Equal(t, orders[0].OrderId, uint64(1)) + require.Equal(t, orders[0].OrderMaker, buyer.String()) + require.Equal(t, orders[0].SpendingToken, ptypes.BaseCurrency) + require.Equal(t, orders[0].TokenAmount.String(), "1000000") + require.Equal(t, orders[0].ElysAmount.String(), "1333333") + require.Equal(t, orders[0].ReturnedElysAmount.String(), "0") + + resp, err := k.ReturnElysEst(ctx, &types.QueryReturnElysEstRequest{ + OrderId: 1, + ElysAmount: sdk.NewInt(333333), + }) + require.NoError(t, err) + require.Equal(t, resp.Amount.String(), "249999") + + _, err = k.ReturnElysEst(ctx, &types.QueryReturnElysEstRequest{ + OrderId: 1, + ElysAmount: sdk.NewInt(7000_000), + }) + require.Error(t, err) +} diff --git a/x/launchpad/module.go b/x/launchpad/module.go new file mode 100644 index 000000000..9b75a5ad3 --- /dev/null +++ b/x/launchpad/module.go @@ -0,0 +1,151 @@ +package launchpad + +import ( + "context" + "encoding/json" + "fmt" + + // this line is used by starport scaffolding # 1 + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + abci "github.com/cometbft/cometbft/abci/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/elys-network/elys/x/launchpad/client/cli" + "github.com/elys-network/elys/x/launchpad/keeper" + "github.com/elys-network/elys/x/launchpad/types" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the name of the module as a string +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) +} + +// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd(types.StoreKey) +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) + + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock contains the logic that is automatically triggered at the beginning of each block +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { + am.keeper.BeginBlocker(ctx) +} + +// EndBlock contains the logic that is automatically triggered at the end of each block +func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} diff --git a/x/launchpad/module_simulation.go b/x/launchpad/module_simulation.go new file mode 100644 index 000000000..8a541ad0c --- /dev/null +++ b/x/launchpad/module_simulation.go @@ -0,0 +1,64 @@ +package launchpad + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + "github.com/elys-network/elys/testutil/sample" + launchpadsimulation "github.com/elys-network/elys/x/launchpad/simulation" + "github.com/elys-network/elys/x/launchpad/types" +) + +// avoid unused import issue +var ( + _ = sample.AccAddress + _ = launchpadsimulation.FindAccount + _ = simulation.MsgEntryKind + _ = baseapp.Paramspace + _ = rand.Rand{} +) + +const ( +// this line is used by starport scaffolding # simapp/module/const +) + +// GenerateGenesisState creates a randomized GenState of the module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + accs := make([]string, len(simState.Accounts)) + for i, acc := range simState.Accounts { + accs[i] = acc.Address.String() + } + launchpadGenesis := types.GenesisState{ + Params: types.DefaultParams(), + // this line is used by starport scaffolding # simapp/module/genesisState + } + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&launchpadGenesis) +} + +// RegisterStoreDecoder registers a decoder. +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + operations := make([]simtypes.WeightedOperation, 0) + + // this line is used by starport scaffolding # simapp/module/operation + + return operations +} + +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + // this line is used by starport scaffolding # simapp/module/OpMsg + } +} diff --git a/x/launchpad/simulation/helpers.go b/x/launchpad/simulation/helpers.go new file mode 100644 index 000000000..92c437c0d --- /dev/null +++ b/x/launchpad/simulation/helpers.go @@ -0,0 +1,15 @@ +package simulation + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +// FindAccount find a specific address from an account list +func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { + creator, err := sdk.AccAddressFromBech32(address) + if err != nil { + panic(err) + } + return simtypes.FindAccount(accs, creator) +} diff --git a/x/launchpad/spec/README.md b/x/launchpad/spec/README.md new file mode 100644 index 000000000..dfd239fc0 --- /dev/null +++ b/x/launchpad/spec/README.md @@ -0,0 +1,35 @@ +# Launchpad module spec + +We are planning to run a public launch of the ELYS token on our own DEX for our community who has been eager to get involved since we recently launched the testnet of our web/mobile app. + +We want to do it in a very decentralized manner without any KYC/AML documentation necessary. + +The structure that we are looking to execute is something along the following lines ( nothing set in stone). + +The initial premise of a public launch for elys. + +1. intial reservation price is 0.75 USDC +2. total number of ELYS tokens to be reserved = 5 million +3. total raise is 3.75 million USDC +4. the launch pad will continue for a week or if it's filled fully. + 4 a) Users can bring in USDC, ETH, ATOM tokens to reserve ELYS ( based on a set swap rate). +5. people who reserve their ELYS will also get additional bonus tokens based on the slot in which they reserve their elys ( the slot is determined by the % of the raise) +6. 0-20% raise 100% bonus, 20-30% raise 90% bonus, 30-40% raise bonus 80%, 40-50% raise bonus 70%, 50-60% raise bonus 60%, 60-70% raise bonus 50%, 70% -80% raise bonus 40%, 80-100% raise bonus 30%, +7. the reserved tokens will be liquid right away at mvp. +8. the bonus tokens will be locked for 6 months and then get vested over 12 months linearly. +9. upto 50% of initial investment that is reserved can be withdrawn in the same currency that was used to reserve for upto 6 months. The amount that is withdrawn will be returned to the account and the elys will be sent back to the Elys foundation. +10. hence the guys who reserve have the option to withdraw upto 50% of their inital inevstment, and at the same time can get max of 100% bonus ( if invested early on) +11. if an investor decides to withdraw their investment then their bonus will be cut by the same amount as the withdraw. + +For example. Let's say investor buys 1000 Elys and has received a 80% bonus of 800 Elys. + +If the user decides to withdraw 30% or 300 Elys then their bonus will also be cut by 30% or 30% \* 800 = 240 Elys. + +The investor will be left with 700 Elys as investment and 560 Elys as bonus. + +## Comments + +- Use fee grant since users can't get ELYS token at the beginning +- For point 6 when people are getting bonus. If someone reserve elys with 50% bonus and then tomorrow if he comes and reavers elys and the bonus is still 50% then these two positions have to be combined + +Each reservation should be consolidated per bonus per currency used diff --git a/x/launchpad/types/codec.go b/x/launchpad/types/codec.go new file mode 100644 index 000000000..7bed004a1 --- /dev/null +++ b/x/launchpad/types/codec.go @@ -0,0 +1,33 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + // this line is used by starport scaffolding # 1 + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgBuyElys{}, "launchpad/BuyElys", nil) + cdc.RegisterConcrete(&MsgReturnElys{}, "launchpad/ReturnElys", nil) + cdc.RegisterConcrete(&MsgWithdrawRaised{}, "launchpad/WithdrawRaised", nil) + cdc.RegisterConcrete(&MsgDepositElysToken{}, "launchpad/DepositElysToken", nil) +} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgBuyElys{}, + &MsgReturnElys{}, + &MsgWithdrawRaised{}, + &MsgDepositElysToken{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + Amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) +) diff --git a/x/launchpad/types/errors.go b/x/launchpad/types/errors.go new file mode 100644 index 000000000..cc82dc98a --- /dev/null +++ b/x/launchpad/types/errors.go @@ -0,0 +1,21 @@ +package types + +// DONTCOVER + +import ( + errorsmod "cosmossdk.io/errors" +) + +// x/launchpad module sentinel errors +var ( + ErrNotEnabledSpendingToken = errorsmod.Register(ModuleName, 1, "not enabled spending token") + ErrLaunchpadNotStarted = errorsmod.Register(ModuleName, 2, "launchpad not started") + ErrLaunchpadAlreadyFinished = errorsmod.Register(ModuleName, 3, "launchpad already finished") + ErrOverflowTotalReserve = errorsmod.Register(ModuleName, 4, "buy amount overflow total reserve") + ErrLaunchpadNotFinished = errorsmod.Register(ModuleName, 5, "launchpad not finished") + ErrLaunchpadReturnPeriodFinished = errorsmod.Register(ModuleName, 6, "launchpad return period finished") + ErrPurchaseOrderNotFound = errorsmod.Register(ModuleName, 7, "purchase order not found") + ErrExceedMaxReturnAmount = errorsmod.Register(ModuleName, 8, "exceed max return amount") + ErrExceedMaxWithdrawableAmount = errorsmod.Register(ModuleName, 9, "exceed max withdrawable amount") + ErrInvalidWithrawAccount = errorsmod.Register(ModuleName, 10, "invalid withdraw account") +) diff --git a/x/launchpad/types/expected_keepers.go b/x/launchpad/types/expected_keepers.go new file mode 100644 index 000000000..203040ed6 --- /dev/null +++ b/x/launchpad/types/expected_keepers.go @@ -0,0 +1,42 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/types" + atypes "github.com/elys-network/elys/x/assetprofile/types" + oracletypes "github.com/elys-network/elys/x/oracle/types" +) + +// AccountKeeper defines the expected account keeper used for simulations (noalias) +type AccountKeeper interface { + GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface needed +type BankKeeper interface { + GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin + + SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error +} + +// OracleKeeper defines the expected interface needed to retrieve price info +type OracleKeeper interface { + GetAssetPrice(ctx sdk.Context, asset string) (oracletypes.Price, bool) + GetAssetPriceFromDenom(ctx sdk.Context, denom string) sdk.Dec + GetPriceFeeder(ctx sdk.Context, feeder string) (val oracletypes.PriceFeeder, found bool) +} + +// AssetProfileKeeper defines the expected interfaces +type AssetProfileKeeper interface { + // SetEntry set a specific entry in the store from its index + SetEntry(ctx sdk.Context, entry atypes.Entry) + // GetEntry returns a entry from its index + GetEntry(ctx sdk.Context, baseDenom string) (val atypes.Entry, found bool) + // GetEntryByDenom returns a entry from its denom value + GetEntryByDenom(ctx sdk.Context, denom string) (val atypes.Entry, found bool) +} diff --git a/x/launchpad/types/genesis.go b/x/launchpad/types/genesis.go new file mode 100644 index 000000000..2abc1a5f9 --- /dev/null +++ b/x/launchpad/types/genesis.go @@ -0,0 +1,18 @@ +package types + +// DefaultIndex is the default global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + Purchases: []Purchase{}, + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + return gs.Params.Validate() +} diff --git a/x/launchpad/types/genesis.pb.go b/x/launchpad/types/genesis.pb.go new file mode 100644 index 000000000..375a8850d --- /dev/null +++ b/x/launchpad/types/genesis.pb.go @@ -0,0 +1,385 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: elys/launchpad/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/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 + +// GenesisState defines the launchpad module's genesis state. +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + Purchases []Purchase `protobuf:"bytes,2,rep,name=purchases,proto3" json:"purchases"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_5a8ddcd685e605b8, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetPurchases() []Purchase { + if m != nil { + return m.Purchases + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "elys.launchpad.GenesisState") +} + +func init() { proto.RegisterFile("elys/launchpad/genesis.proto", fileDescriptor_5a8ddcd685e605b8) } + +var fileDescriptor_5a8ddcd685e605b8 = []byte{ + // 232 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xcd, 0xa9, 0x2c, + 0xd6, 0xcf, 0x49, 0x2c, 0xcd, 0x4b, 0xce, 0x28, 0x48, 0x4c, 0xd1, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, + 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x03, 0xc9, 0xea, 0xc1, 0x65, 0xa5, + 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x94, 0x34, 0x9a, 0x19, + 0x05, 0x89, 0x45, 0x89, 0xb9, 0x50, 0x23, 0xa4, 0xe4, 0xd0, 0x24, 0xe1, 0x2c, 0x88, 0xbc, 0x52, + 0x13, 0x23, 0x17, 0x8f, 0x3b, 0xc4, 0xd2, 0xe0, 0x92, 0xc4, 0x92, 0x54, 0x21, 0x13, 0x2e, 0x36, + 0x88, 0x01, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x62, 0x7a, 0xa8, 0x8e, 0xd0, 0x0b, 0x00, + 0xcb, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0x55, 0x2b, 0x64, 0xc3, 0xc5, 0x59, 0x50, + 0x5a, 0x94, 0x9c, 0x91, 0x58, 0x9c, 0x5a, 0x2c, 0xc1, 0xa4, 0xc0, 0xac, 0xc1, 0x6d, 0x24, 0x81, + 0xa1, 0x11, 0xaa, 0x00, 0xaa, 0x15, 0xa1, 0xc1, 0xc9, 0xe3, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, + 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, + 0x8f, 0xe5, 0x18, 0xa2, 0xf4, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, + 0x41, 0xc6, 0xe9, 0xe6, 0xa5, 0x96, 0x94, 0xe7, 0x17, 0x65, 0x83, 0x39, 0xfa, 0x15, 0x48, 0x1e, + 0x2b, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xfb, 0xca, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, + 0xd5, 0xaf, 0x53, 0x6a, 0x58, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Purchases) > 0 { + for iNdEx := len(m.Purchases) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Purchases[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.Purchases) > 0 { + for _, e := range m.Purchases { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) 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 ErrIntOverflowGenesis + } + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Purchases", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Purchases = append(m.Purchases, Purchase{}) + if err := m.Purchases[len(m.Purchases)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/launchpad/types/genesis_test.go b/x/launchpad/types/genesis_test.go new file mode 100644 index 000000000..613a48a5a --- /dev/null +++ b/x/launchpad/types/genesis_test.go @@ -0,0 +1,41 @@ +package types_test + +import ( + "testing" + + "github.com/elys-network/elys/x/launchpad/types" + "github.com/stretchr/testify/require" +) + +func TestGenesisState_Validate(t *testing.T) { + tests := []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + + // this line is used by starport scaffolding # types/genesis/validField + }, + valid: true, + }, + // this line is used by starport scaffolding # types/genesis/testcase + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/launchpad/types/keys.go b/x/launchpad/types/keys.go new file mode 100644 index 000000000..e601e7aaf --- /dev/null +++ b/x/launchpad/types/keys.go @@ -0,0 +1,24 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "launchpad" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // RouterKey defines the module's message routing key + RouterKey = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_launchpad" + + // ParamsKey is the prefix to retrieve all Params + ParamsKey = "Params/value/" +) + +var PurchasePrefixKey = []byte{0x01} + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/x/launchpad/types/launchpad.pb.go b/x/launchpad/types/launchpad.pb.go new file mode 100644 index 000000000..7ddf82f74 --- /dev/null +++ b/x/launchpad/types/launchpad.pb.go @@ -0,0 +1,1064 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: elys/launchpad/launchpad.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/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 + +// 0-20% raise 100% bonus +// 20-30% raise 90% bonus +// 30-40% raise bonus 80% +// 40-50% raise bonus 70% +// 50-60% raise bonus 60% +// 60-70% raise bonus 50% +// 70-80% raise bonus 40% +// 80-100% raise bonus 30% +type Bonus struct { + RaisePercents []uint64 `protobuf:"varint,1,rep,packed,name=raise_percents,json=raisePercents,proto3" json:"raise_percents,omitempty"` + BonusPercents []uint64 `protobuf:"varint,2,rep,packed,name=bonus_percents,json=bonusPercents,proto3" json:"bonus_percents,omitempty"` + LockDuration uint64 `protobuf:"varint,3,opt,name=lock_duration,json=lockDuration,proto3" json:"lock_duration,omitempty"` + VestingDuration uint64 `protobuf:"varint,4,opt,name=vesting_duration,json=vestingDuration,proto3" json:"vesting_duration,omitempty"` +} + +func (m *Bonus) Reset() { *m = Bonus{} } +func (m *Bonus) String() string { return proto.CompactTextString(m) } +func (*Bonus) ProtoMessage() {} +func (*Bonus) Descriptor() ([]byte, []int) { + return fileDescriptor_5ffa86e749b31956, []int{0} +} +func (m *Bonus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Bonus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Bonus.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 *Bonus) XXX_Merge(src proto.Message) { + xxx_messageInfo_Bonus.Merge(m, src) +} +func (m *Bonus) XXX_Size() int { + return m.Size() +} +func (m *Bonus) XXX_DiscardUnknown() { + xxx_messageInfo_Bonus.DiscardUnknown(m) +} + +var xxx_messageInfo_Bonus proto.InternalMessageInfo + +func (m *Bonus) GetRaisePercents() []uint64 { + if m != nil { + return m.RaisePercents + } + return nil +} + +func (m *Bonus) GetBonusPercents() []uint64 { + if m != nil { + return m.BonusPercents + } + return nil +} + +func (m *Bonus) GetLockDuration() uint64 { + if m != nil { + return m.LockDuration + } + return 0 +} + +func (m *Bonus) GetVestingDuration() uint64 { + if m != nil { + return m.VestingDuration + } + return 0 +} + +type Purchase struct { + OrderId uint64 `protobuf:"varint,1,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"` + OrderMaker string `protobuf:"bytes,2,opt,name=order_maker,json=orderMaker,proto3" json:"order_maker,omitempty"` + SpendingToken string `protobuf:"bytes,3,opt,name=spending_token,json=spendingToken,proto3" json:"spending_token,omitempty"` + TokenAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=token_amount,json=tokenAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"token_amount"` + ElysAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=elys_amount,json=elysAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"elys_amount"` + ReturnedElysAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=returned_elys_amount,json=returnedElysAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"returned_elys_amount"` + BonusAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=bonus_amount,json=bonusAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"bonus_amount"` + VestingStarted bool `protobuf:"varint,8,opt,name=vesting_started,json=vestingStarted,proto3" json:"vesting_started,omitempty"` +} + +func (m *Purchase) Reset() { *m = Purchase{} } +func (m *Purchase) String() string { return proto.CompactTextString(m) } +func (*Purchase) ProtoMessage() {} +func (*Purchase) Descriptor() ([]byte, []int) { + return fileDescriptor_5ffa86e749b31956, []int{1} +} +func (m *Purchase) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Purchase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Purchase.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 *Purchase) XXX_Merge(src proto.Message) { + xxx_messageInfo_Purchase.Merge(m, src) +} +func (m *Purchase) XXX_Size() int { + return m.Size() +} +func (m *Purchase) XXX_DiscardUnknown() { + xxx_messageInfo_Purchase.DiscardUnknown(m) +} + +var xxx_messageInfo_Purchase proto.InternalMessageInfo + +func (m *Purchase) GetOrderId() uint64 { + if m != nil { + return m.OrderId + } + return 0 +} + +func (m *Purchase) GetOrderMaker() string { + if m != nil { + return m.OrderMaker + } + return "" +} + +func (m *Purchase) GetSpendingToken() string { + if m != nil { + return m.SpendingToken + } + return "" +} + +func (m *Purchase) GetVestingStarted() bool { + if m != nil { + return m.VestingStarted + } + return false +} + +func init() { + proto.RegisterType((*Bonus)(nil), "elys.launchpad.Bonus") + proto.RegisterType((*Purchase)(nil), "elys.launchpad.Purchase") +} + +func init() { proto.RegisterFile("elys/launchpad/launchpad.proto", fileDescriptor_5ffa86e749b31956) } + +var fileDescriptor_5ffa86e749b31956 = []byte{ + // 435 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x4f, 0x8e, 0xd3, 0x30, + 0x14, 0x87, 0xe3, 0x69, 0x67, 0x26, 0x75, 0xff, 0x80, 0xac, 0x59, 0x04, 0x16, 0x69, 0x34, 0x08, + 0x08, 0x8b, 0x49, 0x16, 0x9c, 0x80, 0x0a, 0x24, 0x66, 0x81, 0x98, 0x09, 0xac, 0xd8, 0x04, 0x37, + 0xb6, 0xd2, 0x28, 0x8d, 0x1d, 0xd9, 0x0e, 0x30, 0xb7, 0xe0, 0x12, 0xdc, 0x65, 0x96, 0xb3, 0x44, + 0x2c, 0x2a, 0xd4, 0x1e, 0x80, 0x2b, 0x20, 0x3b, 0x4e, 0xd3, 0x75, 0x57, 0xb5, 0xbf, 0xf7, 0xd3, + 0xf7, 0x5e, 0xf3, 0x12, 0xe8, 0xd3, 0xf5, 0x9d, 0x8c, 0xd7, 0xb8, 0x61, 0xd9, 0xaa, 0xc6, 0xa4, + 0x3f, 0x45, 0xb5, 0xe0, 0x8a, 0xa3, 0x99, 0xae, 0x47, 0x7b, 0xfa, 0xf4, 0x22, 0xe7, 0x39, 0x37, + 0xa5, 0x58, 0x9f, 0xda, 0xd4, 0xe5, 0x2f, 0x00, 0x4f, 0x17, 0x9c, 0x35, 0x12, 0x3d, 0x87, 0x33, + 0x81, 0x0b, 0x49, 0xd3, 0x9a, 0x8a, 0x8c, 0x32, 0x25, 0x3d, 0x10, 0x0c, 0xc2, 0x61, 0x32, 0x35, + 0xf4, 0xc6, 0x42, 0x1d, 0x5b, 0xea, 0x7c, 0x1f, 0x3b, 0x69, 0x63, 0x86, 0xee, 0x63, 0xcf, 0xe0, + 0x74, 0xcd, 0xb3, 0x32, 0x25, 0x8d, 0xc0, 0xaa, 0xe0, 0xcc, 0x1b, 0x04, 0x20, 0x1c, 0x26, 0x13, + 0x0d, 0xdf, 0x5a, 0x86, 0x5e, 0xc1, 0xc7, 0xdf, 0xa8, 0x54, 0x05, 0xcb, 0xfb, 0xdc, 0xd0, 0xe4, + 0x1e, 0x59, 0xde, 0x45, 0x2f, 0xff, 0x0d, 0xa0, 0x7b, 0xd3, 0x88, 0x6c, 0x85, 0x25, 0x45, 0x4f, + 0xa0, 0xcb, 0x05, 0xa1, 0x22, 0x2d, 0x88, 0x07, 0x4c, 0xfe, 0xdc, 0xdc, 0xaf, 0x09, 0x9a, 0xc3, + 0x71, 0x5b, 0xaa, 0x70, 0x49, 0x85, 0x77, 0x12, 0x80, 0x70, 0x94, 0x40, 0x83, 0x3e, 0x68, 0xa2, + 0xe7, 0x97, 0x35, 0x65, 0x44, 0x37, 0x55, 0xbc, 0xa4, 0xed, 0x64, 0xa3, 0x64, 0xda, 0xd1, 0xcf, + 0x1a, 0xa2, 0x5b, 0x38, 0x31, 0xd5, 0x14, 0x57, 0xbc, 0x61, 0xca, 0x8c, 0x35, 0x5a, 0x44, 0xf7, + 0x9b, 0xb9, 0xf3, 0x67, 0x33, 0x7f, 0x91, 0x17, 0x6a, 0xd5, 0x2c, 0xa3, 0x8c, 0x57, 0x71, 0xc6, + 0x65, 0xc5, 0xa5, 0xfd, 0xb9, 0x92, 0xa4, 0x8c, 0xd5, 0x5d, 0x4d, 0x65, 0x74, 0xcd, 0x54, 0x32, + 0x36, 0x8e, 0x37, 0x46, 0x81, 0x3e, 0xc2, 0xb1, 0x5e, 0x49, 0x67, 0x3c, 0x3d, 0xca, 0x08, 0xb5, + 0xc2, 0x0a, 0xbf, 0xc2, 0x0b, 0x41, 0x55, 0x23, 0x18, 0x25, 0xe9, 0xa1, 0xf9, 0xec, 0x28, 0x33, + 0xea, 0x5c, 0xef, 0xfa, 0x0e, 0xb7, 0x70, 0xd2, 0x2e, 0xdb, 0x9a, 0xcf, 0x8f, 0x7b, 0x0a, 0xc6, + 0x61, 0x95, 0x2f, 0x61, 0xb7, 0xdb, 0x54, 0x2a, 0x2c, 0x14, 0x25, 0x9e, 0x1b, 0x80, 0xd0, 0x4d, + 0x66, 0x16, 0x7f, 0x6a, 0xe9, 0xe2, 0xfd, 0xfd, 0xd6, 0x07, 0x0f, 0x5b, 0x1f, 0xfc, 0xdd, 0xfa, + 0xe0, 0xe7, 0xce, 0x77, 0x1e, 0x76, 0xbe, 0xf3, 0x7b, 0xe7, 0x3b, 0x5f, 0xa2, 0x83, 0xbe, 0xfa, + 0x7f, 0x5f, 0x31, 0xaa, 0xbe, 0x73, 0x51, 0x9a, 0x4b, 0xfc, 0xe3, 0xe0, 0x9b, 0x30, 0x33, 0x2c, + 0xcf, 0xcc, 0xab, 0xfe, 0xfa, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x19, 0x14, 0xed, 0x0e, 0x32, + 0x03, 0x00, 0x00, +} + +func (m *Bonus) 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 *Bonus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Bonus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.VestingDuration != 0 { + i = encodeVarintLaunchpad(dAtA, i, uint64(m.VestingDuration)) + i-- + dAtA[i] = 0x20 + } + if m.LockDuration != 0 { + i = encodeVarintLaunchpad(dAtA, i, uint64(m.LockDuration)) + i-- + dAtA[i] = 0x18 + } + if len(m.BonusPercents) > 0 { + dAtA2 := make([]byte, len(m.BonusPercents)*10) + var j1 int + for _, num := range m.BonusPercents { + for num >= 1<<7 { + dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j1++ + } + dAtA2[j1] = uint8(num) + j1++ + } + i -= j1 + copy(dAtA[i:], dAtA2[:j1]) + i = encodeVarintLaunchpad(dAtA, i, uint64(j1)) + i-- + dAtA[i] = 0x12 + } + if len(m.RaisePercents) > 0 { + dAtA4 := make([]byte, len(m.RaisePercents)*10) + var j3 int + for _, num := range m.RaisePercents { + for num >= 1<<7 { + dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j3++ + } + dAtA4[j3] = uint8(num) + j3++ + } + i -= j3 + copy(dAtA[i:], dAtA4[:j3]) + i = encodeVarintLaunchpad(dAtA, i, uint64(j3)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Purchase) 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 *Purchase) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Purchase) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.VestingStarted { + i-- + if m.VestingStarted { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + { + size := m.BonusAmount.Size() + i -= size + if _, err := m.BonusAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLaunchpad(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size := m.ReturnedElysAmount.Size() + i -= size + if _, err := m.ReturnedElysAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLaunchpad(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size := m.ElysAmount.Size() + i -= size + if _, err := m.ElysAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLaunchpad(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.TokenAmount.Size() + i -= size + if _, err := m.TokenAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLaunchpad(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.SpendingToken) > 0 { + i -= len(m.SpendingToken) + copy(dAtA[i:], m.SpendingToken) + i = encodeVarintLaunchpad(dAtA, i, uint64(len(m.SpendingToken))) + i-- + dAtA[i] = 0x1a + } + if len(m.OrderMaker) > 0 { + i -= len(m.OrderMaker) + copy(dAtA[i:], m.OrderMaker) + i = encodeVarintLaunchpad(dAtA, i, uint64(len(m.OrderMaker))) + i-- + dAtA[i] = 0x12 + } + if m.OrderId != 0 { + i = encodeVarintLaunchpad(dAtA, i, uint64(m.OrderId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintLaunchpad(dAtA []byte, offset int, v uint64) int { + offset -= sovLaunchpad(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Bonus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RaisePercents) > 0 { + l = 0 + for _, e := range m.RaisePercents { + l += sovLaunchpad(uint64(e)) + } + n += 1 + sovLaunchpad(uint64(l)) + l + } + if len(m.BonusPercents) > 0 { + l = 0 + for _, e := range m.BonusPercents { + l += sovLaunchpad(uint64(e)) + } + n += 1 + sovLaunchpad(uint64(l)) + l + } + if m.LockDuration != 0 { + n += 1 + sovLaunchpad(uint64(m.LockDuration)) + } + if m.VestingDuration != 0 { + n += 1 + sovLaunchpad(uint64(m.VestingDuration)) + } + return n +} + +func (m *Purchase) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.OrderId != 0 { + n += 1 + sovLaunchpad(uint64(m.OrderId)) + } + l = len(m.OrderMaker) + if l > 0 { + n += 1 + l + sovLaunchpad(uint64(l)) + } + l = len(m.SpendingToken) + if l > 0 { + n += 1 + l + sovLaunchpad(uint64(l)) + } + l = m.TokenAmount.Size() + n += 1 + l + sovLaunchpad(uint64(l)) + l = m.ElysAmount.Size() + n += 1 + l + sovLaunchpad(uint64(l)) + l = m.ReturnedElysAmount.Size() + n += 1 + l + sovLaunchpad(uint64(l)) + l = m.BonusAmount.Size() + n += 1 + l + sovLaunchpad(uint64(l)) + if m.VestingStarted { + n += 2 + } + return n +} + +func sovLaunchpad(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozLaunchpad(x uint64) (n int) { + return sovLaunchpad(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Bonus) 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 ErrIntOverflowLaunchpad + } + 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: Bonus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Bonus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLaunchpad + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RaisePercents = append(m.RaisePercents, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLaunchpad + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthLaunchpad + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthLaunchpad + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RaisePercents) == 0 { + m.RaisePercents = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLaunchpad + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RaisePercents = append(m.RaisePercents, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RaisePercents", wireType) + } + case 2: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLaunchpad + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BonusPercents = append(m.BonusPercents, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLaunchpad + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthLaunchpad + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthLaunchpad + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.BonusPercents) == 0 { + m.BonusPercents = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLaunchpad + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BonusPercents = append(m.BonusPercents, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field BonusPercents", wireType) + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LockDuration", wireType) + } + m.LockDuration = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLaunchpad + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LockDuration |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VestingDuration", wireType) + } + m.VestingDuration = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLaunchpad + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VestingDuration |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipLaunchpad(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLaunchpad + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Purchase) 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 ErrIntOverflowLaunchpad + } + 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: Purchase: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Purchase: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderId", wireType) + } + m.OrderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLaunchpad + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OrderId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderMaker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLaunchpad + } + 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 ErrInvalidLengthLaunchpad + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLaunchpad + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OrderMaker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpendingToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLaunchpad + } + 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 ErrInvalidLengthLaunchpad + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLaunchpad + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SpendingToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLaunchpad + } + 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 ErrInvalidLengthLaunchpad + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLaunchpad + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TokenAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ElysAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLaunchpad + } + 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 ErrInvalidLengthLaunchpad + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLaunchpad + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ElysAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReturnedElysAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLaunchpad + } + 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 ErrInvalidLengthLaunchpad + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLaunchpad + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ReturnedElysAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BonusAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLaunchpad + } + 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 ErrInvalidLengthLaunchpad + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLaunchpad + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BonusAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VestingStarted", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLaunchpad + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.VestingStarted = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipLaunchpad(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLaunchpad + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipLaunchpad(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, ErrIntOverflowLaunchpad + } + 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, ErrIntOverflowLaunchpad + } + 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, ErrIntOverflowLaunchpad + } + 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, ErrInvalidLengthLaunchpad + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupLaunchpad + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthLaunchpad + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthLaunchpad = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowLaunchpad = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupLaunchpad = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/launchpad/types/msgs.go b/x/launchpad/types/msgs.go new file mode 100644 index 000000000..a39798daf --- /dev/null +++ b/x/launchpad/types/msgs.go @@ -0,0 +1,205 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const ( + TypeMsgBuyElys = "BuyElys" + TypeMsgReturnElys = "ReturnElys" + TypeMsgDepositElysToken = "DepositElysToken" + TypeMsgWithdrawRaised = "WithdrawRaised" + TypeMsgUpdateParams = "UpdateParams" +) + +var ( + _ sdk.Msg = &MsgBuyElys{} + _ sdk.Msg = &MsgReturnElys{} + _ sdk.Msg = &MsgWithdrawRaised{} + _ sdk.Msg = &MsgDepositElysToken{} +) + +func NewMsgBuyElys(sender string, spendingToken string, tokenAmount sdk.Int) *MsgBuyElys { + return &MsgBuyElys{ + Sender: sender, + SpendingToken: spendingToken, + TokenAmount: tokenAmount, + } +} + +func (msg *MsgBuyElys) Route() string { + return RouterKey +} + +func (msg *MsgBuyElys) Type() string { + return TypeMsgBuyElys +} + +func (msg *MsgBuyElys) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +func (msg *MsgBuyElys) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgBuyElys) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + } + return nil +} + +func NewMsgReturnElys(sender string, orderId uint64, returnElysAmount math.Int) *MsgReturnElys { + return &MsgReturnElys{ + Sender: sender, + OrderId: orderId, + ReturnElysAmount: returnElysAmount, + } +} + +func (msg *MsgReturnElys) Route() string { + return RouterKey +} + +func (msg *MsgReturnElys) Type() string { + return TypeMsgReturnElys +} + +func (msg *MsgReturnElys) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +func (msg *MsgReturnElys) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgReturnElys) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + } + return nil +} + +func NewMsgDepositElysToken(sender string, coin sdk.Coin) *MsgDepositElysToken { + return &MsgDepositElysToken{ + Sender: sender, + Coin: coin, + } +} + +func (msg *MsgDepositElysToken) Route() string { + return RouterKey +} + +func (msg *MsgDepositElysToken) Type() string { + return TypeMsgDepositElysToken +} + +func (msg *MsgDepositElysToken) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgDepositElysToken) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgDepositElysToken) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + } + return nil +} + +func NewMsgWithdrawRaised(sender string, coins sdk.Coins) *MsgWithdrawRaised { + return &MsgWithdrawRaised{ + Sender: sender, + Coins: coins, + } +} + +func (msg *MsgWithdrawRaised) Route() string { + return RouterKey +} + +func (msg *MsgWithdrawRaised) Type() string { + return TypeMsgWithdrawRaised +} + +func (msg *MsgWithdrawRaised) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgWithdrawRaised) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgWithdrawRaised) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + } + return nil +} + +func NewMsgUpdateParams(signer string, params Params) *MsgUpdateParams { + return &MsgUpdateParams{ + Authority: signer, + Params: params, + } +} + +func (msg *MsgUpdateParams) Route() string { + return RouterKey +} + +func (msg *MsgUpdateParams) Type() string { + return TypeMsgUpdateParams +} + +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgUpdateParams) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUpdateParams) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + return nil +} diff --git a/x/launchpad/types/params.go b/x/launchpad/types/params.go new file mode 100644 index 000000000..41c19d11c --- /dev/null +++ b/x/launchpad/types/params.go @@ -0,0 +1,52 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "gopkg.in/yaml.v2" +) + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return Params{ + InitialPrice: sdk.NewDecWithPrec(75, 2), // 0.75 + TotalReserve: sdk.NewInt(4500000_000000), // 4.5 million + SoldAmount: sdk.NewInt(0), + WithdrawAddress: "", + WithdrawnAmount: sdk.Coins(nil), + LaunchpadStarttime: 1710984623, // 2024-03-21 + LaunchpadDuration: 86400 * 100, // 100 days + ReturnDuration: 86400 * 180, // 6 months + MaxReturnPercent: 50, // 50% + SpendingTokens: []string{"uusdc", "uatom", "wei"}, + BonusInfo: Bonus{ + // 0-20% raise 100% bonus + // 20-30% raise 90% bonus + // 30-40% raise bonus 80% + // 40-50% raise bonus 70% + // 50-60% raise bonus 60% + // 60-70% raise bonus 50% + // 70-80% raise bonus 40% + // 80-100% raise bonus 30% + RaisePercents: []uint64{20, 30, 40, 50, 60, 70, 80, 100}, + BonusPercents: []uint64{100, 90, 80, 70, 60, 50, 40, 30}, + LockDuration: 86400 * 180, // 6 months + VestingDuration: 86400 * 365, // 1 year + }, + } +} + +// Validate validates the set of params +func (p Params) Validate() error { + return nil +} + +// String implements the Stringer interface. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} diff --git a/x/launchpad/types/params.pb.go b/x/launchpad/types/params.pb.go new file mode 100644 index 000000000..1c2757901 --- /dev/null +++ b/x/launchpad/types/params.pb.go @@ -0,0 +1,790 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: elys/launchpad/params.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/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 + +// Params defines the parameters for the module. +type Params struct { + InitialPrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=initial_price,json=initialPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"initial_price"` + TotalReserve github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=total_reserve,json=totalReserve,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_reserve"` + SoldAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=sold_amount,json=soldAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"sold_amount"` + WithdrawAddress string `protobuf:"bytes,4,opt,name=withdraw_address,json=withdrawAddress,proto3" json:"withdraw_address,omitempty"` + WithdrawnAmount []types.Coin `protobuf:"bytes,5,rep,name=withdrawn_amount,json=withdrawnAmount,proto3" json:"withdrawn_amount"` + LaunchpadStarttime uint64 `protobuf:"varint,6,opt,name=launchpad_starttime,json=launchpadStarttime,proto3" json:"launchpad_starttime,omitempty"` + LaunchpadDuration uint64 `protobuf:"varint,7,opt,name=launchpad_duration,json=launchpadDuration,proto3" json:"launchpad_duration,omitempty"` + ReturnDuration uint64 `protobuf:"varint,8,opt,name=return_duration,json=returnDuration,proto3" json:"return_duration,omitempty"` + MaxReturnPercent uint64 `protobuf:"varint,9,opt,name=max_return_percent,json=maxReturnPercent,proto3" json:"max_return_percent,omitempty"` + SpendingTokens []string `protobuf:"bytes,10,rep,name=spending_tokens,json=spendingTokens,proto3" json:"spending_tokens,omitempty"` + BonusInfo Bonus `protobuf:"bytes,11,opt,name=bonus_info,json=bonusInfo,proto3" json:"bonus_info"` +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_42cec57a253264db, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetWithdrawAddress() string { + if m != nil { + return m.WithdrawAddress + } + return "" +} + +func (m *Params) GetWithdrawnAmount() []types.Coin { + if m != nil { + return m.WithdrawnAmount + } + return nil +} + +func (m *Params) GetLaunchpadStarttime() uint64 { + if m != nil { + return m.LaunchpadStarttime + } + return 0 +} + +func (m *Params) GetLaunchpadDuration() uint64 { + if m != nil { + return m.LaunchpadDuration + } + return 0 +} + +func (m *Params) GetReturnDuration() uint64 { + if m != nil { + return m.ReturnDuration + } + return 0 +} + +func (m *Params) GetMaxReturnPercent() uint64 { + if m != nil { + return m.MaxReturnPercent + } + return 0 +} + +func (m *Params) GetSpendingTokens() []string { + if m != nil { + return m.SpendingTokens + } + return nil +} + +func (m *Params) GetBonusInfo() Bonus { + if m != nil { + return m.BonusInfo + } + return Bonus{} +} + +func init() { + proto.RegisterType((*Params)(nil), "elys.launchpad.Params") +} + +func init() { proto.RegisterFile("elys/launchpad/params.proto", fileDescriptor_42cec57a253264db) } + +var fileDescriptor_42cec57a253264db = []byte{ + // 503 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x4f, 0x6f, 0xd3, 0x30, + 0x18, 0xc6, 0x1b, 0xda, 0x15, 0xea, 0x8e, 0x6e, 0x18, 0x90, 0xc2, 0x90, 0xd2, 0x8a, 0x03, 0x04, + 0x89, 0xda, 0xda, 0xb8, 0xed, 0xb6, 0xb2, 0x03, 0xe3, 0x42, 0x95, 0x71, 0xe2, 0x12, 0x39, 0x89, + 0xd7, 0x5a, 0x4d, 0xec, 0xc8, 0x76, 0xd6, 0xee, 0x5b, 0x70, 0xe4, 0xc0, 0x81, 0x8f, 0xb3, 0xe3, + 0x8e, 0x88, 0xc3, 0x84, 0xda, 0x2f, 0x82, 0xec, 0xfc, 0xe9, 0xe0, 0x06, 0xa7, 0x38, 0xcf, 0xf3, + 0xe8, 0xf7, 0x5a, 0xef, 0xfb, 0x1a, 0x3c, 0xa7, 0xe9, 0x95, 0xc2, 0x29, 0x29, 0x78, 0x3c, 0xcf, + 0x49, 0x82, 0x73, 0x22, 0x49, 0xa6, 0x50, 0x2e, 0x85, 0x16, 0x70, 0x60, 0x4c, 0xd4, 0x98, 0x07, + 0x4f, 0x66, 0x62, 0x26, 0xac, 0x85, 0xcd, 0xa9, 0x4c, 0x1d, 0x78, 0x7f, 0x21, 0x9a, 0x53, 0xed, + 0xc7, 0x42, 0x65, 0x42, 0xe1, 0x88, 0x28, 0x8a, 0x2f, 0x0f, 0x23, 0xaa, 0xc9, 0x21, 0x8e, 0x05, + 0xe3, 0xa5, 0xff, 0xe2, 0xdb, 0x0e, 0xe8, 0x4e, 0x6d, 0x59, 0x78, 0x0e, 0x1e, 0x32, 0xce, 0x34, + 0x23, 0x69, 0x98, 0x4b, 0x16, 0x53, 0xd7, 0x19, 0x39, 0x7e, 0x6f, 0x82, 0xae, 0x6f, 0x87, 0xad, + 0x9f, 0xb7, 0xc3, 0x97, 0x33, 0xa6, 0xe7, 0x45, 0x84, 0x62, 0x91, 0xe1, 0x0a, 0x5a, 0x7e, 0xc6, + 0x2a, 0x59, 0x60, 0x7d, 0x95, 0x53, 0x85, 0x4e, 0x69, 0x1c, 0xec, 0x56, 0x90, 0xa9, 0x61, 0x18, + 0xa8, 0x16, 0x9a, 0xa4, 0xa1, 0xa4, 0x8a, 0xca, 0x4b, 0xea, 0xde, 0xfb, 0x67, 0xe8, 0x19, 0xd7, + 0xc1, 0xae, 0x85, 0x04, 0x25, 0x03, 0x7e, 0x04, 0x7d, 0x25, 0xd2, 0x24, 0x24, 0x99, 0x28, 0xb8, + 0x76, 0xdb, 0xff, 0x85, 0x04, 0x06, 0x71, 0x62, 0x09, 0xf0, 0x35, 0xd8, 0x5f, 0x32, 0x3d, 0x4f, + 0x24, 0x59, 0x86, 0x24, 0x49, 0x24, 0x55, 0xca, 0xed, 0x18, 0x6a, 0xb0, 0x57, 0xeb, 0x27, 0xa5, + 0x0c, 0x3f, 0x6c, 0xa3, 0xbc, 0xbe, 0xc0, 0xce, 0xa8, 0xed, 0xf7, 0x8f, 0x9e, 0xa1, 0xb2, 0x0e, + 0x32, 0xbd, 0x46, 0x55, 0xaf, 0xd1, 0x3b, 0xc1, 0xf8, 0xa4, 0x63, 0xee, 0xb6, 0x65, 0xf1, 0xaa, + 0x2c, 0x06, 0x8f, 0x9b, 0x79, 0x85, 0x4a, 0x13, 0xa9, 0x35, 0xcb, 0xa8, 0xdb, 0x1d, 0x39, 0x7e, + 0x27, 0x80, 0x8d, 0x75, 0x5e, 0x3b, 0x70, 0x0c, 0xb6, 0x6a, 0x98, 0x14, 0x92, 0x68, 0x26, 0xb8, + 0x7b, 0xdf, 0xe6, 0x1f, 0x35, 0xce, 0x69, 0x65, 0xc0, 0x57, 0x60, 0x4f, 0x52, 0x5d, 0x48, 0xbe, + 0xcd, 0x3e, 0xb0, 0xd9, 0x41, 0x29, 0x37, 0xc1, 0x37, 0x00, 0x66, 0x64, 0x15, 0x56, 0xe1, 0x9c, + 0xca, 0x98, 0x72, 0xed, 0xf6, 0x6c, 0x76, 0x3f, 0x23, 0xab, 0xc0, 0x1a, 0xd3, 0x52, 0x37, 0x58, + 0x95, 0x53, 0x9e, 0x30, 0x3e, 0x0b, 0xb5, 0x58, 0x50, 0xae, 0x5c, 0x30, 0x6a, 0xfb, 0xbd, 0x60, + 0x50, 0xcb, 0x9f, 0xac, 0x0a, 0x8f, 0x01, 0x88, 0x04, 0x2f, 0x54, 0xc8, 0xf8, 0x85, 0x70, 0xfb, + 0x23, 0xc7, 0xef, 0x1f, 0x3d, 0x45, 0x7f, 0xee, 0x35, 0x9a, 0x98, 0x44, 0xd5, 0xa1, 0x9e, 0x8d, + 0x9f, 0xf1, 0x0b, 0x71, 0xdc, 0xf9, 0xfa, 0x7d, 0xd8, 0x9a, 0xbc, 0xbf, 0x5e, 0x7b, 0xce, 0xcd, + 0xda, 0x73, 0x7e, 0xad, 0x3d, 0xe7, 0xcb, 0xc6, 0x6b, 0xdd, 0x6c, 0xbc, 0xd6, 0x8f, 0x8d, 0xd7, + 0xfa, 0x8c, 0xee, 0x8c, 0xd9, 0x10, 0xc7, 0x9c, 0xea, 0xa5, 0x90, 0x0b, 0xfb, 0x83, 0x57, 0x77, + 0x9e, 0x84, 0x1d, 0x79, 0xd4, 0xb5, 0xfb, 0xfe, 0xf6, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcc, + 0x7d, 0xe4, 0xf0, 0x74, 0x03, 0x00, 0x00, +} + +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.BonusInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + if len(m.SpendingTokens) > 0 { + for iNdEx := len(m.SpendingTokens) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.SpendingTokens[iNdEx]) + copy(dAtA[i:], m.SpendingTokens[iNdEx]) + i = encodeVarintParams(dAtA, i, uint64(len(m.SpendingTokens[iNdEx]))) + i-- + dAtA[i] = 0x52 + } + } + if m.MaxReturnPercent != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MaxReturnPercent)) + i-- + dAtA[i] = 0x48 + } + if m.ReturnDuration != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.ReturnDuration)) + i-- + dAtA[i] = 0x40 + } + if m.LaunchpadDuration != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.LaunchpadDuration)) + i-- + dAtA[i] = 0x38 + } + if m.LaunchpadStarttime != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.LaunchpadStarttime)) + i-- + dAtA[i] = 0x30 + } + if len(m.WithdrawnAmount) > 0 { + for iNdEx := len(m.WithdrawnAmount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.WithdrawnAmount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.WithdrawAddress) > 0 { + i -= len(m.WithdrawAddress) + copy(dAtA[i:], m.WithdrawAddress) + i = encodeVarintParams(dAtA, i, uint64(len(m.WithdrawAddress))) + i-- + dAtA[i] = 0x22 + } + { + size := m.SoldAmount.Size() + i -= size + if _, err := m.SoldAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.TotalReserve.Size() + i -= size + if _, err := m.TotalReserve.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.InitialPrice.Size() + i -= size + if _, err := m.InitialPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.InitialPrice.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.TotalReserve.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.SoldAmount.Size() + n += 1 + l + sovParams(uint64(l)) + l = len(m.WithdrawAddress) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + if len(m.WithdrawnAmount) > 0 { + for _, e := range m.WithdrawnAmount { + l = e.Size() + n += 1 + l + sovParams(uint64(l)) + } + } + if m.LaunchpadStarttime != 0 { + n += 1 + sovParams(uint64(m.LaunchpadStarttime)) + } + if m.LaunchpadDuration != 0 { + n += 1 + sovParams(uint64(m.LaunchpadDuration)) + } + if m.ReturnDuration != 0 { + n += 1 + sovParams(uint64(m.ReturnDuration)) + } + if m.MaxReturnPercent != 0 { + n += 1 + sovParams(uint64(m.MaxReturnPercent)) + } + if len(m.SpendingTokens) > 0 { + for _, s := range m.SpendingTokens { + l = len(s) + n += 1 + l + sovParams(uint64(l)) + } + } + l = m.BonusInfo.Size() + n += 1 + l + sovParams(uint64(l)) + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) 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 ErrIntOverflowParams + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InitialPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalReserve", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TotalReserve.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SoldAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SoldAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WithdrawAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawnAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WithdrawnAmount = append(m.WithdrawnAmount, types.Coin{}) + if err := m.WithdrawnAmount[len(m.WithdrawnAmount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LaunchpadStarttime", wireType) + } + m.LaunchpadStarttime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LaunchpadStarttime |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LaunchpadDuration", wireType) + } + m.LaunchpadDuration = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LaunchpadDuration |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ReturnDuration", wireType) + } + m.ReturnDuration = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ReturnDuration |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxReturnPercent", wireType) + } + m.MaxReturnPercent = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxReturnPercent |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpendingTokens", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SpendingTokens = append(m.SpendingTokens, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BonusInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BonusInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/launchpad/types/query.pb.go b/x/launchpad/types/query.pb.go new file mode 100644 index 000000000..0afe6f9cf --- /dev/null +++ b/x/launchpad/types/query.pb.go @@ -0,0 +1,2948 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: elys/launchpad/query.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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 + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7d2bc8a060496a67, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.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 *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7d2bc8a060496a67, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +type QueryBonusRequest struct { + User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (m *QueryBonusRequest) Reset() { *m = QueryBonusRequest{} } +func (m *QueryBonusRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBonusRequest) ProtoMessage() {} +func (*QueryBonusRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7d2bc8a060496a67, []int{2} +} +func (m *QueryBonusRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBonusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBonusRequest.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 *QueryBonusRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBonusRequest.Merge(m, src) +} +func (m *QueryBonusRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBonusRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBonusRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBonusRequest proto.InternalMessageInfo + +func (m *QueryBonusRequest) GetUser() string { + if m != nil { + return m.User + } + return "" +} + +type QueryBonusResponse struct { + TotalBonus github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=total_bonus,json=totalBonus,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_bonus"` +} + +func (m *QueryBonusResponse) Reset() { *m = QueryBonusResponse{} } +func (m *QueryBonusResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBonusResponse) ProtoMessage() {} +func (*QueryBonusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7d2bc8a060496a67, []int{3} +} +func (m *QueryBonusResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBonusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBonusResponse.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 *QueryBonusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBonusResponse.Merge(m, src) +} +func (m *QueryBonusResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBonusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBonusResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBonusResponse proto.InternalMessageInfo + +type QueryBuyElysEstRequest struct { + SpendingToken string `protobuf:"bytes,1,opt,name=spending_token,json=spendingToken,proto3" json:"spending_token,omitempty"` + TokenAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=token_amount,json=tokenAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"token_amount"` +} + +func (m *QueryBuyElysEstRequest) Reset() { *m = QueryBuyElysEstRequest{} } +func (m *QueryBuyElysEstRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBuyElysEstRequest) ProtoMessage() {} +func (*QueryBuyElysEstRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7d2bc8a060496a67, []int{4} +} +func (m *QueryBuyElysEstRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBuyElysEstRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBuyElysEstRequest.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 *QueryBuyElysEstRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBuyElysEstRequest.Merge(m, src) +} +func (m *QueryBuyElysEstRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBuyElysEstRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBuyElysEstRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBuyElysEstRequest proto.InternalMessageInfo + +func (m *QueryBuyElysEstRequest) GetSpendingToken() string { + if m != nil { + return m.SpendingToken + } + return "" +} + +type QueryBuyElysEstResponse struct { + ElysAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=elys_amount,json=elysAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"elys_amount"` + BonusAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=bonus_amount,json=bonusAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"bonus_amount"` + Orders []Purchase `protobuf:"bytes,3,rep,name=orders,proto3" json:"orders"` +} + +func (m *QueryBuyElysEstResponse) Reset() { *m = QueryBuyElysEstResponse{} } +func (m *QueryBuyElysEstResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBuyElysEstResponse) ProtoMessage() {} +func (*QueryBuyElysEstResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7d2bc8a060496a67, []int{5} +} +func (m *QueryBuyElysEstResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBuyElysEstResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBuyElysEstResponse.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 *QueryBuyElysEstResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBuyElysEstResponse.Merge(m, src) +} +func (m *QueryBuyElysEstResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBuyElysEstResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBuyElysEstResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBuyElysEstResponse proto.InternalMessageInfo + +func (m *QueryBuyElysEstResponse) GetOrders() []Purchase { + if m != nil { + return m.Orders + } + return nil +} + +type QueryReturnElysEstRequest struct { + OrderId uint64 `protobuf:"varint,1,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"` + ElysAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=elys_amount,json=elysAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"elys_amount"` +} + +func (m *QueryReturnElysEstRequest) Reset() { *m = QueryReturnElysEstRequest{} } +func (m *QueryReturnElysEstRequest) String() string { return proto.CompactTextString(m) } +func (*QueryReturnElysEstRequest) ProtoMessage() {} +func (*QueryReturnElysEstRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7d2bc8a060496a67, []int{6} +} +func (m *QueryReturnElysEstRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryReturnElysEstRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryReturnElysEstRequest.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 *QueryReturnElysEstRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryReturnElysEstRequest.Merge(m, src) +} +func (m *QueryReturnElysEstRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryReturnElysEstRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryReturnElysEstRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryReturnElysEstRequest proto.InternalMessageInfo + +func (m *QueryReturnElysEstRequest) GetOrderId() uint64 { + if m != nil { + return m.OrderId + } + return 0 +} + +type QueryReturnElysEstResponse struct { + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` +} + +func (m *QueryReturnElysEstResponse) Reset() { *m = QueryReturnElysEstResponse{} } +func (m *QueryReturnElysEstResponse) String() string { return proto.CompactTextString(m) } +func (*QueryReturnElysEstResponse) ProtoMessage() {} +func (*QueryReturnElysEstResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7d2bc8a060496a67, []int{7} +} +func (m *QueryReturnElysEstResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryReturnElysEstResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryReturnElysEstResponse.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 *QueryReturnElysEstResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryReturnElysEstResponse.Merge(m, src) +} +func (m *QueryReturnElysEstResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryReturnElysEstResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryReturnElysEstResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryReturnElysEstResponse proto.InternalMessageInfo + +type QueryOrdersRequest struct { + User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (m *QueryOrdersRequest) Reset() { *m = QueryOrdersRequest{} } +func (m *QueryOrdersRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOrdersRequest) ProtoMessage() {} +func (*QueryOrdersRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7d2bc8a060496a67, []int{8} +} +func (m *QueryOrdersRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOrdersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOrdersRequest.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 *QueryOrdersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOrdersRequest.Merge(m, src) +} +func (m *QueryOrdersRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOrdersRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOrdersRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOrdersRequest proto.InternalMessageInfo + +func (m *QueryOrdersRequest) GetUser() string { + if m != nil { + return m.User + } + return "" +} + +type QueryOrdersResponse struct { + Purchases []Purchase `protobuf:"bytes,1,rep,name=purchases,proto3" json:"purchases"` +} + +func (m *QueryOrdersResponse) Reset() { *m = QueryOrdersResponse{} } +func (m *QueryOrdersResponse) String() string { return proto.CompactTextString(m) } +func (*QueryOrdersResponse) ProtoMessage() {} +func (*QueryOrdersResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7d2bc8a060496a67, []int{9} +} +func (m *QueryOrdersResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOrdersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOrdersResponse.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 *QueryOrdersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOrdersResponse.Merge(m, src) +} +func (m *QueryOrdersResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryOrdersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOrdersResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOrdersResponse proto.InternalMessageInfo + +func (m *QueryOrdersResponse) GetPurchases() []Purchase { + if m != nil { + return m.Purchases + } + return nil +} + +type QueryAllOrdersRequest struct { +} + +func (m *QueryAllOrdersRequest) Reset() { *m = QueryAllOrdersRequest{} } +func (m *QueryAllOrdersRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllOrdersRequest) ProtoMessage() {} +func (*QueryAllOrdersRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7d2bc8a060496a67, []int{10} +} +func (m *QueryAllOrdersRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllOrdersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllOrdersRequest.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 *QueryAllOrdersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllOrdersRequest.Merge(m, src) +} +func (m *QueryAllOrdersRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllOrdersRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllOrdersRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllOrdersRequest proto.InternalMessageInfo + +type QueryAllOrdersResponse struct { + Purchases []Purchase `protobuf:"bytes,1,rep,name=purchases,proto3" json:"purchases"` +} + +func (m *QueryAllOrdersResponse) Reset() { *m = QueryAllOrdersResponse{} } +func (m *QueryAllOrdersResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllOrdersResponse) ProtoMessage() {} +func (*QueryAllOrdersResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7d2bc8a060496a67, []int{11} +} +func (m *QueryAllOrdersResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllOrdersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllOrdersResponse.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 *QueryAllOrdersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllOrdersResponse.Merge(m, src) +} +func (m *QueryAllOrdersResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllOrdersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllOrdersResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllOrdersResponse proto.InternalMessageInfo + +func (m *QueryAllOrdersResponse) GetPurchases() []Purchase { + if m != nil { + return m.Purchases + } + return nil +} + +type QueryModuleBalancesRequest struct { +} + +func (m *QueryModuleBalancesRequest) Reset() { *m = QueryModuleBalancesRequest{} } +func (m *QueryModuleBalancesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryModuleBalancesRequest) ProtoMessage() {} +func (*QueryModuleBalancesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7d2bc8a060496a67, []int{12} +} +func (m *QueryModuleBalancesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryModuleBalancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryModuleBalancesRequest.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 *QueryModuleBalancesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryModuleBalancesRequest.Merge(m, src) +} +func (m *QueryModuleBalancesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryModuleBalancesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryModuleBalancesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryModuleBalancesRequest proto.InternalMessageInfo + +type QueryModuleBalancesResponse struct { + Coins []types.Coin `protobuf:"bytes,1,rep,name=coins,proto3" json:"coins"` +} + +func (m *QueryModuleBalancesResponse) Reset() { *m = QueryModuleBalancesResponse{} } +func (m *QueryModuleBalancesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryModuleBalancesResponse) ProtoMessage() {} +func (*QueryModuleBalancesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7d2bc8a060496a67, []int{13} +} +func (m *QueryModuleBalancesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryModuleBalancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryModuleBalancesResponse.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 *QueryModuleBalancesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryModuleBalancesResponse.Merge(m, src) +} +func (m *QueryModuleBalancesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryModuleBalancesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryModuleBalancesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryModuleBalancesResponse proto.InternalMessageInfo + +func (m *QueryModuleBalancesResponse) GetCoins() []types.Coin { + if m != nil { + return m.Coins + } + return nil +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "elys.launchpad.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "elys.launchpad.QueryParamsResponse") + proto.RegisterType((*QueryBonusRequest)(nil), "elys.launchpad.QueryBonusRequest") + proto.RegisterType((*QueryBonusResponse)(nil), "elys.launchpad.QueryBonusResponse") + proto.RegisterType((*QueryBuyElysEstRequest)(nil), "elys.launchpad.QueryBuyElysEstRequest") + proto.RegisterType((*QueryBuyElysEstResponse)(nil), "elys.launchpad.QueryBuyElysEstResponse") + proto.RegisterType((*QueryReturnElysEstRequest)(nil), "elys.launchpad.QueryReturnElysEstRequest") + proto.RegisterType((*QueryReturnElysEstResponse)(nil), "elys.launchpad.QueryReturnElysEstResponse") + proto.RegisterType((*QueryOrdersRequest)(nil), "elys.launchpad.QueryOrdersRequest") + proto.RegisterType((*QueryOrdersResponse)(nil), "elys.launchpad.QueryOrdersResponse") + proto.RegisterType((*QueryAllOrdersRequest)(nil), "elys.launchpad.QueryAllOrdersRequest") + proto.RegisterType((*QueryAllOrdersResponse)(nil), "elys.launchpad.QueryAllOrdersResponse") + proto.RegisterType((*QueryModuleBalancesRequest)(nil), "elys.launchpad.QueryModuleBalancesRequest") + proto.RegisterType((*QueryModuleBalancesResponse)(nil), "elys.launchpad.QueryModuleBalancesResponse") +} + +func init() { proto.RegisterFile("elys/launchpad/query.proto", fileDescriptor_7d2bc8a060496a67) } + +var fileDescriptor_7d2bc8a060496a67 = []byte{ + // 850 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x4f, 0xe3, 0x46, + 0x18, 0x8d, 0xf9, 0x11, 0xca, 0xa4, 0x20, 0x75, 0x4a, 0x21, 0x18, 0x14, 0xa8, 0x29, 0xbf, 0x8b, + 0x5d, 0x02, 0x54, 0x95, 0xda, 0x0b, 0xa9, 0xa8, 0x8a, 0xaa, 0x8a, 0x92, 0xa2, 0x1e, 0x7a, 0x89, + 0x26, 0xf1, 0x28, 0x58, 0x38, 0x33, 0xc6, 0x33, 0x6e, 0x9b, 0x1e, 0x38, 0xf4, 0xd2, 0xc3, 0x5e, + 0x56, 0xbb, 0x87, 0x3d, 0xee, 0x61, 0xff, 0x19, 0x8e, 0x48, 0x7b, 0x59, 0xed, 0x01, 0xad, 0x60, + 0xff, 0x83, 0xd5, 0xde, 0x57, 0xfe, 0x3c, 0x0e, 0xf9, 0x61, 0x4c, 0x04, 0x7b, 0x8a, 0x33, 0xdf, + 0x9b, 0xf7, 0xde, 0x7c, 0x9e, 0xef, 0x25, 0x48, 0xa7, 0x6e, 0x53, 0x58, 0x2e, 0x09, 0x58, 0xed, + 0xd8, 0x23, 0xb6, 0x75, 0x1a, 0x50, 0xbf, 0x69, 0x7a, 0x3e, 0x97, 0x1c, 0x8f, 0x87, 0x35, 0xb3, + 0x55, 0xd3, 0x27, 0xea, 0xbc, 0xce, 0xa1, 0x64, 0x85, 0x4f, 0x11, 0x4a, 0x9f, 0xad, 0x73, 0x5e, + 0x77, 0xa9, 0x45, 0x3c, 0xc7, 0x22, 0x8c, 0x71, 0x49, 0xa4, 0xc3, 0x99, 0x50, 0xd5, 0xb5, 0x1a, + 0x17, 0x0d, 0x2e, 0xac, 0x2a, 0x11, 0x34, 0x22, 0xb7, 0xfe, 0xda, 0xac, 0x52, 0x49, 0x36, 0x2d, + 0x8f, 0xd4, 0x1d, 0x06, 0x60, 0x85, 0x9d, 0xe9, 0xf2, 0xe2, 0x11, 0x9f, 0x34, 0x62, 0xa2, 0x42, + 0x57, 0xb1, 0xf5, 0x14, 0xd7, 0xdb, 0x85, 0x62, 0x89, 0x1a, 0x77, 0x14, 0xb9, 0x31, 0x81, 0xf0, + 0x61, 0x28, 0xff, 0x1b, 0x90, 0x96, 0xe9, 0x69, 0x40, 0x85, 0x34, 0x7e, 0x41, 0x9f, 0x77, 0xac, + 0x0a, 0x8f, 0x33, 0x41, 0xf1, 0x36, 0xca, 0x46, 0xe2, 0x79, 0x6d, 0x5e, 0x5b, 0xc9, 0x15, 0x27, + 0xcd, 0xce, 0x56, 0x98, 0x11, 0xbe, 0x34, 0x74, 0x7e, 0x39, 0x97, 0x29, 0x2b, 0xac, 0xb1, 0x8c, + 0x3e, 0x03, 0xb2, 0x12, 0x67, 0x41, 0xac, 0x80, 0x31, 0x1a, 0x0a, 0x04, 0xf5, 0x81, 0x68, 0xb4, + 0x0c, 0xcf, 0x06, 0x55, 0x5e, 0x14, 0x50, 0x89, 0x1e, 0xa0, 0x9c, 0xe4, 0x92, 0xb8, 0x95, 0x6a, + 0xb8, 0x1c, 0x6d, 0x28, 0x99, 0xa1, 0xc2, 0xeb, 0xcb, 0xb9, 0xa5, 0xba, 0x23, 0x8f, 0x83, 0xaa, + 0x59, 0xe3, 0x0d, 0x4b, 0x9d, 0x34, 0xfa, 0xd8, 0x10, 0xf6, 0x89, 0x25, 0x9b, 0x1e, 0x15, 0xe6, + 0x3e, 0x93, 0x65, 0x04, 0x14, 0x40, 0x6c, 0x3c, 0xd1, 0xd0, 0x64, 0xa4, 0x13, 0x34, 0xf7, 0xdc, + 0xa6, 0xd8, 0x13, 0x32, 0x76, 0xb5, 0x88, 0xc6, 0x85, 0x47, 0x99, 0xed, 0xb0, 0x7a, 0x45, 0xf2, + 0x13, 0xca, 0x94, 0xbf, 0xb1, 0x78, 0xf5, 0x28, 0x5c, 0xc4, 0x87, 0xe8, 0x53, 0xa8, 0x56, 0x48, + 0x83, 0x07, 0x4c, 0xe6, 0x07, 0xee, 0xe5, 0x29, 0x07, 0x1c, 0xbb, 0x40, 0x61, 0xbc, 0xd7, 0xd0, + 0x54, 0x8f, 0xa9, 0x9b, 0x0e, 0x84, 0x7d, 0x8e, 0xd5, 0xee, 0xd9, 0x81, 0x90, 0x22, 0x12, 0x0b, + 0xfd, 0x43, 0x33, 0x1f, 0xe8, 0x1f, 0x38, 0x14, 0xe5, 0xb7, 0x28, 0xcb, 0x7d, 0x9b, 0xfa, 0x22, + 0x3f, 0x38, 0x3f, 0xb8, 0x92, 0x2b, 0xe6, 0x7b, 0xae, 0x46, 0xe0, 0xd7, 0x8e, 0x89, 0xa0, 0xf1, + 0xe5, 0x88, 0xd0, 0xc6, 0xff, 0x1a, 0x9a, 0x86, 0x73, 0x97, 0xa9, 0x0c, 0x7c, 0xd6, 0xf5, 0x3e, + 0xa6, 0xd1, 0x27, 0x80, 0xab, 0x38, 0x36, 0x1c, 0x7b, 0xa8, 0x3c, 0x02, 0xdf, 0xf7, 0xed, 0xee, + 0xa6, 0x0c, 0x3c, 0xb4, 0x29, 0x86, 0x8d, 0xf4, 0x24, 0x23, 0xea, 0x1d, 0xfc, 0x84, 0xb2, 0x0f, + 0x6a, 0xbf, 0xda, 0x6d, 0xac, 0xa8, 0x3b, 0x7e, 0x00, 0xc7, 0x4f, 0x9b, 0x86, 0xdf, 0xd5, 0x0c, + 0xc6, 0x48, 0x65, 0xe4, 0x07, 0x34, 0xea, 0xa9, 0x56, 0x86, 0xc3, 0xd0, 0x4f, 0xaf, 0x6f, 0x36, + 0x18, 0x53, 0xe8, 0x0b, 0x20, 0xdd, 0x75, 0xdd, 0x0e, 0x07, 0xc6, 0x1f, 0x6a, 0x26, 0xda, 0x0a, + 0x1f, 0x45, 0x70, 0x56, 0x75, 0xf5, 0x57, 0x6e, 0x07, 0x2e, 0x2d, 0x11, 0x97, 0xb0, 0x1a, 0x6d, + 0xa9, 0x1e, 0xa1, 0x99, 0xc4, 0xaa, 0x92, 0xde, 0x41, 0xc3, 0x61, 0x54, 0xc5, 0xb2, 0xd3, 0x66, + 0xd4, 0x5a, 0x33, 0x0c, 0x33, 0x53, 0x85, 0x99, 0xf9, 0x23, 0x77, 0x98, 0xd2, 0x8d, 0xd0, 0xc5, + 0x77, 0x23, 0x68, 0x18, 0x68, 0xf1, 0x19, 0xca, 0x46, 0x91, 0x84, 0x8d, 0x6e, 0xcb, 0xbd, 0xa9, + 0xa7, 0x2f, 0xa4, 0x62, 0x22, 0x4f, 0xc6, 0xfa, 0x7f, 0x2f, 0xdf, 0x3e, 0x1d, 0x58, 0xc4, 0x0b, + 0x56, 0x08, 0xde, 0x60, 0x54, 0xfe, 0xcd, 0xfd, 0x13, 0x2b, 0x31, 0xa3, 0xf1, 0xbf, 0x68, 0x18, + 0x32, 0x07, 0x7f, 0x99, 0x48, 0xdd, 0x9e, 0x88, 0xba, 0x91, 0x06, 0x51, 0xe2, 0x6b, 0x20, 0xfe, + 0x15, 0x36, 0x52, 0xc5, 0x61, 0x2e, 0xf1, 0x33, 0x0d, 0xa1, 0x9b, 0x30, 0xc1, 0x4b, 0xc9, 0xf4, + 0xdd, 0x11, 0xa8, 0x2f, 0xdf, 0x89, 0x53, 0x5e, 0xbe, 0x03, 0x2f, 0x45, 0xfc, 0x4d, 0xba, 0x97, + 0xa0, 0x59, 0x81, 0x39, 0xa5, 0x42, 0x3a, 0x0d, 0xf8, 0x59, 0xc3, 0x2f, 0x34, 0x34, 0xd6, 0x31, + 0x65, 0x78, 0x35, 0x51, 0x34, 0x29, 0x12, 0xf4, 0xb5, 0x7e, 0xa0, 0xca, 0xe2, 0xf7, 0x60, 0x71, + 0x07, 0x6f, 0xa5, 0x5a, 0xf4, 0x61, 0x6f, 0x8f, 0xcb, 0x33, 0x94, 0x8d, 0x26, 0xe1, 0x96, 0xbb, + 0xd3, 0x31, 0x3f, 0xb7, 0xdc, 0x9d, 0xce, 0x51, 0xea, 0xf3, 0xee, 0x44, 0xc9, 0x88, 0x1f, 0x69, + 0x68, 0xb4, 0x35, 0x8d, 0x78, 0x31, 0x91, 0xbf, 0x7b, 0x8c, 0xf5, 0xa5, 0xbb, 0x60, 0xca, 0x89, + 0x05, 0x4e, 0x56, 0xf1, 0x72, 0xaa, 0x13, 0xe2, 0xba, 0x15, 0xe5, 0xe6, 0xb9, 0x86, 0xc6, 0x3b, + 0xa7, 0x14, 0x27, 0xbf, 0x89, 0xc4, 0x41, 0xd7, 0xd7, 0xfb, 0xc2, 0x2a, 0x73, 0xdb, 0x60, 0xce, + 0xc4, 0x5f, 0xa7, 0x9a, 0x6b, 0xc0, 0xe6, 0x4a, 0x55, 0xed, 0x2e, 0xfd, 0x7c, 0x7e, 0x55, 0xd0, + 0x2e, 0xae, 0x0a, 0xda, 0x9b, 0xab, 0x82, 0xf6, 0xf8, 0xba, 0x90, 0xb9, 0xb8, 0x2e, 0x64, 0x5e, + 0x5d, 0x17, 0x32, 0x7f, 0x9a, 0x6d, 0x19, 0xdd, 0xcb, 0xf8, 0x4f, 0x1b, 0x27, 0xe4, 0x75, 0x35, + 0x0b, 0x7f, 0x8d, 0xb6, 0x3e, 0x04, 0x00, 0x00, 0xff, 0xff, 0x8f, 0xcb, 0xf7, 0x4f, 0x05, 0x0a, + 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Bonus queries bonus amounts for a user + Bonus(ctx context.Context, in *QueryBonusRequest, opts ...grpc.CallOption) (*QueryBonusResponse, error) + // BuyElysEst queries estimation result for buying elys + BuyElysEst(ctx context.Context, in *QueryBuyElysEstRequest, opts ...grpc.CallOption) (*QueryBuyElysEstResponse, error) + // ReturnElysEst queries estimation result for returning elys + ReturnElysEst(ctx context.Context, in *QueryReturnElysEstRequest, opts ...grpc.CallOption) (*QueryReturnElysEstResponse, error) + // Orders queries orders placed by user + Orders(ctx context.Context, in *QueryOrdersRequest, opts ...grpc.CallOption) (*QueryOrdersResponse, error) + // AllOrders queries all the orders placed + AllOrders(ctx context.Context, in *QueryAllOrdersRequest, opts ...grpc.CallOption) (*QueryAllOrdersResponse, error) + // ModuleBalances queries module balances + ModuleBalances(ctx context.Context, in *QueryModuleBalancesRequest, opts ...grpc.CallOption) (*QueryModuleBalancesResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/elys.launchpad.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Bonus(ctx context.Context, in *QueryBonusRequest, opts ...grpc.CallOption) (*QueryBonusResponse, error) { + out := new(QueryBonusResponse) + err := c.cc.Invoke(ctx, "/elys.launchpad.Query/Bonus", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) BuyElysEst(ctx context.Context, in *QueryBuyElysEstRequest, opts ...grpc.CallOption) (*QueryBuyElysEstResponse, error) { + out := new(QueryBuyElysEstResponse) + err := c.cc.Invoke(ctx, "/elys.launchpad.Query/BuyElysEst", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ReturnElysEst(ctx context.Context, in *QueryReturnElysEstRequest, opts ...grpc.CallOption) (*QueryReturnElysEstResponse, error) { + out := new(QueryReturnElysEstResponse) + err := c.cc.Invoke(ctx, "/elys.launchpad.Query/ReturnElysEst", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Orders(ctx context.Context, in *QueryOrdersRequest, opts ...grpc.CallOption) (*QueryOrdersResponse, error) { + out := new(QueryOrdersResponse) + err := c.cc.Invoke(ctx, "/elys.launchpad.Query/Orders", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) AllOrders(ctx context.Context, in *QueryAllOrdersRequest, opts ...grpc.CallOption) (*QueryAllOrdersResponse, error) { + out := new(QueryAllOrdersResponse) + err := c.cc.Invoke(ctx, "/elys.launchpad.Query/AllOrders", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ModuleBalances(ctx context.Context, in *QueryModuleBalancesRequest, opts ...grpc.CallOption) (*QueryModuleBalancesResponse, error) { + out := new(QueryModuleBalancesResponse) + err := c.cc.Invoke(ctx, "/elys.launchpad.Query/ModuleBalances", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Bonus queries bonus amounts for a user + Bonus(context.Context, *QueryBonusRequest) (*QueryBonusResponse, error) + // BuyElysEst queries estimation result for buying elys + BuyElysEst(context.Context, *QueryBuyElysEstRequest) (*QueryBuyElysEstResponse, error) + // ReturnElysEst queries estimation result for returning elys + ReturnElysEst(context.Context, *QueryReturnElysEstRequest) (*QueryReturnElysEstResponse, error) + // Orders queries orders placed by user + Orders(context.Context, *QueryOrdersRequest) (*QueryOrdersResponse, error) + // AllOrders queries all the orders placed + AllOrders(context.Context, *QueryAllOrdersRequest) (*QueryAllOrdersResponse, error) + // ModuleBalances queries module balances + ModuleBalances(context.Context, *QueryModuleBalancesRequest) (*QueryModuleBalancesResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) Bonus(ctx context.Context, req *QueryBonusRequest) (*QueryBonusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Bonus not implemented") +} +func (*UnimplementedQueryServer) BuyElysEst(ctx context.Context, req *QueryBuyElysEstRequest) (*QueryBuyElysEstResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BuyElysEst not implemented") +} +func (*UnimplementedQueryServer) ReturnElysEst(ctx context.Context, req *QueryReturnElysEstRequest) (*QueryReturnElysEstResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReturnElysEst not implemented") +} +func (*UnimplementedQueryServer) Orders(ctx context.Context, req *QueryOrdersRequest) (*QueryOrdersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Orders not implemented") +} +func (*UnimplementedQueryServer) AllOrders(ctx context.Context, req *QueryAllOrdersRequest) (*QueryAllOrdersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllOrders not implemented") +} +func (*UnimplementedQueryServer) ModuleBalances(ctx context.Context, req *QueryModuleBalancesRequest) (*QueryModuleBalancesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ModuleBalances not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.launchpad.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Bonus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBonusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Bonus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.launchpad.Query/Bonus", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Bonus(ctx, req.(*QueryBonusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_BuyElysEst_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBuyElysEstRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).BuyElysEst(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.launchpad.Query/BuyElysEst", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BuyElysEst(ctx, req.(*QueryBuyElysEstRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ReturnElysEst_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryReturnElysEstRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ReturnElysEst(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.launchpad.Query/ReturnElysEst", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ReturnElysEst(ctx, req.(*QueryReturnElysEstRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Orders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOrdersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Orders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.launchpad.Query/Orders", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Orders(ctx, req.(*QueryOrdersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AllOrders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllOrdersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AllOrders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.launchpad.Query/AllOrders", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AllOrders(ctx, req.(*QueryAllOrdersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ModuleBalances_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryModuleBalancesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ModuleBalances(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.launchpad.Query/ModuleBalances", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ModuleBalances(ctx, req.(*QueryModuleBalancesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "elys.launchpad.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "Bonus", + Handler: _Query_Bonus_Handler, + }, + { + MethodName: "BuyElysEst", + Handler: _Query_BuyElysEst_Handler, + }, + { + MethodName: "ReturnElysEst", + Handler: _Query_ReturnElysEst_Handler, + }, + { + MethodName: "Orders", + Handler: _Query_Orders_Handler, + }, + { + MethodName: "AllOrders", + Handler: _Query_AllOrders_Handler, + }, + { + MethodName: "ModuleBalances", + Handler: _Query_ModuleBalances_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "elys/launchpad/query.proto", +} + +func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryBonusRequest) 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 *QueryBonusRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBonusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintQuery(dAtA, i, uint64(len(m.User))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBonusResponse) 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 *QueryBonusResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBonusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.TotalBonus.Size() + i -= size + if _, err := m.TotalBonus.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryBuyElysEstRequest) 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 *QueryBuyElysEstRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBuyElysEstRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.TokenAmount.Size() + i -= size + if _, err := m.TokenAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.SpendingToken) > 0 { + i -= len(m.SpendingToken) + copy(dAtA[i:], m.SpendingToken) + i = encodeVarintQuery(dAtA, i, uint64(len(m.SpendingToken))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBuyElysEstResponse) 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 *QueryBuyElysEstResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBuyElysEstResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Orders) > 0 { + for iNdEx := len(m.Orders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Orders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + { + size := m.BonusAmount.Size() + i -= size + if _, err := m.BonusAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.ElysAmount.Size() + i -= size + if _, err := m.ElysAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryReturnElysEstRequest) 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 *QueryReturnElysEstRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryReturnElysEstRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.ElysAmount.Size() + i -= size + if _, err := m.ElysAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.OrderId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.OrderId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryReturnElysEstResponse) 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 *QueryReturnElysEstResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryReturnElysEstResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryOrdersRequest) 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 *QueryOrdersRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOrdersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintQuery(dAtA, i, uint64(len(m.User))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryOrdersResponse) 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 *QueryOrdersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOrdersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Purchases) > 0 { + for iNdEx := len(m.Purchases) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Purchases[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryAllOrdersRequest) 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 *QueryAllOrdersRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllOrdersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAllOrdersResponse) 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 *QueryAllOrdersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllOrdersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Purchases) > 0 { + for iNdEx := len(m.Purchases) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Purchases[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryModuleBalancesRequest) 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 *QueryModuleBalancesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryModuleBalancesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryModuleBalancesResponse) 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 *QueryModuleBalancesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryModuleBalancesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Coins) > 0 { + for iNdEx := len(m.Coins) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Coins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryBonusRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.User) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBonusResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.TotalBonus.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryBuyElysEstRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SpendingToken) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = m.TokenAmount.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryBuyElysEstResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ElysAmount.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.BonusAmount.Size() + n += 1 + l + sovQuery(uint64(l)) + if len(m.Orders) > 0 { + for _, e := range m.Orders { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryReturnElysEstRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.OrderId != 0 { + n += 1 + sovQuery(uint64(m.OrderId)) + } + l = m.ElysAmount.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryReturnElysEstResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryOrdersRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.User) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOrdersResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Purchases) > 0 { + for _, e := range m.Purchases { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryAllOrdersRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAllOrdersResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Purchases) > 0 { + for _, e := range m.Purchases { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryModuleBalancesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryModuleBalancesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Coins) > 0 { + for _, e := range m.Coins { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) 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 ErrIntOverflowQuery + } + 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: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) 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 ErrIntOverflowQuery + } + 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBonusRequest) 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 ErrIntOverflowQuery + } + 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: QueryBonusRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBonusRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field User", 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.User = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBonusResponse) 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 ErrIntOverflowQuery + } + 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: QueryBonusResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBonusResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalBonus", 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 + } + if err := m.TotalBonus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBuyElysEstRequest) 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 ErrIntOverflowQuery + } + 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: QueryBuyElysEstRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBuyElysEstRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpendingToken", 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.SpendingToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenAmount", 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 + } + if err := m.TokenAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBuyElysEstResponse) 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 ErrIntOverflowQuery + } + 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: QueryBuyElysEstResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBuyElysEstResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ElysAmount", 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 + } + if err := m.ElysAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BonusAmount", 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 + } + if err := m.BonusAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Orders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Orders = append(m.Orders, Purchase{}) + if err := m.Orders[len(m.Orders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryReturnElysEstRequest) 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 ErrIntOverflowQuery + } + 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: QueryReturnElysEstRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryReturnElysEstRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderId", wireType) + } + m.OrderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OrderId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ElysAmount", 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 + } + if err := m.ElysAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryReturnElysEstResponse) 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 ErrIntOverflowQuery + } + 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: QueryReturnElysEstResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryReturnElysEstResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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 + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOrdersRequest) 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 ErrIntOverflowQuery + } + 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: QueryOrdersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOrdersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field User", 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.User = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOrdersResponse) 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 ErrIntOverflowQuery + } + 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: QueryOrdersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOrdersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Purchases", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Purchases = append(m.Purchases, Purchase{}) + if err := m.Purchases[len(m.Purchases)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllOrdersRequest) 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 ErrIntOverflowQuery + } + 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: QueryAllOrdersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllOrdersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllOrdersResponse) 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 ErrIntOverflowQuery + } + 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: QueryAllOrdersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllOrdersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Purchases", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Purchases = append(m.Purchases, Purchase{}) + if err := m.Purchases[len(m.Purchases)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryModuleBalancesRequest) 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 ErrIntOverflowQuery + } + 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: QueryModuleBalancesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryModuleBalancesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryModuleBalancesResponse) 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 ErrIntOverflowQuery + } + 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: QueryModuleBalancesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryModuleBalancesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coins", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Coins = append(m.Coins, types.Coin{}) + if err := m.Coins[len(m.Coins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/launchpad/types/query.pb.gw.go b/x/launchpad/types/query.pb.gw.go new file mode 100644 index 000000000..56dacad10 --- /dev/null +++ b/x/launchpad/types/query.pb.gw.go @@ -0,0 +1,592 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: elys/launchpad/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Bonus_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Bonus_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBonusRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Bonus_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Bonus(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Bonus_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBonusRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Bonus_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Bonus(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_BuyElysEst_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_BuyElysEst_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBuyElysEstRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BuyElysEst_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.BuyElysEst(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_BuyElysEst_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBuyElysEstRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BuyElysEst_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.BuyElysEst(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_ReturnElysEst_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_ReturnElysEst_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryReturnElysEstRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ReturnElysEst_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ReturnElysEst(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ReturnElysEst_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryReturnElysEstRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ReturnElysEst_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ReturnElysEst(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Orders_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Orders_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOrdersRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Orders_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Orders(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Orders_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOrdersRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Orders_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Orders(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_AllOrders_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllOrdersRequest + var metadata runtime.ServerMetadata + + msg, err := client.AllOrders(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AllOrders_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllOrdersRequest + var metadata runtime.ServerMetadata + + msg, err := server.AllOrders(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_ModuleBalances_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryModuleBalancesRequest + var metadata runtime.ServerMetadata + + msg, err := client.ModuleBalances(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ModuleBalances_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryModuleBalancesRequest + var metadata runtime.ServerMetadata + + msg, err := server.ModuleBalances(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_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) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_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_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Bonus_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) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Bonus_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_Bonus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BuyElysEst_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) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_BuyElysEst_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_BuyElysEst_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ReturnElysEst_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) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ReturnElysEst_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_ReturnElysEst_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Orders_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) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Orders_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_Orders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllOrders_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) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_AllOrders_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_AllOrders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ModuleBalances_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) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ModuleBalances_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_ModuleBalances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_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) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_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_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Bonus_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) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Bonus_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_Bonus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BuyElysEst_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) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_BuyElysEst_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_BuyElysEst_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ReturnElysEst_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) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_ReturnElysEst_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_ReturnElysEst_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Orders_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) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Orders_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_Orders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllOrders_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) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_AllOrders_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_AllOrders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ModuleBalances_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) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_ModuleBalances_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_ModuleBalances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"elys-network", "elys", "launchpad", "params"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Bonus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"elys-network", "elys", "launchpad", "bonus"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_BuyElysEst_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"elys-network", "elys", "launchpad", "buy_elys_estimation"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_ReturnElysEst_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"elys-network", "elys", "launchpad", "return_elys_estimation"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Orders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"elys-network", "elys", "launchpad", "orders"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_AllOrders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"elys-network", "elys", "launchpad", "all_orders"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_ModuleBalances_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"elys-network", "elys", "launchpad", "module_balances"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_Bonus_0 = runtime.ForwardResponseMessage + + forward_Query_BuyElysEst_0 = runtime.ForwardResponseMessage + + forward_Query_ReturnElysEst_0 = runtime.ForwardResponseMessage + + forward_Query_Orders_0 = runtime.ForwardResponseMessage + + forward_Query_AllOrders_0 = runtime.ForwardResponseMessage + + forward_Query_ModuleBalances_0 = runtime.ForwardResponseMessage +) diff --git a/x/launchpad/types/tx.pb.go b/x/launchpad/types/tx.pb.go new file mode 100644 index 000000000..25a3635c0 --- /dev/null +++ b/x/launchpad/types/tx.pb.go @@ -0,0 +1,2309 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: elys/launchpad/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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 MsgBuyElys struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + SpendingToken string `protobuf:"bytes,2,opt,name=spending_token,json=spendingToken,proto3" json:"spending_token,omitempty"` + TokenAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=token_amount,json=tokenAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"token_amount"` +} + +func (m *MsgBuyElys) Reset() { *m = MsgBuyElys{} } +func (m *MsgBuyElys) String() string { return proto.CompactTextString(m) } +func (*MsgBuyElys) ProtoMessage() {} +func (*MsgBuyElys) Descriptor() ([]byte, []int) { + return fileDescriptor_43169201ef24de22, []int{0} +} +func (m *MsgBuyElys) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBuyElys) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBuyElys.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 *MsgBuyElys) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBuyElys.Merge(m, src) +} +func (m *MsgBuyElys) XXX_Size() int { + return m.Size() +} +func (m *MsgBuyElys) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBuyElys.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBuyElys proto.InternalMessageInfo + +func (m *MsgBuyElys) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgBuyElys) GetSpendingToken() string { + if m != nil { + return m.SpendingToken + } + return "" +} + +type MsgBuyElysResponse struct { + OrderIds []uint64 `protobuf:"varint,1,rep,packed,name=order_ids,json=orderIds,proto3" json:"order_ids,omitempty"` +} + +func (m *MsgBuyElysResponse) Reset() { *m = MsgBuyElysResponse{} } +func (m *MsgBuyElysResponse) String() string { return proto.CompactTextString(m) } +func (*MsgBuyElysResponse) ProtoMessage() {} +func (*MsgBuyElysResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_43169201ef24de22, []int{1} +} +func (m *MsgBuyElysResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBuyElysResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBuyElysResponse.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 *MsgBuyElysResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBuyElysResponse.Merge(m, src) +} +func (m *MsgBuyElysResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgBuyElysResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBuyElysResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBuyElysResponse proto.InternalMessageInfo + +func (m *MsgBuyElysResponse) GetOrderIds() []uint64 { + if m != nil { + return m.OrderIds + } + return nil +} + +type MsgReturnElys struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + OrderId uint64 `protobuf:"varint,2,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"` + ReturnElysAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=return_elys_amount,json=returnElysAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"return_elys_amount"` +} + +func (m *MsgReturnElys) Reset() { *m = MsgReturnElys{} } +func (m *MsgReturnElys) String() string { return proto.CompactTextString(m) } +func (*MsgReturnElys) ProtoMessage() {} +func (*MsgReturnElys) Descriptor() ([]byte, []int) { + return fileDescriptor_43169201ef24de22, []int{2} +} +func (m *MsgReturnElys) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReturnElys) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReturnElys.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 *MsgReturnElys) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReturnElys.Merge(m, src) +} +func (m *MsgReturnElys) XXX_Size() int { + return m.Size() +} +func (m *MsgReturnElys) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReturnElys.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReturnElys proto.InternalMessageInfo + +func (m *MsgReturnElys) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgReturnElys) GetOrderId() uint64 { + if m != nil { + return m.OrderId + } + return 0 +} + +type MsgReturnElysResponse struct { +} + +func (m *MsgReturnElysResponse) Reset() { *m = MsgReturnElysResponse{} } +func (m *MsgReturnElysResponse) String() string { return proto.CompactTextString(m) } +func (*MsgReturnElysResponse) ProtoMessage() {} +func (*MsgReturnElysResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_43169201ef24de22, []int{3} +} +func (m *MsgReturnElysResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReturnElysResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReturnElysResponse.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 *MsgReturnElysResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReturnElysResponse.Merge(m, src) +} +func (m *MsgReturnElysResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgReturnElysResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReturnElysResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReturnElysResponse proto.InternalMessageInfo + +type MsgWithdrawRaised struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Coins []types.Coin `protobuf:"bytes,2,rep,name=coins,proto3" json:"coins"` +} + +func (m *MsgWithdrawRaised) Reset() { *m = MsgWithdrawRaised{} } +func (m *MsgWithdrawRaised) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawRaised) ProtoMessage() {} +func (*MsgWithdrawRaised) Descriptor() ([]byte, []int) { + return fileDescriptor_43169201ef24de22, []int{4} +} +func (m *MsgWithdrawRaised) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawRaised) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawRaised.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 *MsgWithdrawRaised) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawRaised.Merge(m, src) +} +func (m *MsgWithdrawRaised) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawRaised) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawRaised.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawRaised proto.InternalMessageInfo + +func (m *MsgWithdrawRaised) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgWithdrawRaised) GetCoins() []types.Coin { + if m != nil { + return m.Coins + } + return nil +} + +type MsgWithdrawRaisedResponse struct { +} + +func (m *MsgWithdrawRaisedResponse) Reset() { *m = MsgWithdrawRaisedResponse{} } +func (m *MsgWithdrawRaisedResponse) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawRaisedResponse) ProtoMessage() {} +func (*MsgWithdrawRaisedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_43169201ef24de22, []int{5} +} +func (m *MsgWithdrawRaisedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawRaisedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawRaisedResponse.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 *MsgWithdrawRaisedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawRaisedResponse.Merge(m, src) +} +func (m *MsgWithdrawRaisedResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawRaisedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawRaisedResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawRaisedResponse proto.InternalMessageInfo + +type MsgDepositElysToken struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Coin types.Coin `protobuf:"bytes,2,opt,name=coin,proto3" json:"coin"` +} + +func (m *MsgDepositElysToken) Reset() { *m = MsgDepositElysToken{} } +func (m *MsgDepositElysToken) String() string { return proto.CompactTextString(m) } +func (*MsgDepositElysToken) ProtoMessage() {} +func (*MsgDepositElysToken) Descriptor() ([]byte, []int) { + return fileDescriptor_43169201ef24de22, []int{6} +} +func (m *MsgDepositElysToken) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDepositElysToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDepositElysToken.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 *MsgDepositElysToken) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDepositElysToken.Merge(m, src) +} +func (m *MsgDepositElysToken) XXX_Size() int { + return m.Size() +} +func (m *MsgDepositElysToken) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDepositElysToken.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDepositElysToken proto.InternalMessageInfo + +func (m *MsgDepositElysToken) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgDepositElysToken) GetCoin() types.Coin { + if m != nil { + return m.Coin + } + return types.Coin{} +} + +type MsgDepositElysTokenResponse struct { +} + +func (m *MsgDepositElysTokenResponse) Reset() { *m = MsgDepositElysTokenResponse{} } +func (m *MsgDepositElysTokenResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDepositElysTokenResponse) ProtoMessage() {} +func (*MsgDepositElysTokenResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_43169201ef24de22, []int{7} +} +func (m *MsgDepositElysTokenResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDepositElysTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDepositElysTokenResponse.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 *MsgDepositElysTokenResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDepositElysTokenResponse.Merge(m, src) +} +func (m *MsgDepositElysTokenResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDepositElysTokenResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDepositElysTokenResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDepositElysTokenResponse proto.InternalMessageInfo + +type MsgUpdateParams struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_43169201ef24de22, []int{8} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_43169201ef24de22, []int{9} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgBuyElys)(nil), "elys.launchpad.MsgBuyElys") + proto.RegisterType((*MsgBuyElysResponse)(nil), "elys.launchpad.MsgBuyElysResponse") + proto.RegisterType((*MsgReturnElys)(nil), "elys.launchpad.MsgReturnElys") + proto.RegisterType((*MsgReturnElysResponse)(nil), "elys.launchpad.MsgReturnElysResponse") + proto.RegisterType((*MsgWithdrawRaised)(nil), "elys.launchpad.MsgWithdrawRaised") + proto.RegisterType((*MsgWithdrawRaisedResponse)(nil), "elys.launchpad.MsgWithdrawRaisedResponse") + proto.RegisterType((*MsgDepositElysToken)(nil), "elys.launchpad.MsgDepositElysToken") + proto.RegisterType((*MsgDepositElysTokenResponse)(nil), "elys.launchpad.MsgDepositElysTokenResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "elys.launchpad.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "elys.launchpad.MsgUpdateParamsResponse") +} + +func init() { proto.RegisterFile("elys/launchpad/tx.proto", fileDescriptor_43169201ef24de22) } + +var fileDescriptor_43169201ef24de22 = []byte{ + // 633 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xdd, 0x6e, 0xd3, 0x30, + 0x18, 0x6d, 0xd6, 0xb2, 0x9f, 0x6f, 0x3f, 0x8c, 0x00, 0x5b, 0x9b, 0x6e, 0xd9, 0x08, 0x1a, 0x0c, + 0xa1, 0x39, 0xda, 0x06, 0x0f, 0x40, 0x01, 0x89, 0x5d, 0x54, 0x82, 0x08, 0x04, 0x42, 0x88, 0xca, + 0x6d, 0x2c, 0x37, 0x5a, 0x6b, 0x47, 0xb1, 0xcb, 0xd6, 0xb7, 0xe0, 0x09, 0x10, 0x0f, 0xc3, 0xc5, + 0x2e, 0x77, 0x89, 0xb8, 0x98, 0xd0, 0xf6, 0x22, 0xc8, 0x8e, 0x9b, 0xfe, 0xac, 0xdd, 0x26, 0x71, + 0x95, 0xe4, 0x3b, 0xc7, 0xe7, 0x3b, 0x5f, 0x7c, 0x6c, 0x58, 0x25, 0xad, 0xae, 0xf0, 0x5b, 0xb8, + 0xc3, 0x1a, 0xcd, 0x18, 0x87, 0xbe, 0x3c, 0x46, 0x71, 0xc2, 0x25, 0xb7, 0x97, 0x14, 0x80, 0x32, + 0xc0, 0x71, 0x1b, 0x5c, 0xb4, 0xb9, 0xf0, 0xeb, 0x58, 0x10, 0xff, 0xdb, 0x6e, 0x9d, 0x48, 0xbc, + 0xeb, 0x37, 0x78, 0xc4, 0x52, 0xbe, 0x73, 0x8f, 0x72, 0xca, 0xf5, 0xab, 0xaf, 0xde, 0x4c, 0x75, + 0x8d, 0x72, 0x4e, 0x5b, 0xc4, 0xc7, 0x71, 0xe4, 0x63, 0xc6, 0xb8, 0xc4, 0x32, 0xe2, 0x4c, 0x18, + 0xb4, 0x3c, 0xd2, 0x3c, 0xc6, 0x09, 0x6e, 0x1b, 0xd0, 0xfb, 0x61, 0x01, 0x54, 0x05, 0xad, 0x74, + 0xba, 0xaf, 0x5b, 0x5d, 0x61, 0xaf, 0xc0, 0xb4, 0x20, 0x2c, 0x24, 0x49, 0xd1, 0xda, 0xb4, 0xb6, + 0xe7, 0x02, 0xf3, 0x65, 0x6f, 0xc1, 0x92, 0x88, 0x09, 0x0b, 0x23, 0x46, 0x6b, 0x92, 0x1f, 0x12, + 0x56, 0x9c, 0xd2, 0xf8, 0x62, 0xaf, 0xfa, 0x5e, 0x15, 0xed, 0x77, 0xb0, 0xa0, 0xd1, 0x1a, 0x6e, + 0xf3, 0x0e, 0x93, 0xc5, 0xbc, 0x22, 0x55, 0xd0, 0xc9, 0xd9, 0x46, 0xee, 0xcf, 0xd9, 0xc6, 0x23, + 0x1a, 0xc9, 0x66, 0xa7, 0x8e, 0x1a, 0xbc, 0xed, 0x9b, 0x39, 0xd3, 0xc7, 0x8e, 0x08, 0x0f, 0x7d, + 0xd9, 0x8d, 0x89, 0x40, 0x07, 0x4c, 0x06, 0xf3, 0x5a, 0xe3, 0x85, 0x96, 0xf0, 0x76, 0xc1, 0xee, + 0xfb, 0x0b, 0x88, 0x88, 0x39, 0x13, 0xc4, 0x2e, 0xc3, 0x1c, 0x4f, 0x42, 0x92, 0xd4, 0xa2, 0x50, + 0x14, 0xad, 0xcd, 0xfc, 0x76, 0x21, 0x98, 0xd5, 0x85, 0x83, 0x50, 0x78, 0x3f, 0x2d, 0x58, 0xac, + 0x0a, 0x1a, 0x10, 0xd9, 0x49, 0xd8, 0x95, 0x63, 0x95, 0x60, 0xb6, 0x27, 0xa3, 0x07, 0x2a, 0x04, + 0x33, 0x46, 0xc5, 0xfe, 0x02, 0x76, 0xa2, 0x05, 0x6a, 0xea, 0xf7, 0xfd, 0xdf, 0x40, 0xcb, 0x49, + 0x66, 0xc5, 0x4c, 0xb5, 0x0a, 0xf7, 0x87, 0x1c, 0xf6, 0x06, 0xf3, 0xea, 0x70, 0xa7, 0x2a, 0xe8, + 0xc7, 0x48, 0x36, 0xc3, 0x04, 0x1f, 0x05, 0x38, 0x12, 0x24, 0x9c, 0x68, 0xff, 0x39, 0xdc, 0x52, + 0xd9, 0x10, 0xc5, 0xa9, 0xcd, 0xfc, 0xf6, 0xfc, 0x5e, 0x09, 0xa5, 0xdd, 0x91, 0x4a, 0x0f, 0x32, + 0xe9, 0x41, 0x2f, 0x79, 0xc4, 0x2a, 0x05, 0xe5, 0x38, 0x48, 0xd9, 0x5e, 0x19, 0x4a, 0x97, 0x7a, + 0x0c, 0x18, 0xb8, 0x5b, 0x15, 0xf4, 0x15, 0x89, 0xb9, 0x88, 0xa4, 0xb2, 0x96, 0xee, 0xec, 0x24, + 0x0b, 0xfb, 0x50, 0x50, 0xa2, 0xfa, 0xef, 0xdd, 0xc0, 0x81, 0x26, 0x7b, 0xeb, 0x50, 0x1e, 0xd3, + 0x23, 0xb3, 0x40, 0xe0, 0x76, 0x55, 0xd0, 0x0f, 0x71, 0x88, 0x25, 0x79, 0xab, 0xc3, 0x6a, 0xaf, + 0xc1, 0x1c, 0xee, 0xc8, 0x26, 0x4f, 0x22, 0xd9, 0x35, 0x0e, 0xfa, 0x05, 0xfb, 0x19, 0x4c, 0xa7, + 0xa1, 0x36, 0x36, 0x56, 0xd0, 0xf0, 0xb1, 0x42, 0xa9, 0x8a, 0xf1, 0x60, 0xb8, 0x5e, 0x09, 0x56, + 0x47, 0xda, 0xf4, 0x1c, 0xec, 0xfd, 0xca, 0x43, 0xbe, 0x2a, 0xa8, 0x7d, 0x00, 0x33, 0xbd, 0x93, + 0xe1, 0x8c, 0x6a, 0xf6, 0x53, 0xe9, 0x78, 0x93, 0xb1, 0x2c, 0xb1, 0x01, 0xc0, 0x40, 0x20, 0xd7, + 0xc7, 0xac, 0xe8, 0xc3, 0xce, 0xd6, 0x95, 0x70, 0xa6, 0x19, 0xc2, 0xf2, 0xa5, 0x8d, 0x7a, 0x38, + 0x66, 0xe9, 0x28, 0xc9, 0x79, 0x7a, 0x03, 0x52, 0xd6, 0xe5, 0x2b, 0x2c, 0x8d, 0xe4, 0xf1, 0xc1, + 0x98, 0xe5, 0xc3, 0x14, 0xe7, 0xc9, 0xb5, 0x94, 0x4c, 0xff, 0x13, 0x2c, 0x0c, 0xed, 0xf5, 0xc6, + 0x98, 0xa5, 0x83, 0x04, 0xe7, 0xf1, 0x35, 0x84, 0x9e, 0x72, 0xe5, 0xcd, 0xc9, 0xb9, 0x6b, 0x9d, + 0x9e, 0xbb, 0xd6, 0xdf, 0x73, 0xd7, 0xfa, 0x7e, 0xe1, 0xe6, 0x4e, 0x2f, 0xdc, 0xdc, 0xef, 0x0b, + 0x37, 0xf7, 0x19, 0x0d, 0x9c, 0x5c, 0x25, 0xb6, 0xc3, 0x88, 0x3c, 0xe2, 0xc9, 0xa1, 0xfe, 0xf0, + 0x8f, 0x07, 0xaf, 0x6a, 0x75, 0x8a, 0xeb, 0xd3, 0xfa, 0xb6, 0xdc, 0xff, 0x17, 0x00, 0x00, 0xff, + 0xff, 0xae, 0xc7, 0x9c, 0xdc, 0xc9, 0x05, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + BuyElys(ctx context.Context, in *MsgBuyElys, opts ...grpc.CallOption) (*MsgBuyElysResponse, error) + ReturnElys(ctx context.Context, in *MsgReturnElys, opts ...grpc.CallOption) (*MsgReturnElysResponse, error) + DepositElysToken(ctx context.Context, in *MsgDepositElysToken, opts ...grpc.CallOption) (*MsgDepositElysTokenResponse, error) + WithdrawRaised(ctx context.Context, in *MsgWithdrawRaised, opts ...grpc.CallOption) (*MsgWithdrawRaisedResponse, error) + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) BuyElys(ctx context.Context, in *MsgBuyElys, opts ...grpc.CallOption) (*MsgBuyElysResponse, error) { + out := new(MsgBuyElysResponse) + err := c.cc.Invoke(ctx, "/elys.launchpad.Msg/BuyElys", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ReturnElys(ctx context.Context, in *MsgReturnElys, opts ...grpc.CallOption) (*MsgReturnElysResponse, error) { + out := new(MsgReturnElysResponse) + err := c.cc.Invoke(ctx, "/elys.launchpad.Msg/ReturnElys", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DepositElysToken(ctx context.Context, in *MsgDepositElysToken, opts ...grpc.CallOption) (*MsgDepositElysTokenResponse, error) { + out := new(MsgDepositElysTokenResponse) + err := c.cc.Invoke(ctx, "/elys.launchpad.Msg/DepositElysToken", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) WithdrawRaised(ctx context.Context, in *MsgWithdrawRaised, opts ...grpc.CallOption) (*MsgWithdrawRaisedResponse, error) { + out := new(MsgWithdrawRaisedResponse) + err := c.cc.Invoke(ctx, "/elys.launchpad.Msg/WithdrawRaised", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/elys.launchpad.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + BuyElys(context.Context, *MsgBuyElys) (*MsgBuyElysResponse, error) + ReturnElys(context.Context, *MsgReturnElys) (*MsgReturnElysResponse, error) + DepositElysToken(context.Context, *MsgDepositElysToken) (*MsgDepositElysTokenResponse, error) + WithdrawRaised(context.Context, *MsgWithdrawRaised) (*MsgWithdrawRaisedResponse, error) + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) BuyElys(ctx context.Context, req *MsgBuyElys) (*MsgBuyElysResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BuyElys not implemented") +} +func (*UnimplementedMsgServer) ReturnElys(ctx context.Context, req *MsgReturnElys) (*MsgReturnElysResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReturnElys not implemented") +} +func (*UnimplementedMsgServer) DepositElysToken(ctx context.Context, req *MsgDepositElysToken) (*MsgDepositElysTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DepositElysToken not implemented") +} +func (*UnimplementedMsgServer) WithdrawRaised(ctx context.Context, req *MsgWithdrawRaised) (*MsgWithdrawRaisedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method WithdrawRaised not implemented") +} +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_BuyElys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgBuyElys) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).BuyElys(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.launchpad.Msg/BuyElys", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).BuyElys(ctx, req.(*MsgBuyElys)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ReturnElys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgReturnElys) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ReturnElys(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.launchpad.Msg/ReturnElys", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ReturnElys(ctx, req.(*MsgReturnElys)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DepositElysToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDepositElysToken) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DepositElysToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.launchpad.Msg/DepositElysToken", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DepositElysToken(ctx, req.(*MsgDepositElysToken)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_WithdrawRaised_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgWithdrawRaised) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).WithdrawRaised(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.launchpad.Msg/WithdrawRaised", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).WithdrawRaised(ctx, req.(*MsgWithdrawRaised)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.launchpad.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "elys.launchpad.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "BuyElys", + Handler: _Msg_BuyElys_Handler, + }, + { + MethodName: "ReturnElys", + Handler: _Msg_ReturnElys_Handler, + }, + { + MethodName: "DepositElysToken", + Handler: _Msg_DepositElysToken_Handler, + }, + { + MethodName: "WithdrawRaised", + Handler: _Msg_WithdrawRaised_Handler, + }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "elys/launchpad/tx.proto", +} + +func (m *MsgBuyElys) 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 *MsgBuyElys) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBuyElys) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.TokenAmount.Size() + i -= size + if _, err := m.TokenAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.SpendingToken) > 0 { + i -= len(m.SpendingToken) + copy(dAtA[i:], m.SpendingToken) + i = encodeVarintTx(dAtA, i, uint64(len(m.SpendingToken))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgBuyElysResponse) 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 *MsgBuyElysResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBuyElysResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OrderIds) > 0 { + dAtA2 := make([]byte, len(m.OrderIds)*10) + var j1 int + for _, num := range m.OrderIds { + for num >= 1<<7 { + dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j1++ + } + dAtA2[j1] = uint8(num) + j1++ + } + i -= j1 + copy(dAtA[i:], dAtA2[:j1]) + i = encodeVarintTx(dAtA, i, uint64(j1)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgReturnElys) 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 *MsgReturnElys) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgReturnElys) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.ReturnElysAmount.Size() + i -= size + if _, err := m.ReturnElysAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.OrderId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.OrderId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgReturnElysResponse) 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 *MsgReturnElysResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgReturnElysResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawRaised) 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 *MsgWithdrawRaised) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawRaised) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Coins) > 0 { + for iNdEx := len(m.Coins) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Coins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawRaisedResponse) 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 *MsgWithdrawRaisedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawRaisedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDepositElysToken) 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 *MsgDepositElysToken) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDepositElysToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Coin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDepositElysTokenResponse) 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 *MsgDepositElysTokenResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDepositElysTokenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgBuyElys) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.SpendingToken) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.TokenAmount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgBuyElysResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.OrderIds) > 0 { + l = 0 + for _, e := range m.OrderIds { + l += sovTx(uint64(e)) + } + n += 1 + sovTx(uint64(l)) + l + } + return n +} + +func (m *MsgReturnElys) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.OrderId != 0 { + n += 1 + sovTx(uint64(m.OrderId)) + } + l = m.ReturnElysAmount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgReturnElysResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgWithdrawRaised) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Coins) > 0 { + for _, e := range m.Coins { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgWithdrawRaisedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDepositElysToken) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Coin.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgDepositElysTokenResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgBuyElys) 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 ErrIntOverflowTx + } + 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: MsgBuyElys: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBuyElys: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpendingToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SpendingToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TokenAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgBuyElysResponse) 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 ErrIntOverflowTx + } + 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: MsgBuyElysResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBuyElysResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OrderIds = append(m.OrderIds, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.OrderIds) == 0 { + m.OrderIds = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OrderIds = append(m.OrderIds, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field OrderIds", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgReturnElys) 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 ErrIntOverflowTx + } + 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: MsgReturnElys: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgReturnElys: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderId", wireType) + } + m.OrderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OrderId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReturnElysAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ReturnElysAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgReturnElysResponse) 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 ErrIntOverflowTx + } + 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: MsgReturnElysResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgReturnElysResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawRaised) 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 ErrIntOverflowTx + } + 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: MsgWithdrawRaised: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawRaised: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coins", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Coins = append(m.Coins, types.Coin{}) + if err := m.Coins[len(m.Coins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawRaisedResponse) 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 ErrIntOverflowTx + } + 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: MsgWithdrawRaisedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawRaisedResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDepositElysToken) 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 ErrIntOverflowTx + } + 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: MsgDepositElysToken: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDepositElysToken: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDepositElysTokenResponse) 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 ErrIntOverflowTx + } + 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: MsgDepositElysTokenResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDepositElysTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParams) 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 ErrIntOverflowTx + } + 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: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) 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 ErrIntOverflowTx + } + 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: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/launchpad/types/types.go b/x/launchpad/types/types.go new file mode 100644 index 000000000..ab1254f4c --- /dev/null +++ b/x/launchpad/types/types.go @@ -0,0 +1 @@ +package types diff --git a/x/oracle/types/errors.go b/x/oracle/types/errors.go index bb605a668..bed2b0d2a 100644 --- a/x/oracle/types/errors.go +++ b/x/oracle/types/errors.go @@ -8,10 +8,11 @@ import ( // x/oracle module sentinel errors var ( - ErrNotAvailable = errorsmod.Register(ModuleName, 1500, "sample error") + ErrNotAvailable = errorsmod.Register(ModuleName, 1500, "Request not available") ErrInvalidPacketTimeout = errorsmod.Register(ModuleName, 1501, "invalid packet timeout") ErrInvalidVersion = errorsmod.Register(ModuleName, 1502, "invalid version") ErrNotAPriceFeeder = errorsmod.Register(ModuleName, 1503, "not a price feeder") ErrPriceFeederNotActive = errorsmod.Register(ModuleName, 1504, "price feeder is not active") ErrNotModuleAdmin = errorsmod.Register(ModuleName, 1505, "not a module admin") + ErrPriceNotSet = errorsmod.Register(ModuleName, 1506, "Price not set") )