types

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// hard-coded configs
	DefaultMaxValidators   = uint64(100)
	DefaultWeightValidator = float64(2)
	DefaultWeightDelegator = float64(1)

	DefaultMinStakingUnit = "1000000000000000000000000"

	DefaultBlkReward = "0"
	DefaultTxReward  = "10000000000000000000"

	// TODO: not fixed Default ratios yet
	DefaultPenaltyRatioM = float64(0.3)
	DefaultPenaltyRatioL = float64(0.3)

	DefaultLazinessWindow     = int64(10000)
	DefaultLazinessThreshold  = int64(8000)
	DefaultHibernateThreshold = int64(100)
	DefaultHibernatePeriod    = int64(10000)
	DefaultBlockBindingWindow = int64(10000)
	DefaultLockupPeriod       = int64(1000000)

	DefaultDraftOpenCount  = int64(10000)
	DefaultDraftCloseCount = int64(10000)
	DefaultDraftApplyCount = int64(10000)
	DefaultDraftDeposit    = "1000000000000000000000000"
	DefaultDraftQuorumRate = float64(0.3)
	DefaultDraftPassRate   = float64(0.51)
	DefaultDraftRefundRate = float64(0.2)

	DefaultUpgradeProtocolHeight  = int64(1)
	DefaultUpgradeProtocolVersion = uint64(0)
)
View Source
const (
	OneAMOUint64 = uint64(1000000000000000000) // in decimal

)
View Source
const StorageIDLen = 4

Variables

View Source
var Zero = new(Currency).Set(0)

Functions

This section is empty.

Types

type AMOAppConfig added in v1.4.1

type AMOAppConfig struct {
	MaxValidators          uint64   `json:"max_validators"`
	WeightValidator        float64  `json:"weight_validator"`
	WeightDelegator        float64  `json:"weight_delegator"`
	MinStakingUnit         Currency `json:"min_staking_unit"`
	BlkReward              Currency `json:"blk_reward"`
	TxReward               Currency `json:"tx_reward"`
	PenaltyRatioM          float64  `json:"penalty_ratio_m"` // malicious validator
	PenaltyRatioL          float64  `json:"penalty_ratio_l"` // lazy validators
	LazinessWindow         int64    `json:"laziness_window"`
	LazinessThreshold      int64    `json:"laziness_threshold"`
	HibernateThreshold     int64    `json:"hibernate_threshold"`
	HibernatePeriod        int64    `json:"hibernate_period"`
	BlockBindingWindow     int64    `json:"block_binding_window"`
	LockupPeriod           int64    `json:"lockup_period"`
	DraftOpenCount         int64    `json:"draft_open_count"`
	DraftCloseCount        int64    `json:"draft_close_count"`
	DraftApplyCount        int64    `json:"draft_apply_count"`
	DraftDeposit           Currency `json:"draft_deposit"`
	DraftQuorumRate        float64  `json:"draft_quorum_rate"`
	DraftPassRate          float64  `json:"draft_pass_rate"`
	DraftRefundRate        float64  `json:"draft_refund_rate"`
	UpgradeProtocolHeight  int64    `json:"upgrade_protocol_height"`
	UpgradeProtocolVersion uint64   `json:"upgrade_protocol_version"`
}

func NewDefaultAMOAppConfig added in v1.7.6

func NewDefaultAMOAppConfig() (AMOAppConfig, error)

func (*AMOAppConfig) Check added in v1.4.1

func (cfg *AMOAppConfig) Check(
	blockHeight int64,
	protocolVersion uint64,
	txCfgRaw json.RawMessage,
) (AMOAppConfig, error)

type AMOAppConfigGenesis added in v1.7.6

