Merge PR #4678: Clean YAML output
This commit is contained in:
parent
2fdbf631e7
commit
1a7f31f7c8
|
@ -11,8 +11,8 @@ import (
|
|||
|
||||
// BroadcastReq defines a tx broadcasting request.
|
||||
type BroadcastReq struct {
|
||||
Tx types.StdTx `json:"tx"`
|
||||
Mode string `json:"mode"`
|
||||
Tx types.StdTx `json:"tx" yaml:"tx"`
|
||||
Mode string `json:"mode" yaml:"mode"`
|
||||
}
|
||||
|
||||
// BroadcastTxRequest implements a tx broadcasting handler that is responsible
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
// EncodeResp defines a tx encoding response.
|
||||
type EncodeResp struct {
|
||||
Tx string `json:"tx"`
|
||||
Tx string `json:"tx" yaml:"tx"`
|
||||
}
|
||||
|
||||
// EncodeTxRequestHandlerFn returns the encode tx REST handler. In particular,
|
||||
|
|
|
@ -21,7 +21,7 @@ import (
|
|||
|
||||
// GasEstimateResponse defines a response definition for tx gas estimation.
|
||||
type GasEstimateResponse struct {
|
||||
GasEstimate uint64 `json:"gas_estimate"`
|
||||
GasEstimate uint64 `json:"gas_estimate" yaml:"gas_estimate"`
|
||||
}
|
||||
|
||||
func (gr GasEstimateResponse) String() string {
|
||||
|
|
|
@ -25,11 +25,10 @@ type testInput struct {
|
|||
// moduleAccount defines an account for modules that holds coins on a pool
|
||||
type moduleAccount struct {
|
||||
*types.BaseAccount
|
||||
Name string `json:"name"` // name of the module
|
||||
Permission string `json:"permission"` // permission of module account (minter/burner/holder)
|
||||
Name string `json:"name" yaml:"name"` // name of the module
|
||||
Permission string `json:"permission" yaml"permission"` // permission of module account (minter/burner/holder)
|
||||
}
|
||||
|
||||
|
||||
// GetName returns the the name of the holder's module
|
||||
func (ma moduleAccount) GetName() string {
|
||||
return ma.Name
|
||||
|
@ -40,7 +39,6 @@ func (ma moduleAccount) GetPermission() string {
|
|||
return ma.Permission
|
||||
}
|
||||
|
||||
|
||||
func setupTestInput() testInput {
|
||||
db := dbm.NewMemDB()
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@ var _ exported.Account = (*BaseAccount)(nil)
|
|||
// However one doesn't have to use BaseAccount as long as your struct
|
||||
// implements Account.
|
||||
type BaseAccount struct {
|
||||
Address sdk.AccAddress `json:"address"`
|
||||
Coins sdk.Coins `json:"coins"`
|
||||
PubKey crypto.PubKey `json:"public_key"`
|
||||
AccountNumber uint64 `json:"account_number"`
|
||||
Sequence uint64 `json:"sequence"`
|
||||
Address sdk.AccAddress `json:"address" yaml:"address"`
|
||||
Coins sdk.Coins `json:"coins" yaml:"coins"`
|
||||
PubKey crypto.PubKey `json:"public_key" yaml:"public_key"`
|
||||
AccountNumber uint64 `json:"account_number" yaml:"account_number"`
|
||||
Sequence uint64 `json:"sequence" yaml:"sequence"`
|
||||
}
|
||||
|
||||
// NewBaseAccount creates a new BaseAccount object
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
// GenesisState - all auth state that must be provided at genesis
|
||||
type GenesisState struct {
|
||||
Params Params `json:"params"`
|
||||
Params Params `json:"params" yaml:"params"`
|
||||
}
|
||||
|
||||
// NewGenesisState - Create a new genesis state
|
||||
|
|
|
@ -33,11 +33,11 @@ var _ subspace.ParamSet = &Params{}
|
|||
|
||||
// Params defines the parameters for the auth module.
|
||||
type Params struct {
|
||||
MaxMemoCharacters uint64 `json:"max_memo_characters"`
|
||||
TxSigLimit uint64 `json:"tx_sig_limit"`
|
||||
TxSizeCostPerByte uint64 `json:"tx_size_cost_per_byte"`
|
||||
SigVerifyCostED25519 uint64 `json:"sig_verify_cost_ed25519"`
|
||||
SigVerifyCostSecp256k1 uint64 `json:"sig_verify_cost_secp256k1"`
|
||||
MaxMemoCharacters uint64 `json:"max_memo_characters" yaml:"max_memo_characters"`
|
||||
TxSigLimit uint64 `json:"tx_sig_limit" yaml:"tx_sig_limit"`
|
||||
TxSizeCostPerByte uint64 `json:"tx_size_cost_per_byte" yaml:"tx_size_cost_per_byte"`
|
||||
SigVerifyCostED25519 uint64 `json:"sig_verify_cost_ed25519" yaml:"sig_verify_cost_ed25519"`
|
||||
SigVerifyCostSecp256k1 uint64 `json:"sig_verify_cost_secp256k1" yaml:"sig_verify_cost_secp256k1"`
|
||||
}
|
||||
|
||||
// NewParams creates a new Params object
|
||||
|
|
|
@ -8,12 +8,12 @@ import (
|
|||
// a Msg with the other requirements for a StdSignDoc before
|
||||
// it is signed. For use in the CLI.
|
||||
type StdSignMsg struct {
|
||||
ChainID string `json:"chain_id"`
|
||||
AccountNumber uint64 `json:"account_number"`
|
||||
Sequence uint64 `json:"sequence"`
|
||||
Fee StdFee `json:"fee"`
|
||||
Msgs []sdk.Msg `json:"msgs"`
|
||||
Memo string `json:"memo"`
|
||||
ChainID string `json:"chain_id" yaml:"chain_id"`
|
||||
AccountNumber uint64 `json:"account_number" yaml:"account_number"`
|
||||
Sequence uint64 `json:"sequence" yaml:"sequence"`
|
||||
Fee StdFee `json:"fee" yaml:"fee"`
|
||||
Msgs []sdk.Msg `json:"msgs" yaml:"msgs"`
|
||||
Memo string `json:"memo" yaml:"memo"`
|
||||
}
|
||||
|
||||
// get message bytes
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/multisig"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
@ -20,10 +21,10 @@ var (
|
|||
// StdTx is a standard way to wrap a Msg with Fee and Signatures.
|
||||
// NOTE: the first signature is the fee payer (Signatures must not be nil).
|
||||
type StdTx struct {
|
||||
Msgs []sdk.Msg `json:"msg"`
|
||||
Fee StdFee `json:"fee"`
|
||||
Signatures []StdSignature `json:"signatures"`
|
||||
Memo string `json:"memo"`
|
||||
Msgs []sdk.Msg `json:"msg" yaml:"msg"`
|
||||
Fee StdFee `json:"fee" yaml:"fee"`
|
||||
Signatures []StdSignature `json:"signatures" yaml:"signatures"`
|
||||
Memo string `json:"memo" yaml:"memo"`
|
||||
}
|
||||
|
||||
func NewStdTx(msgs []sdk.Msg, fee StdFee, sigs []StdSignature, memo string) StdTx {
|
||||
|
@ -112,8 +113,8 @@ func (tx StdTx) GetSignatures() []StdSignature { return tx.Signatures }
|
|||
// gas to be used by the transaction. The ratio yields an effective "gasprice",
|
||||
// which must be above some miminum to be accepted into the mempool.
|
||||
type StdFee struct {
|
||||
Amount sdk.Coins `json:"amount"`
|
||||
Gas uint64 `json:"gas"`
|
||||
Amount sdk.Coins `json:"amount" yaml:"amount"`
|
||||
Gas uint64 `json:"gas" yaml:"gas"`
|
||||
}
|
||||
|
||||
// NewStdFee returns a new instance of StdFee
|
||||
|
@ -157,12 +158,12 @@ func (fee StdFee) GasPrices() sdk.DecCoins {
|
|||
// and the Sequence numbers for each signature (prevent
|
||||
// inchain replay and enforce tx ordering per account).
|
||||
type StdSignDoc struct {
|
||||
AccountNumber uint64 `json:"account_number"`
|
||||
ChainID string `json:"chain_id"`
|
||||
Fee json.RawMessage `json:"fee"`
|
||||
Memo string `json:"memo"`
|
||||
Msgs []json.RawMessage `json:"msgs"`
|
||||
Sequence uint64 `json:"sequence"`
|
||||
AccountNumber uint64 `json:"account_number" yaml:"account_number"`
|
||||
ChainID string `json:"chain_id" yaml:"chain_id"`
|
||||
Fee json.RawMessage `json:"fee" yaml:"fee"`
|
||||
Memo string `json:"memo" yaml:"memo"`
|
||||
Msgs []json.RawMessage `json:"msgs" yaml:"msgs"`
|
||||
Sequence uint64 `json:"sequence" yaml:"sequence"`
|
||||
}
|
||||
|
||||
// StdSignBytes returns the bytes to sign for a transaction.
|
||||
|
@ -187,8 +188,8 @@ func StdSignBytes(chainID string, accnum uint64, sequence uint64, fee StdFee, ms
|
|||
|
||||
// StdSignature represents a sig
|
||||
type StdSignature struct {
|
||||
crypto.PubKey `json:"pub_key"` // optional
|
||||
Signature []byte `json:"signature"`
|
||||
crypto.PubKey `json:"pub_key" yaml:"pub_key"` // optional
|
||||
Signature []byte `json:"signature" yaml:"signature"`
|
||||
}
|
||||
|
||||
// DefaultTxDecoder logic for standard transaction decoding
|
||||
|
@ -217,3 +218,32 @@ func DefaultTxEncoder(cdc *codec.Codec) sdk.TxEncoder {
|
|||
return cdc.MarshalBinaryLengthPrefixed(tx)
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalYAML returns the YAML representation of the signature.
|
||||
func (ss StdSignature) MarshalYAML() (interface{}, error) {
|
||||
var (
|
||||
bz []byte
|
||||
pubkey string
|
||||
err error
|
||||
)
|
||||
|
||||
if ss.PubKey != nil {
|
||||
pubkey, err = sdk.Bech32ifyAccPub(ss.PubKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
bz, err = yaml.Marshal(struct {
|
||||
PubKey string
|
||||
Signature string
|
||||
}{
|
||||
PubKey: pubkey,
|
||||
Signature: fmt.Sprintf("%s", ss.Signature),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return string(bz), err
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
@ -133,3 +134,31 @@ func TestDefaultTxEncoder(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
require.Equal(t, cdcBytes, encoderBytes)
|
||||
}
|
||||
|
||||
func TestStdSignatureMarshalYAML(t *testing.T) {
|
||||
_, pubKey, _ := KeyTestPubAddr()
|
||||
|
||||
testCases := []struct {
|
||||
sig StdSignature
|
||||
output string
|
||||
}{
|
||||
{
|
||||
StdSignature{},
|
||||
"|\n pubkey: \"\"\n signature: \"\"\n",
|
||||
},
|
||||
{
|
||||
StdSignature{PubKey: pubKey, Signature: []byte("dummySig")},
|
||||
fmt.Sprintf("|\n pubkey: %s\n signature: dummySig\n", sdk.MustBech32ifyAccPub(pubKey)),
|
||||
},
|
||||
{
|
||||
StdSignature{PubKey: pubKey, Signature: nil},
|
||||
fmt.Sprintf("|\n pubkey: %s\n signature: \"\"\n", sdk.MustBech32ifyAccPub(pubKey)),
|
||||
},
|
||||
}
|
||||
|
||||
for i, tc := range testCases {
|
||||
bz, err := yaml.Marshal(tc.sig)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, tc.output, string(bz), "test case #%d", i)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router) {
|
|||
|
||||
// SendReq defines the properties of a send request's body.
|
||||
type SendReq struct {
|
||||
BaseReq rest.BaseReq `json:"base_req"`
|
||||
Amount sdk.Coins `json:"amount"`
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
Amount sdk.Coins `json:"amount" yaml:"amount"`
|
||||
}
|
||||
|
||||
// SendRequestHandlerFn - http request handler to send coins to a address.
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
// GenesisState is the bank state that must be provided at genesis.
|
||||
type GenesisState struct {
|
||||
SendEnabled bool `json:"send_enabled"`
|
||||
SendEnabled bool `json:"send_enabled" yaml:"send_enabled"`
|
||||
}
|
||||
|
||||
// NewGenesisState creates a new genesis state.
|
||||
|
|
|
@ -9,9 +9,9 @@ const RouterKey = ModuleName
|
|||
|
||||
// MsgSend - high level transaction of the coin module
|
||||
type MsgSend struct {
|
||||
FromAddress sdk.AccAddress `json:"from_address"`
|
||||
ToAddress sdk.AccAddress `json:"to_address"`
|
||||
Amount sdk.Coins `json:"amount"`
|
||||
FromAddress sdk.AccAddress `json:"from_address" yaml:"from_address"`
|
||||
ToAddress sdk.AccAddress `json:"to_address" yaml:"to_address"`
|
||||
Amount sdk.Coins `json:"amount" yaml:"amount"`
|
||||
}
|
||||
|
||||
var _ sdk.Msg = MsgSend{}
|
||||
|
@ -56,8 +56,8 @@ func (msg MsgSend) GetSigners() []sdk.AccAddress {
|
|||
|
||||
// MsgMultiSend - high level transaction of the coin module
|
||||
type MsgMultiSend struct {
|
||||
Inputs []Input `json:"inputs"`
|
||||
Outputs []Output `json:"outputs"`
|
||||
Inputs []Input `json:"inputs" yaml:"inputs"`
|
||||
Outputs []Output `json:"outputs" yaml:"outputs"`
|
||||
}
|
||||
|
||||
var _ sdk.Msg = MsgMultiSend{}
|
||||
|
@ -103,8 +103,8 @@ func (msg MsgMultiSend) GetSigners() []sdk.AccAddress {
|
|||
|
||||
// Input models transaction input
|
||||
type Input struct {
|
||||
Address sdk.AccAddress `json:"address"`
|
||||
Coins sdk.Coins `json:"coins"`
|
||||
Address sdk.AccAddress `json:"address" yaml:"address"`
|
||||
Coins sdk.Coins `json:"coins" yaml:"coins"`
|
||||
}
|
||||
|
||||
// ValidateBasic - validate transaction input
|
||||
|
@ -131,8 +131,8 @@ func NewInput(addr sdk.AccAddress, coins sdk.Coins) Input {
|
|||
|
||||
// Output models transaction outputs
|
||||
type Output struct {
|
||||
Address sdk.AccAddress `json:"address"`
|
||||
Coins sdk.Coins `json:"coins"`
|
||||
Address sdk.AccAddress `json:"address" yaml:"address"`
|
||||
Coins sdk.Coins `json:"coins" yaml:"coins"`
|
||||
}
|
||||
|
||||
// ValidateBasic - validate transaction output
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
// GenesisState - crisis genesis state
|
||||
type GenesisState struct {
|
||||
ConstantFee sdk.Coin `json:"constant_fee"`
|
||||
ConstantFee sdk.Coin `json:"constant_fee" yaml:"constant_fee"`
|
||||
}
|
||||
|
||||
// NewGenesisState creates a new GenesisState object
|
||||
|
|
|
@ -6,9 +6,9 @@ import (
|
|||
|
||||
// MsgVerifyInvariant - message struct to verify a particular invariance
|
||||
type MsgVerifyInvariant struct {
|
||||
Sender sdk.AccAddress `json:"sender"`
|
||||
InvariantModuleName string `json:"invariant_module_name"`
|
||||
InvariantRoute string `json:"invariant_route"`
|
||||
Sender sdk.AccAddress `json:"sender" yaml:"sender"`
|
||||
InvariantModuleName string `json:"invariant_module_name" yaml:"invariant_module_name"`
|
||||
InvariantRoute string `json:"invariant_route" yaml:"invariant_route"`
|
||||
}
|
||||
|
||||
// ensure Msg interface compliance at compile time
|
||||
|
|
|
@ -10,11 +10,11 @@ import (
|
|||
type (
|
||||
// CommunityPoolSpendProposalJSON defines a CommunityPoolSpendProposal with a deposit
|
||||
CommunityPoolSpendProposalJSON struct {
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Recipient sdk.AccAddress `json:"recipient"`
|
||||
Amount sdk.Coins `json:"amount"`
|
||||
Deposit sdk.Coins `json:"deposit"`
|
||||
Title string `json:"title" yaml:"title"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
Recipient sdk.AccAddress `json:"recipient" yaml:"recipient"`
|
||||
Amount sdk.Coins `json:"amount" yaml:"amount"`
|
||||
Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -129,9 +129,9 @@ func delegatorWithdrawalAddrHandlerFn(cliCtx context.CLIContext, queryRoute stri
|
|||
// ValidatorDistInfo defines the properties of
|
||||
// validator distribution information response.
|
||||
type ValidatorDistInfo struct {
|
||||
OperatorAddress sdk.AccAddress `json:"operator_address"`
|
||||
SelfBondRewards sdk.DecCoins `json:"self_bond_rewards"`
|
||||
ValidatorCommission types.ValidatorAccumulatedCommission `json:"val_commission"`
|
||||
OperatorAddress sdk.AccAddress `json:"operator_address" yaml:"operator_address"`
|
||||
SelfBondRewards sdk.DecCoins `json:"self_bond_rewards" yaml:"self_bond_rewards"`
|
||||
ValidatorCommission types.ValidatorAccumulatedCommission `json:"val_commission" yaml:"val_commission"`
|
||||
}
|
||||
|
||||
// NewValidatorDistInfo creates a new instance of ValidatorDistInfo.
|
||||
|
|
|
@ -43,12 +43,12 @@ func registerTxRoutes(cliCtx context.CLIContext, r *mux.Router, queryRoute strin
|
|||
|
||||
type (
|
||||
withdrawRewardsReq struct {
|
||||
BaseReq rest.BaseReq `json:"base_req"`
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
}
|
||||
|
||||
setWithdrawalAddrReq struct {
|
||||
BaseReq rest.BaseReq `json:"base_req"`
|
||||
WithdrawAddress sdk.AccAddress `json:"withdraw_address"`
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
WithdrawAddress sdk.AccAddress `json:"withdraw_address" yaml:"withdraw_address"`
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -8,13 +8,13 @@ import (
|
|||
type (
|
||||
// CommunityPoolSpendProposalReq defines a community pool spend proposal request body.
|
||||
CommunityPoolSpendProposalReq struct {
|
||||
BaseReq rest.BaseReq `json:"base_req"`
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Recipient sdk.AccAddress `json:"recipient"`
|
||||
Amount sdk.Coins `json:"amount"`
|
||||
Proposer sdk.AccAddress `json:"proposer"`
|
||||
Deposit sdk.Coins `json:"deposit"`
|
||||
Title string `json:"title" yaml:"title"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
Recipient sdk.AccAddress `json:"recipient" yaml:"recipient"`
|
||||
Amount sdk.Coins `json:"amount" yaml:"amount"`
|
||||
Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"`
|
||||
Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
|
||||
}
|
||||
)
|
||||
|
|
|
@ -12,9 +12,9 @@ import (
|
|||
// delegators within the validator may be left with less than a full token,
|
||||
// thus sdk.Dec is used
|
||||
type DelegatorStartingInfo struct {
|
||||
PreviousPeriod uint64 `json:"previous_period"` // period at which the delegation should withdraw starting from
|
||||
Stake sdk.Dec `json:"stake"` // amount of staking token delegated
|
||||
Height uint64 `json:"creation_height"` // height at which delegation was created
|
||||
PreviousPeriod uint64 `json:"previous_period" yaml:"previous_period"` // period at which the delegation should withdraw starting from
|
||||
Stake sdk.Dec `json:"stake" yaml:"stake"` // amount of staking token delegated
|
||||
Height uint64 `json:"creation_height" yaml:"creation_height"` // height at which delegation was created
|
||||
}
|
||||
|
||||
// create a new DelegatorStartingInfo
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
// global fee pool for distribution
|
||||
type FeePool struct {
|
||||
CommunityPool sdk.DecCoins `json:"community_pool"` // pool for community funds yet to be spent
|
||||
CommunityPool sdk.DecCoins `json:"community_pool" yaml:"community_pool"` // pool for community funds yet to be spent
|
||||
}
|
||||
|
||||
// zero fee pool
|
||||
|
|
|
@ -9,65 +9,65 @@ import (
|
|||
// the address for where distributions rewards are withdrawn to by default
|
||||
// this struct is only used at genesis to feed in default withdraw addresses
|
||||
type DelegatorWithdrawInfo struct {
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"`
|
||||
WithdrawAddress sdk.AccAddress `json:"withdraw_address"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
|
||||
WithdrawAddress sdk.AccAddress `json:"withdraw_address" yaml:"withdraw_address"`
|
||||
}
|
||||
|
||||
// used for import/export via genesis json
|
||||
type ValidatorOutstandingRewardsRecord struct {
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
OutstandingRewards sdk.DecCoins `json:"outstanding_rewards"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
OutstandingRewards sdk.DecCoins `json:"outstanding_rewards" yaml:"outstanding_rewards"`
|
||||
}
|
||||
|
||||
// used for import / export via genesis json
|
||||
type ValidatorAccumulatedCommissionRecord struct {
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
Accumulated ValidatorAccumulatedCommission `json:"accumulated"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
Accumulated ValidatorAccumulatedCommission `json:"accumulated" yaml:"accumulated"`
|
||||
}
|
||||
|
||||
// used for import / export via genesis json
|
||||
type ValidatorHistoricalRewardsRecord struct {
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
Period uint64 `json:"period"`
|
||||
Rewards ValidatorHistoricalRewards `json:"rewards"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
Period uint64 `json:"period" yaml:"period"`
|
||||
Rewards ValidatorHistoricalRewards `json:"rewards" yaml:"rewards"`
|
||||
}
|
||||
|
||||
// used for import / export via genesis json
|
||||
type ValidatorCurrentRewardsRecord struct {
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
Rewards ValidatorCurrentRewards `json:"rewards"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
Rewards ValidatorCurrentRewards `json:"rewards" yaml:"rewards"`
|
||||
}
|
||||
|
||||
// used for import / export via genesis json
|
||||
type DelegatorStartingInfoRecord struct {
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
StartingInfo DelegatorStartingInfo `json:"starting_info"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
StartingInfo DelegatorStartingInfo `json:"starting_info" yaml:"starting_info"`
|
||||
}
|
||||
|
||||
// used for import / export via genesis json
|
||||
type ValidatorSlashEventRecord struct {
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
Height uint64 `json:"height"`
|
||||
Period uint64 `json:"period"`
|
||||
Event ValidatorSlashEvent `json:"validator_slash_event"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
Height uint64 `json:"height" yaml:"height"`
|
||||
Period uint64 `json:"period" yaml:"period"`
|
||||
Event ValidatorSlashEvent `json:"validator_slash_event" yaml:"validator_slash_event"`
|
||||
}
|
||||
|
||||
// GenesisState - all distribution state that must be provided at genesis
|
||||
type GenesisState struct {
|
||||
FeePool FeePool `json:"fee_pool"`
|
||||
CommunityTax sdk.Dec `json:"community_tax"`
|
||||
BaseProposerReward sdk.Dec `json:"base_proposer_reward"`
|
||||
BonusProposerReward sdk.Dec `json:"bonus_proposer_reward"`
|
||||
WithdrawAddrEnabled bool `json:"withdraw_addr_enabled"`
|
||||
DelegatorWithdrawInfos []DelegatorWithdrawInfo `json:"delegator_withdraw_infos"`
|
||||
PreviousProposer sdk.ConsAddress `json:"previous_proposer"`
|
||||
OutstandingRewards []ValidatorOutstandingRewardsRecord `json:"outstanding_rewards"`
|
||||
ValidatorAccumulatedCommissions []ValidatorAccumulatedCommissionRecord `json:"validator_accumulated_commissions"`
|
||||
ValidatorHistoricalRewards []ValidatorHistoricalRewardsRecord `json:"validator_historical_rewards"`
|
||||
ValidatorCurrentRewards []ValidatorCurrentRewardsRecord `json:"validator_current_rewards"`
|
||||
DelegatorStartingInfos []DelegatorStartingInfoRecord `json:"delegator_starting_infos"`
|
||||
ValidatorSlashEvents []ValidatorSlashEventRecord `json:"validator_slash_events"`
|
||||
FeePool FeePool `json:"fee_pool" yaml:"fee_pool"`
|
||||
CommunityTax sdk.Dec `json:"community_tax" yaml:"community_tax"`
|
||||
BaseProposerReward sdk.Dec `json:"base_proposer_reward" yaml:"base_proposer_reward"`
|
||||
BonusProposerReward sdk.Dec `json:"bonus_proposer_reward" yaml:"bonus_proposer_reward"`
|
||||
WithdrawAddrEnabled bool `json:"withdraw_addr_enabled" yaml:"withdraw_addr_enabled"`
|
||||
DelegatorWithdrawInfos []DelegatorWithdrawInfo `json:"delegator_withdraw_infos" yaml:"delegator_withdraw_infos"`
|
||||
PreviousProposer sdk.ConsAddress `json:"previous_proposer" yaml:"previous_proposer"`
|
||||
OutstandingRewards []ValidatorOutstandingRewardsRecord `json:"outstanding_rewards" yaml:"outstanding_rewards"`
|
||||
ValidatorAccumulatedCommissions []ValidatorAccumulatedCommissionRecord `json:"validator_accumulated_commissions" yaml:"validator_accumulated_commissions"`
|
||||
ValidatorHistoricalRewards []ValidatorHistoricalRewardsRecord `json:"validator_historical_rewards" yaml:"validator_historical_rewards"`
|
||||
ValidatorCurrentRewards []ValidatorCurrentRewardsRecord `json:"validator_current_rewards" yaml:"validator_current_rewards"`
|
||||
DelegatorStartingInfos []DelegatorStartingInfoRecord `json:"delegator_starting_infos" yaml:"delegator_starting_infos"`
|
||||
ValidatorSlashEvents []ValidatorSlashEventRecord `json:"validator_slash_events" yaml:"validator_slash_events"`
|
||||
}
|
||||
|
||||
func NewGenesisState(feePool FeePool, communityTax, baseProposerReward, bonusProposerReward sdk.Dec,
|
||||
|
|
|
@ -10,8 +10,8 @@ var _, _, _ sdk.Msg = &MsgSetWithdrawAddress{}, &MsgWithdrawDelegatorReward{}, &
|
|||
|
||||
// msg struct for changing the withdraw address for a delegator (or validator self-delegation)
|
||||
type MsgSetWithdrawAddress struct {
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"`
|
||||
WithdrawAddress sdk.AccAddress `json:"withdraw_address"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
|
||||
WithdrawAddress sdk.AccAddress `json:"withdraw_address" yaml:"withdraw_address"`
|
||||
}
|
||||
|
||||
func NewMsgSetWithdrawAddress(delAddr, withdrawAddr sdk.AccAddress) MsgSetWithdrawAddress {
|
||||
|
@ -48,8 +48,8 @@ func (msg MsgSetWithdrawAddress) ValidateBasic() sdk.Error {
|
|||
|
||||
// msg struct for delegation withdraw from a single validator
|
||||
type MsgWithdrawDelegatorReward struct {
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
}
|
||||
|
||||
func NewMsgWithdrawDelegatorReward(delAddr sdk.AccAddress, valAddr sdk.ValAddress) MsgWithdrawDelegatorReward {
|
||||
|
@ -86,7 +86,7 @@ func (msg MsgWithdrawDelegatorReward) ValidateBasic() sdk.Error {
|
|||
|
||||
// msg struct for validator withdraw
|
||||
type MsgWithdrawValidatorCommission struct {
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
}
|
||||
|
||||
func NewMsgWithdrawValidatorCommission(valAddr sdk.ValAddress) MsgWithdrawValidatorCommission {
|
||||
|
|
|
@ -23,10 +23,10 @@ func init() {
|
|||
|
||||
// CommunityPoolSpendProposal spends from the community pool
|
||||
type CommunityPoolSpendProposal struct {
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Recipient sdk.AccAddress `json:"recipient"`
|
||||
Amount sdk.Coins `json:"amount"`
|
||||
Title string `json:"title" yaml:"title"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
Recipient sdk.AccAddress `json:"recipient" yaml:"recipient"`
|
||||
Amount sdk.Coins `json:"amount" yaml:"amount"`
|
||||
}
|
||||
|
||||
// NewCommunityPoolSpendProposal creates a new community pool spned proposal.
|
||||
|
|
|
@ -22,7 +22,7 @@ const (
|
|||
|
||||
// params for query 'custom/distr/validator_outstanding_rewards'
|
||||
type QueryValidatorOutstandingRewardsParams struct {
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
}
|
||||
|
||||
// creates a new instance of QueryValidatorOutstandingRewardsParams
|
||||
|
@ -34,7 +34,7 @@ func NewQueryValidatorOutstandingRewardsParams(validatorAddr sdk.ValAddress) Que
|
|||
|
||||
// params for query 'custom/distr/validator_commission'
|
||||
type QueryValidatorCommissionParams struct {
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
}
|
||||
|
||||
// creates a new instance of QueryValidatorCommissionParams
|
||||
|
@ -46,9 +46,9 @@ func NewQueryValidatorCommissionParams(validatorAddr sdk.ValAddress) QueryValida
|
|||
|
||||
// params for query 'custom/distr/validator_slashes'
|
||||
type QueryValidatorSlashesParams struct {
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
StartingHeight uint64 `json:"starting_height"`
|
||||
EndingHeight uint64 `json:"ending_height"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
StartingHeight uint64 `json:"starting_height" yaml:"starting_height"`
|
||||
EndingHeight uint64 `json:"ending_height" yaml:"ending_height"`
|
||||
}
|
||||
|
||||
// creates a new instance of QueryValidatorSlashesParams
|
||||
|
@ -62,8 +62,8 @@ func NewQueryValidatorSlashesParams(validatorAddr sdk.ValAddress, startingHeight
|
|||
|
||||
// params for query 'custom/distr/delegation_rewards'
|
||||
type QueryDelegationRewardsParams struct {
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
}
|
||||
|
||||
// creates a new instance of QueryDelegationRewardsParams
|
||||
|
@ -76,7 +76,7 @@ func NewQueryDelegationRewardsParams(delegatorAddr sdk.AccAddress, validatorAddr
|
|||
|
||||
// params for query 'custom/distr/delegator_total_rewards' and 'custom/distr/delegator_validators'
|
||||
type QueryDelegatorParams struct {
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
|
||||
}
|
||||
|
||||
// creates a new instance of QueryDelegationRewardsParams
|
||||
|
@ -88,7 +88,7 @@ func NewQueryDelegatorParams(delegatorAddr sdk.AccAddress) QueryDelegatorParams
|
|||
|
||||
// params for query 'custom/distr/withdraw_addr'
|
||||
type QueryDelegatorWithdrawAddrParams struct {
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
|
||||
}
|
||||
|
||||
// NewQueryDelegatorWithdrawAddrParams creates a new instance of QueryDelegatorWithdrawAddrParams.
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
// QueryDelegatorTotalRewardsResponse defines the properties of
|
||||
// QueryDelegatorTotalRewards query's response.
|
||||
type QueryDelegatorTotalRewardsResponse struct {
|
||||
Rewards []DelegationDelegatorReward `json:"rewards"`
|
||||
Total sdk.DecCoins `json:"total"`
|
||||
Rewards []DelegationDelegatorReward `json:"rewards" yaml:"rewards"`
|
||||
Total sdk.DecCoins `json:"total" yaml:"total"`
|
||||
}
|
||||
|
||||
// NewQueryDelegatorTotalRewardsResponse constructs a QueryDelegatorTotalRewardsResponse
|
||||
|
@ -35,8 +35,8 @@ func (res QueryDelegatorTotalRewardsResponse) String() string {
|
|||
// DelegationDelegatorReward defines the properties
|
||||
// of a delegator's delegation reward.
|
||||
type DelegationDelegatorReward struct {
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
Reward sdk.DecCoins `json:"reward"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
Reward sdk.DecCoins `json:"reward" yaml:"reward"`
|
||||
}
|
||||
|
||||
// NewDelegationDelegatorReward constructs a DelegationDelegatorReward.
|
||||
|
|
|
@ -19,8 +19,8 @@ import (
|
|||
// + number of slashes which ended the associated period (and might need to read that record)
|
||||
// + one per validator for the zeroeth period, set on initialization
|
||||
type ValidatorHistoricalRewards struct {
|
||||
CumulativeRewardRatio sdk.DecCoins `json:"cumulative_reward_ratio"`
|
||||
ReferenceCount uint16 `json:"reference_count"`
|
||||
CumulativeRewardRatio sdk.DecCoins `json:"cumulative_reward_ratio" yaml:"cumulative_reward_ratio"`
|
||||
ReferenceCount uint16 `json:"reference_count" yaml:"reference_count"`
|
||||
}
|
||||
|
||||
// create a new ValidatorHistoricalRewards
|
||||
|
@ -35,8 +35,8 @@ func NewValidatorHistoricalRewards(cumulativeRewardRatio sdk.DecCoins, reference
|
|||
// kept as a running counter and incremented each block
|
||||
// as long as the validator's tokens remain constant
|
||||
type ValidatorCurrentRewards struct {
|
||||
Rewards sdk.DecCoins `json:"rewards"` // current rewards
|
||||
Period uint64 `json:"period"` // current period
|
||||
Rewards sdk.DecCoins `json:"rewards" yaml:"rewards"` // current rewards
|
||||
Period uint64 `json:"period" yaml:"period"` // current period
|
||||
}
|
||||
|
||||
// create a new ValidatorCurrentRewards
|
||||
|
@ -61,8 +61,8 @@ func InitialValidatorAccumulatedCommission() ValidatorAccumulatedCommission {
|
|||
// needed to calculate appropriate amounts of staking token
|
||||
// for delegations which withdraw after a slash has occurred
|
||||
type ValidatorSlashEvent struct {
|
||||
ValidatorPeriod uint64 `json:"validator_period"` // period when the slash occurred
|
||||
Fraction sdk.Dec `json:"fraction"` // slash fraction
|
||||
ValidatorPeriod uint64 `json:"validator_period" yaml:"validator_period"` // period when the slash occurred
|
||||
Fraction sdk.Dec `json:"fraction" yaml:"fraction"` // slash fraction
|
||||
}
|
||||
|
||||
// create a new ValidatorSlashEvent
|
||||
|
|
|
@ -14,21 +14,21 @@ import (
|
|||
|
||||
// GenesisAccount is a struct for account initialization used exclusively during genesis
|
||||
type GenesisAccount struct {
|
||||
Address sdk.AccAddress `json:"address"`
|
||||
Coins sdk.Coins `json:"coins"`
|
||||
Sequence uint64 `json:"sequence_number"`
|
||||
AccountNumber uint64 `json:"account_number"`
|
||||
Address sdk.AccAddress `json:"address" yaml:"address"`
|
||||
Coins sdk.Coins `json:"coins" yaml:"coins"`
|
||||
Sequence uint64 `json:"sequence_number" yaml:"sequence_number"`
|
||||
AccountNumber uint64 `json:"account_number" yaml:"account_number"`
|
||||
|
||||
// vesting account fields
|
||||
OriginalVesting sdk.Coins `json:"original_vesting"` // total vesting coins upon initialization
|
||||
DelegatedFree sdk.Coins `json:"delegated_free"` // delegated vested coins at time of delegation
|
||||
DelegatedVesting sdk.Coins `json:"delegated_vesting"` // delegated vesting coins at time of delegation
|
||||
StartTime int64 `json:"start_time"` // vesting start time (UNIX Epoch time)
|
||||
EndTime int64 `json:"end_time"` // vesting end time (UNIX Epoch time)
|
||||
OriginalVesting sdk.Coins `json:"original_vesting" yaml:"original_vesting"` // total vesting coins upon initialization
|
||||
DelegatedFree sdk.Coins `json:"delegated_free" yaml:"delegated_free"` // delegated vested coins at time of delegation
|
||||
DelegatedVesting sdk.Coins `json:"delegated_vesting" yaml:"delegated_vesting"` // delegated vesting coins at time of delegation
|
||||
StartTime int64 `json:"start_time" yaml:"start_time"` // vesting start time (UNIX Epoch time)
|
||||
EndTime int64 `json:"end_time" yaml:"end_time"` // vesting end time (UNIX Epoch time)
|
||||
|
||||
// module account fields
|
||||
ModuleName string `json:"module_name"` // name of the module account
|
||||
ModulePermission string `json:"module_permission"` // permission of module account
|
||||
ModuleName string `json:"module_name" yaml:"module_name"` // name of the module account
|
||||
ModulePermission string `json:"module_permission" yaml:"module_permission"` // permission of module account
|
||||
}
|
||||
|
||||
// Validate checks for errors on the vesting and module account parameters
|
||||
|
|
|
@ -26,11 +26,11 @@ const (
|
|||
)
|
||||
|
||||
type printInfo struct {
|
||||
Moniker string `json:"moniker"`
|
||||
ChainID string `json:"chain_id"`
|
||||
NodeID string `json:"node_id"`
|
||||
GenTxsDir string `json:"gentxs_dir"`
|
||||
AppMessage json.RawMessage `json:"app_message"`
|
||||
Moniker string `json:"moniker" yaml:"moniker"`
|
||||
ChainID string `json:"chain_id" yaml:"chain_id"`
|
||||
NodeID string `json:"node_id" yaml:"node_id"`
|
||||
GenTxsDir string `json:"gentxs_dir" yaml:"gentxs_dir"`
|
||||
AppMessage json.RawMessage `json:"app_message" yaml:"app_message"`
|
||||
}
|
||||
|
||||
func newPrintInfo(moniker, chainID, nodeID, genTxsDir string,
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
|
||||
// State to Unmarshal
|
||||
type GenesisState struct {
|
||||
GenTxs []json.RawMessage `json:"gentxs"`
|
||||
GenTxs []json.RawMessage `json:"gentxs" yaml:"gentxs"`
|
||||
}
|
||||
|
||||
// NewGenesisState creates a new GenesisState object
|
||||
|
|
|
@ -64,26 +64,26 @@ func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, phs []ProposalREST
|
|||
|
||||
// PostProposalReq defines the properties of a proposal request's body.
|
||||
type PostProposalReq struct {
|
||||
BaseReq rest.BaseReq `json:"base_req"`
|
||||
Title string `json:"title"` // Title of the proposal
|
||||
Description string `json:"description"` // Description of the proposal
|
||||
ProposalType string `json:"proposal_type"` // Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal}
|
||||
Proposer sdk.AccAddress `json:"proposer"` // Address of the proposer
|
||||
InitialDeposit sdk.Coins `json:"initial_deposit"` // Coins to add to the proposal's deposit
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
Title string `json:"title" yaml:"title"` // Title of the proposal
|
||||
Description string `json:"description" yaml:"description"` // Description of the proposal
|
||||
ProposalType string `json:"proposal_type" yaml:"proposal_type"` // Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal}
|
||||
Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"` // Address of the proposer
|
||||
InitialDeposit sdk.Coins `json:"initial_deposit" yaml:"initial_deposit"` // Coins to add to the proposal's deposit
|
||||
}
|
||||
|
||||
// DepositReq defines the properties of a deposit request's body.
|
||||
type DepositReq struct {
|
||||
BaseReq rest.BaseReq `json:"base_req"`
|
||||
Depositor sdk.AccAddress `json:"depositor"` // Address of the depositor
|
||||
Amount sdk.Coins `json:"amount"` // Coins to add to the proposal's deposit
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
Depositor sdk.AccAddress `json:"depositor" yaml:"depositor"` // Address of the depositor
|
||||
Amount sdk.Coins `json:"amount" yaml:"amount"` // Coins to add to the proposal's deposit
|
||||
}
|
||||
|
||||
// VoteReq defines the properties of a vote request's body.
|
||||
type VoteReq struct {
|
||||
BaseReq rest.BaseReq `json:"base_req"`
|
||||
Voter sdk.AccAddress `json:"voter"` // address of the voter
|
||||
Option string `json:"option"` // option from OptionSet chosen by the voter
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
Voter sdk.AccAddress `json:"voter" yaml:"voter"` // address of the voter
|
||||
Option string `json:"option" yaml:"option"` // option from OptionSet chosen by the voter
|
||||
}
|
||||
|
||||
func postProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
|
||||
|
|
|
@ -17,8 +17,8 @@ const (
|
|||
// Proposer contains metadata of a governance proposal used for querying a
|
||||
// proposer.
|
||||
type Proposer struct {
|
||||
ProposalID uint64 `json:"proposal_id"`
|
||||
Proposer string `json:"proposer"`
|
||||
ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"`
|
||||
Proposer string `json:"proposer" yaml:"proposer"`
|
||||
}
|
||||
|
||||
// NewProposer returns a new Proposer given id and proposer
|
||||
|
|
|
@ -16,13 +16,13 @@ const (
|
|||
|
||||
// GenesisState - all staking state that must be provided at genesis
|
||||
type GenesisState struct {
|
||||
StartingProposalID uint64 `json:"starting_proposal_id"`
|
||||
Deposits Deposits `json:"deposits"`
|
||||
Votes Votes `json:"votes"`
|
||||
Proposals []Proposal `json:"proposals"`
|
||||
DepositParams DepositParams `json:"deposit_params"`
|
||||
VotingParams VotingParams `json:"voting_params"`
|
||||
TallyParams TallyParams `json:"tally_params"`
|
||||
StartingProposalID uint64 `json:"starting_proposal_id" yaml:"starting_proposal_id"`
|
||||
Deposits Deposits `json:"deposits" yaml:"deposits"`
|
||||
Votes Votes `json:"votes" yaml:"votes"`
|
||||
Proposals []Proposal `json:"proposals" yaml:"proposals"`
|
||||
DepositParams DepositParams `json:"deposit_params" yaml:"deposit_params"`
|
||||
VotingParams VotingParams `json:"voting_params" yaml:"voting_params"`
|
||||
TallyParams TallyParams `json:"tally_params" yaml:"tally_params"`
|
||||
}
|
||||
|
||||
// NewGenesisState creates a new genesis state for the governance module
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
|
||||
// Deposit
|
||||
type Deposit struct {
|
||||
ProposalID uint64 `json:"proposal_id"` // proposalID of the proposal
|
||||
Depositor sdk.AccAddress `json:"depositor"` // Address of the depositor
|
||||
Amount sdk.Coins `json:"amount"` // Deposit amount
|
||||
ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` // proposalID of the proposal
|
||||
Depositor sdk.AccAddress `json:"depositor" yaml:"depositor"` // Address of the depositor
|
||||
Amount sdk.Coins `json:"amount" yaml:"amount"` // Deposit amount
|
||||
}
|
||||
|
||||
// NewDeposit creates a new Deposit instance
|
||||
|
|
|
@ -17,9 +17,9 @@ var _, _, _ sdk.Msg = MsgSubmitProposal{}, MsgDeposit{}, MsgVote{}
|
|||
|
||||
// MsgSubmitProposal
|
||||
type MsgSubmitProposal struct {
|
||||
Content Content `json:"content"`
|
||||
InitialDeposit sdk.Coins `json:"initial_deposit"` // Initial deposit paid by sender. Must be strictly positive
|
||||
Proposer sdk.AccAddress `json:"proposer"` // Address of the proposer
|
||||
Content Content `json:"content" yaml:"content"`
|
||||
InitialDeposit sdk.Coins `json:"initial_deposit" yaml:"initial_deposit"` // Initial deposit paid by sender. Must be strictly positive
|
||||
Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"` // Address of the proposer
|
||||
}
|
||||
|
||||
func NewMsgSubmitProposal(content Content, initialDeposit sdk.Coins, proposer sdk.AccAddress) MsgSubmitProposal {
|
||||
|
@ -77,9 +77,9 @@ func (msg MsgSubmitProposal) GetSigners() []sdk.AccAddress {
|
|||
|
||||
// MsgDeposit
|
||||
type MsgDeposit struct {
|
||||
ProposalID uint64 `json:"proposal_id"` // ID of the proposal
|
||||
Depositor sdk.AccAddress `json:"depositor"` // Address of the depositor
|
||||
Amount sdk.Coins `json:"amount"` // Coins to add to the proposal's deposit
|
||||
ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` // ID of the proposal
|
||||
Depositor sdk.AccAddress `json:"depositor" yaml:"depositor"` // Address of the depositor
|
||||
Amount sdk.Coins `json:"amount" yaml:"amount"` // Coins to add to the proposal's deposit
|
||||
}
|
||||
|
||||
func NewMsgDeposit(depositor sdk.AccAddress, proposalID uint64, amount sdk.Coins) MsgDeposit {
|
||||
|
@ -127,9 +127,9 @@ func (msg MsgDeposit) GetSigners() []sdk.AccAddress {
|
|||
|
||||
// MsgVote
|
||||
type MsgVote struct {
|
||||
ProposalID uint64 `json:"proposal_id"` // ID of the proposal
|
||||
Voter sdk.AccAddress `json:"voter"` // address of the voter
|
||||
Option VoteOption `json:"option"` // option from OptionSet chosen by the voter
|
||||
ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` // ID of the proposal
|
||||
Voter sdk.AccAddress `json:"voter" yaml:"voter"` // address of the voter
|
||||
Option VoteOption `json:"option" yaml:"option"` // option from OptionSet chosen by the voter
|
||||
}
|
||||
|
||||
func NewMsgVote(voter sdk.AccAddress, proposalID uint64, option VoteOption) MsgVote {
|
||||
|
|
|
@ -26,8 +26,8 @@ func ParamKeyTable() params.KeyTable {
|
|||
|
||||
// Param around deposits for governance
|
||||
type DepositParams struct {
|
||||
MinDeposit sdk.Coins `json:"min_deposit,omitempty"` // Minimum deposit for a proposal to enter voting period.
|
||||
MaxDepositPeriod time.Duration `json:"max_deposit_period,omitempty"` // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 months
|
||||
MinDeposit sdk.Coins `json:"min_deposit,omitempty" yaml:"min_deposit,omitempty"` // Minimum deposit for a proposal to enter voting period.
|
||||
MaxDepositPeriod time.Duration `json:"max_deposit_period,omitempty" yaml:"max_deposit_period,omitempty"` // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 months
|
||||
}
|
||||
|
||||
// NewDepositParams creates a new DepositParams object
|
||||
|
@ -51,9 +51,9 @@ func (dp DepositParams) Equal(dp2 DepositParams) bool {
|
|||
|
||||
// Param around Tallying votes in governance
|
||||
type TallyParams struct {
|
||||
Quorum sdk.Dec `json:"quorum,omitempty"` // Minimum percentage of total stake needed to vote for a result to be considered valid
|
||||
Threshold sdk.Dec `json:"threshold,omitempty"` // Minimum proportion of Yes votes for proposal to pass. Initial value: 0.5
|
||||
Veto sdk.Dec `json:"veto,omitempty"` // Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3
|
||||
Quorum sdk.Dec `json:"quorum,omitempty" yaml:"quorum,omitempty"` // Minimum percentage of total stake needed to vote for a result to be considered valid
|
||||
Threshold sdk.Dec `json:"threshold,omitempty" yaml:"threshold,omitempty"` // Minimum proportion of Yes votes for proposal to pass. Initial value: 0.5
|
||||
Veto sdk.Dec `json:"veto,omitempty" yaml:"veto,omitempty"` // Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3
|
||||
}
|
||||
|
||||
// NewTallyParams creates a new TallyParams object
|
||||
|
@ -75,7 +75,7 @@ func (tp TallyParams) String() string {
|
|||
|
||||
// Param around Voting in governance
|
||||
type VotingParams struct {
|
||||
VotingPeriod time.Duration `json:"voting_period,omitempty"` // Length of the voting period.
|
||||
VotingPeriod time.Duration `json:"voting_period,omitempty" yaml:"voting_period,omitempty"` // Length of the voting period.
|
||||
}
|
||||
|
||||
// NewVotingParams creates a new VotingParams object
|
||||
|
@ -92,9 +92,9 @@ func (vp VotingParams) String() string {
|
|||
|
||||
// Params returns all of the governance params
|
||||
type Params struct {
|
||||
VotingParams VotingParams `json:"voting_params"`
|
||||
TallyParams TallyParams `json:"tally_params"`
|
||||
DepositParams DepositParams `json:"deposit_params"`
|
||||
VotingParams VotingParams `json:"voting_params" yaml:"voting_params"`
|
||||
TallyParams TallyParams `json:"tally_params" yaml:"tally_params"`
|
||||
DepositParams DepositParams `json:"deposit_params" yaml:"deposit_parmas"`
|
||||
}
|
||||
|
||||
func (gp Params) String() string {
|
||||
|
|
|
@ -12,18 +12,18 @@ import (
|
|||
// Proposal defines a struct used by the governance module to allow for voting
|
||||
// on network changes.
|
||||
type Proposal struct {
|
||||
Content `json:"content"` // Proposal content interface
|
||||
Content `json:"content" yaml:"content"` // Proposal content interface
|
||||
|
||||
ProposalID uint64 `json:"id"` // ID of the proposal
|
||||
Status ProposalStatus `json:"proposal_status"` // Status of the Proposal {Pending, Active, Passed, Rejected}
|
||||
FinalTallyResult TallyResult `json:"final_tally_result"` // Result of Tallys
|
||||
ProposalID uint64 `json:"id" yaml:"id"` // ID of the proposal
|
||||
Status ProposalStatus `json:"proposal_status" yaml:"proposal_status"` // Status of the Proposal {Pending, Active, Passed, Rejected}
|
||||
FinalTallyResult TallyResult `json:"final_tally_result" yaml:"final_tally_result"` // Result of Tallys
|
||||
|
||||
SubmitTime time.Time `json:"submit_time"` // Time of the block where TxGovSubmitProposal was included
|
||||
DepositEndTime time.Time `json:"deposit_end_time"` // Time that the Proposal would expire if deposit amount isn't met
|
||||
TotalDeposit sdk.Coins `json:"total_deposit"` // Current deposit on this proposal. Initial value is set at InitialDeposit
|
||||
SubmitTime time.Time `json:"submit_time" yaml:"submit_time"` // Time of the block where TxGovSubmitProposal was included
|
||||
DepositEndTime time.Time `json:"deposit_end_time" yaml:"deposit_end_time"` // Time that the Proposal would expire if deposit amount isn't met
|
||||
TotalDeposit sdk.Coins `json:"total_deposit" yaml:"total_deposit"` // Current deposit on this proposal. Initial value is set at InitialDeposit
|
||||
|
||||
VotingStartTime time.Time `json:"voting_start_time"` // Time of the block where MinDeposit was reached. -1 if MinDeposit is not reached
|
||||
VotingEndTime time.Time `json:"voting_end_time"` // Time that the VotingPeriod for this proposal will end and votes will be tallied
|
||||
VotingStartTime time.Time `json:"voting_start_time" yaml:"voting_start_time"` // Time of the block where MinDeposit was reached. -1 if MinDeposit is not reached
|
||||
VotingEndTime time.Time `json:"voting_end_time" yaml:"voting_end_time"` // Time that the VotingPeriod for this proposal will end and votes will be tallied
|
||||
}
|
||||
|
||||
func NewProposal(content Content, id uint64, submitTime, depositEndTime time.Time) Proposal {
|
||||
|
@ -197,10 +197,10 @@ func (status ProposalStatus) Format(s fmt.State, verb rune) {
|
|||
|
||||
// Tally Results
|
||||
type TallyResult struct {
|
||||
Yes sdk.Int `json:"yes"`
|
||||
Abstain sdk.Int `json:"abstain"`
|
||||
No sdk.Int `json:"no"`
|
||||
NoWithVeto sdk.Int `json:"no_with_veto"`
|
||||
Yes sdk.Int `json:"yes" yaml:"yes"`
|
||||
Abstain sdk.Int `json:"abstain" yaml:"abstain"`
|
||||
No sdk.Int `json:"no" yaml:"no"`
|
||||
NoWithVeto sdk.Int `json:"no_with_veto" yaml:"no_with_veto"`
|
||||
}
|
||||
|
||||
func NewTallyResult(yes, abstain, no, noWithVeto sdk.Int) TallyResult {
|
||||
|
@ -255,8 +255,8 @@ const (
|
|||
|
||||
// Text Proposal
|
||||
type TextProposal struct {
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Title string `json:"title" yaml:"title"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
}
|
||||
|
||||
func NewTextProposal(title, description string) Content {
|
||||
|
@ -284,8 +284,8 @@ func (tp TextProposal) String() string {
|
|||
// TODO: We have to add fields for SUP specific arguments e.g. commit hash,
|
||||
// upgrade date, etc.
|
||||
type SoftwareUpgradeProposal struct {
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Title string `json:"title" yaml:"title"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
}
|
||||
|
||||
func NewSoftwareUpgradeProposal(title, description string) Content {
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
|
||||
// Vote
|
||||
type Vote struct {
|
||||
ProposalID uint64 `json:"proposal_id"` // proposalID of the proposal
|
||||
Voter sdk.AccAddress `json:"voter"` // address of the voter
|
||||
Option VoteOption `json:"option"` // option from OptionSet chosen by the voter
|
||||
ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` // proposalID of the proposal
|
||||
Voter sdk.AccAddress `json:"voter" yaml:"voter"` // address of the voter
|
||||
Option VoteOption `json:"option" yaml:"option"` // option from OptionSet chosen by the voter
|
||||
}
|
||||
|
||||
// NewVote creates a new Vote instance
|
||||
|
|
|
@ -6,8 +6,8 @@ import (
|
|||
|
||||
// GenesisState - minter state
|
||||
type GenesisState struct {
|
||||
Minter Minter `json:"minter"` // minter object
|
||||
Params Params `json:"params"` // inflation params
|
||||
Minter Minter `json:"minter" yaml:"minter"` // minter object
|
||||
Params Params `json:"params" yaml:"params"` // inflation params
|
||||
}
|
||||
|
||||
// NewGenesisState creates a new GenesisState object
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
|
||||
// Minter represents the minting state.
|
||||
type Minter struct {
|
||||
Inflation sdk.Dec `json:"inflation"` // current annual inflation rate
|
||||
AnnualProvisions sdk.Dec `json:"annual_provisions"` // current annual expected provisions
|
||||
Inflation sdk.Dec `json:"inflation" yaml:"inflation"` // current annual inflation rate
|
||||
AnnualProvisions sdk.Dec `json:"annual_provisions" yaml:"annual_provisions"` // current annual expected provisions
|
||||
}
|
||||
|
||||
// NewMinter returns a new Minter object with the given inflation and annual
|
||||
|
|
|
@ -19,12 +19,12 @@ var (
|
|||
|
||||
// mint parameters
|
||||
type Params struct {
|
||||
MintDenom string `json:"mint_denom"` // type of coin to mint
|
||||
InflationRateChange sdk.Dec `json:"inflation_rate_change"` // maximum annual change in inflation rate
|
||||
InflationMax sdk.Dec `json:"inflation_max"` // maximum inflation rate
|
||||
InflationMin sdk.Dec `json:"inflation_min"` // minimum inflation rate
|
||||
GoalBonded sdk.Dec `json:"goal_bonded"` // goal of percent bonded atoms
|
||||
BlocksPerYear uint64 `json:"blocks_per_year"` // expected blocks per year
|
||||
MintDenom string `json:"mint_denom" yaml:"mint_denom"` // type of coin to mint
|
||||
InflationRateChange sdk.Dec `json:"inflation_rate_change" yaml:"inflation_rate_change"` // maximum annual change in inflation rate
|
||||
InflationMax sdk.Dec `json:"inflation_max" yaml:"inflation_max"` // maximum inflation rate
|
||||
InflationMin sdk.Dec `json:"inflation_min" yaml:"inflation_min"` // minimum inflation rate
|
||||
GoalBonded sdk.Dec `json:"goal_bonded" yaml:"goal_bonded"` // goal of percent bonded atoms
|
||||
BlocksPerYear uint64 `json:"blocks_per_year" yaml:"blocks_per_year"` // expected blocks per year
|
||||
}
|
||||
|
||||
// ParamTable for minting module.
|
||||
|
|
|
@ -18,30 +18,30 @@ type (
|
|||
// ParamChangeJSON defines a parameter change used in JSON input. This
|
||||
// allows values to be specified in raw JSON instead of being string encoded.
|
||||
ParamChangeJSON struct {
|
||||
Subspace string `json:"subspace"`
|
||||
Key string `json:"key"`
|
||||
Subkey string `json:"subkey,omitempty"`
|
||||
Value json.RawMessage `json:"value"`
|
||||
Subspace string `json:"subspace" yaml:"subspace"`
|
||||
Key string `json:"key" yaml:"key"`
|
||||
Subkey string `json:"subkey,omitempty" yaml:"subkey,omitempty"`
|
||||
Value json.RawMessage `json:"value" yaml:"value"`
|
||||
}
|
||||
|
||||
// ParamChangeProposalJSON defines a ParameterChangeProposal with a deposit used
|
||||
// to parse parameter change proposals from a JSON file.
|
||||
ParamChangeProposalJSON struct {
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Changes ParamChangesJSON `json:"changes"`
|
||||
Deposit sdk.Coins `json:"deposit"`
|
||||
Title string `json:"title" yaml:"title"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
Changes ParamChangesJSON `json:"changes" yaml:"changes"`
|
||||
Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
|
||||
}
|
||||
|
||||
// ParamChangeProposalReq defines a parameter change proposal request body.
|
||||
ParamChangeProposalReq struct {
|
||||
BaseReq rest.BaseReq `json:"base_req"`
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Changes ParamChangesJSON `json:"changes"`
|
||||
Proposer sdk.AccAddress `json:"proposer"`
|
||||
Deposit sdk.Coins `json:"deposit"`
|
||||
Title string `json:"title" yaml:"title"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
Changes ParamChangesJSON `json:"changes" yaml:"changes"`
|
||||
Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"`
|
||||
Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -181,8 +181,8 @@ func TestSubspace(t *testing.T) {
|
|||
}
|
||||
|
||||
type paramJSON struct {
|
||||
Param1 int64 `json:"param1,omitempty"`
|
||||
Param2 string `json:"param2,omitempty"`
|
||||
Param1 int64 `json:"param1,omitempty" yaml:"param1,omitempty"`
|
||||
Param2 string `json:"param2,omitempty" yaml:"param2,omitempty"`
|
||||
}
|
||||
|
||||
func TestJSONUpdate(t *testing.T) {
|
||||
|
|
|
@ -32,13 +32,13 @@ var (
|
|||
)
|
||||
|
||||
type testParamsSlashingRate struct {
|
||||
DoubleSign uint16 `json:"double_sign,omitempty"`
|
||||
Downtime uint16 `json:"downtime,omitempty"`
|
||||
DoubleSign uint16 `json:"double_sign,omitempty" yaml:"double_sign,omitempty"`
|
||||
Downtime uint16 `json:"downtime,omitempty" yaml:"downtime,omitempty"`
|
||||
}
|
||||
|
||||
type testParams struct {
|
||||
MaxValidators uint16 `json:"max_validators"` // maximum number of validators (max uint16 = 65535)
|
||||
SlashingRate testParamsSlashingRate `json:"slashing_rate"`
|
||||
MaxValidators uint16 `json:"max_validators" yaml:"max_validators"` // maximum number of validators (max uint16 = 65535)
|
||||
SlashingRate testParamsSlashingRate `json:"slashing_rate" yaml:"slashing_rate"`
|
||||
}
|
||||
|
||||
func (tp *testParams) ParamSetPairs() subspace.ParamSetPairs {
|
||||
|
|
|
@ -24,9 +24,9 @@ func init() {
|
|||
// ParameterChangeProposal defines a proposal which contains multiple parameter
|
||||
// changes.
|
||||
type ParameterChangeProposal struct {
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Changes []ParamChange `json:"changes"`
|
||||
Title string `json:"title" yaml:"title"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
Changes []ParamChange `json:"changes" yaml:"changes"`
|
||||
}
|
||||
|
||||
func NewParameterChangeProposal(title, description string, changes []ParamChange) ParameterChangeProposal {
|
||||
|
@ -79,10 +79,10 @@ func (pcp ParameterChangeProposal) String() string {
|
|||
|
||||
// ParamChange defines a parameter change.
|
||||
type ParamChange struct {
|
||||
Subspace string `json:"subspace"`
|
||||
Key string `json:"key"`
|
||||
Subkey string `json:"subkey,omitempty"`
|
||||
Value string `json:"value"`
|
||||
Subspace string `json:"subspace" yaml:"subspace"`
|
||||
Key string `json:"key" yaml:"key"`
|
||||
Subkey string `json:"subkey,omitempty" yaml:"subkey,omitempty"`
|
||||
Value string `json:"value" yaml:"value"`
|
||||
}
|
||||
|
||||
func NewParamChange(subspace, key, value string) ParamChange {
|
||||
|
|
|
@ -23,7 +23,7 @@ func NewLogWriter(testingmode bool) LogWriter {
|
|||
|
||||
// log writter
|
||||
type StandardLogWriter struct {
|
||||
OpEntries []OperationEntry `json:"op_entries"`
|
||||
OpEntries []OperationEntry `json:"op_entries" yaml:"op_entries"`
|
||||
}
|
||||
|
||||
// add an entry to the log writter
|
||||
|
|
|
@ -34,10 +34,10 @@ const (
|
|||
|
||||
// OperationEntry - an operation entry for logging (ex. BeginBlock, EndBlock, XxxMsg, etc)
|
||||
type OperationEntry struct {
|
||||
EntryKind string `json:"entry_kind"`
|
||||
Height int64 `json:"height"`
|
||||
Order int64 `json:"order"`
|
||||
Operation json.RawMessage `json:"operation"`
|
||||
EntryKind string `json:"entry_kind" yaml:"entry_kind"`
|
||||
Height int64 `json:"height" yaml:"height"`
|
||||
Order int64 `json:"order" yaml:"order"`
|
||||
Operation json.RawMessage `json:"operation" yaml:"operation"`
|
||||
}
|
||||
|
||||
// BeginBlockEntry - operation entry for begin block
|
||||
|
@ -93,11 +93,11 @@ func (oe OperationEntry) MustMarshal() json.RawMessage {
|
|||
|
||||
// OperationMsg - structure for operation output
|
||||
type OperationMsg struct {
|
||||
Route string `json:"route"`
|
||||
Name string `json:"name"`
|
||||
Comment string `json:"comment"`
|
||||
OK bool `json:"ok"`
|
||||
Msg json.RawMessage `json:"msg"`
|
||||
Route string `json:"route" yaml:"route"`
|
||||
Name string `json:"name" yaml:"name"`
|
||||
Comment string `json:"comment" yaml:"comment"`
|
||||
OK bool `json:"ok" yaml:"ok"`
|
||||
Msg json.RawMessage `json:"msg" yaml:"msg"`
|
||||
}
|
||||
|
||||
// OperationMsg - create a new operation message from sdk.Msg
|
||||
|
|
|
@ -22,7 +22,7 @@ func registerTxRoutes(cliCtx context.CLIContext, r *mux.Router) {
|
|||
|
||||
// Unjail TX body
|
||||
type UnjailReq struct {
|
||||
BaseReq rest.BaseReq `json:"base_req"`
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
}
|
||||
|
||||
func unjailRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
|
||||
// GenesisState - all slashing state that must be provided at genesis
|
||||
type GenesisState struct {
|
||||
Params Params `json:"params"`
|
||||
SigningInfos map[string]ValidatorSigningInfo `json:"signing_infos"`
|
||||
MissedBlocks map[string][]MissedBlock `json:"missed_blocks"`
|
||||
Params Params `json:"params" yaml:"params"`
|
||||
SigningInfos map[string]ValidatorSigningInfo `json:"signing_infos" yaml:"signing_infos"`
|
||||
MissedBlocks map[string][]MissedBlock `json:"missed_blocks" yaml:"missed_blocks"`
|
||||
}
|
||||
|
||||
// NewGenesisState creates a new GenesisState object
|
||||
|
@ -28,8 +28,8 @@ func NewGenesisState(
|
|||
|
||||
// MissedBlock
|
||||
type MissedBlock struct {
|
||||
Index int64 `json:"index"`
|
||||
Missed bool `json:"missed"`
|
||||
Index int64 `json:"index" yaml:"index"`
|
||||
Missed bool `json:"missed" yaml:"missed"`
|
||||
}
|
||||
|
||||
// DefaultGenesisState - default GenesisState used by Cosmos Hub
|
||||
|
|
|
@ -9,7 +9,7 @@ var _ sdk.Msg = &MsgUnjail{}
|
|||
|
||||
// MsgUnjail - struct for unjailing jailed validator
|
||||
type MsgUnjail struct {
|
||||
ValidatorAddr sdk.ValAddress `json:"address"` // address of the validator operator
|
||||
ValidatorAddr sdk.ValAddress `json:"address" yaml:"address"` // address of the validator operator
|
||||
}
|
||||
|
||||
func NewMsgUnjail(validatorAddr sdk.ValAddress) MsgUnjail {
|
||||
|
|
|
@ -41,12 +41,12 @@ func ParamKeyTable() params.KeyTable {
|
|||
|
||||
// Params - used for initializing default parameter for slashing at genesis
|
||||
type Params struct {
|
||||
MaxEvidenceAge time.Duration `json:"max_evidence_age"`
|
||||
SignedBlocksWindow int64 `json:"signed_blocks_window"`
|
||||
MinSignedPerWindow sdk.Dec `json:"min_signed_per_window"`
|
||||
DowntimeJailDuration time.Duration `json:"downtime_jail_duration"`
|
||||
SlashFractionDoubleSign sdk.Dec `json:"slash_fraction_double_sign"`
|
||||
SlashFractionDowntime sdk.Dec `json:"slash_fraction_downtime"`
|
||||
MaxEvidenceAge time.Duration `json:"max_evidence_age" yaml:"max_evidence_age"`
|
||||
SignedBlocksWindow int64 `json:"signed_blocks_window" yaml:"signed_blocks_window"`
|
||||
MinSignedPerWindow sdk.Dec `json:"min_signed_per_window" yaml:"min_signed_per_window"`
|
||||
DowntimeJailDuration time.Duration `json:"downtime_jail_duration" yaml:"downtime_jail_duration"`
|
||||
SlashFractionDoubleSign sdk.Dec `json:"slash_fraction_double_sign" yaml:"slash_fraction_double_sign"`
|
||||
SlashFractionDowntime sdk.Dec `json:"slash_fraction_downtime" yaml:"slash_fraction_downtime"`
|
||||
}
|
||||
|
||||
// NewParams creates a new Params object
|
||||
|
|
|
@ -9,12 +9,12 @@ import (
|
|||
|
||||
// Signing info for a validator
|
||||
type ValidatorSigningInfo struct {
|
||||
Address sdk.ConsAddress `json:"address"` // validator consensus address
|
||||
StartHeight int64 `json:"start_height"` // height at which validator was first a candidate OR was unjailed
|
||||
IndexOffset int64 `json:"index_offset"` // index offset into signed block bit array
|
||||
JailedUntil time.Time `json:"jailed_until"` // timestamp validator cannot be unjailed until
|
||||
Tombstoned bool `json:"tombstoned"` // whether or not a validator has been tombstoned (killed out of validator set)
|
||||
MissedBlocksCounter int64 `json:"missed_blocks_counter"` // missed blocks counter (to avoid scanning the array every time)
|
||||
Address sdk.ConsAddress `json:"address" yaml:"address"` // validator consensus address
|
||||
StartHeight int64 `json:"start_height" yaml:"start_height"` // height at which validator was first a candidate OR was unjailed
|
||||
IndexOffset int64 `json:"index_offset" yaml:"index_offset"` // index offset into signed block bit array
|
||||
JailedUntil time.Time `json:"jailed_until" yaml:"jailed_until"` // timestamp validator cannot be unjailed until
|
||||
Tombstoned bool `json:"tombstoned" yaml:"tombstoned"` // whether or not a validator has been tombstoned (killed out of validator set)
|
||||
MissedBlocksCounter int64 `json:"missed_blocks_counter" yaml:"missed_blocks_counter"` // missed blocks counter (to avoid scanning the array every time)
|
||||
}
|
||||
|
||||
// Construct a new `ValidatorSigningInfo` struct
|
||||
|
|
|
@ -31,27 +31,27 @@ func registerTxRoutes(cliCtx context.CLIContext, r *mux.Router) {
|
|||
type (
|
||||
// DelegateRequest defines the properties of a delegation request's body.
|
||||
DelegateRequest struct {
|
||||
BaseReq rest.BaseReq `json:"base_req"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"` // in bech32
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"` // in bech32
|
||||
Amount sdk.Coin `json:"amount"`
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` // in bech32
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` // in bech32
|
||||
Amount sdk.Coin `json:"amount" yaml:"amount"`
|
||||
}
|
||||
|
||||
// RedelegateRequest defines the properties of a redelegate request's body.
|
||||
RedelegateRequest struct {
|
||||
BaseReq rest.BaseReq `json:"base_req"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"` // in bech32
|
||||
ValidatorSrcAddress sdk.ValAddress `json:"validator_src_address"` // in bech32
|
||||
ValidatorDstAddress sdk.ValAddress `json:"validator_dst_address"` // in bech32
|
||||
Amount sdk.Coin `json:"amount"`
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` // in bech32
|
||||
ValidatorSrcAddress sdk.ValAddress `json:"validator_src_address" yaml:"validator_src_address"` // in bech32
|
||||
ValidatorDstAddress sdk.ValAddress `json:"validator_dst_address" yaml:"validator_dst_address"` // in bech32
|
||||
Amount sdk.Coin `json:"amount" yaml:"amount"`
|
||||
}
|
||||
|
||||
// UndelegateRequest defines the properties of a undelegate request's body.
|
||||
UndelegateRequest struct {
|
||||
BaseReq rest.BaseReq `json:"base_req"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"` // in bech32
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"` // in bech32
|
||||
Amount sdk.Coin `json:"amount"`
|
||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` // in bech32
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` // in bech32
|
||||
Amount sdk.Coin `json:"amount" yaml:"amount"`
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -11,15 +11,15 @@ type (
|
|||
// Commission defines a commission parameters for a given validator.
|
||||
Commission struct {
|
||||
CommissionRates
|
||||
UpdateTime time.Time `json:"update_time"` // the last time the commission rate was changed
|
||||
UpdateTime time.Time `json:"update_time" yaml:"update_time"` // the last time the commission rate was changed
|
||||
}
|
||||
|
||||
// CommissionRates defines the initial commission rates to be used for creating a
|
||||
// validator.
|
||||
CommissionRates struct {
|
||||
Rate sdk.Dec `json:"rate"` // the commission rate charged to delegators, as a fraction
|
||||
MaxRate sdk.Dec `json:"max_rate"` // maximum commission rate which validator can ever charge, as a fraction
|
||||
MaxChangeRate sdk.Dec `json:"max_change_rate"` // maximum daily increase of the validator commission, as a fraction
|
||||
Rate sdk.Dec `json:"rate" yaml:"rate"` // the commission rate charged to delegators, as a fraction
|
||||
MaxRate sdk.Dec `json:"max_rate" yaml:"max_rate"` // maximum commission rate which validator can ever charge, as a fraction
|
||||
MaxChangeRate sdk.Dec `json:"max_change_rate" yaml:"max_change_rate"` // maximum daily increase of the validator commission, as a fraction
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@ var _ exported.DelegationI = Delegation{}
|
|||
// owned by one delegator, and is associated with the voting power of one
|
||||
// validator.
|
||||
type Delegation struct {
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
Shares sdk.Dec `json:"shares"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
Shares sdk.Dec `json:"shares" yaml:"shares"`
|
||||
}
|
||||
|
||||
// NewDelegation creates a new delegation object
|
||||
|
@ -106,17 +106,17 @@ func (d Delegations) String() (out string) {
|
|||
// UnbondingDelegation stores all of a single delegator's unbonding bonds
|
||||
// for a single validator in an time-ordered list
|
||||
type UnbondingDelegation struct {
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"` // delegator
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"` // validator unbonding from operator addr
|
||||
Entries []UnbondingDelegationEntry `json:"entries"` // unbonding delegation entries
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` // delegator
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` // validator unbonding from operator addr
|
||||
Entries []UnbondingDelegationEntry `json:"entries" yaml:"entries"` // unbonding delegation entries
|
||||
}
|
||||
|
||||
// UnbondingDelegationEntry - entry to an UnbondingDelegation
|
||||
type UnbondingDelegationEntry struct {
|
||||
CreationHeight int64 `json:"creation_height"` // height which the unbonding took place
|
||||
CompletionTime time.Time `json:"completion_time"` // time at which the unbonding delegation will complete
|
||||
InitialBalance sdk.Int `json:"initial_balance"` // atoms initially scheduled to receive at completion
|
||||
Balance sdk.Int `json:"balance"` // atoms to receive at completion
|
||||
CreationHeight int64 `json:"creation_height" yaml:"creation_height"` // height which the unbonding took place
|
||||
CompletionTime time.Time `json:"completion_time" yaml:"completion_time"` // time at which the unbonding delegation will complete
|
||||
InitialBalance sdk.Int `json:"initial_balance" yaml:"initial_balance"` // atoms initially scheduled to receive at completion
|
||||
Balance sdk.Int `json:"balance" yaml:"balance"` // atoms to receive at completion
|
||||
}
|
||||
|
||||
// IsMature - is the current entry mature
|
||||
|
@ -220,18 +220,18 @@ func (ubds UnbondingDelegations) String() (out string) {
|
|||
// redelegating bonds from a particular source validator to a
|
||||
// particular destination validator
|
||||
type Redelegation struct {
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"` // delegator
|
||||
ValidatorSrcAddress sdk.ValAddress `json:"validator_src_address"` // validator redelegation source operator addr
|
||||
ValidatorDstAddress sdk.ValAddress `json:"validator_dst_address"` // validator redelegation destination operator addr
|
||||
Entries []RedelegationEntry `json:"entries"` // redelegation entries
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` // delegator
|
||||
ValidatorSrcAddress sdk.ValAddress `json:"validator_src_address" yaml:"validator_src_address"` // validator redelegation source operator addr
|
||||
ValidatorDstAddress sdk.ValAddress `json:"validator_dst_address" yaml:"validator_dst_address"` // validator redelegation destination operator addr
|
||||
Entries []RedelegationEntry `json:"entries" yaml:"entries"` // redelegation entries
|
||||
}
|
||||
|
||||
// RedelegationEntry - entry to a Redelegation
|
||||
type RedelegationEntry struct {
|
||||
CreationHeight int64 `json:"creation_height"` // height at which the redelegation took place
|
||||
CompletionTime time.Time `json:"completion_time"` // time at which the redelegation will complete
|
||||
InitialBalance sdk.Int `json:"initial_balance"` // initial balance when redelegation started
|
||||
SharesDst sdk.Dec `json:"shares_dst"` // amount of destination-validator shares created by redelegation
|
||||
CreationHeight int64 `json:"creation_height" yaml:"creation_height"` // height at which the redelegation took place
|
||||
CompletionTime time.Time `json:"completion_time" yaml:"completion_time"` // time at which the redelegation will complete
|
||||
InitialBalance sdk.Int `json:"initial_balance" yaml:"initial_balance"` // initial balance when redelegation started
|
||||
SharesDst sdk.Dec `json:"shares_dst" yaml:"shares_dst"` // amount of destination-validator shares created by redelegation
|
||||
}
|
||||
|
||||
// NewRedelegation - create a new redelegation object
|
||||
|
@ -352,7 +352,7 @@ func (d Redelegations) String() (out string) {
|
|||
// in addition to shares which is more suitable for client responses.
|
||||
type DelegationResponse struct {
|
||||
Delegation
|
||||
Balance sdk.Int `json:"balance"`
|
||||
Balance sdk.Int `json:"balance" yaml:"balance"`
|
||||
}
|
||||
|
||||
func NewDelegationResp(d sdk.AccAddress, v sdk.ValAddress, s sdk.Dec, b sdk.Int) DelegationResponse {
|
||||
|
@ -394,7 +394,7 @@ func (d DelegationResponses) String() (out string) {
|
|||
// responses.
|
||||
type RedelegationResponse struct {
|
||||
Redelegation
|
||||
Entries []RedelegationEntryResponse `json:"entries"` // nolint: structtag
|
||||
Entries []RedelegationEntryResponse `json:"entries" yaml:"entries"` // nolint: structtag
|
||||
}
|
||||
|
||||
// RedelegationEntryResponse is equivalent to a RedelegationEntry except that it
|
||||
|
|
|
@ -6,14 +6,14 @@ import (
|
|||
|
||||
// GenesisState - all staking state that must be provided at genesis
|
||||
type GenesisState struct {
|
||||
Params Params `json:"params"`
|
||||
LastTotalPower sdk.Int `json:"last_total_power"`
|
||||
LastValidatorPowers []LastValidatorPower `json:"last_validator_powers"`
|
||||
Validators Validators `json:"validators"`
|
||||
Delegations Delegations `json:"delegations"`
|
||||
UnbondingDelegations []UnbondingDelegation `json:"unbonding_delegations"`
|
||||
Redelegations []Redelegation `json:"redelegations"`
|
||||
Exported bool `json:"exported"`
|
||||
Params Params `json:"params" yaml:"params"`
|
||||
LastTotalPower sdk.Int `json:"last_total_power" yaml:"last_total_power"`
|
||||
LastValidatorPowers []LastValidatorPower `json:"last_validator_powers" yaml:"last_validator_powers"`
|
||||
Validators Validators `json:"validators" yaml:"validators"`
|
||||
Delegations Delegations `json:"delegations" yaml:"delegations"`
|
||||
UnbondingDelegations []UnbondingDelegation `json:"unbonding_delegations" yaml:"unbonding_delegations"`
|
||||
Redelegations []Redelegation `json:"redelegations" yaml:"redelegations"`
|
||||
Exported bool `json:"exported" yaml:"exported"`
|
||||
}
|
||||
|
||||
// Last validator power, needed for validator set update logic
|
||||
|
|
|
@ -22,23 +22,23 @@ var (
|
|||
|
||||
// MsgCreateValidator - struct for bonding transactions
|
||||
type MsgCreateValidator struct {
|
||||
Description Description `json:"description"`
|
||||
Commission CommissionRates `json:"commission"`
|
||||
MinSelfDelegation sdk.Int `json:"min_self_delegation"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
PubKey crypto.PubKey `json:"pubkey"`
|
||||
Value sdk.Coin `json:"value"`
|
||||
Description Description `json:"description" yaml:"description"`
|
||||
Commission CommissionRates `json:"commission" yaml:"commission"`
|
||||
MinSelfDelegation sdk.Int `json:"min_self_delegation" yaml:"min_self_delegation"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
PubKey crypto.PubKey `json:"pubkey" yaml:"pubkey"`
|
||||
Value sdk.Coin `json:"value" yaml:"value"`
|
||||
}
|
||||
|
||||
type msgCreateValidatorJSON struct {
|
||||
Description Description `json:"description"`
|
||||
Commission CommissionRates `json:"commission"`
|
||||
MinSelfDelegation sdk.Int `json:"min_self_delegation"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
PubKey string `json:"pubkey"`
|
||||
Value sdk.Coin `json:"value"`
|
||||
Description Description `json:"description" yaml:"description"`
|
||||
Commission CommissionRates `json:"commission" yaml:"commission"`
|
||||
MinSelfDelegation sdk.Int `json:"min_self_delegation" yaml:"min_self_delegation"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
PubKey string `json:"pubkey" yaml:"pubkey"`
|
||||
Value sdk.Coin `json:"value" yaml:"value"`
|
||||
}
|
||||
|
||||
// Default way to create validator. Delegator address and validator address are the same
|
||||
|
@ -155,15 +155,15 @@ func (msg MsgCreateValidator) ValidateBasic() sdk.Error {
|
|||
// MsgEditValidator - struct for editing a validator
|
||||
type MsgEditValidator struct {
|
||||
Description
|
||||
ValidatorAddress sdk.ValAddress `json:"address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"address" yaml:"address"`
|
||||
|
||||
// We pass a reference to the new commission rate and min self delegation as it's not mandatory to
|
||||
// update. If not updated, the deserialized rate will be zero with no way to
|
||||
// distinguish if an update was intended.
|
||||
//
|
||||
// REF: #2373
|
||||
CommissionRate *sdk.Dec `json:"commission_rate"`
|
||||
MinSelfDelegation *sdk.Int `json:"min_self_delegation"`
|
||||
CommissionRate *sdk.Dec `json:"commission_rate" yaml:"commission_rate"`
|
||||
MinSelfDelegation *sdk.Int `json:"min_self_delegation" yaml:"min_self_delegation"`
|
||||
}
|
||||
|
||||
func NewMsgEditValidator(valAddr sdk.ValAddress, description Description, newRate *sdk.Dec, newMinSelfDelegation *sdk.Int) MsgEditValidator {
|
||||
|
@ -213,9 +213,9 @@ func (msg MsgEditValidator) ValidateBasic() sdk.Error {
|
|||
|
||||
// MsgDelegate - struct for bonding transactions
|
||||
type MsgDelegate struct {
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
Amount sdk.Coin `json:"amount"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
Amount sdk.Coin `json:"amount" yaml:"amount"`
|
||||
}
|
||||
|
||||
func NewMsgDelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) MsgDelegate {
|
||||
|
@ -257,10 +257,10 @@ func (msg MsgDelegate) ValidateBasic() sdk.Error {
|
|||
|
||||
// MsgDelegate - struct for bonding transactions
|
||||
type MsgBeginRedelegate struct {
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"`
|
||||
ValidatorSrcAddress sdk.ValAddress `json:"validator_src_address"`
|
||||
ValidatorDstAddress sdk.ValAddress `json:"validator_dst_address"`
|
||||
Amount sdk.Coin `json:"amount"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
|
||||
ValidatorSrcAddress sdk.ValAddress `json:"validator_src_address" yaml:"validator_src_address"`
|
||||
ValidatorDstAddress sdk.ValAddress `json:"validator_dst_address" yaml:"validator_dst_address"`
|
||||
Amount sdk.Coin `json:"amount" yaml:"amount"`
|
||||
}
|
||||
|
||||
func NewMsgBeginRedelegate(delAddr sdk.AccAddress, valSrcAddr,
|
||||
|
@ -306,9 +306,9 @@ func (msg MsgBeginRedelegate) ValidateBasic() sdk.Error {
|
|||
|
||||
// MsgUndelegate - struct for unbonding transactions
|
||||
type MsgUndelegate struct {
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address"`
|
||||
Amount sdk.Coin `json:"amount"`
|
||||
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
|
||||
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
|
||||
Amount sdk.Coin `json:"amount" yaml:"amount"`
|
||||
}
|
||||
|
||||
func NewMsgUndelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) MsgUndelegate {
|
||||
|
|
|
@ -35,11 +35,11 @@ var _ params.ParamSet = (*Params)(nil)
|
|||
|
||||
// Params defines the high level settings for staking
|
||||
type Params struct {
|
||||
UnbondingTime time.Duration `json:"unbonding_time"` // time duration of unbonding
|
||||
MaxValidators uint16 `json:"max_validators"` // maximum number of validators (max uint16 = 65535)
|
||||
MaxEntries uint16 `json:"max_entries"` // max entries for either unbonding delegation or redelegation (per pair/trio)
|
||||
UnbondingTime time.Duration `json:"unbonding_time" yaml:"unbonding_time"` // time duration of unbonding
|
||||
MaxValidators uint16 `json:"max_validators" yaml:"max_validators"` // maximum number of validators (max uint16 = 65535)
|
||||
MaxEntries uint16 `json:"max_entries" yaml:"max_entries"` // max entries for either unbonding delegation or redelegation (per pair/trio)
|
||||
// note: we need to be a bit careful about potential overflow here, since this is user-determined
|
||||
BondDenom string `json:"bond_denom"` // bondable coin denomination
|
||||
BondDenom string `json:"bond_denom" yaml:"bond_denom"` // bondable coin denomination
|
||||
}
|
||||
|
||||
func NewParams(unbondingTime time.Duration, maxValidators, maxEntries uint16,
|
||||
|
|
|
@ -18,8 +18,8 @@ const (
|
|||
|
||||
// Pool - tracking bonded and not-bonded token supply of the bond denomination
|
||||
type Pool struct {
|
||||
NotBondedTokens sdk.Int `json:"not_bonded_tokens"` // tokens which are not bonded to a validator (unbonded or unbonding)
|
||||
BondedTokens sdk.Int `json:"bonded_tokens"` // tokens which are currently bonded to a validator
|
||||
NotBondedTokens sdk.Int `json:"not_bonded_tokens" yaml:"not_bonded_tokens"` // tokens which are not bonded to a validator (unbonded or unbonding)
|
||||
BondedTokens sdk.Int `json:"bonded_tokens" yaml:"bonded_tokens"` // tokens which are currently bonded to a validator
|
||||
}
|
||||
|
||||
// NewPool creates a new Pool instance used for queries
|
||||
|
|
|
@ -36,17 +36,17 @@ var _ exported.ValidatorI = Validator{}
|
|||
// divided by the current exchange rate. Voting power can be calculated as total
|
||||
// bonded shares multiplied by exchange rate.
|
||||
type Validator struct {
|
||||
OperatorAddress sdk.ValAddress `json:"operator_address"` // address of the validator's operator; bech encoded in JSON
|
||||
ConsPubKey crypto.PubKey `json:"consensus_pubkey"` // the consensus public key of the validator; bech encoded in JSON
|
||||
Jailed bool `json:"jailed"` // has the validator been jailed from bonded status?
|
||||
Status sdk.BondStatus `json:"status"` // validator status (bonded/unbonding/unbonded)
|
||||
Tokens sdk.Int `json:"tokens"` // delegated tokens (incl. self-delegation)
|
||||
DelegatorShares sdk.Dec `json:"delegator_shares"` // total shares issued to a validator's delegators
|
||||
Description Description `json:"description"` // description terms for the validator
|
||||
UnbondingHeight int64 `json:"unbonding_height"` // if unbonding, height at which this validator has begun unbonding
|
||||
UnbondingCompletionTime time.Time `json:"unbonding_time"` // if unbonding, min time for the validator to complete unbonding
|
||||
Commission Commission `json:"commission"` // commission parameters
|
||||
MinSelfDelegation sdk.Int `json:"min_self_delegation"` // validator's self declared minimum self delegation
|
||||
OperatorAddress sdk.ValAddress `json:"operator_address" yaml:"operator_address"` // address of the validator's operator; bech encoded in JSON
|
||||
ConsPubKey crypto.PubKey `json:"consensus_pubkey" yaml:"consensus_pubkey"` // the consensus public key of the validator; bech encoded in JSON
|
||||
Jailed bool `json:"jailed" yaml:"jailed"` // has the validator been jailed from bonded status?
|
||||
Status sdk.BondStatus `json:"status" yaml:"status"` // validator status (bonded/unbonding/unbonded)
|
||||
Tokens sdk.Int `json:"tokens" yaml:"tokens"` // delegated tokens (incl. self-delegation)
|
||||
DelegatorShares sdk.Dec `json:"delegator_shares" yaml:"delegator_shares"` // total shares issued to a validator's delegators
|
||||
Description Description `json:"description" yaml:"description"` // description terms for the validator
|
||||
UnbondingHeight int64 `json:"unbonding_height" yaml:"unbonding_height"` // if unbonding, height at which this validator has begun unbonding
|
||||
UnbondingCompletionTime time.Time `json:"unbonding_time" yaml:"unbonding_time"` // if unbonding, min time for the validator to complete unbonding
|
||||
Commission Commission `json:"commission" yaml:"commission"` // commission parameters
|
||||
MinSelfDelegation sdk.Int `json:"min_self_delegation" yaml:"min_self_delegation"` // validator's self declared minimum self delegation
|
||||
}
|
||||
|
||||
// custom marshal yaml function due to consensus pubkey
|
||||
|
@ -163,17 +163,17 @@ func (v Validator) String() string {
|
|||
|
||||
// this is a helper struct used for JSON de- and encoding only
|
||||
type bechValidator struct {
|
||||
OperatorAddress sdk.ValAddress `json:"operator_address"` // the bech32 address of the validator's operator
|
||||
ConsPubKey string `json:"consensus_pubkey"` // the bech32 consensus public key of the validator
|
||||
Jailed bool `json:"jailed"` // has the validator been jailed from bonded status?
|
||||
Status sdk.BondStatus `json:"status"` // validator status (bonded/unbonding/unbonded)
|
||||
Tokens sdk.Int `json:"tokens"` // delegated tokens (incl. self-delegation)
|
||||
DelegatorShares sdk.Dec `json:"delegator_shares"` // total shares issued to a validator's delegators
|
||||
Description Description `json:"description"` // description terms for the validator
|
||||
UnbondingHeight int64 `json:"unbonding_height"` // if unbonding, height at which this validator has begun unbonding
|
||||
UnbondingCompletionTime time.Time `json:"unbonding_time"` // if unbonding, min time for the validator to complete unbonding
|
||||
Commission Commission `json:"commission"` // commission parameters
|
||||
MinSelfDelegation sdk.Int `json:"min_self_delegation"` // minimum self delegation
|
||||
OperatorAddress sdk.ValAddress `json:"operator_address" yaml:"operator_address"` // the bech32 address of the validator's operator
|
||||
ConsPubKey string `json:"consensus_pubkey" yaml:"consensus_pubkey"` // the bech32 consensus public key of the validator
|
||||
Jailed bool `json:"jailed" yaml:"jailed"` // has the validator been jailed from bonded status?
|
||||
Status sdk.BondStatus `json:"status" yaml:"status"` // validator status (bonded/unbonding/unbonded)
|
||||
Tokens sdk.Int `json:"tokens" yaml:"tokens"` // delegated tokens (incl. self-delegation)
|
||||
DelegatorShares sdk.Dec `json:"delegator_shares" yaml:"delegator_shares"` // total shares issued to a validator's delegators
|
||||
Description Description `json:"description" yaml:"description"` // description terms for the validator
|
||||
UnbondingHeight int64 `json:"unbonding_height" yaml:"unbonding_height"` // if unbonding, height at which this validator has begun unbonding
|
||||
UnbondingCompletionTime time.Time `json:"unbonding_time" yaml:"unbonding_time"` // if unbonding, min time for the validator to complete unbonding
|
||||
Commission Commission `json:"commission" yaml:"commission"` // commission parameters
|
||||
MinSelfDelegation sdk.Int `json:"min_self_delegation" yaml:"min_self_delegation"` // minimum self delegation
|
||||
}
|
||||
|
||||
// MarshalJSON marshals the validator to JSON using Bech32
|
||||
|
@ -260,10 +260,10 @@ const DoNotModifyDesc = "[do-not-modify]"
|
|||
|
||||
// Description - description fields for a validator
|
||||
type Description struct {
|
||||
Moniker string `json:"moniker"` // name
|
||||
Identity string `json:"identity"` // optional identity signature (ex. UPort or Keybase)
|
||||
Website string `json:"website"` // optional website link
|
||||
Details string `json:"details"` // optional details
|
||||
Moniker string `json:"moniker" yaml:"moniker"` // name
|
||||
Identity string `json:"identity" yaml:"identity"` // optional identity signature (ex. UPort or Keybase)
|
||||
Website string `json:"website" yaml:"website"` // optional website link
|
||||
Details string `json:"details" yaml:"details"` // optional details
|
||||
}
|
||||
|
||||
// NewDescription returns a new Description with the provided values.
|
||||
|
|
|
@ -295,9 +295,9 @@ func TestValidatorMarshalYAML(t *testing.T) {
|
|||
commission:
|
||||
commissionrates:
|
||||
rate: "0.000000000000000000"
|
||||
maxrate: "0.000000000000000000"
|
||||
maxchangerate: "0.000000000000000000"
|
||||
updatetime: 1970-01-01T00:00:00Z
|
||||
max_rate: "0.000000000000000000"
|
||||
max_change_rate: "0.000000000000000000"
|
||||
update_time: 1970-01-01T00:00:00Z
|
||||
minselfdelegation: "1"
|
||||
`, validator.OperatorAddress.String(), bechifiedPub)
|
||||
require.Equal(t, want, string(bs))
|
||||
|
|
|
@ -17,8 +17,8 @@ var _ exported.ModuleAccountI = (*ModuleAccount)(nil)
|
|||
// ModuleAccount defines an account for modules that holds coins on a pool
|
||||
type ModuleAccount struct {
|
||||
*authtypes.BaseAccount
|
||||
Name string `json:"name"` // name of the module
|
||||
Permission string `json:"permission"` // permission of module account (minter/burner/holder)
|
||||
Name string `json:"name" yaml:"name"` // name of the module
|
||||
Permission string `json:"permission" yaml:"permission"` // permission of module account (minter/burner/holder)
|
||||
}
|
||||
|
||||
// NewModuleAddress creates an AccAddress from the hash of the module's name
|
||||
|
|
|
@ -2,7 +2,7 @@ package types
|
|||
|
||||
// GenesisState is the supply state that must be provided at genesis.
|
||||
type GenesisState struct {
|
||||
Supply Supply `json:"supply"`
|
||||
Supply Supply `json:"supply" yaml:"supply"`
|
||||
}
|
||||
|
||||
// NewGenesisState creates a new genesis state.
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
// Supply represents a struct that passively keeps track of the total supply amounts in the network
|
||||
type Supply struct {
|
||||
Total sdk.Coins `json:"total_supply"` // total supply of tokens registered on the chain
|
||||
Total sdk.Coins `json:"total_supply" yaml:"total_supply"` // total supply of tokens registered on the chain
|
||||
}
|
||||
|
||||
// NewSupply creates a new Supply instance
|
||||
|
|
|
@ -4,9 +4,10 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"gopkg.in/yaml.v2"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
@ -20,7 +21,7 @@ func TestSupplyMarshalYAML(t *testing.T) {
|
|||
bzCoins, err := yaml.Marshal(coins)
|
||||
require.NoError(t, err)
|
||||
|
||||
want := fmt.Sprintf(`total:
|
||||
want := fmt.Sprintf(`total_supply:
|
||||
%s`, string(bzCoins))
|
||||
|
||||
require.Equal(t, want, string(bz))
|
||||
|
|
Loading…
Reference in New Issue