Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- func AccumulateDelegationsAverageStakingDate() error
- func CheckTx(ctx types.Context, store state.SimpleDB, tx sdk.Tx) (res sdk.CheckResult, err error)
- func DeliverTx(ctx types.Context, store state.SimpleDB, tx sdk.Tx, hash []byte) (res sdk.DeliverResult, err error)
- func ErrBadAmount() error
- func ErrBadCompRate() error
- func ErrBadRequest() error
- func ErrBadValidatorAddr() error
- func ErrCandidateExistsAddr() error
- func ErrCandidateHasPendingUnstakeRequests() error
- func ErrCandidateWithdrawalDisallowed() error
- func ErrDelegationNotExists() error
- func ErrInsufficientFunds() error
- func ErrInvalidCubeSignature() error
- func ErrInvalidWithdrawalAmount() error
- func ErrMissingSignature() error
- func ErrReachMaxAmount() error
- func ErrVerificationDisallowed() error
- func GetCandidateDailyStakeMaxValue(candidateId int64, startBlockHeight int64) (res sdk.Int)
- func GetCandidatesTotalShares() (res sdk.Int)
- func GetNumOfDelegatorsByCandidate(candidateId int64) int64
- func HandlePendingUnstakeRequests(height int64) error
- func NewAwardDistributor(store state.SimpleDB, height int64, validators, backupValidators Validators, ...) *awardDistributor
- func NewTxAcceptCandidacyAccountUpdate(accountUpdateRequestId int64) sdk.Tx
- func NewTxActivateCandidacy() sdk.Tx
- func NewTxDeactivateCandidacy() sdk.Tx
- func NewTxDeclareCandidacy(pubKey types.PubKey, maxAmount string, compRate sdk.Rat, ...) sdk.Tx
- func NewTxDelegate(validatorAddress common.Address, amount, cubeBatch, sig string) sdk.Tx
- func NewTxSetCompRate(delegatorAddress common.Address, compRate sdk.Rat) sdk.Tx
- func NewTxUpdateCandidacy(pubKey types.PubKey, maxAmount string, compRate sdk.Rat, ...) sdk.Tx
- func NewTxUpdateCandidacyAccount(newCandidateAddress common.Address) sdk.Tx
- func NewTxVerifyCandidacy(candidateAddress common.Address, verified bool) sdk.Tx
- func NewTxWithdraw(validatorAddress common.Address, amount string) sdk.Tx
- func NewTxWithdrawCandidacy() sdk.Tx
- func RecordCandidateDailyStakes(blockHeight int64) error
- func RemoveDelegation(id int64)
- func RemoveExpiredCandidateDailyStakes(blockHeight int64)
- func RemoveValidator(pubKey types.PubKey) (err error)
- func ResetDeliverSqlTx()
- func SaveAbsentValidators(store state.SimpleDB, absentValidators *AbsentValidators)
- func SaveCandidate(candidate *Candidate)
- func SaveCandidateDailyStake(cds *CandidateDailyStake)
- func SaveDelegation(d *Delegation)
- func SetDeliverSqlTx(tx *sql.Tx)
- func SetGenesisValidator(val types.GenesisValidator, store state.SimpleDB) error
- func SlashAbsentValidator(pubKey types.PubKey, absence *Absence, blockTime, blockHeight int64) (err error)
- func SlashBadProposer(pubKey types.PubKey, blockTime, blockHeight int64) (err error)
- func SlashByzantineValidator(pubKey types.PubKey, blockTime, blockHeight int64) (err error)
- func UpdateDelegation(d *Delegation)
- func UpdateValidatorSet(blockHeight int64) (change []abci.Validator, err error)
- func VerifyCubeSignature(address common.Address, nonce uint64, cubeBatch string, sig string) error
- type Absence
- type AbsentValidators
- type AwardInfo
- type AwardInfos
- type Candidate
- func (c *Candidate) AddShares(value sdk.Int) (res sdk.Int)
- func (c *Candidate) CalcVotingPower(blockHeight int64) (res int64)
- func (c *Candidate) Hash() []byte
- func (c Candidate) IsActive() bool
- func (c *Candidate) ParseMaxShares() sdk.Int
- func (c *Candidate) ParseShares() sdk.Int
- func (c *Candidate) SelfStakingAmount(ssr sdk.Rat) (res sdk.Int)
- func (c *Candidate) Validator() Validator
- type CandidateAccountUpdateRequest
- type CandidateDailyStake
- type Candidates
- type CubePubKey
- type DelegateHistory
- type Delegation
- func GetDelegation(delegatorAddress common.Address, candidateId int64) *Delegation
- func GetDelegations(state string) (delegations []*Delegation)
- func GetDelegationsByCandidate(candidateId int64, state string) (delegations []*Delegation)
- func QueryDelegationsByAddress(delegatorAddress common.Address) (delegations []*Delegation)
- func (d *Delegation) AccumulateAverageStakingDate()
- func (d *Delegation) AddAwardAmount(value sdk.Int) (res sdk.Int)
- func (d *Delegation) AddDelegateAmount(value sdk.Int) (res sdk.Int)
- func (d *Delegation) AddPendingWithdrawAmount(value sdk.Int) (res sdk.Int)
- func (d *Delegation) AddSlashAmount(value sdk.Int) (res sdk.Int)
- func (d *Delegation) AddWithdrawAmount(value sdk.Int) (res sdk.Int)
- func (d *Delegation) CalcVotingPower(sharesPercentage sdk.Rat, blockHeight int64) int64
- func (d *Delegation) Hash() []byte
- func (d *Delegation) ParseAwardAmount() sdk.Int
- func (d *Delegation) ParseDelegateAmount() sdk.Int
- func (d *Delegation) ParsePendingWithdrawAmount() sdk.Int
- func (d *Delegation) ParseSlashAmount() sdk.Int
- func (d *Delegation) ParseWithdrawAmount() sdk.Int
- func (d *Delegation) ReduceAverageStakingDate(withdrawAmount sdk.Int)
- func (d *Delegation) ResetVotingPower()
- func (d *Delegation) Shares() (res sdk.Int)
- type Description
- type Slash
- type SqlTxWrapper
- type TxAcceptCandidacyAccountUpdate
- type TxActivateCandidacy
- type TxDeactivateCandidacy
- type TxDeclareCandidacy
- type TxDelegate
- type TxSetCompRate
- type TxUpdateCandidacy
- type TxUpdateCandidacyAccount
- type TxVerifyCandidacy
- type TxWithdraw
- type TxWithdrawCandidacy
- type UnstakeRequest
- type Validator
- type Validators
Constants ¶
const ( ByteTxDeclareCandidacy = 0x55 ByteTxUpdateCandidacy = 0x56 ByteTxWithdrawCandidacy = 0x57 ByteTxVerifyCandidacy = 0x58 ByteTxActivateCandidacy = 0x59 ByteTxDelegate = 0x60 ByteTxWithdraw = 0x61 ByteTxSetCompRate = 0x62 ByteTxUpdateCandidacyAccount = 0x63 ByteTxAcceptCandidacyAccountUpdate = 0x64 ByteTxDeactivateCandidacy = 0x65 TypeTxDeclareCandidacy = "stake/declareCandidacy" TypeTxUpdateCandidacy = "stake/updateCandidacy" TypeTxVerifyCandidacy = "stake/verifyCandidacy" TypeTxWithdrawCandidacy = "stake/withdrawCandidacy" TypeTxActivateCandidacy = "stake/activateCandidacy" TypeTxDeactivateCandidacy = "stake/deactivateCandidacy" TypeTxDelegate = "stake/delegate" TypeTxWithdraw = "stake/withdraw" TypeTxSetCompRate = "stake/setCompRate" TypeTxUpdateCandidacyAccount = "stake/updateCandidacyAccount" TypeTxAcceptCandidacyAccountUpdate = "stake/acceptCandidacyAccountUpdate" )
register the tx type with its validation logic make sure to use the name of the handler as the prefix in the tx type, so it gets routed properly
Variables ¶
This section is empty.
Functions ¶
func AccumulateDelegationsAverageStakingDate ¶
func AccumulateDelegationsAverageStakingDate() error
func DeliverTx ¶
func DeliverTx(ctx types.Context, store state.SimpleDB, tx sdk.Tx, hash []byte) (res sdk.DeliverResult, err error)
DeliverTx executes the tx if valid
func ErrBadAmount ¶
func ErrBadAmount() error
func ErrBadCompRate ¶
func ErrBadCompRate() error
func ErrBadRequest ¶
func ErrBadRequest() error
func ErrBadValidatorAddr ¶
func ErrBadValidatorAddr() error
func ErrCandidateExistsAddr ¶
func ErrCandidateExistsAddr() error
func ErrCandidateHasPendingUnstakeRequests ¶
func ErrCandidateHasPendingUnstakeRequests() error
func ErrCandidateWithdrawalDisallowed ¶
func ErrCandidateWithdrawalDisallowed() error
func ErrDelegationNotExists ¶
func ErrDelegationNotExists() error
func ErrInsufficientFunds ¶
func ErrInsufficientFunds() error
func ErrInvalidCubeSignature ¶
func ErrInvalidCubeSignature() error
func ErrInvalidWithdrawalAmount ¶
func ErrInvalidWithdrawalAmount() error
func ErrMissingSignature ¶
func ErrMissingSignature() error
func ErrReachMaxAmount ¶
func ErrReachMaxAmount() error
func ErrVerificationDisallowed ¶
func ErrVerificationDisallowed() error
func NewAwardDistributor ¶
func NewTxActivateCandidacy ¶
func NewTxDeclareCandidacy ¶
func NewTxDelegate ¶
func NewTxSetCompRate ¶
func NewTxUpdateCandidacy ¶
func NewTxVerifyCandidacy ¶
func NewTxWithdrawCandidacy ¶
func RemoveDelegation ¶
func RemoveDelegation(id int64)
func RemoveExpiredCandidateDailyStakes ¶
func RemoveExpiredCandidateDailyStakes(blockHeight int64)
func RemoveValidator ¶
func ResetDeliverSqlTx ¶
func ResetDeliverSqlTx()
func SaveAbsentValidators ¶
func SaveAbsentValidators(store state.SimpleDB, absentValidators *AbsentValidators)
func SaveCandidate ¶
func SaveCandidate(candidate *Candidate)
func SaveCandidateDailyStake ¶
func SaveCandidateDailyStake(cds *CandidateDailyStake)
func SaveDelegation ¶
func SaveDelegation(d *Delegation)
func SetDeliverSqlTx ¶
func SetGenesisValidator ¶
func SetGenesisValidator(val types.GenesisValidator, store state.SimpleDB) error
func SlashAbsentValidator ¶
func SlashBadProposer ¶
func SlashByzantineValidator ¶
func UpdateDelegation ¶
func UpdateDelegation(d *Delegation)
func UpdateValidatorSet ¶
UpdateValidatorSet - Updates the voting power for the candidate set and returns the subset of validators which have changed for Tendermint
Types ¶
type Absence ¶
func (*Absence) Accumulate ¶
func (a *Absence) Accumulate()
type AbsentValidators ¶
func LoadAbsentValidators ¶
func LoadAbsentValidators(store state.SimpleDB) *AbsentValidators
func (AbsentValidators) Clear ¶
func (av AbsentValidators) Clear(currentBlockHeight int64)
func (AbsentValidators) Remove ¶
func (av AbsentValidators) Remove(pk types.PubKey)
type AwardInfos ¶
type AwardInfos []AwardInfo
type Candidate ¶
type Candidate struct { Id int64 `json:"id"` PubKey types.PubKey `json:"pub_key"` // Pubkey of candidate OwnerAddress string `json:"owner_address"` // Sender of BondTx - UnbondTx returns here VotingPower int64 `json:"voting_power"` // Voting power if pubKey is a considered a validator PendingVotingPower int64 `json:"pending_voting_power"` CompRate sdk.Rat `json:"comp_rate"` CreatedAt int64 `json:"created_at"` Description Description `json:"description"` Verified string `json:"verified"` Active string `json:"active"` BlockHeight int64 `json:"block_height"` Rank int64 `json:"rank"` State string `json:"state"` NumOfDelegators int64 `json:"num_of_delegators"` }
Candidate defines the total Amount of bond shares and their exchange rate to coins. Accumulation of interest is modelled as an in increase in the exchange rate, and slashing as a decrease. When coins are delegated to this candidate, the candidate is credited with a DelegatorBond whose number of bond shares is based on the Amount of coins delegated divided by the current exchange rate. Voting power can be calculated as total bonds multiplied by exchange rate. NOTE if the Owner.Empty() == true then this is a candidate who has revoked candidacy
func GetCandidateByAddress ¶
func GetCandidateById ¶
func GetCandidateByPubKey ¶
func QueryCandidateByAddress ¶
func QueryCandidateById ¶
func (*Candidate) CalcVotingPower ¶
func (*Candidate) ParseMaxShares ¶
func (*Candidate) ParseShares ¶
func (*Candidate) SelfStakingAmount ¶
type CandidateAccountUpdateRequest ¶
type CandidateAccountUpdateRequest struct { Id int64 `json:"id"` CandidateId int64 `json:"candidate_id"` FromAddress common.Address `json:"from_address"` ToAddress common.Address `json:"to_address"` CreatedBlockHeight int64 `json:"created_block_height"` AcceptedBlockHeight int64 `json:"accepted_block_height"` State string `json:"state"` }
func (*CandidateAccountUpdateRequest) Hash ¶
func (c *CandidateAccountUpdateRequest) Hash() []byte
type CandidateDailyStake ¶
type CandidateDailyStake struct { Id int64 `json:"id"` Amount string `json:"amount"` BlockHeight int64 `json:"block_height"` CandidateId int64 `json:"candidate_id"` }
func (*CandidateDailyStake) Hash ¶
func (c *CandidateDailyStake) Hash() []byte
type Candidates ¶
type Candidates []*Candidate
func GetActiveCandidates ¶
func GetActiveCandidates() (candidates Candidates)
func GetBackupValidators ¶
func GetBackupValidators() (candidates Candidates)
func GetCandidates ¶
func GetCandidates() (candidates Candidates)
func QueryCandidates ¶
func QueryCandidates() (candidates Candidates)
func (Candidates) Less ¶
func (cs Candidates) Less(i, j int) bool
func (Candidates) Swap ¶
func (cs Candidates) Swap(i, j int)
func (Candidates) Validators ¶
func (cs Candidates) Validators() Validators
Validators - get the most recent updated validator set from the Candidates. These bonds are already sorted by VotingPower from the UpdateVotingPower function which is the only function which is to modify the VotingPower
type CubePubKey ¶
type DelegateHistory ¶
type DelegateHistory struct { Id int64 `json:"id"` DelegatorAddress common.Address `json:"delegator_address"` Amount sdk.Int `json:"amount"` OpCode string `json:"op_code"` BlockHeight int64 `json:"block_height"` CandidateId int64 `json:"candidate_id"` }
func (*DelegateHistory) Hash ¶
func (d *DelegateHistory) Hash() []byte
type Delegation ¶
type Delegation struct { Id int64 `json:"id"` DelegatorAddress common.Address `json:"delegator_address"` PubKey types.PubKey `json:"pub_key"` ValidatorAddress string `json:"validator_address"` DelegateAmount string `json:"delegate_amount"` AwardAmount string `json:"award_amount"` WithdrawAmount string `json:"withdraw_amount"` PendingWithdrawAmount string `json:"pending_withdraw_amount"` SlashAmount string `json:"slash_amount"` CompRate sdk.Rat `json:"comp_rate"` VotingPower int64 `json:"voting_power"` CreatedAt int64 `json:"created_at"` State string `json:"state"` BlockHeight int64 `json:"block_height"` AverageStakingDate int64 `json:"average_staking_date"` CandidateId int64 `json:"candidate_id"` }
func GetDelegation ¶
func GetDelegation(delegatorAddress common.Address, candidateId int64) *Delegation
func GetDelegations ¶
func GetDelegations(state string) (delegations []*Delegation)
func GetDelegationsByCandidate ¶
func GetDelegationsByCandidate(candidateId int64, state string) (delegations []*Delegation)
func QueryDelegationsByAddress ¶
func QueryDelegationsByAddress(delegatorAddress common.Address) (delegations []*Delegation)
func (*Delegation) AccumulateAverageStakingDate ¶
func (d *Delegation) AccumulateAverageStakingDate()
func (*Delegation) AddAwardAmount ¶
func (d *Delegation) AddAwardAmount(value sdk.Int) (res sdk.Int)
func (*Delegation) AddDelegateAmount ¶
func (d *Delegation) AddDelegateAmount(value sdk.Int) (res sdk.Int)
func (*Delegation) AddPendingWithdrawAmount ¶
func (d *Delegation) AddPendingWithdrawAmount(value sdk.Int) (res sdk.Int)
func (*Delegation) AddSlashAmount ¶
func (d *Delegation) AddSlashAmount(value sdk.Int) (res sdk.Int)
func (*Delegation) AddWithdrawAmount ¶
func (d *Delegation) AddWithdrawAmount(value sdk.Int) (res sdk.Int)
func (*Delegation) CalcVotingPower ¶
func (d *Delegation) CalcVotingPower(sharesPercentage sdk.Rat, blockHeight int64) int64
func (*Delegation) Hash ¶
func (d *Delegation) Hash() []byte
func (*Delegation) ParseAwardAmount ¶
func (d *Delegation) ParseAwardAmount() sdk.Int
func (*Delegation) ParseDelegateAmount ¶
func (d *Delegation) ParseDelegateAmount() sdk.Int
func (*Delegation) ParsePendingWithdrawAmount ¶
func (d *Delegation) ParsePendingWithdrawAmount() sdk.Int
func (*Delegation) ParseSlashAmount ¶
func (d *Delegation) ParseSlashAmount() sdk.Int
func (*Delegation) ParseWithdrawAmount ¶
func (d *Delegation) ParseWithdrawAmount() sdk.Int
func (*Delegation) ReduceAverageStakingDate ¶
func (d *Delegation) ReduceAverageStakingDate(withdrawAmount sdk.Int)
func (*Delegation) ResetVotingPower ¶
func (d *Delegation) ResetVotingPower()
func (*Delegation) Shares ¶
func (d *Delegation) Shares() (res sdk.Int)
type Description ¶
type Slash ¶
type SqlTxWrapper ¶
type SqlTxWrapper struct {
// contains filtered or unexported fields
}
func (*SqlTxWrapper) Commit ¶
func (wrapper *SqlTxWrapper) Commit()
func (*SqlTxWrapper) Rollback ¶
func (wrapper *SqlTxWrapper) Rollback()
type TxAcceptCandidacyAccountUpdate ¶
type TxAcceptCandidacyAccountUpdate struct {
AccountUpdateRequestId int64 `json:"account_update_request_id"`
}
func (TxAcceptCandidacyAccountUpdate) ValidateBasic ¶
func (tx TxAcceptCandidacyAccountUpdate) ValidateBasic() error
func (TxAcceptCandidacyAccountUpdate) Wrap ¶
func (tx TxAcceptCandidacyAccountUpdate) Wrap() sdk.Tx
Wrap - Wrap a Tx as a Echoin Tx
type TxActivateCandidacy ¶
type TxActivateCandidacy struct{}
func (TxActivateCandidacy) ValidateBasic ¶
func (tx TxActivateCandidacy) ValidateBasic() error
ValidateBasic - Check for non-empty candidate, and valid coins
func (TxActivateCandidacy) Wrap ¶
func (tx TxActivateCandidacy) Wrap() sdk.Tx
Wrap - Wrap a Tx as a Basecoin Tx
type TxDeactivateCandidacy ¶
type TxDeactivateCandidacy struct{}
func (TxDeactivateCandidacy) ValidateBasic ¶
func (tx TxDeactivateCandidacy) ValidateBasic() error
ValidateBasic - Check for non-empty candidate, and valid coins
func (TxDeactivateCandidacy) Wrap ¶
func (tx TxDeactivateCandidacy) Wrap() sdk.Tx
Wrap - Wrap a Tx as a Basecoin Tx
type TxDeclareCandidacy ¶
type TxDeclareCandidacy struct { PubKey string `json:"pub_key"` MaxAmount string `json:"max_amount"` CompRate sdk.Rat `json:"comp_rate"` Description Description `json:"description"` }
func (TxDeclareCandidacy) SelfStakingAmount ¶
func (tx TxDeclareCandidacy) SelfStakingAmount(ssr sdk.Rat) (res sdk.Int)
func (TxDeclareCandidacy) ValidateBasic ¶
func (tx TxDeclareCandidacy) ValidateBasic() error
func (TxDeclareCandidacy) Wrap ¶
func (tx TxDeclareCandidacy) Wrap() sdk.Tx
type TxDelegate ¶
type TxDelegate struct { ValidatorAddress common.Address `json:"validator_address"` Amount string `json:"amount"` CubeBatch string `json:"cube_batch"` Sig string `json:"sig"` }
TxDelegate - struct for bonding or unbonding transactions
func (TxDelegate) ValidateBasic ¶
func (tx TxDelegate) ValidateBasic() error
type TxSetCompRate ¶
type TxSetCompRate struct { DelegatorAddress common.Address `json:"delegator_address"` CompRate sdk.Rat `json:"comp_rate"` }
func (TxSetCompRate) ValidateBasic ¶
func (tx TxSetCompRate) ValidateBasic() error
type TxUpdateCandidacy ¶
type TxUpdateCandidacy struct { PubKey string `json:"pub_key"` MaxAmount string `json:"max_amount"` CompRate sdk.Rat `json:"comp_rate"` Description Description `json:"description"` }
func (TxUpdateCandidacy) ValidateBasic ¶
func (tx TxUpdateCandidacy) ValidateBasic() error
func (TxUpdateCandidacy) Wrap ¶
func (tx TxUpdateCandidacy) Wrap() sdk.Tx
type TxUpdateCandidacyAccount ¶
type TxUpdateCandidacyAccount struct {
NewCandidateAddress common.Address `json:"new_candidate_account"`
}
func (TxUpdateCandidacyAccount) ValidateBasic ¶
func (tx TxUpdateCandidacyAccount) ValidateBasic() error
func (TxUpdateCandidacyAccount) Wrap ¶
func (tx TxUpdateCandidacyAccount) Wrap() sdk.Tx
Wrap - Wrap a Tx as a Echoin Tx
type TxVerifyCandidacy ¶
type TxVerifyCandidacy struct { CandidateAddress common.Address `json:"candidate_address"` Verified bool `json:"verified"` }
func (TxVerifyCandidacy) ValidateBasic ¶
func (tx TxVerifyCandidacy) ValidateBasic() error
ValidateBasic - Check for non-empty candidate, and valid coins
func (TxVerifyCandidacy) Wrap ¶
func (tx TxVerifyCandidacy) Wrap() sdk.Tx
Wrap - Wrap a Tx as a Basecoin Tx
type TxWithdraw ¶
type TxWithdraw struct { ValidatorAddress common.Address `json:"validator_address"` Amount string `json:"amount"` }
func (TxWithdraw) ValidateBasic ¶
func (tx TxWithdraw) ValidateBasic() error
type TxWithdrawCandidacy ¶
type TxWithdrawCandidacy struct{}
func (TxWithdrawCandidacy) ValidateBasic ¶
func (tx TxWithdrawCandidacy) ValidateBasic() error
ValidateBasic - Check for non-empty candidate, and valid coins
func (TxWithdrawCandidacy) Wrap ¶
func (tx TxWithdrawCandidacy) Wrap() sdk.Tx
Wrap - Wrap a Tx as a Basecoin Tx
type UnstakeRequest ¶
type UnstakeRequest struct { Id int64 `json:"id"` DelegatorAddress common.Address `json:"delegator_address"` InitiatedBlockHeight int64 `json:"initiated_block_height"` PerformedBlockHeight int64 `json:"performed_block_height"` Amount string `json:"amount"` State string `json:"state"` CandidateId int64 `json:"candidate_id"` }
func GetUnstakeRequests ¶
func GetUnstakeRequests(height int64) (reqs []*UnstakeRequest)
func GetUnstakeRequestsByDelegator ¶
func GetUnstakeRequestsByDelegator(delegatorAddress common.Address) []*UnstakeRequest
func (*UnstakeRequest) Hash ¶
func (r *UnstakeRequest) Hash() []byte
type Validator ¶
type Validator Candidate
Validator is one of the top Candidates
func (Validator) ABCIValidator ¶
ABCIValidator - Get the validator from a bond value
type Validators ¶
type Validators []Validator
Validators - list of Validators
func (Validators) Less ¶
func (vs Validators) Less(i, j int) bool
func (Validators) Remove ¶
func (vs Validators) Remove(i int) Validators
func (Validators) Swap ¶
func (vs Validators) Swap(i, j int)