Skip to content

Commit

Permalink
Add in send coins from account to module
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Dusek committed Apr 18, 2024
1 parent a8721f0 commit 9fd76c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions x/market/keeper/msg_server_create_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,22 @@ func (k msgServer) CreatePool(goCtx context.Context, msg *types.MsgCreatePool) (
}
}

// Get the borrower address
creator, _ := sdk.AccAddressFromBech32(msg.Creator)

// All coins added to pools are deposited into the module account until redemption
sdkError := k.bankKeeper.SendCoinsFromAccountToModule(ctx, creator, types.ModuleName, coinPair)
if sdkError != nil {
return nil, sdkError
}

_ = member1
_ = member2
_ = pair
_ = pool
_ = found
_ = ctx
_ = creator

return &types.MsgCreatePoolResponse{}, nil
}
1 change: 1 addition & 0 deletions x/market/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type AccountKeeper interface {
// BankKeeper defines the expected interface for the Bank module.
type BankKeeper interface {
SpendableCoins(context.Context, sdk.AccAddress) sdk.Coins
SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
// Methods imported from bank should be defined here
}

Expand Down

0 comments on commit 9fd76c0

Please sign in to comment.