icmodule

package
v1.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

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 / IScoreICXRatio * (RrepDivider / MinRrep)
)
View Source
const (
	ConfigFile               = "./icon_config.json"
	IScoreICXRatio           = 1_000
	VotedRewardMultiplier    = 100
	InitialTermPeriod        = DayBlock
	DecentralizedTermPeriod  = 43120
	InitialDepositTerm       = 1_296_000
	DisableDepositTerm       = 0
	InitialUnstakeSlotMax    = 1
	InitialDelegationSlotMax = 10
	IISS2BondRequirement     = 0
	InitialIRep              = 50_000 // in icx, not loop
	MinIRep                  = 10_000
	RewardPoint              = 0.7
	ICX                      = 1_000_000_000_000_000_000

	DefaultTermPeriod                           = InitialTermPeriod
	DefaultUnbondingPeriodMultiplier            = 7
	DefaultUnstakeSlotMax                       = 1000
	DefaultMainPRepCount                        = 22
	DefaultSubPRepCount                         = 78
	DefaultIRep                                 = 0
	DefaultRRep                                 = 1200
	DefaultBondRequirement                      = 5 // 5%
	DefaultLockMinMultiplier                    = 5
	DefaultLockMaxMultiplier                    = 20
	DefaultIglobal                              = YearBlock * IScoreICXRatio
	DefaultIprep                                = 50 // 50%
	DefaultIcps                                 = 0  // 0%
	DefaultIrelay                               = 0  // 0%
	DefaultIvoter                               = 50 // 50%
	DefaultUnbondingMax                         = 100
	DefaultValidationPenaltyCondition           = 660
	DefaultConsistentValidationPenaltyCondition = 5
	DefaultConsistentValidationPenaltyMask      = 30
	DefaultConsistentValidationPenaltySlashRate = 0 // 0%
	DefaultDelegationSlotMax                    = 100
	DefaultExtraMainPRepCount                   = 3
	DefaultNonVotePenaltySlashRate              = 0 // 0%
)
View Source
const (
	IllegalArgumentError errors.Code = scoreresult.RevertedError + iota
	DuplicateError
	InvalidStateError
	NotFoundError
	NotReadyError
)
View Source
const (
	Revision0 = iota
	Revision1
	Revision2
	Revision3
	Revision4
	Revision5
	Revision6
	Revision7
	Revision8
	Revision9
	Revision10
	Revision11
	Revision12
	Revision13
	Revision14
	Revision15
	Revision16
	Revision17
	Revision18
	Revision19
	Revision20
	Revision21
	Revision22
	Revision23
	Revision24
	Revision25
	Revision26
	Revision27
	Revision28
	RevisionReserved
)
View Source
const (
	DefaultRevision = Revision1
	MaxRevision     = RevisionReserved - 1
	LatestRevision  = MaxRevision
)
View Source
const (
	RevisionIISS = Revision5

	RevisionDecentralize = Revision6

	RevisionFixTotalDelegated = Revision7

	RevisionFixBugDisabledPRep = Revision8

	RevisionIISS2                     = Revision9
	RevisionFixBurnEventSignature     = Revision9
	RevisionMultipleUnstakes          = Revision9
	RevisionFixEmailValidation        = Revision9
	RevisionDelegationSlotMaxTo100    = Revision9
	RevisionSystemSCORE               = Revision9
	RevisionSetIRepViaNetworkProposal = Revision9
	RevisionPreventDuplicatedEndpoint = Revision9

	RevisionFixInvalidUnstake = Revision11

	RevisionBurnV2 = Revision12

	RevisionICON2R0              = Revision13
	RevisionFixClaimIScore       = Revision13
	RevisionFixSetDelegation     = Revision13
	RevisionFixRLPBug            = Revision13
	RevisionResetPenaltyMask     = Revision13
	RevisionEnableBondAPIs       = Revision13
	RevisionFixIllegalDelegation = Revision13
	RevisionStopICON1Support     = Revision13

	RevisionICON2R1       = Revision14
	RevisionEnableIISS3   = Revision14
	RevisionEnableFee3    = Revision14
	RevisionBlockAccounts = Revision14

	RevisionICON2R2      = Revision15
	RevisionEnableJavaEE = Revision15

	RevisionFixIGlobal = Revision16

	RevisionICON2R3             = Revision17
	RevisionEnableSetScoreOwner = Revision17
	RevisionExtraMainPReps      = Revision17
	RevisionFixVotingReward     = Revision17

	RevisionFixTransferRewardFund = Revision18

	RevisionJavaPurgeEnumCache = Revision19

	RevisionJavaFixMapValues = Revision20

	RevisionBTP2           = Revision21
	RevisionBlockAccounts2 = Revision21

	RevisionUpdatePRepStats = Revision22
	RevisionBlockAccountAPI = Revision22

	RevisionFixJCLSteps = Revision23

	RevisionIISS4R0            = Revision24
	RevisionChainScoreEventLog = Revision24

	RevisionIISS4R1 = Revision25

	RevisionFixIssueRegulator = Revision26

	RevisionRecoverUnderIssuance = Revision27

	RevisionSetBondRequirementRate = Revision28
)
View Source
const (
	CalculationFailedError = CodeIISS + iota
)
View Source
const (
	CodeIISS = errors.CodeCritical + errors.CodeSegment*(iota+1)
)
View Source
const (
	DenomInRate = int64(10_000)
)

