Skip to content

Commit 8025fd2

Browse files
committed
move bank to x/bank and add missing v50 upgrades
1 parent e4a27ff commit 8025fd2

File tree

16 files changed

+726
-146
lines changed

16 files changed

+726
-146
lines changed

app/app.go

+11-8
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ import (
143143
appkeepers "github.com/initia-labs/miniwasm/app/keepers"
144144
applanes "github.com/initia-labs/miniwasm/app/lanes"
145145

146+
"github.com/initia-labs/miniwasm/x/bank"
147+
bankkeeper "github.com/initia-labs/miniwasm/x/bank/keeper"
146148
"github.com/initia-labs/miniwasm/x/tokenfactory"
147149
tokenfactorykeeper "github.com/initia-labs/miniwasm/x/tokenfactory/keeper"
148150
tokenfactorytypes "github.com/initia-labs/miniwasm/x/tokenfactory/types"
@@ -163,15 +165,15 @@ var (
163165
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
164166
// x/auction's module account must be instantiated upon genesis to accrue auction rewards not
165167
// distributed to proposers
166-
auctiontypes.ModuleName: nil,
167-
opchildtypes.ModuleName: {authtypes.Minter, authtypes.Burner},
168+
auctiontypes.ModuleName: nil,
169+
opchildtypes.ModuleName: {authtypes.Minter, authtypes.Burner},
170+
tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
168171

169172
// slinky oracle permissions
170173
oracletypes.ModuleName: nil,
171174

172175
// this is only for testing
173-
authtypes.Minter: {authtypes.Minter},
174-
tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
176+
authtypes.Minter: {authtypes.Minter},
175177
}
176178
)
177179

