Concepts
x/protocolpool
is a supplemental Cosmos SDK module that handles functionality for community pool funds. The module provides a separate module account for the community pool making it easier to track the pool assets. Starting with v0.53 of the Cosmos SDK, community funds can be tracked using this module instead of the x/distribution
module. Funds are migrated from the x/distribution
module’s community pool to x/protocolpool
’s module account automatically.
This module is supplemental
; it is not required to run a Cosmos SDK chain. x/protocolpool
enhances the community pool functionality provided by x/distribution
and enables custom modules to further extend the community pool.
Note: as long as an external commmunity pool keeper (here, x/protocolpool
) is wired in DI configs, x/distribution
will automatically use it for its external pool.
Usage Limitations
The followingx/distribution
handlers will now return an error when the protocolpool
module is used with x/distribution
:
QueryService
CommunityPool
CommunityPoolSpend
FundCommunityPool
x/distribution
, please update them to use the x/protocolpool
equivalents.
State Transitions
FundCommunityPool
FundCommunityPool can be called by any valid account to send funds to thex/protocolpool
module account.
CommunityPoolSpend
CommunityPoolSpend can be called by the module authority (default governance module account) or any account with authorization to spend funds from thex/protocolpool
module account to a receiver address.
CreateContinuousFund
CreateContinuousFund is a message used to initiate a continuous fund for a specific recipient. The proposed percentage of funds will be distributed only on withdraw request for the recipient. The fund distribution continues until expiry time is reached or continuous fund request is canceled. NOTE: This feature is designed to work with the SDK’s default bond denom.CancelContinuousFund
CancelContinuousFund is a message used to cancel an existing continuous fund proposal for a specific recipient. Cancelling a continuous fund stops further distribution of funds, and the state object is removed from storage.Messages
MsgFundCommunityPool
This message sends coins directly from the sender to the community pool.If you know the
x/protocolpool
module account address, you can directly use bank send
transaction instead.- The msg will fail if the amount cannot be transferred from the sender to the
x/protocolpool
module account.
MsgCommunityPoolSpend
This message distributes funds from thex/protocolpool
module account to the recipient using DistributeFromCommunityPool
keeper method.
v0.53.x/proto/cosmos/protocolpool/v1/tx.proto
- The amount cannot be transferred to the recipient from the
x/protocolpool
module account. - The
recipient
address is restricted
MsgCreateContinuousFund
This message is used to create a continuous fund for a specific recipient. The proposed percentage of funds will be distributed only on withdraw request for the recipient. This fund distribution continues until expiry time is reached or continuous fund request is canceled. v0.53.x/proto/cosmos/protocolpool/v1/tx.proto- The recipient address is empty or restricted.
- The percentage is zero/negative/greater than one.
- The Expiry time is less than the current block time.
If two continuous fund proposals to the same address are created, the previous ContinuousFund will be updated with the new ContinuousFund.
MsgCancelContinuousFund
This message is used to cancel an existing continuous fund proposal for a specific recipient. Once canceled, the continuous fund will no longer distribute funds at each begin block, and the state object will be removed. v0.53.x/x/protocolpool/proto/cosmos/protocolpool/v1/tx.proto- The recipient address is empty or restricted.
- The ContinuousFund for the recipient does not exist.
Client
It takes the advantage ofAutoCLI
v0.53.x/x/protocolpool/autocli.go