From 887b825ee1917c55d683a7c745fb8e25ace8b844 Mon Sep 17 00:00:00 2001 From: MD Aleem <72057206+aleem1314@users.noreply.github.com> Date: Wed, 5 Oct 2022 09:01:43 +0530 Subject: [PATCH] fix: create basket simulation (#1505) Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com> --- x/ecocredit/basket/simulation/msg_create.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x/ecocredit/basket/simulation/msg_create.go b/x/ecocredit/basket/simulation/msg_create.go index 0fe3a69f65..350855f9a8 100644 --- a/x/ecocredit/basket/simulation/msg_create.go +++ b/x/ecocredit/basket/simulation/msg_create.go @@ -78,7 +78,7 @@ func SimulateMsgCreate(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, } if result != nil { - return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgCreate, fmt.Sprintf("basket with name %s already exists", basketName)), nil, nil + return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgCreate, fmt.Sprintf("basket with denom %s already exists", denom)), nil, nil } dateCriteria := randomDateCriteria(r, sdkCtx) @@ -122,6 +122,10 @@ func SimulateMsgCreate(ak ecocredit.AccountKeeper, bk ecocredit.BankKeeper, return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgCreate, err.Error()), nil, nil } + if strings.Contains(err.Error(), fmt.Sprintf("basket with name %s already exists", basketName)) { + return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgCreate, err.Error()), nil, nil + } + if strings.Contains(err.Error(), "insufficient funds") { return simtypes.NoOpMsg(ecocredit.ModuleName, TypeMsgCreate, err.Error()), nil, nil }