@@ -206,7 +208,7 @@ type MinitiaApp struct {
206208

207209
// keepers
208210
AccountKeeper *authkeeper.AccountKeeper
209-
BankKeeper *appkeepers.BaseKeeper
211+
BankKeeper *bankkeeper.Keeper
210212
CapabilityKeeper *capabilitykeeper.Keeper
211213
UpgradeKeeper *upgradekeeper.Keeper
212214
GroupKeeper *groupkeeper.Keeper
@@ -346,7 +348,7 @@ func NewMinitiaApp(
346348
)
347349
app.AccountKeeper = &accountKeeper
348350

349-
bankKeeper := appkeepers.NewBaseKeeper(
351+
bankKeeper := bankkeeper.NewKeeper(
350352
appCodec,
351353
runtime.NewKVStoreService(keys[banktypes.StoreKey]),
352354
app.AccountKeeper,
@@ -680,12 +682,13 @@ func NewMinitiaApp(
680682
contractKeeper := wasmkeeper.NewDefaultPermissionKeeper(app.WasmKeeper)
681683

682684
tokenfactoryKeeper := tokenfactorykeeper.NewKeeper(
685+
ac,
683686
appCodec,
684687
runtime.NewKVStoreService(keys[tokenfactorytypes.StoreKey]),
685688
app.AccountKeeper,
686689
app.BankKeeper,
687690
communityPoolKeeper,
688-
ac,
691+
authorityAddr,
689692
)
690693
app.TokenFactoryKeeper = &tokenfactoryKeeper
691694
app.TokenFactoryKeeper.SetContractKeeper(contractKeeper)
@@ -705,7 +708,7 @@ func NewMinitiaApp(
705708

706709
app.ModuleManager = module.NewManager(
707710
auth.NewAppModule(appCodec, *app.AccountKeeper, nil, nil),
708-
appkeepers.NewBankAppModule(appCodec, *&app.BankKeeper, app.AccountKeeper, nil),
711+
bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, nil),
709712
opchild.NewAppModule(appCodec, *app.OPChildKeeper),
710713
capability.NewAppModule(appCodec, *app.CapabilityKeeper, false),
711714
feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, *app.FeeGrantKeeper, app.interfaceRegistry),

app/keepers/community_pool.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ import (
66
sdk "github.com/cosmos/cosmos-sdk/types"
77
)
88

9-
type BankKeeper interface {
9+
type bankKeeperForCommunityPoolKeeper interface {
1010
SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
1111
}
1212

1313
type CommunityPoolKeeper struct {
14-
bk BankKeeper
14+
bk bankKeeperForCommunityPoolKeeper
1515
feeCollectorName string
1616
}
1717

18-
func NewCommunityPoolKeeper(bk BankKeeper, feeCollectorName string) CommunityPoolKeeper {
18+
func NewCommunityPoolKeeper(bk bankKeeperForCommunityPoolKeeper, feeCollectorName string) CommunityPoolKeeper {
1919
return CommunityPoolKeeper{
2020
bk: bk,
2121
feeCollectorName: feeCollectorName,

go.mod

+7-10
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@ go 1.21.5
55
require (
66
cosmossdk.io/api v0.7.3
77
cosmossdk.io/client/v2 v2.0.0-beta.1
8+
cosmossdk.io/collections v0.4.0
89
cosmossdk.io/core v0.11.0
910
cosmossdk.io/errors v1.0.1
1011
cosmossdk.io/log v1.3.1
1112
cosmossdk.io/math v1.2.0
1213
cosmossdk.io/store v1.0.2
1314
cosmossdk.io/tools/confix v0.1.1
1415
cosmossdk.io/x/feegrant v0.1.0
16+
cosmossdk.io/x/tx v0.13.0
1517
cosmossdk.io/x/upgrade v0.1.1
1618
// we also need to update `LIBWASMVM_VERSION` of images/private/Dockerfile#5
1719
github.com/CosmWasm/wasmd v0.50.0
20+
github.com/CosmWasm/wasmvm v1.5.0
1821
github.com/cometbft/cometbft v0.38.5
1922
github.com/cosmos/cosmos-db v1.0.0
23+
github.com/cosmos/cosmos-proto v1.0.0-beta.4
2024
github.com/cosmos/cosmos-sdk v0.50.3
2125
github.com/cosmos/go-bip39 v1.0.0
2226
github.com/cosmos/gogoproto v1.4.11
@@ -25,7 +29,9 @@ require (
2529
github.com/cosmos/ibc-go/modules/capability v1.0.0
2630
github.com/cosmos/ibc-go/v8 v8.0.0
2731
github.com/golang/mock v1.6.0
32+
github.com/golang/protobuf v1.5.3
2833
github.com/gorilla/mux v1.8.1
34+
github.com/grpc-ecosystem/grpc-gateway v1.16.0
2935
github.com/initia-labs/OPinit v0.2.0-beta.1
3036
github.com/initia-labs/initia v0.2.0-beta.7.1
3137
github.com/pkg/errors v0.9.1
@@ -37,16 +43,6 @@ require (
3743
github.com/spf13/cobra v1.8.0
3844
github.com/spf13/viper v1.18.2
3945
github.com/stretchr/testify v1.8.4
40-
)
41-
42-
require (
43-
cosmossdk.io/collections v0.4.0
44-
cosmossdk.io/x/tx v0.13.0
45-
github.com/CosmWasm/wasmvm v1.5.0
46-
github.com/cosmos/cosmos-proto v1.0.0-beta.4
47-
github.com/golang/protobuf v1.5.3
48-
github.com/grpc-ecosystem/grpc-gateway v1.16.0
49-
github.com/hashicorp/go-metrics v0.5.2
5046
google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0
5147
google.golang.org/grpc v1.61.0
5248
google.golang.org/protobuf v1.32.0
@@ -129,6 +125,7 @@ require (
129125
github.com/hashicorp/go-getter v1.7.3 // indirect
130126
github.com/hashicorp/go-hclog v1.5.0 // indirect
131127
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
128+
github.com/hashicorp/go-metrics v0.5.2 // indirect
132129
github.com/hashicorp/go-plugin v1.5.2 // indirect
133130
github.com/hashicorp/go-safetemp v1.0.0 // indirect
134131
github.com/hashicorp/go-version v1.6.0 // indirect

proto/miniwasm/tokenfactory/v1beta1/tx.proto

+33-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
syntax = "proto3";
22
package miniwasm.tokenfactory.v1beta1;
33

4-
import "gogoproto/gogo.proto";
54
import "amino/amino.proto";
5+
import "cosmos_proto/cosmos.proto";
66
import "cosmos/base/v1beta1/coin.proto";
77
import "cosmos/bank/v1beta1/bank.proto";
88
import "cosmos/msg/v1/msg.proto";
9+
import "gogoproto/gogo.proto";
10+
import "miniwasm/tokenfactory/v1beta1/params.proto";
911

1012
option go_package = "github.com/initia-labs/miniwasm/x/tokenfactory/types";
1113

@@ -22,6 +24,9 @@ service Msg {
2224
rpc SetBeforeSendHook(MsgSetBeforeSendHook)
2325
returns (MsgSetBeforeSendHookResponse);
2426
rpc ForceTransfer(MsgForceTransfer) returns (MsgForceTransferResponse);
27+
// UpdateParams defines an operation for updating the x/tokenfactory module
28+
// parameters.
29+
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
2530
}
2631

2732
// MsgCreateDenom defines the message structure for the CreateDenom gRPC service
@@ -38,7 +43,7 @@ message MsgCreateDenom {
3843

3944
option (amino.name) = "tokenfactory/MsgCreateDenom";
4045

41-
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
46+
string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
4247
// subdenom can be up to 44 "alphanumeric" characters long.
4348
string subdenom = 2 [ (gogoproto.moretags) = "yaml:\"subdenom\"" ];
4449
}
@@ -58,7 +63,7 @@ message MsgMint {
5863
option (cosmos.msg.v1.signer) = "sender";
5964
option (amino.name) = "tokenfactory/MsgMint";
6065

61-
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
66+
string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
6267
cosmos.base.v1beta1.Coin amount = 2 [
6368
(gogoproto.moretags) = "yaml:\"amount\"",
6469
(gogoproto.nullable) = false
@@ -79,7 +84,7 @@ message MsgBurn {
7984
option (cosmos.msg.v1.signer) = "sender";
8085
option (amino.name) = "tokenfactory/MsgBurn";
8186

82-
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
87+
string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
8388
cosmos.base.v1beta1.Coin amount = 2 [
8489
(gogoproto.moretags) = "yaml:\"amount\"",
8590
(gogoproto.nullable) = false
@@ -98,7 +103,7 @@ message MsgChangeAdmin {
98103
option (cosmos.msg.v1.signer) = "sender";
99104
option (amino.name) = "tokenfactory/MsgChangeAdmin";
100105

101-
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
106+
string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
102107
string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ];
103108
string new_admin = 3 [ (gogoproto.moretags) = "yaml:\"new_admin\"" ];
104109
}
@@ -113,7 +118,7 @@ message MsgSetBeforeSendHook {
113118
option (cosmos.msg.v1.signer) = "sender";
114119
option (amino.name) = "tokenfactory/MsgSetBeforeSendHook";
115120

116-
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
121+
string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
117122
string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ];
118123
string cosmwasm_address = 3 [
119124
(gogoproto.moretags) = "yaml:\"cosmwasm_address\"",
@@ -131,7 +136,7 @@ message MsgSetDenomMetadata {
131136
option (cosmos.msg.v1.signer) = "sender";
132137
option (amino.name) = "tokenfactory/MsgSetDenomMetadata";
133138

134-
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
139+
string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
135140
cosmos.bank.v1beta1.Metadata metadata = 2 [
136141
(gogoproto.moretags) = "yaml:\"metadata\"",
137142
(gogoproto.nullable) = false
@@ -146,7 +151,7 @@ message MsgForceTransfer {
146151
option (cosmos.msg.v1.signer) = "sender";
147152
option (amino.name) = "tokenfactory/MsgForceTransfer";
148153

149-
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
154+
string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
150155
cosmos.base.v1beta1.Coin amount = 2 [
151156
(gogoproto.moretags) = "yaml:\"amount\"",
152157
(gogoproto.nullable) = false
@@ -157,4 +162,23 @@ message MsgForceTransfer {
157162
[ (gogoproto.moretags) = "yaml:\"transfer_to_address\"" ];
158163
}
159164

160-
message MsgForceTransferResponse {}
165+
message MsgForceTransferResponse {}
166+
167+
// MsgUpdateParams is the Msg/UpdateParams request type.
168+
message MsgUpdateParams {
169+
option (cosmos.msg.v1.signer) = "authority";
170+
option (amino.name) = "move/MsgUpdateParams";
171+
172+
// authority is the address that controls the module
173+
// (defaults to x/gov unless overwritten).
174+
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
175+
// params defines the x/staking parameters to update.
176+
//
177+
// NOTE: All parameters must be supplied.
178+
Params params = 2
179+
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
180+
}
181+
182+
// MsgUpdateParamsResponse defines the response structure for executing a
183+
// MsgUpdateParams message.
184+
message MsgUpdateParamsResponse {}

0 commit comments

Comments
 (0)