type AMOAppConfigGenesis struct {
	MaxValidators          uint64   `json:"max_validators"`
	WeightValidator        float64  `json:"weight_validator"`
	WeightDelegator        float64  `json:"weight_delegator"`
	MinStakingUnit         Currency `json:"min_staking_unit"`
	BlkReward              Currency `json:"blk_reward"`
	TxReward               Currency `json:"tx_reward"`
	PenaltyRatioM          float64  `json:"penalty_ratio_m"`
	PenaltyRatioL          float64  `json:"penalty_ratio_l"`
	LazinessCounterWindow  int64    `json:"laziness_counter_window"`
	LazinessThreshold      float64  `json:"laziness_threshold"`
	BlockBindingWindow     int64    `json:"block_binding_window"`
	LockupPeriod           int64    `json:"lockup_period"`
	DraftOpenCount         int64    `json:"draft_open_count"`
	DraftCloseCount        int64    `json:"draft_close_count"`
	DraftApplyCount        int64    `json:"draft_apply_count"`
	DraftDeposit           Currency `json:"draft_deposit"`
	DraftQuorumRate        float64  `json:"draft_quorum_rate"`
	DraftPassRate          float64  `json:"draft_pass_rate"`
	DraftRefundRate        float64  `json:"draft_refund_rate"`
	UpgradeProtocolHeight  int64    `json:"upgrade_protocol_height"`
	UpgradeProtocolVersion uint64   `json:"upgrade_protocol_version"`
}

func (*AMOAppConfigGenesis) Migrate added in v1.7.6

func (bCfg *AMOAppConfigGenesis) Migrate() AMOAppConfig

type Currency

type Currency struct {
	big.Int
}

Currency uses big endian for compatibility to big.Int

func (*Currency) Add

func (c *Currency) Add(a *Currency) *Currency

func (*Currency) Clone added in v1.4.2

func (c *Currency) Clone() (*Currency, error)

func (Currency) Equals

func (c Currency) Equals(a *Currency) bool

func (Currency) GreaterThan

func (c Currency) GreaterThan(a *Currency) bool

func (Currency) LessThan

func (c Currency) LessThan(a *Currency) bool

func (Currency) MarshalJSON

func (c Currency) MarshalJSON() ([]byte, error)

func (*Currency) Set

func (c *Currency) Set(x uint64) *Currency

func (*Currency) SetAMO

func (c *Currency) SetAMO(x float64) *Currency

func (*Currency) SetBytes added in v1.2.0

func (c *Currency) SetBytes(x []byte) (*Currency, error)

func (*Currency) SetString

func (c *Currency) SetString(x string, base int) (*Currency, error)

func (Currency) String

func (c Currency) String() string

func (*Currency) Sub

func (c *Currency) Sub(a *Currency) *Currency

func (*Currency) UnmarshalJSON

func (c *Currency) UnmarshalJSON(data []byte) error

type DIDEntry added in v1.7.0

type DIDEntry struct {
	Owner    crypto.Address  `json:"owner,omitempty"` // obsolete
	Document json.RawMessage `json:"document"`
	Meta     json.RawMessage `json:"meta,omitempty"`
}

type Delegate

type Delegate struct {
	Delegatee crypto.Address `json:"delegatee"`
	Amount    Currency       `json:"amount"`
}

type DelegateEx added in v1.1.0

type DelegateEx struct {
	Delegator crypto.Address `json:"delegator"` // just for convenience
	*Delegate
}

type Draft added in v1.4.1

type Draft struct {
	Proposer crypto.Address `json:"proposer"`
	Config   AMOAppConfig   `json:"config"`
	Desc     string         `json:"desc"`

	OpenCount  int64    `json:"open_count"`
	CloseCount int64    `json:"close_count"`
	ApplyCount int64    `json:"apply_count"`
	Deposit    Currency `json:"deposit"`

	TallyQuorum  Currency `json:"tally_quorum"`
	TallyApprove Currency `json:"tally_approve"`
	TallyReject  Currency `json:"tally_reject"`
}

type DraftEx added in v1.4.1

type DraftEx struct {
	*DraftForQuery
	Votes []*VoteInfo `json:"votes"`
}

