distribution

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2023 License: MIT Imports: 13 Imported by: 0

README

Distribution module

Usage

(Tx) Fund community pool
fundCommunityPoolMsg := types.FundCommunityPoolMsg {
    Amount: "1000",
}

txbytes, err := xplac.FundCommunityPool(fundCommunityPoolMsg).CreateAndSignTx()
res, err := xplac.Broadcast(txbytes)
(Tx) Proposal community pool spend
// Input data
communityPoolSpendMsg := types.CommunityPoolSpendMsg{
    Title: "community pool spend",
    Description: "pay me",
    Recipient: "xpla1ka84cuec6339t8s4nh3sp5zf2fre6dh2v2g9mp",
    Amount: "10000",
    Deposit: "1000",
}

// Use json file
communityPoolSpendMsg := types.CommunityPoolSpendMsg{
    JsonFilePath: "./proposal.json"
}

txbytes, err := xplac.CommunityPoolSpend(communityPoolSpendMsg).CreateAndSignTx()
res, err := xplac.Broadcast(txbytes)
(Tx) Withdraw rewards
withdrawRewardsMsg := types.WithdrawRewardsMsg{
    DelegatorAddr: "xpla1e4f6k98es55vxxv2pcfzpsjrf3mvazeyqpw8g9",
    ValidatorAddr: "xplavaloper19yq7kjcgse7x672faptju0lxmy4cvdlcsx9ftw",
}
txbytes, err := xplac.WithdrawRewards(withdrawRewardsMsg).CreateAndSignTx()
res, err := xplac.Broadcast(txbytes)
(Tx) Withdraw all rewards
txbytes, err := xplac.WithdrawAllRewards().CreateAndSignTx()
res, err := xplac.Broadcast(txbytes)
(Tx) Set withdraw address
setWithdrawAddrMsg := types.SetwithdrawAddrMsg {
    WithdrawAddr: "xpla1e4f6k98es55vxxv2pcfzpsjrf3mvazeyqpw8g9",
}
txbytes, err := xplac.SetWithdrawAddr(setWithdrawAddrMsg).CreateAndSignTx()
res, err := xplac.Broadcast(txbytes)
(Query) distribution parameters
res, err := xplac.DistributionParams().Query()
(Query) validator outstanding rewards
validatorOutstandingRewardsMsg := types.ValidatorOutstandingRewardsMsg {
    ValidatorAddr: "xplavaloper19yq7kjcgse7x672faptju0lxmy4cvdlcsx9ftw",
}
res, err := xplac.ValidatorOutstandingRewards(validatorOutstandingRewardsMsg).Query()
(Query) commission
queryDistCommissionMsg := types.QueryDistCommissionMsg {
    ValidatorAddr: "xplavaloper19yq7kjcgse7x672faptju0lxmy4cvdlcsx9ftw",
}
res, err := xplac.DistCommission(queryDistCommissionMsg).Query()
(Query) validator slashes
queryDistSlashesMsg := types.QueryDistSlashesMsg{
    ValidatorAddr: "xplavaloper19yq7kjcgse7x672faptju0lxmy4cvdlcsx9ftw",
}

res, err := xplac.DistSlashes(queryDistSlashesMsg).Query()
(Query) rewards
// reward for a validator
queryDistRewardsMsg := types.QueryDistRewardsMsg{
    ValidatorAddr: "xplavaloper19yq7kjcgse7x672faptju0lxmy4cvdlcsx9ftw",
    DelegatorAddr: "xpla1e4f6k98es55vxxv2pcfzpsjrf3mvazeyqpw8g9",
}

// total rewards
queryDistRewardsMsg := types.QueryDistRewardsMsg{
    DelegatorAddr: "xpla1e4f6k98es55vxxv2pcfzpsjrf3mvazeyqpw8g9",
}
res, err := xplac.DistRewards(queryDistRewardsMsg).Query()
(Query) community pool
res, err := xplac.CommunityPool().Query()

Documentation

Index

Constants

