0g-chain/x/kavadist/keeper/proposal_handler.go

25 lines
811 B
Go
Raw Normal View History

package keeper
import (
2023-11-21 19:08:07 +00:00
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
2024-08-03 09:51:56 +00:00
"github.com/0glabs/0g-chain/x/kavadist/types"
)
// HandleCommunityPoolMultiSpendProposal is a handler for executing a passed community multi-spend proposal
func HandleCommunityPoolMultiSpendProposal(ctx sdk.Context, k Keeper, p *types.CommunityPoolMultiSpendProposal) error {
for _, receiverInfo := range p.RecipientList {
if k.blacklistedAddrs[receiverInfo.Address] {
return errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is blacklisted from receiving external funds", receiverInfo.Address)
}
err := k.distKeeper.DistributeFromFeePool(ctx, receiverInfo.Amount, receiverInfo.GetAddress())
if err != nil {
return err
}
}
return nil
}