Skip to content

Commit

Permalink
Merge branch 'special-allocations-init' of https://github.com/tenderm…
Browse files Browse the repository at this point in the history
…int/spn into special-allocations-init
  • Loading branch information
lumtis committed May 16, 2022
2 parents 2b69ac2 + 8658832 commit 99d49b2
Show file tree
Hide file tree
Showing 76 changed files with 7,445 additions and 11 deletions.
36 changes: 29 additions & 7 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ import (
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/cosmos-sdk/x/mint"
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/cosmos/cosmos-sdk/x/params"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
Expand Down Expand Up @@ -125,6 +122,14 @@ import (
participationmodulekeeper "github.com/tendermint/spn/x/participation/keeper"
participationmoduletypes "github.com/tendermint/spn/x/participation/types"

claimmodule "github.com/tendermint/spn/x/claim"
claimmodulekeeper "github.com/tendermint/spn/x/claim/keeper"
claimmoduletypes "github.com/tendermint/spn/x/claim/types"

"github.com/tendermint/spn/x/mint"
mintkeeper "github.com/tendermint/spn/x/mint/keeper"
minttypes "github.com/tendermint/spn/x/mint/types"

// this line is used by starport scaffolding # stargate/app/moduleImport

"github.com/ignite-hq/cli/ignite/pkg/cosmoscmd"
Expand Down Expand Up @@ -174,6 +179,7 @@ var (
transfer.AppModuleBasic{},
vesting.AppModuleBasic{},
participationmodule.AppModuleBasic{},
claimmodule.AppModuleBasic{},
// this line is used by starport scaffolding # stargate/app/moduleBasic
profilemodule.AppModuleBasic{},
launchmodule.AppModuleBasic{},
Expand Down Expand Up @@ -266,6 +272,7 @@ type App struct {
MonitoringpKeeper monitoringpmodulekeeper.Keeper
RewardKeeper rewardmodulekeeper.Keeper
ParticipationKeeper participationmodulekeeper.Keeper
ClaimKeeper claimmodulekeeper.Keeper
// this line is used by starport scaffolding # stargate/app/keeperDeclaration

transferModule transfer.AppModule
Expand Down Expand Up @@ -324,6 +331,7 @@ func New(
rewardmoduletypes.StoreKey,
fundraisingtypes.StoreKey,
participationmoduletypes.StoreKey,
claimmoduletypes.StoreKey,
// this line is used by starport scaffolding # stargate/app/storeKey
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand Down Expand Up @@ -368,14 +376,14 @@ func New(
stakingKeeper := stakingkeeper.NewKeeper(
appCodec, keys[stakingtypes.StoreKey], app.AuthKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName),
)
app.MintKeeper = mintkeeper.NewKeeper(
appCodec, keys[minttypes.StoreKey], app.GetSubspace(minttypes.ModuleName), &stakingKeeper,
app.AuthKeeper, app.BankKeeper, authtypes.FeeCollectorName,
)
app.DistrKeeper = distrkeeper.NewKeeper(
appCodec, keys[distrtypes.StoreKey], app.GetSubspace(distrtypes.ModuleName), app.AuthKeeper, app.BankKeeper,
&stakingKeeper, authtypes.FeeCollectorName, app.ModuleAccountAddrs(),
)
app.MintKeeper = mintkeeper.NewKeeper(
appCodec, keys[minttypes.StoreKey], app.GetSubspace(minttypes.ModuleName), &stakingKeeper,
app.AuthKeeper, app.BankKeeper, app.DistrKeeper, authtypes.FeeCollectorName,
)
app.SlashingKeeper = slashingkeeper.NewKeeper(
appCodec, keys[slashingtypes.StoreKey], &stakingKeeper, app.GetSubspace(slashingtypes.ModuleName),
)
Expand Down Expand Up @@ -520,6 +528,14 @@ func New(
app.StakingKeeper,
)

app.ClaimKeeper = *claimmodulekeeper.NewKeeper(
appCodec,
keys[claimmoduletypes.StoreKey],
keys[claimmoduletypes.MemStoreKey],
app.GetSubspace(claimmoduletypes.ModuleName),
app.BankKeeper,
)

// this line is used by starport scaffolding # stargate/app/keeperDefinition

// Create static IBC router, add transfer route, then set and seal it
Expand Down Expand Up @@ -569,6 +585,7 @@ func New(
rewardmodule.NewAppModule(appCodec, app.RewardKeeper, app.AuthKeeper, app.BankKeeper),
fundraisingmodule.NewAppModule(appCodec, app.FundraisingKeeper, app.AuthKeeper, app.BankKeeper, app.DistrKeeper),
participationmodule.NewAppModule(appCodec, app.ParticipationKeeper, app.AuthKeeper, app.BankKeeper, app.FundraisingKeeper),
claimmodule.NewAppModule(appCodec, app.ClaimKeeper, app.AuthKeeper, app.BankKeeper),
// this line is used by starport scaffolding # stargate/app/appModule
)

Expand Down Expand Up @@ -603,6 +620,7 @@ func New(
monitoringpmoduletypes.ModuleName,
participationmoduletypes.ModuleName,
launchmoduletypes.ModuleName,
claimmoduletypes.ModuleName,
)

app.mm.SetOrderEndBlockers(
Expand Down Expand Up @@ -632,6 +650,7 @@ func New(
monitoringpmoduletypes.ModuleName,
participationmoduletypes.ModuleName,
launchmoduletypes.ModuleName,
claimmoduletypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand Down Expand Up @@ -666,6 +685,7 @@ func New(
rewardmoduletypes.ModuleName,
fundraisingtypes.ModuleName,
participationmoduletypes.ModuleName,
claimmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/initGenesis
)

Expand Down Expand Up @@ -696,6 +716,7 @@ func New(
participationmodule.NewAppModule(appCodec, app.ParticipationKeeper, app.AuthKeeper, app.BankKeeper, app.FundraisingKeeper),
fundraisingmodule.NewAppModule(appCodec, app.FundraisingKeeper, app.AuthKeeper, app.BankKeeper, app.DistrKeeper),
monitoringpModule,
claimmodule.NewAppModule(appCodec, app.ClaimKeeper, app.AuthKeeper, app.BankKeeper),
)
app.sm.RegisterStoreDecoders()

Expand Down Expand Up @@ -890,6 +911,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(rewardmoduletypes.ModuleName)
paramsKeeper.Subspace(fundraisingtypes.ModuleName)
paramsKeeper.Subspace(participationmoduletypes.ModuleName)
paramsKeeper.Subspace(claimmoduletypes.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace

return paramsKeeper
Expand Down
4 changes: 4 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ genesis:
mint:
params:
mint_denom: "uspn"
distribution_proportions:
staking: "0.400000000000000000"
incentives: "0.400000000000000000"
community_pool: "0.200000000000000000"
launch:
params:
revertDelay: "5"
Expand Down
7 changes: 6 additions & 1 deletion localnet/genesis_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,12 @@
"inflation_max": "0.200000000000000000",
"inflation_min": "0.070000000000000000",
"inflation_rate_change": "0.130000000000000000",
"mint_denom": "uspn"
"mint_denom": "uspn",
"distribution_proportions": {
"staking": "0.400000000000000000",
"incentives": "0.400000000000000000",
"community_pool": "0.200000000000000000",
}
}
},
"monitoringc": {
Expand Down
14 changes: 14 additions & 0 deletions proto/claim/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
syntax = "proto3";
package tendermint.spn.claim;

import "gogoproto/gogo.proto";
import "claim/params.proto";
// this line is used by starport scaffolding # genesis/proto/import

option go_package = "github.com/tendermint/spn/x/claim/types";

// GenesisState defines the claim module's genesis state.
message GenesisState {
Params params = 1 [(gogoproto.nullable) = false];
// this line is used by starport scaffolding # genesis/proto/state
}
12 changes: 12 additions & 0 deletions proto/claim/params.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
syntax = "proto3";
package tendermint.spn.claim;

import "gogoproto/gogo.proto";

option go_package = "github.com/tendermint/spn/x/claim/types";

// Params defines the parameters for the module.
message Params {
option (gogoproto.goproto_stringer) = false;

}
30 changes: 30 additions & 0 deletions proto/claim/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
syntax = "proto3";
package tendermint.spn.claim;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "claim/params.proto";
// this line is used by starport scaffolding # 1

option go_package = "github.com/tendermint/spn/x/claim/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 = "/tendermint/spn/claim/params";
}
// this line is used by starport scaffolding # 2
}

// 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];
}

// this line is used by starport scaffolding # 3
13 changes: 13 additions & 0 deletions proto/claim/tx.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";
package tendermint.spn.claim;

// this line is used by starport scaffolding # proto/tx/import

option go_package = "github.com/tendermint/spn/x/claim/types";

// Msg defines the Msg service.
service Msg {
// this line is used by starport scaffolding # proto/tx/rpc
}

// this line is used by starport scaffolding # proto/tx/message
16 changes: 16 additions & 0 deletions proto/mint/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
syntax = "proto3";
package tendermint.spn.mint;

import "gogoproto/gogo.proto";
import "mint/mint.proto";

option go_package = "github.com/tendermint/spn/x/mint/types";

// GenesisState defines the mint module's genesis state.
message GenesisState {
// minter is a space for holding current inflation information.
Minter minter = 1 [(gogoproto.nullable) = false];

// params defines all the paramaters of the module.
Params params = 2 [(gogoproto.nullable) = false];
}
72 changes: 72 additions & 0 deletions proto/mint/mint.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
syntax = "proto3";
package tendermint.spn.mint;

option go_package = "github.com/tendermint/spn/x/mint/types";

import "gogoproto/gogo.proto";

// Minter represents the minting state.
message Minter {
// current annual inflation rate
string inflation = 1
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
// current annual expected provisions
string annual_provisions = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}

message DistributionProportions {
// staking defines the proportion of the minted minted_denom that is to be
// allocated as staking rewards.
string staking = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// incentives defines the proportion of the minted minted_denom that is
// to be allocated as incentives.
string incentives = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// community_pool defines the proportion of the minted minted_denom that is
// to be allocated to the community pool.
string community_pool = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}

// Params holds parameters for the mint module.
message Params {
option (gogoproto.goproto_stringer) = false;

// type of coin to mint
string mint_denom = 1;
// maximum annual change in inflation rate
string inflation_rate_change = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// maximum inflation rate
string inflation_max = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// minimum inflation rate
string inflation_min = 4 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// goal of percent bonded atoms
string goal_bonded = 5 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// expected blocks per year
uint64 blocks_per_year = 6;
// distribution_proportions defines the proportion of the minted denom
DistributionProportions distribution_proportions = 7
[ (gogoproto.nullable) = false ];
}
57 changes: 57 additions & 0 deletions proto/mint/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
syntax = "proto3";
package tendermint.spn.mint;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "mint/mint.proto";

option go_package = "github.com/tendermint/spn/x/mint/types";

// Query provides defines the gRPC querier service.
service Query {
// Params returns the total set of minting parameters.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/cosmos/mint/v1beta1/params";
}

// Inflation returns the current minting inflation value.
rpc Inflation(QueryInflationRequest) returns (QueryInflationResponse) {
option (google.api.http).get = "/cosmos/mint/v1beta1/inflation";
}

// AnnualProvisions current minting annual provisions value.
rpc AnnualProvisions(QueryAnnualProvisionsRequest) returns (QueryAnnualProvisionsResponse) {
option (google.api.http).get = "/cosmos/mint/v1beta1/annual_provisions";
}
}

// QueryParamsRequest is the request type for the Query/Params RPC method.
message QueryParamsRequest {}

// QueryParamsResponse is the response type for the Query/Params RPC method.
message QueryParamsResponse {
// params defines the parameters of the module.
Params params = 1 [(gogoproto.nullable) = false];
}

// QueryInflationRequest is the request type for the Query/Inflation RPC method.
message QueryInflationRequest {}

// QueryInflationResponse is the response type for the Query/Inflation RPC
// method.
message QueryInflationResponse {
// inflation is the current minting inflation value.
bytes inflation = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
}

// QueryAnnualProvisionsRequest is the request type for the
// Query/AnnualProvisions RPC method.
message QueryAnnualProvisionsRequest {}

// QueryAnnualProvisionsResponse is the response type for the
// Query/AnnualProvisions RPC method.
message QueryAnnualProvisionsResponse {
// annual_provisions is the current minting annual provisions value.
bytes annual_provisions = 1
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
}
Loading

0 comments on commit 99d49b2

Please sign in to comment.