Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Encodings For MsgFundCommunityPool from Distribution (backport #1458) #1519

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions x/wasm/keeper/handler_plugin_encoders.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@
ValidatorAddress: msg.WithdrawDelegatorReward.Validator,
}
return []sdk.Msg{&withdrawMsg}, nil
case msg.FundCommunityPool != nil:
amt, err := ConvertWasmCoinsToSdkCoins(msg.FundCommunityPool.Amount)
if err != nil {
return nil, err

Check warning on line 149 in x/wasm/keeper/handler_plugin_encoders.go

View check run for this annotation

Codecov / codecov/patch

x/wasm/keeper/handler_plugin_encoders.go#L149

Added line #L149 was not covered by tests
}
fundMsg := distributiontypes.MsgFundCommunityPool{
Depositor: sender.String(),
Amount: amt,
}
return []sdk.Msg{&fundMsg}, nil
default:
return nil, sdkerrors.Wrap(types.ErrUnknownMsg, "unknown variant of Distribution")
}
Expand Down
22 changes: 22 additions & 0 deletions x/wasm/keeper/handler_plugin_encoders_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,28 @@ func TestEncoding(t *testing.T) {
},
},
},
"distribution fund community pool": {
sender: addr1,
srcMsg: wasmvmtypes.CosmosMsg{
Distribution: &wasmvmtypes.DistributionMsg{
FundCommunityPool: &wasmvmtypes.FundCommunityPoolMsg{
Amount: wasmvmtypes.Coins{
wasmvmtypes.NewCoin(200, "stones"),
wasmvmtypes.NewCoin(200, "feathers"),
},
},
},
},
output: []sdk.Msg{
&distributiontypes.MsgFundCommunityPool{
Depositor: addr1.String(),
Amount: sdk.NewCoins(
sdk.NewInt64Coin("stones", 200),
sdk.NewInt64Coin("feathers", 200),
),
},
},
},
"stargate encoded bank msg": {
sender: addr2,
srcMsg: wasmvmtypes.CosmosMsg{
Expand Down