github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/distribution/types/delegator.go (about) 1 package types 2 3 import ( 4 sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types" 5 ) 6 7 // starting info for a delegator reward period 8 // tracks the previous validator period, the delegation's amount 9 // of staking token, and the creation height (to check later on 10 // if any slashes have occurred) 11 // NOTE that even though validators are slashed to whole staking tokens, the 12 // delegators within the validator may be left with less than a full token, 13 // thus sdk.Dec is used 14 type DelegatorStartingInfo struct { 15 PreviousPeriod uint64 `json:"previous_period" yaml:"previous_period"` // period at which the delegation should withdraw starting from 16 Stake sdk.Dec `json:"stake" yaml:"stake"` // amount of staking token delegated 17 Height uint64 `json:"creation_height" yaml:"creation_height"` // height at which delegation was created 18 } 19 20 // create a new DelegatorStartingInfo 21 func NewDelegatorStartingInfo(previousPeriod uint64, stake sdk.Dec, height uint64) DelegatorStartingInfo { 22 return DelegatorStartingInfo{ 23 PreviousPeriod: previousPeriod, 24 Stake: stake, 25 Height: height, 26 } 27 }