Documentation ¶
Index ¶
- Constants
- Variables
- func HashForIDCalculation(idBytes []byte, attr []byte, timeout uint64, idx uint32, hashFunc crypto.Hash) []byte
- func NewBillID(shardPart []byte, unitPart []byte) types.UnitID
- func NewFeeCreditRecordID(shardPart []byte, unitPart []byte) types.UnitID
- func NewTxSystem(observe txsystem.Observability, opts ...Option) (*txsystem.GenericTxSystem, error)
- func NewUnitData(unitID types.UnitID) (state.UnitData, error)
- type BillData
- type DustCollector
- type LockAttributes
- type Module
- type Option
- func WithFeeCalculator(calc fc.FeeCalculator) Option
- func WithHashAlgorithm(hashAlgorithm crypto.Hash) Option
- func WithPredicateExecutor(exec PredicateExecutor) Option
- func WithState(s *state.State) Option
- func WithSystemDescriptionRecords(records []*genesis.SystemDescriptionRecord) Option
- func WithSystemIdentifier(systemIdentifier types.SystemID) Option
- func WithTrustBase(trust map[string]abcrypto.Verifier) Option
- type Options
- type PredicateExecutor
- type SplitAttributes
- type SwapDCAttributes
- type TargetUnit
- type TransferAttributes
- type TransferDCAttributes
- type UnlockAttributes
Constants ¶
View Source
const ( PayloadTypeTransfer = "trans" PayloadTypeSplit = "split" PayloadTypeTransDC = "transDC" PayloadTypeSwapDC = "swapDC" PayloadTypeLock = "lock" PayloadTypeUnlock = "unlock" )
View Source
const ( UnitIDLength = UnitPartLength + TypePartLength UnitPartLength = 32 TypePartLength = 1 )
View Source
const DefaultSystemIdentifier types.SystemID = 0x00000001
Variables ¶
View Source
var ( // The ID of the dust collector money supply DustCollectorMoneySupplyID = NewBillID(nil, nil) // Dust collector predicate DustCollectorPredicate = templates.NewP2pkh256BytesFromKeyHash(abHasher.Sum256([]byte("dust collector"))) )
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 ( ErrInvalidDataType = errors.New("invalid data type") ErrInvalidBillValue = errors.New("transaction value must be equal to bill value") )
View Source
var ( ErrTxNil = errors.New("tx is nil") ErrTxAttrNil = errors.New("tx attributes is nil") ErrBillNil = errors.New("bill is nil") ErrBillLocked = errors.New("bill is already locked") ErrTargetSystemIdentifierEmpty = errors.New("TargetSystemIdentifier is empty") ErrTargetRecordIDEmpty = errors.New("TargetRecordID is empty") ErrAdditionTimeInvalid = errors.New("EarliestAdditionTime 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 (
ErrBillUnlocked = errors.New("bill is already unlocked")
)
View Source
var ErrInvalidLockStatus = errors.New("invalid lock status: expected non-zero value, got zero value")
Functions ¶
func HashForIDCalculation ¶
func NewFeeCreditRecordID ¶
func NewTxSystem ¶
func NewTxSystem(observe txsystem.Observability, opts ...Option) (*txsystem.GenericTxSystem, error)
Types ¶
type BillData ¶
type BillData struct { V uint64 `json:"value,string"` // The monetary value of this bill T uint64 `json:"lastUpdate,string"` // The round number of the last transaction with the bill Backlink types.Bytes `json:"backlink"` // Backlink (256-bit hash) Locked uint64 `json:"locked,string"` // locked status of the bill, non-zero value means locked // contains filtered or unexported fields }
func (*BillData) SummaryValueInput ¶
type DustCollector ¶
type DustCollector struct {
// contains filtered or unexported fields
}
func NewDustCollector ¶
func NewDustCollector(s *state.State) *DustCollector
func (*DustCollector) AddDustBill ¶
func (d *DustCollector) AddDustBill(id types.UnitID, currentBlockNumber uint64)
func (*DustCollector) GetDustBills ¶
func (d *DustCollector) GetDustBills(blockNumber uint64) []types.UnitID
func (*DustCollector) RemoveDustBills ¶
func (d *DustCollector) RemoveDustBills(blockNumber uint64)
type LockAttributes ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func NewMoneyModule ¶
func (*Module) BeginBlockFuncs ¶
func (*Module) EndBlockFuncs ¶
func (*Module) TxExecutors ¶
func (m *Module) TxExecutors() map[string]txsystem.ExecuteFunc
type Option ¶
type Option func(*Options)
func WithFeeCalculator ¶
func WithFeeCalculator(calc fc.FeeCalculator) Option
func WithHashAlgorithm ¶
func WithPredicateExecutor ¶ added in v0.4.0
func WithPredicateExecutor(exec PredicateExecutor) Option
WithPredicateExecutor allows to replace the default predicate executor function. Should be used by tests only.
func WithSystemDescriptionRecords ¶
func WithSystemDescriptionRecords(records []*genesis.SystemDescriptionRecord) Option
func WithSystemIdentifier ¶
type PredicateExecutor ¶ added in v0.4.0
type PredicateExecutor func(ctx context.Context, predicate types.PredicateBytes, args []byte, txo *types.TransactionOrder, env predicates.TxContext) (bool, error)
type SplitAttributes ¶
type SplitAttributes struct { TargetUnits []*TargetUnit RemainingValue uint64 Backlink []byte // contains filtered or unexported fields }
type SwapDCAttributes ¶
type TargetUnit ¶
type TransferAttributes ¶
type TransferDCAttributes ¶
type UnlockAttributes ¶
type UnlockAttributes struct { Backlink []byte // contains filtered or unexported fields }
Source Files ¶
- attributes.go
- bill.go
- dust_collector.go
- fee_credit_tx_recorder.go
- money_module.go
- money_tx_system.go
- money_tx_system_opts.go
- tx_executor_lock.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
- tx_executor_unlock.go
- unit_types.go
Click to show internal directories.
Click to hide internal directories.