type DraftForQuery added in v1.7.5

type DraftForQuery struct {
	Proposer crypto.Address  `json:"proposer"`
	Config   json.RawMessage `json:"config"`
	Desc     string          `json:"desc"`

	OpenCount  int64    `json:"open_count"`
	CloseCount int64    `json:"close_count"`
	ApplyCount int64    `json:"apply_count"`
	Deposit    Currency `json:"deposit"`

	TallyQuorum  Currency `json:"tally_quorum"`
	TallyApprove Currency `json:"tally_approve"`
	TallyReject  Currency `json:"tally_reject"`
}

type Extra added in v1.4.1

type Extra struct {
	Register json.RawMessage `json:"register,omitempty"`
	Request  json.RawMessage `json:"request,omitempty"`
	Grant    json.RawMessage `json:"grant,omitempty"`
}

type Hibernate added in v1.7.0

type Hibernate struct {
	Start int64 `json:"start"` // This may be redundant.
	End   int64 `json:"end"`
}

type Parcel added in v1.4.1

type Parcel struct {
	Owner        crypto.Address `json:"owner"`
	Custody      bytes.HexBytes `json:"custody"`
	ProxyAccount crypto.Address `json:"proxy_account,omitempty"`
	Extra        Extra          `json:"extra,omitempty"`
	OnSale       bool           `json:"on_sale"`
}

type ParcelEx added in v1.4.1

type ParcelEx struct {
	*Parcel
	Requests []*RequestEx `json:"requests,omitempty"`
	Usages   []*UsageEx   `json:"usages,omitempty"`
}

type Request added in v1.4.1

type Request struct {
	Payment   Currency       `json:"payment"`
	Agency    crypto.Address `json:"agency,omitempty"`
	Dealer    crypto.Address `json:"dealer,omitempty"`
	DealerFee Currency       `json:"dealer_fee,omitempty"`
	Extra     Extra          `json:"extra,omitempty"`
}

type RequestEx added in v1.4.1

type RequestEx struct {
	*Request
	Recipient crypto.Address `json:"recipient"`
}

type Stake

type Stake struct {
	Validator ed25519.PubKeyEd25519 `json:"validator"`
	Amount    Currency              `json:"amount"`
}

type StakeEx added in v1.1.0

type StakeEx struct {
	*Stake
	Delegates []*DelegateEx `json:"delegates,omitempty"`
}

func (StakeEx) MarshalJSON added in v1.5.0

func (s StakeEx) MarshalJSON() ([]byte, error)

type Storage added in v1.4.1

type Storage struct {
	Owner           crypto.Address `json:"owner"`
	Url             string         `json:"url"`
	RegistrationFee Currency       `json:"registration_fee"`
	HostingFee      Currency       `json:"hosting_fee"`
	Active          bool           `json:"active"`
}

type UDC added in v1.4.1

type UDC struct {
	Owner     crypto.Address   `json:"owner"`     // required
	Desc      string           `json:"desc"`      // optional
	Operators []crypto.Address `json:"operators"` // optional
	Total     Currency         `json:"total"`     // required
}

type Usage added in v1.4.1

type Usage struct {
	Custody bytes.HexBytes `json:"custody"`
	Extra   Extra          `json:"extra,omitempty"`
}

type UsageEx added in v1.4.1

type UsageEx struct {
	*Usage
	Recipient crypto.Address `json:"recipient"`
}

type VCEntry added in v1.9.0

type VCEntry struct {
	Credential json.RawMessage `json:"credential"`
	Meta       json.RawMessage `json:"meta,omitempty"`
}

type Vote added in v1.4.1

type Vote struct {
	Approve bool `json:"approve"`
}

type VoteInfo added in v1.4.1

type VoteInfo struct {
	Voter crypto.Address `json:"voter"`
	*Vote
}

Jump to

Keyboard shortcuts

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