Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
javiersuweijie committed Nov 10, 2023
1 parent 7f282a9 commit 15cb7c5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions x/alliance/keeper/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func (k Keeper) UpdateAlliance(ctx context.Context, req *types.MsgUpdateAlliance
if !found {
return status.Errorf(codes.NotFound, "Asset with denom: %s does not exist", req.Denom)
}

asset.RewardWeightRange = req.RewardWeightRange
if asset.RewardWeightRange.Min.GT(req.RewardWeight) || asset.RewardWeightRange.Max.LT(req.RewardWeight) {
return types.ErrRewardWeightOutOfBound
Expand Down
4 changes: 4 additions & 0 deletions x/alliance/keeper/tests/asset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ func TestRewardWeightDecay(t *testing.T) {
Description: "",
Denom: AllianceDenom,
RewardWeight: sdk.MustNewDecFromStr("0.5"),
RewardWeightRange: types.RewardWeightRange{Min: sdk.NewDec(0), Max: sdk.NewDec(5)},
TakeRate: sdk.ZeroDec(),
RewardChangeRate: sdk.ZeroDec(),
RewardChangeInterval: 0,
Expand All @@ -753,6 +754,7 @@ func TestRewardWeightDecay(t *testing.T) {
Description: "",
Denom: AllianceDenom,
RewardWeight: sdk.MustNewDecFromStr("0.5"),
RewardWeightRange: types.RewardWeightRange{Min: sdk.NewDec(0), Max: sdk.NewDec(5)},
TakeRate: sdk.ZeroDec(),
RewardChangeRate: sdk.MustNewDecFromStr("0.1"),
RewardChangeInterval: decayInterval,
Expand All @@ -779,6 +781,7 @@ func TestRewardWeightDecay(t *testing.T) {
Description: "",
Denom: AllianceDenomTwo,
RewardWeight: sdk.MustNewDecFromStr("0.5"),
RewardWeightRange: types.RewardWeightRange{Min: sdk.NewDec(0), Max: sdk.NewDec(5)},
TakeRate: sdk.ZeroDec(),
RewardChangeRate: sdk.MustNewDecFromStr("0.1"),
RewardChangeInterval: decayInterval,
Expand Down Expand Up @@ -1113,6 +1116,7 @@ func TestRewardWeightRateChange(t *testing.T) {
Description: "",
Denom: alliance.Denom,
RewardWeight: alliance.RewardWeight,
RewardWeightRange: types.RewardWeightRange{Min: sdk.NewDec(0), Max: sdk.NewDec(5)},
TakeRate: alliance.TakeRate,
RewardChangeRate: sdk.MustNewDecFromStr("1.001"),
RewardChangeInterval: time.Minute * 5,
Expand Down
2 changes: 1 addition & 1 deletion x/alliance/types/tests/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestProposalsContent(t *testing.T) {
title: "Alliance2",
desc: "Alliance with 2",
typ: "msg_update_alliance_proposal",
str: "title:\"Alliance2\" description:\"Alliance with 2\" denom:\"ibc/denom2\" reward_weight:\"2000000000000000000\" take_rate:\"2000000000000000000\" reward_change_rate:\"2000000000000000000\" reward_change_interval:<seconds:3600 > ",
str: "title:\"Alliance2\" description:\"Alliance with 2\" denom:\"ibc/denom2\" reward_weight:\"2000000000000000000\" take_rate:\"2000000000000000000\" reward_change_rate:\"2000000000000000000\" reward_change_interval:<seconds:3600 > reward_weight_range:<min:\"0\" max:\"5000000000000000000\" > ",
},
"msg_delete_alliance_proposal": {
p: types.NewMsgDeleteAllianceProposal("test", "abcd", "ibc/denom"),
Expand Down

0 comments on commit 15cb7c5

Please sign in to comment.