2021-06-02 17:03:25 +00:00
|
|
|
package keeper
|
|
|
|
|
|
|
|
import (
|
2023-11-21 19:08:07 +00:00
|
|
|
errorsmod "cosmossdk.io/errors"
|
2021-06-02 17:03:25 +00:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
|
|
|
2024-05-01 03:17:24 +00:00
|
|
|
"github.com/0glabs/0g-chain/x/kavadist/types"
|
2021-06-02 17:03:25 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|