Variables

View Source
var (
	BigIntZero           = new(big.Int)
	BigIntICX            = big.NewInt(ICX)
	BigIntInitialIRep    = new(big.Int).Mul(big.NewInt(InitialIRep), BigIntICX)
	BigIntMinIRep        = new(big.Int).Mul(big.NewInt(MinIRep), BigIntICX)
	BigIntIScoreICXRatio = big.NewInt(IScoreICXRatio)
	BigIntRegPRepFee     = new(big.Int).Mul(big.NewInt(2000), BigIntICX)
)

The following variables are read-only

View Source
var (
	BigIntMinDelegation = big.NewInt(int64(MinDelegation))
)
View Source
var BlockedAccount = map[string]bool{
	"hx76dcc464a27d74ca7798dd789d2e1da8193219b4": true,
	"hxac5c6e6f7a6e8ae1baba5f0cb512f7596b95f1fe": true,
	"hx966f5f9e2ab5b80a0f2125378e85d17a661352f4": true,
	"hxad2bc6446ee3ae23228889d21f1871ed182ca2ca": true,
	"hxc39a4c8438abbcb6b49de4691f07ee9b24968a1b": true,
	"hx96505aac67c4f9033e4bac47397d760f121bcc44": true,
	"hxf5bbebeb7a7d37d2aee5d93a8459e182cbeb725d": true,
	"hx4602589eb91cf99b27296e5bd712387a23dd8ce5": true,
	"hxa67e30ec59e73b9e15c7f2c4ddc42a13b44b2097": true,
	"hx52c32d0b82f46596f697d8ba2afb39105f3a6360": true,
	"hx985cf67b563fb908543385da806f297482f517b4": true,
	"hxc0567bbcba511b84012103a2360825fddcd058ab": true,
	"hx20be21b8afbbc0ba46f0671508cfe797c7bb91be": true,
	"hx19e551eae80f9b9dcfed1554192c91c96a9c71d1": true,
	"hx0607341382dee5e039a87562dcb966e71881f336": true,
	"hxdea6fe8d6811ec28db095b97762fdd78b48c291f": true,
	"hxaf3a561e3888a2b497941e464f82fd4456db3ebf": true,
	"hx061b01c59bd9fc1282e7494ff03d75d0e7187f47": true,
	"hx10d12d5726f50e4cf92c5fad090637b403516a41": true,
	"hx10e8a7289c3989eac07828a840905344d8ed559b": true,
}

Functions

func ValueToRevision

func ValueToRevision(v int) module.Revision

Types

type CallContext added in v0.9.10

type CallContext interface {
	WorldContext
	From() module.Address
	HandleBurn(address module.Address, amount *big.Int) error
	SumOfStepUsed() *big.Int
	OnEvent(addr module.Address, indexed, data [][]byte)
	CallOnTimer(to module.Address, params []byte) error
	FrameLogger() *trace.Logger
	TransactionInfo() *state.TransactionInfo
}

type EnableEventLogger added in v1.4.0

type EnableEventLogger interface {
	AddEventEnable(blockHeight int64, owner module.Address, status EnableStatus) error
}

type EnableStatus added in v1.4.0

