Documentation ¶
Index ¶
- Constants
- Variables
- func ClaimEventLog(cc icmodule.CallContext, address module.Address, claim *big.Int, icx *big.Int)
- func CompileVoters(state *icstate.State, csi module.ConsensusInfo) ([]module.Address, []module.Address, error)
- func GetIssueData(es *ExtensionStateImpl) (*IssuePRepJSON, *IssueResultJSON)
- func NewCallContext(cc contract.CallContext, from module.Address) icmodule.CallContext
- func NewClaimIScoreLog(from module.Address, amount *big.Int, claim *icstage.IScoreClaim) *claimIScoreLog
- func NewExtensionSnapshot(database db.Database, hash []byte) state.ExtensionSnapshot
- func NewExtensionSnapshotWithBuilder(builder merkle.Builder, raw []byte) state.ExtensionSnapshot
- func NewWorldContext(ctx state.WorldContext) icmodule.WorldContext
- func RegisterBaseTx()
- func RegulateIssueInfo(issue *icstate.Issue, iScore *big.Int)
- type Calculator
- func (c *Calculator) Back() *icstage.Snapshot
- func (c *Calculator) Base() *icreward.Snapshot
- func (c *Calculator) Error() error
- func (c *Calculator) Result() *icreward.Snapshot
- func (c *Calculator) StartHeight() int64
- func (c *Calculator) Stop()
- func (c *Calculator) Temp() *icreward.State
- func (c *Calculator) TotalReward() *big.Int
- func (c *Calculator) WaitResult(blockHeight int64) error
- type CalculatorHolder
- type Claimed
- type ExtensionLog
- type ExtensionSnapshotImpl
- func (s *ExtensionSnapshotImpl) Back1() *icstage.Snapshot
- func (s *ExtensionSnapshotImpl) Back2() *icstage.Snapshot
- func (s *ExtensionSnapshotImpl) Bytes() []byte
- func (s *ExtensionSnapshotImpl) Flush() error
- func (s *ExtensionSnapshotImpl) NewState(readonly bool) state.ExtensionState
- func (s *ExtensionSnapshotImpl) RLPDecodeSelf(d codec.Decoder) error
- func (s *ExtensionSnapshotImpl) RLPEncodeSelf(e codec.Encoder) error
- func (s *ExtensionSnapshotImpl) Reward() *icreward.Snapshot
- type ExtensionStateImpl
- func (es *ExtensionStateImpl) AddEventBond(blockHeight int64, from module.Address, delta map[string]*big.Int) (err error)
- func (es *ExtensionStateImpl) AppendExtensionLog(el ExtensionLog)
- func (es *ExtensionStateImpl) Burn(cc icmodule.CallContext, amount *big.Int) error
- func (es *ExtensionStateImpl) CalculationBlockHeight() int64
- func (es *ExtensionStateImpl) ClaimIScore(cc icmodule.CallContext) error
- func (es *ExtensionStateImpl) ClearCache()
- func (es *ExtensionStateImpl) ClearPRepIllegalDelegated() error
- func (es *ExtensionStateImpl) DisqualifyPRep(cc icmodule.CallContext, address module.Address) error
- func (es *ExtensionStateImpl) GenesisTerm(blockHeight int64, revision int) error
- func (es *ExtensionStateImpl) GetBond(address module.Address) (map[string]interface{}, error)
- func (es *ExtensionStateImpl) GetBonderList(address module.Address) (map[string]interface{}, error)
- func (es *ExtensionStateImpl) GetIScore(from module.Address, revision int, txID []byte) (*big.Int, error)
- func (es *ExtensionStateImpl) GetMainPRepsInJSON(blockHeight int64) (map[string]interface{}, error)
- func (es *ExtensionStateImpl) GetPRepInJSON(address module.Address, blockHeight int64) (map[string]interface{}, error)
- func (es *ExtensionStateImpl) GetPRepTermInJSON(blockHeight int64) (map[string]interface{}, error)
- func (es *ExtensionStateImpl) GetSnapshot() state.ExtensionSnapshot
- func (es *ExtensionStateImpl) GetSubPRepsInJSON(blockHeight int64) (map[string]interface{}, error)
- func (es *ExtensionStateImpl) HandleConsensusInfo(cc icmodule.CallContext) error
- func (es *ExtensionStateImpl) IsDecentralized() bool
- func (es *ExtensionStateImpl) Logger() log.Logger
- func (es *ExtensionStateImpl) OnBaseTx(cc icmodule.CallContext, data []byte) error
- func (es *ExtensionStateImpl) OnExecutionBegin(wc icmodule.WorldContext) error
- func (es *ExtensionStateImpl) OnExecutionEnd(wc icmodule.WorldContext, totalFee *big.Int, calculator *Calculator) error
- func (es *ExtensionStateImpl) OnTransactionEnd(blockHeight int64, success bool) error
- func (es *ExtensionStateImpl) PenalizeNonVoters(cc icmodule.CallContext, address module.Address) error
- func (es *ExtensionStateImpl) RegisterPRep(cc icmodule.CallContext, info *icstate.PRepInfo) error
- func (es *ExtensionStateImpl) Reset(isnapshot state.ExtensionSnapshot)
- func (es *ExtensionStateImpl) SetBond(blockHeight int64, from module.Address, bonds icstate.Bonds) error
- func (es *ExtensionStateImpl) SetBonderList(from module.Address, bl icstate.BonderList) error
- func (es *ExtensionStateImpl) SetDelegation(cc icmodule.CallContext, ds icstate.Delegations) error
- func (es *ExtensionStateImpl) SetGovernanceVariables(from module.Address, irep *big.Int, blockHeight int64) error
- func (es *ExtensionStateImpl) SetLogger(logger log.Logger)
- func (es *ExtensionStateImpl) SetPRep(cc icmodule.CallContext, info *icstate.PRepInfo) error
- func (es *ExtensionStateImpl) SetStake(cc icmodule.CallContext, v *big.Int) (err error)
- func (es *ExtensionStateImpl) UnregisterPRep(cc icmodule.CallContext) error
- func (es *ExtensionStateImpl) ValidateIRep(oldIRep, newIRep *big.Int, prevSetIRepHeight int64) error
- func (es *ExtensionStateImpl) ValidateRewardFund(iglobal *big.Int, totalSupply *big.Int) error
- type IssuePRepJSON
- type IssueResultJSON
- func (i *IssueResultJSON) Equal(i2 *IssueResultJSON) bool
- func (i *IssueResultJSON) Format(f fmt.State, c rune)
- func (i *IssueResultJSON) GetByFee() *big.Int
- func (i *IssueResultJSON) GetByOverIssuedICX() *big.Int
- func (i *IssueResultJSON) GetIssue() *big.Int
- func (i *IssueResultJSON) GetTotalReward() *big.Int
- type RewardType
Constants ¶
View Source
const ( DayBlock = 24 * 60 * 60 / 2 DayPerMonth = 30 MonthBlock = DayBlock * DayPerMonth MonthPerYear = 12 YearBlock = MonthBlock * MonthPerYear MinRrep = 200 RrepMultiplier = 3 // rrep = rrep + eep + dbp = 3 * rrep RrepDivider = 10_000 // rrep(10_000) = 100.00%, rrep(200) = 2.00% MinDelegation = YearBlock / icmodule.IScoreICXRatio * (RrepDivider / MinRrep) )
View Source
const CodeOffsetForICON = 100
View Source
const (
CriticalCalculatorError = errors.CodeCritical + CodeOffsetForICON + iota
)
View Source
const InitBlockHeight = -1
View Source
const IrepInflationLimit = 14 // 14%
Variables ¶
View Source
var (
BigIntMinDelegation = big.NewInt(int64(MinDelegation))
)
Functions ¶
func ClaimEventLog ¶ added in v0.9.10
func CompileVoters ¶ added in v0.9.7
func CompileVoters(state *icstate.State, csi module.ConsensusInfo) ([]module.Address, []module.Address, error)
CompileVoters return slice of owner address of voters It returns slice of owner address of all voters, slice of owner address of voted voters and any error encountered.
func GetIssueData ¶ added in v0.9.6
func GetIssueData(es *ExtensionStateImpl) (*IssuePRepJSON, *IssueResultJSON)
GetIssueData return issue information for base TX
func NewCallContext ¶ added in v0.9.10
func NewCallContext(cc contract.CallContext, from module.Address) icmodule.CallContext
func NewClaimIScoreLog ¶ added in v0.9.10
func NewExtensionSnapshot ¶ added in v0.9.6
func NewExtensionSnapshot(database db.Database, hash []byte) state.ExtensionSnapshot
func NewExtensionSnapshotWithBuilder ¶ added in v0.9.6
func NewExtensionSnapshotWithBuilder(builder merkle.Builder, raw []byte) state.ExtensionSnapshot
func NewWorldContext ¶ added in v1.0.0
func NewWorldContext(ctx state.WorldContext) icmodule.WorldContext
func RegisterBaseTx ¶
func RegisterBaseTx()
Types ¶
type Calculator ¶ added in v0.9.6
type Calculator struct {
// contains filtered or unexported fields
}
func NewCalculator ¶ added in v0.9.6
func UpdateCalculator ¶ added in v0.9.8
func UpdateCalculator(c *Calculator, ess state.ExtensionSnapshot, logger log.Logger) *Calculator
func (*Calculator) Back ¶ added in v0.9.6
func (c *Calculator) Back() *icstage.Snapshot
func (*Calculator) Base ¶ added in v0.9.6
func (c *Calculator) Base() *icreward.Snapshot
func (*Calculator) Error ¶ added in v0.9.7
func (c *Calculator) Error() error
func (*Calculator) Result ¶ added in v0.9.6
func (c *Calculator) Result() *icreward.Snapshot
func (*Calculator) StartHeight ¶ added in v0.9.6
func (c *Calculator) StartHeight() int64
func (*Calculator) Stop ¶ added in v0.9.8
func (c *Calculator) Stop()
func (*Calculator) Temp ¶ added in v0.9.6
func (c *Calculator) Temp() *icreward.State
func (*Calculator) TotalReward ¶ added in v0.9.6
func (c *Calculator) TotalReward() *big.Int
func (*Calculator) WaitResult ¶ added in v0.9.10
func (c *Calculator) WaitResult(blockHeight int64) error
type CalculatorHolder ¶ added in v0.9.8
type CalculatorHolder struct {
// contains filtered or unexported fields
}
func (*CalculatorHolder) Get ¶ added in v0.9.8
func (h *CalculatorHolder) Get() *Calculator
func (*CalculatorHolder) Start ¶ added in v0.9.8
func (h *CalculatorHolder) Start(ess state.ExtensionSnapshot, logger log.Logger)
type ExtensionLog ¶ added in v0.9.10
type ExtensionLog interface {
Handle(es *ExtensionStateImpl) error
}
type ExtensionSnapshotImpl ¶ added in v0.9.6
type ExtensionSnapshotImpl struct {
// contains filtered or unexported fields
}
func (*ExtensionSnapshotImpl) Back1 ¶ added in v0.9.7
func (s *ExtensionSnapshotImpl) Back1() *icstage.Snapshot
func (*ExtensionSnapshotImpl) Back2 ¶ added in v0.9.8
func (s *ExtensionSnapshotImpl) Back2() *icstage.Snapshot
func (*ExtensionSnapshotImpl) Bytes ¶ added in v0.9.6
func (s *ExtensionSnapshotImpl) Bytes() []byte
func (*ExtensionSnapshotImpl) Flush ¶ added in v0.9.6
func (s *ExtensionSnapshotImpl) Flush() error
func (*ExtensionSnapshotImpl) NewState ¶ added in v0.9.6
func (s *ExtensionSnapshotImpl) NewState(readonly bool) state.ExtensionState
func (*ExtensionSnapshotImpl) RLPDecodeSelf ¶ added in v0.9.6
func (s *ExtensionSnapshotImpl) RLPDecodeSelf(d codec.Decoder) error
func (*ExtensionSnapshotImpl) RLPEncodeSelf ¶ added in v0.9.6
func (s *ExtensionSnapshotImpl) RLPEncodeSelf(e codec.Encoder) error
func (*ExtensionSnapshotImpl) Reward ¶ added in v0.9.7
func (s *ExtensionSnapshotImpl) Reward() *icreward.Snapshot
type ExtensionStateImpl ¶ added in v0.9.6
type ExtensionStateImpl struct { State *icstate.State Front *icstage.State Back1 *icstage.State Back2 *icstage.State Reward *icreward.State // contains filtered or unexported fields }
func (*ExtensionStateImpl) AddEventBond ¶ added in v0.9.6
func (*ExtensionStateImpl) AppendExtensionLog ¶ added in v0.9.10
func (es *ExtensionStateImpl) AppendExtensionLog(el ExtensionLog)
func (*ExtensionStateImpl) Burn ¶ added in v0.9.10
func (es *ExtensionStateImpl) Burn(cc icmodule.CallContext, amount *big.Int) error
func (*ExtensionStateImpl) CalculationBlockHeight ¶ added in v0.9.6
func (es *ExtensionStateImpl) CalculationBlockHeight() int64
func (*ExtensionStateImpl) ClaimIScore ¶ added in v0.9.10
func (es *ExtensionStateImpl) ClaimIScore(cc icmodule.CallContext) error
func (*ExtensionStateImpl) ClearCache ¶ added in v0.9.6
func (es *ExtensionStateImpl) ClearCache()
ClearCache clear cache. It's called before executing first transaction and also it could be called at the end of base transaction
func (*ExtensionStateImpl) ClearPRepIllegalDelegated ¶ added in v0.9.10
func (es *ExtensionStateImpl) ClearPRepIllegalDelegated() error
func (*ExtensionStateImpl) DisqualifyPRep ¶ added in v0.9.6
func (es *ExtensionStateImpl) DisqualifyPRep(cc icmodule.CallContext, address module.Address) error
func (*ExtensionStateImpl) GenesisTerm ¶ added in v0.9.6
func (es *ExtensionStateImpl) GenesisTerm(blockHeight int64, revision int) error
func (*ExtensionStateImpl) GetBond ¶ added in v1.0.0
func (es *ExtensionStateImpl) GetBond(address module.Address) (map[string]interface{}, error)
func (*ExtensionStateImpl) GetBonderList ¶ added in v0.9.6
func (es *ExtensionStateImpl) GetBonderList(address module.Address) (map[string]interface{}, error)
func (*ExtensionStateImpl) GetMainPRepsInJSON ¶ added in v0.9.6
func (es *ExtensionStateImpl) GetMainPRepsInJSON(blockHeight int64) (map[string]interface{}, error)
func (*ExtensionStateImpl) GetPRepInJSON ¶ added in v0.9.6
func (*ExtensionStateImpl) GetPRepTermInJSON ¶ added in v0.9.6
func (es *ExtensionStateImpl) GetPRepTermInJSON(blockHeight int64) (map[string]interface{}, error)
func (*ExtensionStateImpl) GetSnapshot ¶ added in v0.9.6
func (es *ExtensionStateImpl) GetSnapshot() state.ExtensionSnapshot
func (*ExtensionStateImpl) GetSubPRepsInJSON ¶ added in v0.9.6
func (es *ExtensionStateImpl) GetSubPRepsInJSON(blockHeight int64) (map[string]interface{}, error)
func (*ExtensionStateImpl) HandleConsensusInfo ¶ added in v1.0.2
func (es *ExtensionStateImpl) HandleConsensusInfo(cc icmodule.CallContext) error
func (*ExtensionStateImpl) IsDecentralized ¶ added in v0.9.6
func (es *ExtensionStateImpl) IsDecentralized() bool
func (*ExtensionStateImpl) Logger ¶ added in v0.9.6
func (es *ExtensionStateImpl) Logger() log.Logger
func (*ExtensionStateImpl) OnBaseTx ¶ added in v0.9.8
func (es *ExtensionStateImpl) OnBaseTx(cc icmodule.CallContext, data []byte) error
func (*ExtensionStateImpl) OnExecutionBegin ¶ added in v0.9.7
func (es *ExtensionStateImpl) OnExecutionBegin(wc icmodule.WorldContext) error
func (*ExtensionStateImpl) OnExecutionEnd ¶ added in v0.9.6
func (es *ExtensionStateImpl) OnExecutionEnd(wc icmodule.WorldContext, totalFee *big.Int, calculator *Calculator) error
func (*ExtensionStateImpl) OnTransactionEnd ¶ added in v0.9.10
func (es *ExtensionStateImpl) OnTransactionEnd(blockHeight int64, success bool) error
func (*ExtensionStateImpl) PenalizeNonVoters ¶ added in v1.1.0
func (es *ExtensionStateImpl) PenalizeNonVoters(cc icmodule.CallContext, address module.Address) error
func (*ExtensionStateImpl) RegisterPRep ¶ added in v0.9.6
func (es *ExtensionStateImpl) RegisterPRep(cc icmodule.CallContext, info *icstate.PRepInfo) error
func (*ExtensionStateImpl) Reset ¶ added in v0.9.6
func (es *ExtensionStateImpl) Reset(isnapshot state.ExtensionSnapshot)
func (*ExtensionStateImpl) SetBonderList ¶ added in v0.9.6
func (es *ExtensionStateImpl) SetBonderList(from module.Address, bl icstate.BonderList) error
func (*ExtensionStateImpl) SetDelegation ¶ added in v0.9.6
func (es *ExtensionStateImpl) SetDelegation( cc icmodule.CallContext, ds icstate.Delegations) error
func (*ExtensionStateImpl) SetGovernanceVariables ¶ added in v0.9.6
func (*ExtensionStateImpl) SetLogger ¶ added in v0.9.6
func (es *ExtensionStateImpl) SetLogger(logger log.Logger)
func (*ExtensionStateImpl) SetPRep ¶ added in v0.9.6
func (es *ExtensionStateImpl) SetPRep(cc icmodule.CallContext, info *icstate.PRepInfo) error
func (*ExtensionStateImpl) SetStake ¶ added in v0.9.10
func (es *ExtensionStateImpl) SetStake(cc icmodule.CallContext, v *big.Int) (err error)
func (*ExtensionStateImpl) UnregisterPRep ¶ added in v0.9.6
func (es *ExtensionStateImpl) UnregisterPRep(cc icmodule.CallContext) error
func (*ExtensionStateImpl) ValidateIRep ¶ added in v0.9.6
func (es *ExtensionStateImpl) ValidateIRep(oldIRep, newIRep *big.Int, prevSetIRepHeight int64) error
func (*ExtensionStateImpl) ValidateRewardFund ¶ added in v1.1.1
type IssuePRepJSON ¶ added in v0.9.6
type IssuePRepJSON struct { IRep *common.HexInt `json:"irep"` RRep *common.HexInt `json:"rrep"` TotalDelegation *common.HexInt `json:"totalDelegation"` Value *common.HexInt `json:"value"` }
func ParseIssuePRepData ¶ added in v0.9.7
func ParseIssuePRepData(data []byte) (*IssuePRepJSON, error)
func (*IssuePRepJSON) Equal ¶ added in v0.9.7
func (i *IssuePRepJSON) Equal(i2 *IssuePRepJSON) bool
func (*IssuePRepJSON) GetIRep ¶ added in v0.9.7
func (i *IssuePRepJSON) GetIRep() *big.Int
func (*IssuePRepJSON) GetRRep ¶ added in v0.9.7
func (i *IssuePRepJSON) GetRRep() *big.Int
func (*IssuePRepJSON) GetTotalDelegation ¶ added in v0.9.7
func (i *IssuePRepJSON) GetTotalDelegation() *big.Int
func (*IssuePRepJSON) GetValue ¶ added in v0.9.7
func (i *IssuePRepJSON) GetValue() *big.Int
type IssueResultJSON ¶ added in v0.9.6
type IssueResultJSON struct { ByFee *common.HexInt `json:"coveredByFee"` ByOverIssuedICX *common.HexInt `json:"coveredByOverIssuedICX"` Issue *common.HexInt `json:"issue"` }
func ParseIssueResultData ¶ added in v0.9.7
func ParseIssueResultData(data []byte) (*IssueResultJSON, error)
func (*IssueResultJSON) Equal ¶ added in v0.9.7
func (i *IssueResultJSON) Equal(i2 *IssueResultJSON) bool
func (*IssueResultJSON) Format ¶ added in v0.9.7
func (i *IssueResultJSON) Format(f fmt.State, c rune)
func (*IssueResultJSON) GetByFee ¶ added in v0.9.7
func (i *IssueResultJSON) GetByFee() *big.Int
func (*IssueResultJSON) GetByOverIssuedICX ¶ added in v0.9.7
func (i *IssueResultJSON) GetByOverIssuedICX() *big.Int
func (*IssueResultJSON) GetIssue ¶ added in v0.9.7
func (i *IssueResultJSON) GetIssue() *big.Int
func (*IssueResultJSON) GetTotalReward ¶ added in v0.9.6
func (i *IssueResultJSON) GetTotalReward() *big.Int
type RewardType ¶ added in v0.9.6
type RewardType int
const ( TypeBlockProduce RewardType = iota TypeVoted TypeVoting )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.