2021-06-02 17:03:25 +00:00
|
|
|
package keeper
|
|
|
|
|
|
|
|
import (
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
2023-04-05 23:21:59 +00:00
|
|
|
errorsmod "cosmossdk.io/errors"
|
2021-06-02 17:03:25 +00:00
|
|
|
|
|
|
|
"github.com/kava-labs/kava/x/kavadist/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
// HandleCommunityPoolMultiSpendProposal is a handler for executing a passed community multi-spend proposal
|
2022-01-08 00:39:27 +00:00
|
|
|
func HandleCommunityPoolMultiSpendProposal(ctx sdk.Context, k Keeper, p *types.CommunityPoolMultiSpendProposal) error {
|
2021-06-02 17:03:25 +00:00
|
|
|
for _, receiverInfo := range p.RecipientList {
|
2022-01-08 00:39:27 +00:00
|
|
|
if k.blacklistedAddrs[receiverInfo.Address] {
|
2023-04-05 23:21:59 +00:00
|
|
|
return errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is blacklisted from receiving external funds", receiverInfo.Address)
|
2021-06-02 17:03:25 +00:00
|
|
|
}
|
2023-01-26 17:01:28 +00:00
|
|
|
err := k.distKeeper.DistributeFromFeePool(ctx, receiverInfo.Amount, receiverInfo.GetAddress())
|
2021-06-02 17:03:25 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|