type EnableStatus int
const (
	ESEnable EnableStatus = iota
	ESDisableTemp
	ESDisablePermanent
	ESJail
	ESUnjail
	ESEnableAtNextTerm
	ESMax
)

func (EnableStatus) IsDisabledPermanently added in v1.4.0

func (ef EnableStatus) IsDisabledPermanently() bool

func (EnableStatus) IsDisabledTemporarily added in v1.4.0

func (ef EnableStatus) IsDisabledTemporarily() bool

func (EnableStatus) IsEnabled added in v1.4.0

func (ef EnableStatus) IsEnabled() bool

func (EnableStatus) IsJail added in v1.4.0

func (ef EnableStatus) IsJail() bool

func (EnableStatus) IsUnjail added in v1.4.0

func (ef EnableStatus) IsUnjail() bool

func (EnableStatus) String added in v1.4.0

func (ef EnableStatus) String() string

type PRepEvent added in v1.4.0

type PRepEvent int
const (
	PRepEventBlockVote PRepEvent = iota
	PRepEventImposePenalty
	PRepEventMainIn
	PRepEventRequestUnjail
	PRepEventTermEnd
	PRepEventValidatorOut
)

type PenaltyType added in v0.9.10

type PenaltyType int
const (
	PenaltyNone PenaltyType = iota
	PenaltyPRepDisqualification
	PenaltyAccumulatedValidationFailure
	PenaltyValidationFailure
	PenaltyMissedNetworkProposalVote
	PenaltyDoubleSign
	PenaltyReserved
)

func GetPenaltyTypes added in v1.4.0

func GetPenaltyTypes() []PenaltyType

func ToPenaltyType added in v1.4.0

func ToPenaltyType(name string) PenaltyType

func (PenaltyType) IsValid added in v1.4.0

func (p PenaltyType) IsValid() bool

func (PenaltyType) String added in v1.4.0

func (p PenaltyType) String() string

type Rate added in v1.4.0

type Rate int64

func ToRate added in v1.4.0

func ToRate(percent int64) Rate

func (Rate) DenomBigInt added in v1.4.0

func (r Rate) DenomBigInt() *big.Int

DenomBigInt returns denominator in *BigInt

func (Rate) DenomInt64 added in v1.4.0

func (r Rate) DenomInt64() int64

DenomInt64 returns denominator in int64

func (Rate) IsValid added in v1.4.0

func (r Rate) IsValid() bool

func (Rate) MulBigInt added in v1.4.0

func (r Rate) MulBigInt(v *big.Int) *big.Int

func (Rate) MulInt64 added in v1.4.0

func (r Rate) MulInt64(v int64) int64

func (Rate) NumBigInt added in v1.4.0

func (r Rate) NumBigInt() *big.Int

NumBigInt returns numerator in *big.Int

func (Rate) NumInt64 added in v1.4.0

func (r Rate) NumInt64() int64

NumInt64 returns numerator in int64

func (Rate) Percent added in v1.4.0

func (r Rate) Percent() int64

func (Rate) String added in v1.4.0

func (r Rate) String() string

type StateContext added in v1.4.0

type StateContext interface {
	BlockHeight() int64
	RevisionValue() int
	TermRevisionValue() int
	TermIISSVersion() int
	GetActiveDSAMask() int64
	GetBondRequirement() Rate
	AddEventEnable(from module.Address, status EnableStatus) error
}

type WorldContext added in v0.9.10

type WorldContext interface {
	Revision() module.Revision
	BlockHeight() int64
	Origin() module.Address
	Treasury() module.Address
	TransactionID() []byte
	ConsensusInfo() module.ConsensusInfo
	GetBalance(address module.Address) *big.Int
	Deposit(address module.Address, amount *big.Int, opType module.OpType) error
	Withdraw(address module.Address, amount *big.Int, opType module.OpType) error
	Transfer(from module.Address, to module.Address, amount *big.Int, opType module.OpType) error
	GetTotalSupply() *big.Int
	AddTotalSupply(amount *big.Int) (*big.Int, error)
	SetValidators(validators []module.Validator) error
	StepPrice() *big.Int
	GetScoreOwner(score module.Address) (module.Address, error)
	SetScoreOwner(from module.Address, score module.Address, owner module.Address) error
	GetBTPContext() state.BTPContext
	GetActiveDSAMask() int64
	Governance() module.Address
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL