Skip to content

Commit

Permalink
Merge branch 'main' into hallazzang/fix-typos
Browse files Browse the repository at this point in the history
  • Loading branch information
hallazzang committed Jul 15, 2024
2 parents dc500fa + 2c0d9bd commit 44b4c7b
Show file tree
Hide file tree
Showing 28 changed files with 14,410 additions and 168 deletions.
21 changes: 19 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ import (
"github.com/milkyway-labs/milkyway/x/records"
recordskeeper "github.com/milkyway-labs/milkyway/x/records/keeper"
recordstypes "github.com/milkyway-labs/milkyway/x/records/types"
"github.com/milkyway-labs/milkyway/x/restaking"
restakingkeeper "github.com/milkyway-labs/milkyway/x/restaking/keeper"
restakingtypes "github.com/milkyway-labs/milkyway/x/restaking/types"
"github.com/milkyway-labs/milkyway/x/services"
serviceskeeper "github.com/milkyway-labs/milkyway/x/services/keeper"
servicestypes "github.com/milkyway-labs/milkyway/x/services/types"
Expand Down Expand Up @@ -289,6 +292,7 @@ type MilkyWayApp struct {
ServicesKeeper *serviceskeeper.Keeper
OperatorsKeeper *operatorskeeper.Keeper
PoolsKeeper *poolskeeper.Keeper
RestakingKeeper *restakingkeeper.Keeper

// make scoped keepers public for test purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -352,7 +356,7 @@ func NewMilkyWayApp(
icacallbackstypes.StoreKey, recordstypes.StoreKey, stakeibctypes.StoreKey,

// Custom modules
servicestypes.StoreKey, operatorstypes.StoreKey, poolstypes.StoreKey,
servicestypes.StoreKey, operatorstypes.StoreKey, poolstypes.StoreKey, restakingtypes.StoreKey,
)
tkeys := storetypes.NewTransientStoreKeys(forwardingtypes.TransientStoreKey)
memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
Expand Down Expand Up @@ -884,6 +888,16 @@ func NewMilkyWayApp(
keys[poolstypes.StoreKey],
app.AccountKeeper,
)
app.RestakingKeeper = restakingkeeper.NewKeeper(
app.appCodec,
keys[restakingtypes.StoreKey],
app.AccountKeeper,
app.BankKeeper,
app.PoolsKeeper,
app.OperatorsKeeper,
app.ServicesKeeper,
authorityAddr,
)

/**** Module Options ****/

Expand Down Expand Up @@ -934,6 +948,7 @@ func NewMilkyWayApp(
services.NewAppModule(appCodec, app.ServicesKeeper),
operators.NewAppModule(appCodec, app.OperatorsKeeper),
pools.NewAppModule(appCodec, app.PoolsKeeper),
restaking.NewAppModule(appCodec, app.RestakingKeeper),
)

if err := app.setupIndexer(appOpts, homePath, ac, vc, appCodec); err != nil {
Expand Down Expand Up @@ -975,6 +990,7 @@ func NewMilkyWayApp(
servicestypes.ModuleName,
operatorstypes.ModuleName,
poolstypes.ModuleName,
restakingtypes.ModuleName,
)

app.ModuleManager.SetOrderEndBlockers(
Expand All @@ -992,6 +1008,7 @@ func NewMilkyWayApp(
servicestypes.ModuleName,
operatorstypes.ModuleName,
poolstypes.ModuleName,
restakingtypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand All @@ -1011,7 +1028,7 @@ func NewMilkyWayApp(
stakeibctypes.ModuleName, epochstypes.ModuleName, icqtypes.ModuleName,
recordstypes.ModuleName, ratelimittypes.ModuleName, icacallbackstypes.ModuleName,

servicestypes.ModuleName, operatorstypes.ModuleName, poolstypes.ModuleName,
servicestypes.ModuleName, operatorstypes.ModuleName, poolstypes.ModuleName, restakingtypes.ModuleName,
}

app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...)
Expand Down
6 changes: 3 additions & 3 deletions proto/milkyway/pools/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ option go_package = "github.com/milkyway-labs/milkyway/x/pools/types";
service Query {
// PoolById defines a gRPC query method that returns the pool by the given ID.
rpc PoolById(QueryPoolByIdRequest) returns (QueryPoolResponse) {
option (google.api.http).get = "/milkyway/pool/v1/pool/{pool_id}";
option (google.api.http).get = "/milkyway/pools/v1/pools/{pool_id}";
}

// PoolByDenom defines a gRPC query method that returns the pool by the given
// denom.
rpc PoolByDenom(QueryPoolByDenomRequest) returns (QueryPoolResponse) {
option (google.api.http).get = "/milkyway/pool/v1/pool/denom/{denom}";
option (google.api.http).get = "/milkyway/pools/v1/pool/denom/{denom}";
}

// Pools defines a gRPC query method that returns all pools.
rpc Pools(QueryPoolsRequest) returns (QueryPoolsResponse) {
option (google.api.http).get = "/milkyway/pool/v1/pools";
option (google.api.http).get = "/milkyway/pools/v1/pools";
}
}

Expand Down
47 changes: 46 additions & 1 deletion proto/milkyway/restaking/v1/models.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ message PoolDelegation {
];
}

// PoolDelegationResponse is equivalent to PoolDelegation except that it
// contains a balance in addition to shares which is more suitable for client
// responses.
message PoolDelegationResponse {
option (gogoproto.equal) = false;

PoolDelegation delegation = 1
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];

cosmos.base.v1beta1.Coin balance = 2
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}

// OperatorDelegation represents the bond with tokens held by an account with a
// given operator. It is owned by one delegator, and is associated with a
// operator.
Expand All @@ -48,6 +61,22 @@ message OperatorDelegation {
];
}

// OperatorDelegationResponse is equivalent to OperatorDelegation except that it
// contains a balance in addition to shares which is more suitable for client
// responses.
message OperatorDelegationResponse {
option (gogoproto.equal) = false;

OperatorDelegation delegation = 1
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];

repeated cosmos.base.v1beta1.Coin balance = 2 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
}

// ServiceDelegation represents the bond with tokens held by an account with a
// given service. It is owned by one delegator, and is associated with a
// service.
Expand All @@ -66,4 +95,20 @@ message ServiceDelegation {
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins",
(gogoproto.nullable) = false
];
}
}

// ServiceDelegationResponse is equivalent to ServiceDelegation except that it
// contains a balance in addition to shares which is more suitable for client
// responses.
message ServiceDelegationResponse {
option (gogoproto.equal) = false;

ServiceDelegation delegation = 1
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];

repeated cosmos.base.v1beta1.Coin balance = 2 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
}
Loading

0 comments on commit 44b4c7b

Please sign in to comment.