Documentation ¶
Index ¶
- Constants
- Variables
- func HashForIDCalculation(idBytes []byte, attr []byte, timeout uint64, hashFunc crypto.Hash) []byte
- func NewBillID(shardPart []byte, unitPart []byte) types.UnitID
- func NewFeeCreditRecordID(shardPart []byte, unitPart []byte) types.UnitID
- func NewTxSystem(opts ...Option) (*txsystem.GenericTxSystem, error)
- type BillData
- type DustCollector
- type InitialBill
- type Module
- type Option
- func WithDCMoneyAmount(a uint64) Option
- func WithFeeCalculator(calc fc.FeeCalculator) Option
- func WithHashAlgorithm(hashAlgorithm gocrypto.Hash) Option
- func WithInitialBill(bill *InitialBill) Option
- func WithState(s *state.State) Option
- func WithSystemDescriptionRecords(records []*genesis.SystemDescriptionRecord) Option
- func WithSystemIdentifier(systemIdentifier []byte) Option
- func WithTrustBase(trust map[string]crypto.Verifier) Option
- type Options
- type SplitAttributes
- type SwapDCAttributes
- type TransferAttributes
- type TransferDCAttributes
Constants ¶
View Source
const ( PayloadTypeTransfer = "trans" PayloadTypeSplit = "split" PayloadTypeTransDC = "transDC" PayloadTypeSwapDC = "swapDC" )
View Source
const ( UnitIDLength = UnitPartLength + TypePartLength UnitPartLength = 32 TypePartLength = 1 )
Variables ¶
View Source
var ( ErrInitialBillIsNil = errors.New("initial bill may not be nil") ErrInvalidInitialBillID = errors.New("initial bill ID may not be equal to the DC money supply ID") ErrUndefinedSystemDescriptionRecords = errors.New("undefined system description records") ErrNilFeeCreditBill = errors.New("fee credit bill is nil in system description record") ErrInvalidFeeCreditBillID = errors.New("fee credit bill may not be equal to the DC money supply ID and initial bill ID") )
View Source
var ( ErrReclaimFCInvalidTargetUnit = errors.New("invalid target unit") ErrReclaimFCInvalidTxFee = errors.New("the transaction fees cannot exceed the transferred value") ErrReclaimFCInvalidTargetUnitBacklink = errors.New("invalid target unit backlink") )
View Source
var ( ErrInvalidBillValue = errors.New("transaction value must be equal to bill value") ErrSplitBillZeroAmount = errors.New("when splitting a bill the value assigned to the new bill must be greater than zero") ErrSplitBillZeroRemainder = errors.New("when splitting a bill the remaining value of the bill must be greater than zero") ErrInvalidDataType = errors.New("invalid data type") )
View Source
var ( ErrTxNil = errors.New("tx is nil") ErrBillNil = errors.New("bill is nil") ErrTargetSystemIdentifierEmpty = errors.New("TargetSystemIdentifier is empty") ErrTargetRecordIDEmpty = errors.New("TargetRecordID is empty") ErrAdditionTimeInvalid = errors.New("EarliestAdditonTime is greater than LatestAdditionTime") ErrRecordIDExists = errors.New("fee tx cannot contain fee credit reference") ErrFeeProofExists = errors.New("fee tx cannot contain fee authorization proof") ErrInvalidFCValue = errors.New("the amount to transfer cannot exceed the value of the bill") ErrInvalidFeeValue = errors.New("the transaction max fee cannot exceed the transferred amount") ErrInvalidBacklink = errors.New("the transaction backlink is not equal to unit backlink") )
View Source
var ( BillUnitType = []byte{0x00} FeeCreditRecordUnitType = []byte{0x0f} )
View Source
var DefaultSystemIdentifier = []byte{0, 0, 0, 0}
Functions ¶
func HashForIDCalculation ¶ added in v0.2.0
func NewFeeCreditRecordID ¶ added in v0.2.0
func NewTxSystem ¶ added in v0.2.0
func NewTxSystem(opts ...Option) (*txsystem.GenericTxSystem, error)
Types ¶
type BillData ¶
type BillData struct { V uint64 // The monetary value of this bill T uint64 // The round number of the last transaction with the bill Backlink []byte // Backlink (256-bit hash) }
func (*BillData) SummaryValueInput ¶ added in v0.2.0
type DustCollector ¶ added in v0.2.0
type DustCollector struct {
// contains filtered or unexported fields
}
func NewDustCollector ¶ added in v0.2.0
func NewDustCollector(s *state.State) *DustCollector
func (*DustCollector) AddDustBill ¶ added in v0.2.0
func (d *DustCollector) AddDustBill(id types.UnitID, currentBlockNumber uint64)
func (*DustCollector) GetDustBills ¶ added in v0.2.0
func (d *DustCollector) GetDustBills(blockNumber uint64) []types.UnitID
func (*DustCollector) RemoveDustBills ¶ added in v0.2.0
func (d *DustCollector) RemoveDustBills(blockNumber uint64)
type Module ¶ added in v0.2.0
type Module struct {
// contains filtered or unexported fields
}
func NewMoneyModule ¶ added in v0.2.0
func (*Module) BeginBlockFuncs ¶ added in v0.2.0
func (*Module) EndBlockFuncs ¶ added in v0.2.0
func (*Module) GenericTransactionValidator ¶ added in v0.2.0
func (m *Module) GenericTransactionValidator() txsystem.GenericTransactionValidator
func (*Module) TxExecutors ¶ added in v0.2.0
func (m *Module) TxExecutors() map[string]txsystem.TxExecutor
type Option ¶
type Option func(*Options)
func WithDCMoneyAmount ¶ added in v0.2.0
func WithFeeCalculator ¶ added in v0.2.0
func WithFeeCalculator(calc fc.FeeCalculator) Option
func WithHashAlgorithm ¶ added in v0.2.0
func WithInitialBill ¶ added in v0.2.0
func WithInitialBill(bill *InitialBill) Option
func WithSystemDescriptionRecords ¶ added in v0.2.0
func WithSystemDescriptionRecords(records []*genesis.SystemDescriptionRecord) Option
func WithSystemIdentifier ¶ added in v0.2.0
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func DefaultOptions ¶ added in v0.2.0
func DefaultOptions() *Options
type SplitAttributes ¶ added in v0.2.0
type SwapDCAttributes ¶ added in v0.2.0
type TransferAttributes ¶ added in v0.2.0
Source Files ¶
- attributes.go
- bill.go
- dust_collector.go
- fee_credit_tx_recorder.go
- logger.go
- money_module.go
- money_tx_system.go
- money_tx_system_opts.go
- tx_executor_reclaim_fee_credit.go
- tx_executor_split.go
- tx_executor_swap_dc.go
- tx_executor_transfer.go
- tx_executor_transfer_dc.go
- tx_executor_transfer_fee_credit.go
- unit_types.go
Click to show internal directories.
Click to hide internal directories.