Documentation ¶
Index ¶
- Constants
- func CalcBonus(fromTS uint64, toTS uint64, rate uint8, value *big.Int) *big.Int
- func CheckCandEnoughSelfVotes(newVotes *big.Int, c *meter.Candidate, bl *meter.BucketList, ...) bool
- func CheckEnoughSelfVotes(subVotes *big.Int, c *meter.Candidate, bl *meter.BucketList, ...) bool
- func GetCandidateBucket(c *meter.Candidate, bl *meter.BucketList) (*meter.Bucket, error)
- func GetCandidateSelfBuckets(c *meter.Candidate, bl *meter.BucketList) ([]*meter.Bucket, error)
- func GetOpName(op uint32) string
- func InTimeSpan(ts, now, span uint64) bool
- func TouchBucketBonus(ts uint64, bucket *meter.Bucket) *big.Int
- type Staking
- func (s *Staking) BoundHandler(env *setypes.ScriptEnv, sb *StakingBody, gas uint64) (leftOverGas uint64, err error)
- func (s *Staking) BucketUpdateHandler(env *setypes.ScriptEnv, sb *StakingBody, gas uint64) (leftOverGas uint64, err error)
- func (s *Staking) CandidateHandler(env *setypes.ScriptEnv, sb *StakingBody, gas uint64) (leftOverGas uint64, err error)
- func (s *Staking) CandidateUpdateHandler(env *setypes.ScriptEnv, sb *StakingBody, gas uint64) (leftOverGas uint64, err error)
- func (s *Staking) Chain() *chain.Chain
- func (s *Staking) DelegateExitJailHandler(env *setypes.ScriptEnv, sb *StakingBody, gas uint64) (leftOverGas uint64, err error)
- func (s *Staking) DelegateHandler(env *setypes.ScriptEnv, sb *StakingBody, gas uint64) (leftOverGas uint64, err error)
- func (s *Staking) DelegateStatFlushHandler(env *setypes.ScriptEnv, sb *StakingBody, gas uint64) (leftOverGas uint64, err error)
- func (s *Staking) DelegateStatHandler(env *setypes.ScriptEnv, sb *StakingBody, gas uint64) (leftOverGas uint64, err error)
- func (s *Staking) DoTeslaFork1_Correction(bid meter.Bytes32, owner meter.Address, amount *big.Int, state *state.State, ...)
- func (s *Staking) DoTeslaFork5_BonusCorrection(state *state.State)
- func (s *Staking) DoTeslaFork6_StakingCorrection(state *state.State)
- func (s *Staking) GoverningHandler(env *setypes.ScriptEnv, sb *StakingBody, gas uint64) (leftOverGas uint64, err error)
- func (s *Staking) Handle(senv *setypes.ScriptEnv, payload []byte, to *meter.Address, gas uint64) (seOutput *setypes.ScriptEngineOutput, leftOverGas uint64, err error)
- func (s *Staking) UnBoundHandler(env *setypes.ScriptEnv, sb *StakingBody, gas uint64) (leftOverGas uint64, err error)
- func (s *Staking) UnCandidateHandler(env *setypes.ScriptEnv, sb *StakingBody, gas uint64) (leftOverGas uint64, err error)
- func (s *Staking) UnDelegateHandler(env *setypes.ScriptEnv, sb *StakingBody, gas uint64) (leftOverGas uint64, err error)
- type StakingBody
Constants ¶
View Source
const ( OP_BOUND = uint32(1) OP_UNBOUND = uint32(2) OP_CANDIDATE = uint32(3) OP_UNCANDIDATE = uint32(4) OP_DELEGATE = uint32(5) OP_UNDELEGATE = uint32(6) OP_CANDIDATE_UPDT = uint32(7) OP_BUCKET_UPDT = uint32(8) OP_DELEGATE_STATISTICS = uint32(101) OP_DELEGATE_EXITJAIL = uint32(102) OP_FLUSH_ALL_STATISTICS = uint32(103) OP_GOVERNING = uint32(10001) )
Variables ¶
This section is empty.
Functions ¶
func CheckCandEnoughSelfVotes ¶ added in v1.2.0
func CheckEnoughSelfVotes ¶
func GetCandidateBucket ¶ added in v1.2.0
get the bucket that candidate initialized
func GetCandidateSelfBuckets ¶ added in v1.2.0
get the buckets which owner is candidate
func InTimeSpan ¶
Types ¶
type Staking ¶
type Staking struct {
// contains filtered or unexported fields
}
Candidate indicates the structure of a candidate
func (*Staking) BoundHandler ¶
func (*Staking) BucketUpdateHandler ¶
func (s *Staking) BucketUpdateHandler(env *setypes.ScriptEnv, sb *StakingBody, gas uint64) (leftOverGas uint64, err error)
update the bucket value. we can only increase the balance
func (*Staking) CandidateHandler ¶
func (*Staking) CandidateUpdateHandler ¶
func (s *Staking) CandidateUpdateHandler(env *setypes.ScriptEnv, sb *StakingBody, gas uint64) (leftOverGas uint64, err error)
This method only update the attached infomation of candidate. Stricted to: name, public key, IP/port, commission
func (*Staking) DelegateExitJailHandler ¶
func (*Staking) DelegateHandler ¶
func (*Staking) DelegateStatFlushHandler ¶
func (s *Staking) DelegateStatFlushHandler(env *setypes.ScriptEnv, sb *StakingBody, gas uint64) (leftOverGas uint64, err error)
this is debug API, only executor has the right to call
func (*Staking) DelegateStatHandler ¶
func (*Staking) DoTeslaFork1_Correction ¶
func (*Staking) DoTeslaFork5_BonusCorrection ¶
func (*Staking) DoTeslaFork6_StakingCorrection ¶
func (*Staking) GoverningHandler ¶
func (*Staking) UnBoundHandler ¶
func (*Staking) UnCandidateHandler ¶
func (*Staking) UnDelegateHandler ¶
type StakingBody ¶
type StakingBody struct { Opcode uint32 Version uint32 Option uint32 HolderAddr meter.Address CandAddr meter.Address CandName []byte CandDescription []byte CandPubKey []byte //ecdsa.PublicKey CandIP []byte CandPort uint16 StakingID meter.Bytes32 // only for unbond Amount *big.Int Token byte // meter or meter gov Autobid uint8 // autobid percentile Timestamp uint64 // staking timestamp Nonce uint64 //staking nonce ExtraData []byte }
Candidate indicates the structure of a candidate
func DecodeFromBytes ¶
func DecodeFromBytes(bytes []byte) (*StakingBody, error)
func (*StakingBody) String ¶ added in v1.2.0
func (sb *StakingBody) String() string
func (*StakingBody) ToString ¶
func (sb *StakingBody) ToString() string
func (*StakingBody) UniteHash ¶ added in v1.2.0
func (sb *StakingBody) UniteHash() (hash meter.Bytes32)
func (*StakingBody) UniteHashWithoutExtraData ¶ added in v1.2.0
func (sb *StakingBody) UniteHashWithoutExtraData() (hash meter.Bytes32)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.