0g-chain/migrate/v0_8/sdk/distribution/v18de63/genesis.go
Ruaridh 4a8b5696cb
v0.8 Migration Scripts (#518)
* initial sketch

* add module migrations

* add migrations for all accout types

* test account migration

* add tendermint migration and migrate cmd

* remove need for errors pkg dependency

* add bech32 decoding fork

* add suggested params and cmd to write them

* add basic upgrade instructions

* fix tests

* address some migration todos

* tidy contrib folder

* finalize params values

* align cdp init genesis with other modules

* add tendermint and distribution test
add custom distribution migration to patch bug

* add staking migration test

* add slashing, evidence tests, refactor auth tests

* add full migration test

* remove go-amino dependency from go.mod
also tidy up unused indirect dependencies

* address remaining TODOs

* remove commented out code from legacy types

* add spot/liquidation markets ids to kava-3 params

* Apply suggestions from code review

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* address code review suggestions

* add validate genesis to migrate test

* refactor add params func

* remove commented out code from old types

* fix add params

* add deputy address

* add tests using exported kava-2 state

* incorporate new cdp params from master

* update params from review

Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>

* add deputy account

* add committee permissions for new params

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
2020-06-03 15:35:00 -04:00

70 lines
4.1 KiB
Go

package v18de63
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// 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" 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" 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" 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" 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" 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" 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" 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" 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"`
}