Skip to content

Commit

Permalink
use accountKeeper.NewAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Jan 4, 2024
1 parent f63e6d8 commit 7154a69
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions x/opchild/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type AccountKeeper interface {
NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI

IterateAccounts(ctx context.Context, process func(sdk.AccountI) (stop bool))
NewAccount(ctx context.Context, acc sdk.AccountI) sdk.AccountI
GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI // only used for simulation
HasAccount(ctx context.Context, addr sdk.AccAddress) bool
SetAccount(ctx context.Context, acc sdk.AccountI)
Expand Down
4 changes: 2 additions & 2 deletions x/ophost/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func (ms MsgServer) CreateBridge(ctx context.Context, req *types.MsgCreateBridge

// create bridge account
bridgeAcc := types.NewBridgeAccountWithAddress(types.BridgeAddress(bridgeId))
bridgeAcc.AccountNumber = ms.authKeeper.NextAccountNumber(ctx)
ms.authKeeper.SetAccount(ctx, bridgeAcc)
bridgeAccI := (ms.authKeeper.NewAccount(ctx, bridgeAcc)) // set the account number
ms.authKeeper.SetAccount(ctx, bridgeAccI)

sdk.UnwrapSDKContext(ctx).EventManager().EmitEvent(sdk.NewEvent(
types.EventTypeCreateBridge,
Expand Down
1 change: 1 addition & 0 deletions x/ophost/types/expected_keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type AccountKeeper interface {
NextAccountNumber(ctx context.Context) uint64

IterateAccounts(ctx context.Context, cb func(account sdk.AccountI) (stop bool))
NewAccount(ctx context.Context, acc sdk.AccountI) sdk.AccountI
GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI
HasAccount(ctx context.Context, addr sdk.AccAddress) bool
SetAccount(ctx context.Context, acc sdk.AccountI)
Expand Down

0 comments on commit 7154a69

Please sign in to comment.