View Source
const (
	DistributionModule                             = "distribution"
	DistributionFundCommunityPoolMsgType           = "fund-community-pool"
	DistributionProposalCommunityPoolSpendMsgType  = "proposal-community-pool-spend"
	DistributionWithdrawRewardsMsgType             = "withdraw-rewards"
	DistributionWithdrawAllRewardsMsgType          = "withdraw-all-rewards"
	DistributionSetWithdrawAddrMsgType             = "set-withdraw-addr"
	DistributionQueryDistributionParamsMsgType     = "query-distribution-params"
	DistributionValidatorOutstandingRewardsMsgType = "validator-outstanding-rewards"
	DistributionQueryDistCommissionMsgType         = "dist-query-commission"
	DistributionQuerySlashesMsgType                = "dist-slashes"
	DistributionQueryRewardsMsgType                = "dist-rewards"
	DistributionQueryTotalRewardsMsgType           = "dist-total-rewards"
	DistributionQueryCommunityPoolMsgType          = "query-community-pool"
)

Variables

This section is empty.

Functions

func MakeFundCommunityPoolMsg

func MakeFundCommunityPoolMsg(fundCommunityPoolMsg types.FundCommunityPoolMsg, privKey key.PrivateKey) (disttypes.MsgFundCommunityPool, error)

(Tx) make msg - fund community pool

func MakeProposalCommunityPoolSpendMsg

func MakeProposalCommunityPoolSpendMsg(communityPoolSpendMsg types.CommunityPoolSpendMsg, privKey key.PrivateKey, encodingConfig params.EncodingConfig) (govtypes.MsgSubmitProposal, error)

(Tx) make msg - proposal community pool

func MakeQueryCommunityPoolMsg

func MakeQueryCommunityPoolMsg() (disttypes.QueryCommunityPoolRequest, error)

(Query) make msg - community pool

func MakeQueryDistCommissionMsg

func MakeQueryDistCommissionMsg(queryDistCommissionMsg types.QueryDistCommissionMsg) (disttypes.QueryValidatorCommissionRequest, error)

(Query) make msg - commission

func MakeQueryDistRewardsMsg added in v0.1.3

func MakeQueryDistRewardsMsg(queryDistRewardsMsg types.QueryDistRewardsMsg) (disttypes.QueryDelegationRewardsRequest, error)

(Query) make msg - distribution rewards

func MakeQueryDistSlashesMsg

func MakeQueryDistSlashesMsg(queryDistSlashesMsg types.QueryDistSlashesMsg) (disttypes.QueryValidatorSlashesRequest, error)

(Query) make msg - distribution slashes

func MakeQueryDistTotalRewardsMsg added in v0.1.3

func MakeQueryDistTotalRewardsMsg(queryDistRewardsMsg types.QueryDistRewardsMsg) (disttypes.QueryDelegationTotalRewardsRequest, error)

(Query) make msg - distribution all rewards

func MakeQueryDistributionParamsMsg

func MakeQueryDistributionParamsMsg() (disttypes.QueryParamsRequest, error)

(Query) make msg - distribution params

func MakeSetWithdrawAddrMsg

func MakeSetWithdrawAddrMsg(setWithdrawAddrMsg types.SetWithdrawAddrMsg, privKey key.PrivateKey) (disttypes.MsgSetWithdrawAddress, error)

(Tx) make msg - withdraw address

func MakeValidatorOutstandingRewardsMsg

func MakeValidatorOutstandingRewardsMsg(validatorOutstandingRewardsMsg types.ValidatorOutstandingRewardsMsg) (disttypes.QueryValidatorOutstandingRewardsRequest, error)

(Query) make msg - validator outstanding rewards

func MakeWithdrawAllRewardsMsg

func MakeWithdrawAllRewardsMsg(privKey key.PrivateKey, grpcConn grpc.ClientConn, ctx context.Context) ([]sdk.Msg, error)

(Tx) make msg - withdraw all rewards

func MakeWithdrawRewardsMsg

func MakeWithdrawRewardsMsg(withdrawRewardsMsg types.WithdrawRewardsMsg, privKey key.PrivateKey) ([]sdk.Msg, error)

(Tx) make msg - withdraw rewards

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL