Skip to content

Commit

Permalink
Use cosmos-sdk v0.44 function Module() to generate unique addresses f…
Browse files Browse the repository at this point in the history
…or each escrow, closes #99
  • Loading branch information
LeCodeurDuDimanche committed Nov 26, 2021
1 parent 7c11d81 commit 3ef6556
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions x/escrow/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package keeper
import (
"encoding/hex"
"fmt"
"github.com/cosmos/cosmos-sdk/types/address"
"time"

"github.com/cosmos/cosmos-sdk/store"
Expand Down Expand Up @@ -86,10 +87,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger {

// GetEscrowAddress returns the address of the escrow account
func (k Keeper) GetEscrowAddress(id string) sdk.AccAddress {
//TODO: use the changes introduced by https://github.com/cosmos/cosmos-sdk/pull/9088 in v0.43 to effectively have one account per escrow
return k.accountKeeper.GetModuleAddress(types.ModuleName)
// We could use this instead, but it is not optimal and increases probability of collision
// return k.accountKeeper.GetModuleAddress(types.ModuleName + id)
return address.Module(types.ModuleName, []byte(id))
}

func (k Keeper) ImportNextID(ctx sdk.Context, nextID uint64) {
Expand Down

0 comments on commit 3ef6556

Please sign in to comment.